repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
vanniktech/RxPermission | rxpermission/src/main/java/com/vanniktech/rxpermission/RealRxPermission.java | RealRxPermission.ensureEach | @NonNull @CheckReturnValue private <T> ObservableTransformer<T, Permission> ensureEach(@NonNull final String... permissions) {
checkPermissions(permissions);
return new ObservableTransformer<T, Permission>() {
@Override @NonNull @CheckReturnValue public ObservableSource<Permission> apply(final Observable<T> o) {
return request(o, permissions);
}
};
} | java | @NonNull @CheckReturnValue private <T> ObservableTransformer<T, Permission> ensureEach(@NonNull final String... permissions) {
checkPermissions(permissions);
return new ObservableTransformer<T, Permission>() {
@Override @NonNull @CheckReturnValue public ObservableSource<Permission> apply(final Observable<T> o) {
return request(o, permissions);
}
};
} | [
"@",
"NonNull",
"@",
"CheckReturnValue",
"private",
"<",
"T",
">",
"ObservableTransformer",
"<",
"T",
",",
"Permission",
">",
"ensureEach",
"(",
"@",
"NonNull",
"final",
"String",
"...",
"permissions",
")",
"{",
"checkPermissions",
"(",
"permissions",
")",
";"... | Map emitted items from the source observable into {@link Permission} objects for each
permission in parameters.
<p>
If one or several permissions have never been requested, invoke the related framework method
to ask the user if he allows the permissions. | [
"Map",
"emitted",
"items",
"from",
"the",
"source",
"observable",
"into",
"{"
] | train | https://github.com/vanniktech/RxPermission/blob/db2b438f40e98d7440a70bc1a35e866312b813e0/rxpermission/src/main/java/com/vanniktech/rxpermission/RealRxPermission.java#L77-L85 |
Scout24/appmon4j | core/src/main/java/de/is24/util/monitoring/InApplicationMonitor.java | InApplicationMonitor.addTimerMeasurement | public void addTimerMeasurement(String name, long timing) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.addTimerMeasurement(escapedName, timing);
}
}
} | java | public void addTimerMeasurement(String name, long timing) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.addTimerMeasurement(escapedName, timing);
}
}
} | [
"public",
"void",
"addTimerMeasurement",
"(",
"String",
"name",
",",
"long",
"timing",
")",
"{",
"if",
"(",
"monitorActive",
")",
"{",
"String",
"escapedName",
"=",
"keyHandler",
".",
"handle",
"(",
"name",
")",
";",
"for",
"(",
"MonitorPlugin",
"p",
":",
... | Add a timer measurement for the given name.
{@link Timer}s allow adding timer measurements, implicitly incrementing the count
Timers count and measure timed events.
The application decides which unit to use for timing.
Miliseconds are suggested and some {@link ReportVisitor} implementations
may imply this.
@param name name of the {@link Timer}
@param timing number of elapsed time units for a single measurement | [
"Add",
"a",
"timer",
"measurement",
"for",
"the",
"given",
"name",
".",
"{",
"@link",
"Timer",
"}",
"s",
"allow",
"adding",
"timer",
"measurements",
"implicitly",
"incrementing",
"the",
"count",
"Timers",
"count",
"and",
"measure",
"timed",
"events",
".",
"T... | train | https://github.com/Scout24/appmon4j/blob/a662e5123805ea455cfd01e1b9ae5d808f83529c/core/src/main/java/de/is24/util/monitoring/InApplicationMonitor.java#L230-L237 |
gallandarakhneorg/afc | advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/SimpleViewer.java | SimpleViewer.getElementUnderMouse | @SuppressWarnings({ "rawtypes" })
public MapElement getElementUnderMouse(GisPane<?> pane, double x, double y) {
final GISContainer model = pane.getDocumentModel();
final Point2d mousePosition = pane.toDocumentPosition(x, y);
final Rectangle2d selectionArea = pane.toDocumentRect(x - 2, y - 2, 5, 5);
return getElementUnderMouse(model, mousePosition, selectionArea);
} | java | @SuppressWarnings({ "rawtypes" })
public MapElement getElementUnderMouse(GisPane<?> pane, double x, double y) {
final GISContainer model = pane.getDocumentModel();
final Point2d mousePosition = pane.toDocumentPosition(x, y);
final Rectangle2d selectionArea = pane.toDocumentRect(x - 2, y - 2, 5, 5);
return getElementUnderMouse(model, mousePosition, selectionArea);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
"}",
")",
"public",
"MapElement",
"getElementUnderMouse",
"(",
"GisPane",
"<",
"?",
">",
"pane",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"GISContainer",
"model",
"=",
"pane",
".",
"getDo... | Replies the element at the given mouse position.
@param pane the element pane.
@param x the x position of the mouse.
@param y the y position of the mouse.
@return the element.
@since 15.0 | [
"Replies",
"the",
"element",
"at",
"the",
"given",
"mouse",
"position",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/SimpleViewer.java#L261-L267 |
wisdom-framework/wisdom-jdbc | wisdom-jdbc-drivers/abstract-jdbc-driver/src/main/java/org/wisdom/jdbc/driver/helpers/AbstractDataSourceFactory.java | AbstractDataSourceFactory.setBeanProperties | static void setBeanProperties(Object object, Properties props)
throws SQLException {
if (props != null) {
Enumeration<?> enumeration = props.keys();
while (enumeration.hasMoreElements()) {
String name = (String) enumeration.nextElement();
setProperty(object, name, props.getProperty(name));
}
}
} | java | static void setBeanProperties(Object object, Properties props)
throws SQLException {
if (props != null) {
Enumeration<?> enumeration = props.keys();
while (enumeration.hasMoreElements()) {
String name = (String) enumeration.nextElement();
setProperty(object, name, props.getProperty(name));
}
}
} | [
"static",
"void",
"setBeanProperties",
"(",
"Object",
"object",
",",
"Properties",
"props",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"props",
"!=",
"null",
")",
"{",
"Enumeration",
"<",
"?",
">",
"enumeration",
"=",
"props",
".",
"keys",
"(",
")",
... | Sets the given properties on the target object.
@param object the object on which the properties need to be set
@param props the properties
@throws SQLException if a property cannot be set. | [
"Sets",
"the",
"given",
"properties",
"on",
"the",
"target",
"object",
"."
] | train | https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-jdbc-drivers/abstract-jdbc-driver/src/main/java/org/wisdom/jdbc/driver/helpers/AbstractDataSourceFactory.java#L123-L133 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java | Constraints.inRangeProperties | public PropertyConstraint inRangeProperties(String propertyName, String minPropertyName, String maxPropertyName) {
Constraint min = gteProperty(propertyName, minPropertyName);
Constraint max = lteProperty(propertyName, maxPropertyName);
return new CompoundPropertyConstraint(new And(min, max));
} | java | public PropertyConstraint inRangeProperties(String propertyName, String minPropertyName, String maxPropertyName) {
Constraint min = gteProperty(propertyName, minPropertyName);
Constraint max = lteProperty(propertyName, maxPropertyName);
return new CompoundPropertyConstraint(new And(min, max));
} | [
"public",
"PropertyConstraint",
"inRangeProperties",
"(",
"String",
"propertyName",
",",
"String",
"minPropertyName",
",",
"String",
"maxPropertyName",
")",
"{",
"Constraint",
"min",
"=",
"gteProperty",
"(",
"propertyName",
",",
"minPropertyName",
")",
";",
"Constrain... | Apply a inclusive "range" constraint between two other properties to a
bean property.
@param propertyName the property with the range constraint.
@param minPropertyName the low edge of the range
@param maxPropertyName the high edge of the range
@return The range constraint constraint | [
"Apply",
"a",
"inclusive",
"range",
"constraint",
"between",
"two",
"other",
"properties",
"to",
"a",
"bean",
"property",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L911-L915 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java | BigIntegerExtensions.operator_modulo | @Inline(value="$1.mod($2)")
@Pure
public static BigInteger operator_modulo(BigInteger a, BigInteger b) {
return a.mod(b);
} | java | @Inline(value="$1.mod($2)")
@Pure
public static BigInteger operator_modulo(BigInteger a, BigInteger b) {
return a.mod(b);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$1.mod($2)\"",
")",
"@",
"Pure",
"public",
"static",
"BigInteger",
"operator_modulo",
"(",
"BigInteger",
"a",
",",
"BigInteger",
"b",
")",
"{",
"return",
"a",
".",
"mod",
"(",
"b",
")",
";",
"}"
] | The binary <code>modulo</code> operator.
@param a
a BigInteger. May not be <code>null</code>.
@param b
a BigInteger. May not be <code>null</code>.
@return <code>a.mod(b)</code>
@throws NullPointerException
if {@code a} or {@code b} is <code>null</code>. | [
"The",
"binary",
"<code",
">",
"modulo<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java#L133-L137 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java | MediaDescriptorField.createFormat | private RTPFormat createFormat(int payload, Text description) {
MediaType mtype = MediaType.fromDescription(mediaType);
switch (mtype) {
case AUDIO:
return createAudioFormat(payload, description);
case VIDEO:
return createVideoFormat(payload, description);
case APPLICATION:
return createApplicationFormat(payload, description);
default:
return null;
}
} | java | private RTPFormat createFormat(int payload, Text description) {
MediaType mtype = MediaType.fromDescription(mediaType);
switch (mtype) {
case AUDIO:
return createAudioFormat(payload, description);
case VIDEO:
return createVideoFormat(payload, description);
case APPLICATION:
return createApplicationFormat(payload, description);
default:
return null;
}
} | [
"private",
"RTPFormat",
"createFormat",
"(",
"int",
"payload",
",",
"Text",
"description",
")",
"{",
"MediaType",
"mtype",
"=",
"MediaType",
".",
"fromDescription",
"(",
"mediaType",
")",
";",
"switch",
"(",
"mtype",
")",
"{",
"case",
"AUDIO",
":",
"return",... | Creates or updates format using payload number and text format description.
@param payload the payload number of the format.
@param description text description of the format
@return format object | [
"Creates",
"or",
"updates",
"format",
"using",
"payload",
"number",
"and",
"text",
"format",
"description",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java#L400-L412 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/DiskTreebank.java | DiskTreebank.loadPath | @Override
public void loadPath(File path, FileFilter filt) {
if(path.exists()) {
filePaths.add(path);
fileFilters.add(filt);
} else {
System.err.printf("%s: File/path %s does not exist. Skipping.\n" , this.getClass().getName(), path.getPath());
}
} | java | @Override
public void loadPath(File path, FileFilter filt) {
if(path.exists()) {
filePaths.add(path);
fileFilters.add(filt);
} else {
System.err.printf("%s: File/path %s does not exist. Skipping.\n" , this.getClass().getName(), path.getPath());
}
} | [
"@",
"Override",
"public",
"void",
"loadPath",
"(",
"File",
"path",
",",
"FileFilter",
"filt",
")",
"{",
"if",
"(",
"path",
".",
"exists",
"(",
")",
")",
"{",
"filePaths",
".",
"add",
"(",
"path",
")",
";",
"fileFilters",
".",
"add",
"(",
"filt",
"... | Load trees from given directory. This version just records
the paths to be processed, and actually processes them at apply time.
@param path file or directory to load from
@param filt a FilenameFilter of files to load | [
"Load",
"trees",
"from",
"given",
"directory",
".",
"This",
"version",
"just",
"records",
"the",
"paths",
"to",
"be",
"processed",
"and",
"actually",
"processes",
"them",
"at",
"apply",
"time",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/DiskTreebank.java#L112-L120 |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.normalizeActionPath | private String normalizeActionPath(Resource parent, String uri) {
String relativeUri = extractRelativeUrl(uri, parent.getUri());
if (!relativeUri.startsWith("/")) {
relativeUri = "/" + relativeUri;
}
return relativeUri;
} | java | private String normalizeActionPath(Resource parent, String uri) {
String relativeUri = extractRelativeUrl(uri, parent.getUri());
if (!relativeUri.startsWith("/")) {
relativeUri = "/" + relativeUri;
}
return relativeUri;
} | [
"private",
"String",
"normalizeActionPath",
"(",
"Resource",
"parent",
",",
"String",
"uri",
")",
"{",
"String",
"relativeUri",
"=",
"extractRelativeUrl",
"(",
"uri",
",",
"parent",
".",
"getUri",
"(",
")",
")",
";",
"if",
"(",
"!",
"relativeUri",
".",
"st... | A method normalizing "action" path. In RAML action path must always starts with a "/".
@param parent the parent resource
@param uri the path to normalize
@return the normalized path | [
"A",
"method",
"normalizing",
"action",
"path",
".",
"In",
"RAML",
"action",
"path",
"must",
"always",
"starts",
"with",
"a",
"/",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L201-L207 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.stopEnvironment | public void stopEnvironment(String userName, String environmentId) {
stopEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().last().body();
} | java | public void stopEnvironment(String userName, String environmentId) {
stopEnvironmentWithServiceResponseAsync(userName, environmentId).toBlocking().last().body();
} | [
"public",
"void",
"stopEnvironment",
"(",
"String",
"userName",
",",
"String",
"environmentId",
")",
"{",
"stopEnvironmentWithServiceResponseAsync",
"(",
"userName",
",",
"environmentId",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",... | Stops an environment by stopping all resources inside the environment This operation can take a while to complete.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@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 | [
"Stops",
"an",
"environment",
"by",
"stopping",
"all",
"resources",
"inside",
"the",
"environment",
"This",
"operation",
"can",
"take",
"a",
"while",
"to",
"complete",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L1234-L1236 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.getAttributeValue | public String getAttributeValue(final By by, final String attributeName) {
WebElement element = findElement(by);
return element.getAttribute(attributeName);
} | java | public String getAttributeValue(final By by, final String attributeName) {
WebElement element = findElement(by);
return element.getAttribute(attributeName);
} | [
"public",
"String",
"getAttributeValue",
"(",
"final",
"By",
"by",
",",
"final",
"String",
"attributeName",
")",
"{",
"WebElement",
"element",
"=",
"findElement",
"(",
"by",
")",
";",
"return",
"element",
".",
"getAttribute",
"(",
"attributeName",
")",
";",
... | Delegates to {@link #findElement(By)} and then calls
{@link WebElement#getAttribute(String) getAttribute(String)} on the returned element.
@param by
the {@link By} used to locate the element
@param attributeName
the attribute name
@return the attribute value | [
"Delegates",
"to",
"{",
"@link",
"#findElement",
"(",
"By",
")",
"}",
"and",
"then",
"calls",
"{",
"@link",
"WebElement#getAttribute",
"(",
"String",
")",
"getAttribute",
"(",
"String",
")",
"}",
"on",
"the",
"returned",
"element",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L528-L531 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/helper/CheckPointHelper.java | CheckPointHelper.addValidationRule | public CheckPointHelper addValidationRule(String ruleName, StandardValueType standardValueType, BaseValidationCheck validationCheck, AssistType assistType) {
ValidationRule rule = new ValidationRule(ruleName, standardValueType, validationCheck);
if (assistType == null) {
assistType = AssistType.all();
}
rule.setAssistType(assistType);
this.validationRuleStore.addRule(rule);
return this;
} | java | public CheckPointHelper addValidationRule(String ruleName, StandardValueType standardValueType, BaseValidationCheck validationCheck, AssistType assistType) {
ValidationRule rule = new ValidationRule(ruleName, standardValueType, validationCheck);
if (assistType == null) {
assistType = AssistType.all();
}
rule.setAssistType(assistType);
this.validationRuleStore.addRule(rule);
return this;
} | [
"public",
"CheckPointHelper",
"addValidationRule",
"(",
"String",
"ruleName",
",",
"StandardValueType",
"standardValueType",
",",
"BaseValidationCheck",
"validationCheck",
",",
"AssistType",
"assistType",
")",
"{",
"ValidationRule",
"rule",
"=",
"new",
"ValidationRule",
"... | Add the fresh user rule
@param ruleName use rule name - must uniqueue
@param standardValueType rule check standardvalue type
@param validationCheck rule check class with extends BaseValidationCheck and overide replace or check method and exception method
@param assistType input field type
@return CheckPointHelper check point helper | [
"Add",
"the",
"fresh",
"user",
"rule"
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/helper/CheckPointHelper.java#L63-L71 |
kubernetes-client/java | util/src/main/java/io/kubernetes/client/util/Yaml.java | Yaml.loadAs | public static <T> T loadAs(Reader reader, Class<T> clazz) {
return getSnakeYaml().loadAs(reader, clazz);
} | java | public static <T> T loadAs(Reader reader, Class<T> clazz) {
return getSnakeYaml().loadAs(reader, clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"loadAs",
"(",
"Reader",
"reader",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"getSnakeYaml",
"(",
")",
".",
"loadAs",
"(",
"reader",
",",
"clazz",
")",
";",
"}"
] | Load an API object from a YAML stream. Returns a concrete typed object using the type
specified.
@param reader The YAML stream
@param clazz The class of object to return.
@return An instantiation of the object.
@throws IOException If an error occurs while reading the YAML. | [
"Load",
"an",
"API",
"object",
"from",
"a",
"YAML",
"stream",
".",
"Returns",
"a",
"concrete",
"typed",
"object",
"using",
"the",
"type",
"specified",
"."
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/util/Yaml.java#L221-L223 |
matiwinnetou/spring-soy-view | spring-soy-view/src/main/java/pl/matisoft/soy/bundle/DefaultSoyMsgBundleResolver.java | DefaultSoyMsgBundleResolver.createSoyMsgBundle | protected SoyMsgBundle createSoyMsgBundle(final Locale locale) throws IOException {
Preconditions.checkNotNull(messagesPath, "messagesPath cannot be null!");
final String path = messagesPath + "_" + locale.toString() + ".xlf";
final Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources(path);
final List<SoyMsgBundle> msgBundles = Lists.newArrayList();
final SoyMsgBundleHandler msgBundleHandler = new SoyMsgBundleHandler(new XliffMsgPlugin());
while (e.hasMoreElements()) {
final URL msgFile = e.nextElement();
final SoyMsgBundle soyMsgBundle = msgBundleHandler.createFromResource(msgFile);
msgBundles.add(soyMsgBundle);
}
return mergeMsgBundles(locale, msgBundles).orNull();
} | java | protected SoyMsgBundle createSoyMsgBundle(final Locale locale) throws IOException {
Preconditions.checkNotNull(messagesPath, "messagesPath cannot be null!");
final String path = messagesPath + "_" + locale.toString() + ".xlf";
final Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources(path);
final List<SoyMsgBundle> msgBundles = Lists.newArrayList();
final SoyMsgBundleHandler msgBundleHandler = new SoyMsgBundleHandler(new XliffMsgPlugin());
while (e.hasMoreElements()) {
final URL msgFile = e.nextElement();
final SoyMsgBundle soyMsgBundle = msgBundleHandler.createFromResource(msgFile);
msgBundles.add(soyMsgBundle);
}
return mergeMsgBundles(locale, msgBundles).orNull();
} | [
"protected",
"SoyMsgBundle",
"createSoyMsgBundle",
"(",
"final",
"Locale",
"locale",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"messagesPath",
",",
"\"messagesPath cannot be null!\"",
")",
";",
"final",
"String",
"path",
"=",
"messa... | An implementation that using a ContextClassLoader iterates over all urls it finds
based on a messagePath and locale, e.g. messages_de_DE.xlf and returns a merged
SoyMsgBundle of SoyMsgBundle matching a a pattern it finds in a class path.
@param locale - locale
@return SoyMsgBundle - bundle
@throws java.io.IOException - io error | [
"An",
"implementation",
"that",
"using",
"a",
"ContextClassLoader",
"iterates",
"over",
"all",
"urls",
"it",
"finds",
"based",
"on",
"a",
"messagePath",
"and",
"locale",
"e",
".",
"g",
".",
"messages_de_DE",
".",
"xlf",
"and",
"returns",
"a",
"merged",
"SoyM... | train | https://github.com/matiwinnetou/spring-soy-view/blob/a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1/spring-soy-view/src/main/java/pl/matisoft/soy/bundle/DefaultSoyMsgBundleResolver.java#L104-L121 |
web3j/web3j | core/src/main/java/org/web3j/ens/EnsResolver.java | EnsResolver.reverseResolve | public String reverseResolve(String address) {
if (WalletUtils.isValidAddress(address)) {
String reverseName = Numeric.cleanHexPrefix(address) + REVERSE_NAME_SUFFIX;
PublicResolver resolver = obtainPublicResolver(reverseName);
byte[] nameHash = NameHash.nameHashAsBytes(reverseName);
String name = null;
try {
name = resolver.name(nameHash).send();
} catch (Exception e) {
throw new RuntimeException("Unable to execute Ethereum request", e);
}
if (!isValidEnsName(name)) {
throw new RuntimeException("Unable to resolve name for address: " + address);
} else {
return name;
}
} else {
throw new EnsResolutionException("Address is invalid: " + address);
}
} | java | public String reverseResolve(String address) {
if (WalletUtils.isValidAddress(address)) {
String reverseName = Numeric.cleanHexPrefix(address) + REVERSE_NAME_SUFFIX;
PublicResolver resolver = obtainPublicResolver(reverseName);
byte[] nameHash = NameHash.nameHashAsBytes(reverseName);
String name = null;
try {
name = resolver.name(nameHash).send();
} catch (Exception e) {
throw new RuntimeException("Unable to execute Ethereum request", e);
}
if (!isValidEnsName(name)) {
throw new RuntimeException("Unable to resolve name for address: " + address);
} else {
return name;
}
} else {
throw new EnsResolutionException("Address is invalid: " + address);
}
} | [
"public",
"String",
"reverseResolve",
"(",
"String",
"address",
")",
"{",
"if",
"(",
"WalletUtils",
".",
"isValidAddress",
"(",
"address",
")",
")",
"{",
"String",
"reverseName",
"=",
"Numeric",
".",
"cleanHexPrefix",
"(",
"address",
")",
"+",
"REVERSE_NAME_SU... | Reverse name resolution as documented in the
<a href="https://docs.ens.domains/en/latest/userguide.html#reverse-name-resolution">specification</a>.
@param address an ethereum address, example: "0x314159265dd8dbb310642f98f50c066173c1259b"
@return a EnsName registered for provided address | [
"Reverse",
"name",
"resolution",
"as",
"documented",
"in",
"the",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"ens",
".",
"domains",
"/",
"en",
"/",
"latest",
"/",
"userguide",
".",
"html#reverse",
"-",
"name",
"-",
"resolution",
">",
"specificat... | train | https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/ens/EnsResolver.java#L97-L118 |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputSender.java | PythonDualInputSender.sendBuffer2 | public int sendBuffer2(SingleElementPushBackIterator<IN2> input) throws IOException {
if (serializer2 == null) {
IN2 value = input.next();
serializer2 = getSerializer(value);
input.pushBack(value);
}
return sendBuffer(input, serializer2);
} | java | public int sendBuffer2(SingleElementPushBackIterator<IN2> input) throws IOException {
if (serializer2 == null) {
IN2 value = input.next();
serializer2 = getSerializer(value);
input.pushBack(value);
}
return sendBuffer(input, serializer2);
} | [
"public",
"int",
"sendBuffer2",
"(",
"SingleElementPushBackIterator",
"<",
"IN2",
">",
"input",
")",
"throws",
"IOException",
"{",
"if",
"(",
"serializer2",
"==",
"null",
")",
"{",
"IN2",
"value",
"=",
"input",
".",
"next",
"(",
")",
";",
"serializer2",
"=... | Extracts records from an iterator and writes them to the memory-mapped file. This method assumes that all values
in the iterator are of the same type. This method does NOT take care of synchronization. The caller must
guarantee that the file may be written to before calling this method.
@param input iterator containing records
@return size of the written buffer
@throws IOException | [
"Extracts",
"records",
"from",
"an",
"iterator",
"and",
"writes",
"them",
"to",
"the",
"memory",
"-",
"mapped",
"file",
".",
"This",
"method",
"assumes",
"that",
"all",
"values",
"in",
"the",
"iterator",
"are",
"of",
"the",
"same",
"type",
".",
"This",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputSender.java#L69-L76 |
Erudika/para | para-core/src/main/java/com/erudika/para/utils/Config.java | Config.getConfigBoolean | public static boolean getConfigBoolean(String key, boolean defaultValue) {
return Boolean.parseBoolean(getConfigParam(key, Boolean.toString(defaultValue)));
} | java | public static boolean getConfigBoolean(String key, boolean defaultValue) {
return Boolean.parseBoolean(getConfigParam(key, Boolean.toString(defaultValue)));
} | [
"public",
"static",
"boolean",
"getConfigBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"getConfigParam",
"(",
"key",
",",
"Boolean",
".",
"toString",
"(",
"defaultValue",
")",
")",
")",... | Returns the boolean value of a configuration parameter.
@param key the param key
@param defaultValue the default param value
@return the value of a param | [
"Returns",
"the",
"boolean",
"value",
"of",
"a",
"configuration",
"parameter",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Config.java#L324-L326 |
alkacon/opencms-core | src/org/opencms/configuration/preferences/CmsUserDefinedPreference.java | CmsUserDefinedPreference.fillAttributes | public static void fillAttributes(CmsPreferenceData pref, Element elem) {
CmsXmlContentProperty prop = pref.getPropertyDefinition();
for (String[] attrToSet : new String[][] {
{I_CmsXmlConfiguration.A_VALUE, pref.getDefaultValue()},
{CmsWorkplaceConfiguration.A_NICE_NAME, prop.getNiceName()},
{CmsWorkplaceConfiguration.A_DESCRIPTION, prop.getDescription()},
{CmsWorkplaceConfiguration.A_WIDGET, prop.getConfiguredWidget()},
{CmsWorkplaceConfiguration.A_WIDGET_CONFIG, prop.getWidgetConfiguration()},
{CmsWorkplaceConfiguration.A_RULE_REGEX, prop.getRuleRegex()},
{CmsWorkplaceConfiguration.A_ERROR, prop.getError()}}) {
String attrName = attrToSet[0];
String value = attrToSet[1];
if (value != null) {
elem.addAttribute(attrName, value);
}
}
} | java | public static void fillAttributes(CmsPreferenceData pref, Element elem) {
CmsXmlContentProperty prop = pref.getPropertyDefinition();
for (String[] attrToSet : new String[][] {
{I_CmsXmlConfiguration.A_VALUE, pref.getDefaultValue()},
{CmsWorkplaceConfiguration.A_NICE_NAME, prop.getNiceName()},
{CmsWorkplaceConfiguration.A_DESCRIPTION, prop.getDescription()},
{CmsWorkplaceConfiguration.A_WIDGET, prop.getConfiguredWidget()},
{CmsWorkplaceConfiguration.A_WIDGET_CONFIG, prop.getWidgetConfiguration()},
{CmsWorkplaceConfiguration.A_RULE_REGEX, prop.getRuleRegex()},
{CmsWorkplaceConfiguration.A_ERROR, prop.getError()}}) {
String attrName = attrToSet[0];
String value = attrToSet[1];
if (value != null) {
elem.addAttribute(attrName, value);
}
}
} | [
"public",
"static",
"void",
"fillAttributes",
"(",
"CmsPreferenceData",
"pref",
",",
"Element",
"elem",
")",
"{",
"CmsXmlContentProperty",
"prop",
"=",
"pref",
".",
"getPropertyDefinition",
"(",
")",
";",
"for",
"(",
"String",
"[",
"]",
"attrToSet",
":",
"new"... | Helper method used to create the configuration attributes for a CmsPreferenceData bean.<p>
@param pref the preference data
@param elem the element in which the attributes should be created | [
"Helper",
"method",
"used",
"to",
"create",
"the",
"configuration",
"attributes",
"for",
"a",
"CmsPreferenceData",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/preferences/CmsUserDefinedPreference.java#L65-L82 |
alkacon/opencms-core | src/org/opencms/workplace/explorer/CmsResourceUtil.java | CmsResourceUtil.getSmallIconResource | public static Resource getSmallIconResource(CmsExplorerTypeSettings explorerType, String resourceName) {
if (explorerType == null) {
explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
(resourceName == null) && !CmsResource.isFolder(resourceName)
? CmsResourceTypeUnknownFile.RESOURCE_TYPE_NAME
: "unknown_folder");
}
if (!explorerType.getIconRules().isEmpty() && (resourceName != null)) {
String extension = CmsResource.getExtension(resourceName);
if (extension != null) {
CmsIconRule rule = explorerType.getIconRules().get(extension);
if ((rule != null) && (rule.getSmallIconStyle() != null)) {
return new CmsCssIcon(rule.getSmallIconStyle());
}
}
}
if (explorerType.getSmallIconStyle() != null) {
return new CmsCssIcon(explorerType.getSmallIconStyle());
} else {
return new ExternalResource(
CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + explorerType.getOriginalIcon()));
}
} | java | public static Resource getSmallIconResource(CmsExplorerTypeSettings explorerType, String resourceName) {
if (explorerType == null) {
explorerType = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
(resourceName == null) && !CmsResource.isFolder(resourceName)
? CmsResourceTypeUnknownFile.RESOURCE_TYPE_NAME
: "unknown_folder");
}
if (!explorerType.getIconRules().isEmpty() && (resourceName != null)) {
String extension = CmsResource.getExtension(resourceName);
if (extension != null) {
CmsIconRule rule = explorerType.getIconRules().get(extension);
if ((rule != null) && (rule.getSmallIconStyle() != null)) {
return new CmsCssIcon(rule.getSmallIconStyle());
}
}
}
if (explorerType.getSmallIconStyle() != null) {
return new CmsCssIcon(explorerType.getSmallIconStyle());
} else {
return new ExternalResource(
CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + explorerType.getOriginalIcon()));
}
} | [
"public",
"static",
"Resource",
"getSmallIconResource",
"(",
"CmsExplorerTypeSettings",
"explorerType",
",",
"String",
"resourceName",
")",
"{",
"if",
"(",
"explorerType",
"==",
"null",
")",
"{",
"explorerType",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
... | Returns the small icon resource for the given resource.<p>
@param explorerType the resource explorer type settings
@param resourceName the resource name
@return the icon resource | [
"Returns",
"the",
"small",
"icon",
"resource",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/explorer/CmsResourceUtil.java#L315-L339 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/utils/CSVLoader.java | CSVLoader.display | private static void display(String format, Object... args) {
System.out.println(MessageFormatter.arrayFormat(format, args).getMessage());
} | java | private static void display(String format, Object... args) {
System.out.println(MessageFormatter.arrayFormat(format, args).getMessage());
} | [
"private",
"static",
"void",
"display",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"MessageFormatter",
".",
"arrayFormat",
"(",
"format",
",",
"args",
")",
".",
"getMessage",
"(",
")",
")",... | Write the given message to stdout only. Uses {}-style parameters | [
"Write",
"the",
"given",
"message",
"to",
"stdout",
"only",
".",
"Uses",
"{}",
"-",
"style",
"parameters"
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/utils/CSVLoader.java#L296-L298 |
ginere/ginere-base | src/main/java/eu/ginere/base/util/i18n/I18NConnector.java | I18NConnector.getLabel | public static String getLabel(String section, String idInSection) {
Language language=getThreadLocalLanguage(null);
if (language==null){
return idInSection;
} else {
return getLabel(language, section, idInSection);
}
} | java | public static String getLabel(String section, String idInSection) {
Language language=getThreadLocalLanguage(null);
if (language==null){
return idInSection;
} else {
return getLabel(language, section, idInSection);
}
} | [
"public",
"static",
"String",
"getLabel",
"(",
"String",
"section",
",",
"String",
"idInSection",
")",
"{",
"Language",
"language",
"=",
"getThreadLocalLanguage",
"(",
"null",
")",
";",
"if",
"(",
"language",
"==",
"null",
")",
"{",
"return",
"idInSection",
... | Returns the value for this label ussing the getThreadLocaleLanguage
@param section
@param idInSection
@return | [
"Returns",
"the",
"value",
"for",
"this",
"label",
"ussing",
"the",
"getThreadLocaleLanguage"
] | train | https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/i18n/I18NConnector.java#L85-L93 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java | ClassPropertyUsageAnalyzer.countPropertyQualifier | private void countPropertyQualifier(PropertyIdValue property, int count) {
PropertyRecord propertyRecord = getPropertyRecord(property);
propertyRecord.qualifierCount = propertyRecord.qualifierCount + count;
} | java | private void countPropertyQualifier(PropertyIdValue property, int count) {
PropertyRecord propertyRecord = getPropertyRecord(property);
propertyRecord.qualifierCount = propertyRecord.qualifierCount + count;
} | [
"private",
"void",
"countPropertyQualifier",
"(",
"PropertyIdValue",
"property",
",",
"int",
"count",
")",
"{",
"PropertyRecord",
"propertyRecord",
"=",
"getPropertyRecord",
"(",
"property",
")",
";",
"propertyRecord",
".",
"qualifierCount",
"=",
"propertyRecord",
"."... | Counts additional occurrences of a property as qualifier property of
statements.
@param property
the property to count
@param count
the number of times to count the property | [
"Counts",
"additional",
"occurrences",
"of",
"a",
"property",
"as",
"qualifier",
"property",
"of",
"statements",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java#L448-L451 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.listSiteDiagnosticCategoriesSlotAsync | public Observable<Page<DiagnosticCategoryInner>> listSiteDiagnosticCategoriesSlotAsync(final String resourceGroupName, final String siteName, final String slot) {
return listSiteDiagnosticCategoriesSlotWithServiceResponseAsync(resourceGroupName, siteName, slot)
.map(new Func1<ServiceResponse<Page<DiagnosticCategoryInner>>, Page<DiagnosticCategoryInner>>() {
@Override
public Page<DiagnosticCategoryInner> call(ServiceResponse<Page<DiagnosticCategoryInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DiagnosticCategoryInner>> listSiteDiagnosticCategoriesSlotAsync(final String resourceGroupName, final String siteName, final String slot) {
return listSiteDiagnosticCategoriesSlotWithServiceResponseAsync(resourceGroupName, siteName, slot)
.map(new Func1<ServiceResponse<Page<DiagnosticCategoryInner>>, Page<DiagnosticCategoryInner>>() {
@Override
public Page<DiagnosticCategoryInner> call(ServiceResponse<Page<DiagnosticCategoryInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DiagnosticCategoryInner",
">",
">",
"listSiteDiagnosticCategoriesSlotAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"siteName",
",",
"final",
"String",
"slot",
")",
"{",
"return",
"listSiteDiagno... | Get Diagnostics Categories.
Get Diagnostics Categories.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param slot Slot Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DiagnosticCategoryInner> object | [
"Get",
"Diagnostics",
"Categories",
".",
"Get",
"Diagnostics",
"Categories",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1392-L1400 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/Utils.java | Utils.concatenateUrls | public static String concatenateUrls(String rootUrl, String path) {
if (rootUrl == null || rootUrl.isEmpty()) {
return path;
}
if (path == null || path.isEmpty()) {
return rootUrl;
}
String finalUrl;
if (rootUrl.charAt(rootUrl.length() - 1) == '/' && path.charAt(0) == '/') {
finalUrl = rootUrl.substring(0, rootUrl.length() - 2) + path;
} else if (rootUrl.charAt(rootUrl.length() - 1) != '/' && path.charAt(0) != '/') {
finalUrl = rootUrl + "/" + path;
} else {
finalUrl = rootUrl + path;
}
return finalUrl;
} | java | public static String concatenateUrls(String rootUrl, String path) {
if (rootUrl == null || rootUrl.isEmpty()) {
return path;
}
if (path == null || path.isEmpty()) {
return rootUrl;
}
String finalUrl;
if (rootUrl.charAt(rootUrl.length() - 1) == '/' && path.charAt(0) == '/') {
finalUrl = rootUrl.substring(0, rootUrl.length() - 2) + path;
} else if (rootUrl.charAt(rootUrl.length() - 1) != '/' && path.charAt(0) != '/') {
finalUrl = rootUrl + "/" + path;
} else {
finalUrl = rootUrl + path;
}
return finalUrl;
} | [
"public",
"static",
"String",
"concatenateUrls",
"(",
"String",
"rootUrl",
",",
"String",
"path",
")",
"{",
"if",
"(",
"rootUrl",
"==",
"null",
"||",
"rootUrl",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"path",
";",
"}",
"if",
"(",
"path",
"==",
... | Concatenates two URLs. The function checks for trailing and preceding slashes in rootUrl and path.
@param rootUrl first part of the url
@param path second part of the url
@return Concatenated string containing rootUrl and path. | [
"Concatenates",
"two",
"URLs",
".",
"The",
"function",
"checks",
"for",
"trailing",
"and",
"preceding",
"slashes",
"in",
"rootUrl",
"and",
"path",
"."
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/Utils.java#L172-L192 |
jbundle/webapp | base/src/main/java/org/jbundle/util/webapp/base/HttpServiceTracker.java | HttpServiceTracker.makeServlet | public Servlet makeServlet(String alias, Dictionary<String, String> dictionary)
{
String servletClass = dictionary.get(BundleConstants.SERVICE_CLASS);
return (Servlet)ClassServiceUtility.getClassService().makeObjectFromClassName(servletClass);
} | java | public Servlet makeServlet(String alias, Dictionary<String, String> dictionary)
{
String servletClass = dictionary.get(BundleConstants.SERVICE_CLASS);
return (Servlet)ClassServiceUtility.getClassService().makeObjectFromClassName(servletClass);
} | [
"public",
"Servlet",
"makeServlet",
"(",
"String",
"alias",
",",
"Dictionary",
"<",
"String",
",",
"String",
">",
"dictionary",
")",
"{",
"String",
"servletClass",
"=",
"dictionary",
".",
"get",
"(",
"BundleConstants",
".",
"SERVICE_CLASS",
")",
";",
"return",... | Create the servlet.
The SERVLET_CLASS property must be supplied.
@param alias
@param dictionary
@return | [
"Create",
"the",
"servlet",
".",
"The",
"SERVLET_CLASS",
"property",
"must",
"be",
"supplied",
"."
] | train | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/HttpServiceTracker.java#L98-L102 |
openxc/openxc-android | library/src/main/java/com/openxc/VehicleManager.java | VehicleManager.addListener | public void addListener(KeyMatcher matcher, VehicleMessage.Listener listener) {
Log.i(TAG, "Adding listener " + listener + " to " + matcher);
mNotifier.register(matcher, listener);
} | java | public void addListener(KeyMatcher matcher, VehicleMessage.Listener listener) {
Log.i(TAG, "Adding listener " + listener + " to " + matcher);
mNotifier.register(matcher, listener);
} | [
"public",
"void",
"addListener",
"(",
"KeyMatcher",
"matcher",
",",
"VehicleMessage",
".",
"Listener",
"listener",
")",
"{",
"Log",
".",
"i",
"(",
"TAG",
",",
"\"Adding listener \"",
"+",
"listener",
"+",
"\" to \"",
"+",
"matcher",
")",
";",
"mNotifier",
".... | Register to receive a callback when a message with key matching the given
KeyMatcher is received.
This function can be used to set up a wildcard listener, or one that
receives a wider range of responses than just a 1 to 1 match of keys.
@param matcher A KeyMatcher implement the desired filtering logic.
@param listener An listener instance to receive the callback. | [
"Register",
"to",
"receive",
"a",
"callback",
"when",
"a",
"message",
"with",
"key",
"matching",
"the",
"given",
"KeyMatcher",
"is",
"received",
"."
] | train | https://github.com/openxc/openxc-android/blob/799adbdcd107a72fe89737bbf19c039dc2881665/library/src/main/java/com/openxc/VehicleManager.java#L407-L410 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileCopier.java | FileCopier.internalCopyDirContent | private void internalCopyDirContent(File src, File dest) throws IORuntimeException {
if (null != copyFilter && false == copyFilter.accept(src)) {
//被过滤的目录跳过
return;
}
if (false == dest.exists()) {
//目标为不存在路径,创建为目录
dest.mkdirs();
} else if (false == dest.isDirectory()) {
throw new IORuntimeException(StrUtil.format("Src [{}] is a directory but dest [{}] is a file!", src.getPath(), dest.getPath()));
}
final String files[] = src.list();
File srcFile;
File destFile;
for (String file : files) {
srcFile = new File(src, file);
destFile = this.isOnlyCopyFile ? dest : new File(dest, file);
// 递归复制
if (srcFile.isDirectory()) {
internalCopyDirContent(srcFile, destFile);
} else {
internalCopyFile(srcFile, destFile);
}
}
} | java | private void internalCopyDirContent(File src, File dest) throws IORuntimeException {
if (null != copyFilter && false == copyFilter.accept(src)) {
//被过滤的目录跳过
return;
}
if (false == dest.exists()) {
//目标为不存在路径,创建为目录
dest.mkdirs();
} else if (false == dest.isDirectory()) {
throw new IORuntimeException(StrUtil.format("Src [{}] is a directory but dest [{}] is a file!", src.getPath(), dest.getPath()));
}
final String files[] = src.list();
File srcFile;
File destFile;
for (String file : files) {
srcFile = new File(src, file);
destFile = this.isOnlyCopyFile ? dest : new File(dest, file);
// 递归复制
if (srcFile.isDirectory()) {
internalCopyDirContent(srcFile, destFile);
} else {
internalCopyFile(srcFile, destFile);
}
}
} | [
"private",
"void",
"internalCopyDirContent",
"(",
"File",
"src",
",",
"File",
"dest",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"null",
"!=",
"copyFilter",
"&&",
"false",
"==",
"copyFilter",
".",
"accept",
"(",
"src",
")",
")",
"{",
"//被过滤的目录跳过\r"... | 拷贝目录内容,只用于内部,不做任何安全检查<br>
拷贝内容的意思为源目录下的所有文件和目录拷贝到另一个目录下,而不拷贝源目录本身
@param src 源目录
@param dest 目标目录
@throws IORuntimeException IO异常 | [
"拷贝目录内容,只用于内部,不做任何安全检查<br",
">",
"拷贝内容的意思为源目录下的所有文件和目录拷贝到另一个目录下,而不拷贝源目录本身"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileCopier.java#L201-L227 |
jfoenixadmin/JFoenix | jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java | ValidationPane.updateErrorContainerSize | private void updateErrorContainerSize(double w, double errorContainerHeight) {
errorContainerClip.setWidth(w);
errorContainerClip.setHeight(errorContainerHeight);
resize(w, errorContainerHeight);
} | java | private void updateErrorContainerSize(double w, double errorContainerHeight) {
errorContainerClip.setWidth(w);
errorContainerClip.setHeight(errorContainerHeight);
resize(w, errorContainerHeight);
} | [
"private",
"void",
"updateErrorContainerSize",
"(",
"double",
"w",
",",
"double",
"errorContainerHeight",
")",
"{",
"errorContainerClip",
".",
"setWidth",
"(",
"w",
")",
";",
"errorContainerClip",
".",
"setHeight",
"(",
"errorContainerHeight",
")",
";",
"resize",
... | update the size of error container and its clip
@param w
@param errorContainerHeight | [
"update",
"the",
"size",
"of",
"error",
"container",
"and",
"its",
"clip"
] | train | https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/ValidationPane.java#L205-L209 |
jmxtrans/jmxtrans | jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/support/opentsdb/OpenTSDBMessageFormatter.java | OpenTSDBMessageFormatter.addTypeNamesTags | protected void addTypeNamesTags(StringBuilder resultString, Result result) {
if (mergeTypeNamesTags) {
// Produce a single tag with all the TypeName keys concatenated and all the values joined with '_'.
String typeNameValues = TypeNameValuesStringBuilder.getDefaultBuilder().build(typeNames, result.getTypeName());
addTag(resultString, StringUtils.join(typeNames, ""), typeNameValues);
} else {
Map<String, String> typeNameMap = TypeNameValue.extractMap(result.getTypeName());
for (String oneTypeName : typeNames) {
String value = typeNameMap.get(oneTypeName);
if (value == null)
value = "";
addTag(resultString, oneTypeName, value);
}
}
} | java | protected void addTypeNamesTags(StringBuilder resultString, Result result) {
if (mergeTypeNamesTags) {
// Produce a single tag with all the TypeName keys concatenated and all the values joined with '_'.
String typeNameValues = TypeNameValuesStringBuilder.getDefaultBuilder().build(typeNames, result.getTypeName());
addTag(resultString, StringUtils.join(typeNames, ""), typeNameValues);
} else {
Map<String, String> typeNameMap = TypeNameValue.extractMap(result.getTypeName());
for (String oneTypeName : typeNames) {
String value = typeNameMap.get(oneTypeName);
if (value == null)
value = "";
addTag(resultString, oneTypeName, value);
}
}
} | [
"protected",
"void",
"addTypeNamesTags",
"(",
"StringBuilder",
"resultString",
",",
"Result",
"result",
")",
"{",
"if",
"(",
"mergeTypeNamesTags",
")",
"{",
"// Produce a single tag with all the TypeName keys concatenated and all the values joined with '_'.",
"String",
"typeNameV... | Add the tag(s) for typeNames.
@param result - the result of the JMX query.
@param resultString - current form of the metric string.
@return String - the updated metric string with the necessary tag(s) added. | [
"Add",
"the",
"tag",
"(",
"s",
")",
"for",
"typeNames",
"."
] | train | https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/support/opentsdb/OpenTSDBMessageFormatter.java#L214-L228 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.saveHq | public static byte[] saveHq(Bitmap src) throws ImageSaveException {
return save(src, Bitmap.CompressFormat.JPEG, JPEG_QUALITY_HQ);
} | java | public static byte[] saveHq(Bitmap src) throws ImageSaveException {
return save(src, Bitmap.CompressFormat.JPEG, JPEG_QUALITY_HQ);
} | [
"public",
"static",
"byte",
"[",
"]",
"saveHq",
"(",
"Bitmap",
"src",
")",
"throws",
"ImageSaveException",
"{",
"return",
"save",
"(",
"src",
",",
"Bitmap",
".",
"CompressFormat",
".",
"JPEG",
",",
"JPEG_QUALITY_HQ",
")",
";",
"}"
] | Saving image in jpeg to byte array with better quality 90
@param src source image
@return saved data
@throws ImageSaveException if it is unable to save image | [
"Saving",
"image",
"in",
"jpeg",
"to",
"byte",
"array",
"with",
"better",
"quality",
"90"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L254-L256 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java | InstanceFailoverGroupsInner.beginCreateOrUpdate | public InstanceFailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().single().body();
} | java | public InstanceFailoverGroupInner beginCreateOrUpdate(String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters).toBlocking().single().body();
} | [
"public",
"InstanceFailoverGroupInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"locationName",
",",
"String",
"failoverGroupName",
",",
"InstanceFailoverGroupInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync"... | Creates or updates a failover group.
@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 locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@param parameters The failover group parameters.
@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 InstanceFailoverGroupInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"failover",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L300-L302 |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/DynamoDBStreamsProxy.java | DynamoDBStreamsProxy.createKinesisClient | @Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
setAwsClientConfigProperties(awsClientConfig, configProps);
AWSCredentialsProvider credentials = getCredentialsProvider(configProps);
awsClientConfig.setUserAgentPrefix(
String.format(
USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
AmazonDynamoDBStreamsAdapterClient adapterClient =
new AmazonDynamoDBStreamsAdapterClient(credentials, awsClientConfig);
if (configProps.containsKey(AWS_ENDPOINT)) {
adapterClient.setEndpoint(configProps.getProperty(AWS_ENDPOINT));
} else {
adapterClient.setRegion(Region.getRegion(
Regions.fromName(configProps.getProperty(AWS_REGION))));
}
return adapterClient;
} | java | @Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
setAwsClientConfigProperties(awsClientConfig, configProps);
AWSCredentialsProvider credentials = getCredentialsProvider(configProps);
awsClientConfig.setUserAgentPrefix(
String.format(
USER_AGENT_FORMAT,
EnvironmentInformation.getVersion(),
EnvironmentInformation.getRevisionInformation().commitId));
AmazonDynamoDBStreamsAdapterClient adapterClient =
new AmazonDynamoDBStreamsAdapterClient(credentials, awsClientConfig);
if (configProps.containsKey(AWS_ENDPOINT)) {
adapterClient.setEndpoint(configProps.getProperty(AWS_ENDPOINT));
} else {
adapterClient.setRegion(Region.getRegion(
Regions.fromName(configProps.getProperty(AWS_REGION))));
}
return adapterClient;
} | [
"@",
"Override",
"protected",
"AmazonKinesis",
"createKinesisClient",
"(",
"Properties",
"configProps",
")",
"{",
"ClientConfiguration",
"awsClientConfig",
"=",
"new",
"ClientConfigurationFactory",
"(",
")",
".",
"getConfig",
"(",
")",
";",
"setAwsClientConfigProperties",... | Creates an AmazonDynamoDBStreamsAdapterClient.
Uses it as the internal client interacting with the DynamoDB streams.
@param configProps configuration properties
@return an AWS DynamoDB streams adapter client | [
"Creates",
"an",
"AmazonDynamoDBStreamsAdapterClient",
".",
"Uses",
"it",
"as",
"the",
"internal",
"client",
"interacting",
"with",
"the",
"DynamoDB",
"streams",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/DynamoDBStreamsProxy.java#L77-L100 |
soarcn/AndroidLifecyle | lifecycle/src/main/java/com/cocosw/lifecycle/LifecycleDispatcher.java | LifecycleDispatcher.unregisterActivityLifecycleCallbacks | public static void unregisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
if (PRE_ICS) {
preIcsUnregisterActivityLifecycleCallbacks(callback);
} else {
postIcsUnregisterActivityLifecycleCallbacks(application, callback);
}
} | java | public static void unregisterActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
if (PRE_ICS) {
preIcsUnregisterActivityLifecycleCallbacks(callback);
} else {
postIcsUnregisterActivityLifecycleCallbacks(application, callback);
}
} | [
"public",
"static",
"void",
"unregisterActivityLifecycleCallbacks",
"(",
"Application",
"application",
",",
"ActivityLifecycleCallbacksCompat",
"callback",
")",
"{",
"if",
"(",
"PRE_ICS",
")",
"{",
"preIcsUnregisterActivityLifecycleCallbacks",
"(",
"callback",
")",
";",
"... | Unregisters a previously registered callback.
@param application The application with which to unregister the callback.
@param callback The callback to unregister. | [
"Unregisters",
"a",
"previously",
"registered",
"callback",
"."
] | train | https://github.com/soarcn/AndroidLifecyle/blob/f1e36f1f20871863cc2007aa0fa6c30143dd2091/lifecycle/src/main/java/com/cocosw/lifecycle/LifecycleDispatcher.java#L65-L71 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDisplayLanguage | public static String getDisplayLanguage(String localeID, ULocale displayLocale) {
return getDisplayLanguageInternal(new ULocale(localeID), displayLocale, false);
} | java | public static String getDisplayLanguage(String localeID, ULocale displayLocale) {
return getDisplayLanguageInternal(new ULocale(localeID), displayLocale, false);
} | [
"public",
"static",
"String",
"getDisplayLanguage",
"(",
"String",
"localeID",
",",
"ULocale",
"displayLocale",
")",
"{",
"return",
"getDisplayLanguageInternal",
"(",
"new",
"ULocale",
"(",
"localeID",
")",
",",
"displayLocale",
",",
"false",
")",
";",
"}"
] | <strong>[icu]</strong> Returns a locale's language localized for display in the provided locale.
This is a cover for the ICU4C API.
@param localeID the id of the locale whose language will be displayed.
@param displayLocale the locale in which to display the name.
@return the localized language name. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"a",
"locale",
"s",
"language",
"localized",
"for",
"display",
"in",
"the",
"provided",
"locale",
".",
"This",
"is",
"a",
"cover",
"for",
"the",
"ICU4C",
"API",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1405-L1407 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/TextureFutureHelper.java | TextureFutureHelper.getSolidColorTexture | public GVRBitmapTexture getSolidColorTexture(int color) {
GVRBitmapTexture texture;
synchronized (mColorTextureCache) {
texture = mColorTextureCache.get(color);
Log.d(TAG, "getSolidColorTexture(): have cached texture for 0x%08X: %b", color, texture != null);
if (texture == null) {
texture = new ImmutableBitmapTexture(mContext, makeSolidColorBitmap(color));
Log.d(TAG, "getSolidColorTexture(): caching texture for 0x%08X", color);
mColorTextureCache.put(color, texture);
Log.d(TAG, "getSolidColorTexture(): succeeded caching for 0x%08X: %b",
color, mColorTextureCache.indexOfKey(color) >= 0);
}
}
return texture;
} | java | public GVRBitmapTexture getSolidColorTexture(int color) {
GVRBitmapTexture texture;
synchronized (mColorTextureCache) {
texture = mColorTextureCache.get(color);
Log.d(TAG, "getSolidColorTexture(): have cached texture for 0x%08X: %b", color, texture != null);
if (texture == null) {
texture = new ImmutableBitmapTexture(mContext, makeSolidColorBitmap(color));
Log.d(TAG, "getSolidColorTexture(): caching texture for 0x%08X", color);
mColorTextureCache.put(color, texture);
Log.d(TAG, "getSolidColorTexture(): succeeded caching for 0x%08X: %b",
color, mColorTextureCache.indexOfKey(color) >= 0);
}
}
return texture;
} | [
"public",
"GVRBitmapTexture",
"getSolidColorTexture",
"(",
"int",
"color",
")",
"{",
"GVRBitmapTexture",
"texture",
";",
"synchronized",
"(",
"mColorTextureCache",
")",
"{",
"texture",
"=",
"mColorTextureCache",
".",
"get",
"(",
"color",
")",
";",
"Log",
".",
"d... | Gets an immutable {@linkplain GVRBitmapTexture texture} with the specified color,
returning a cached instance if possible.
@param color An Android {@link Color}.
@return And immutable instance of {@link GVRBitmapTexture}. | [
"Gets",
"an",
"immutable",
"{",
"@linkplain",
"GVRBitmapTexture",
"texture",
"}",
"with",
"the",
"specified",
"color",
"returning",
"a",
"cached",
"instance",
"if",
"possible",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/TextureFutureHelper.java#L67-L82 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/RGroupQuery.java | RGroupQuery.checkIfThenConditionsMet | private boolean checkIfThenConditionsMet(List<Integer> rGroupNumbers, List<Integer[]> distributions) {
for (int outer = 0; outer < rGroupNumbers.size(); outer++) {
int rgroupNum = rGroupNumbers.get(outer);
if (allZeroArray(distributions.get(outer))) {
for (int inner = 0; inner < rGroupNumbers.size(); inner++) {
int rgroupNum2 = rGroupNumbers.get(inner);
if (!allZeroArray(distributions.get(inner))) {
RGroupList rgrpList = rGroupDefinitions.get(rgroupNum2);
if (rgrpList.getRequiredRGroupNumber() == rgroupNum) {
logger.info(" Rejecting >> all 0 for " + rgroupNum + " but requirement found from "
+ rgrpList.getRGroupNumber());
return false;
}
}
}
}
}
return true;
} | java | private boolean checkIfThenConditionsMet(List<Integer> rGroupNumbers, List<Integer[]> distributions) {
for (int outer = 0; outer < rGroupNumbers.size(); outer++) {
int rgroupNum = rGroupNumbers.get(outer);
if (allZeroArray(distributions.get(outer))) {
for (int inner = 0; inner < rGroupNumbers.size(); inner++) {
int rgroupNum2 = rGroupNumbers.get(inner);
if (!allZeroArray(distributions.get(inner))) {
RGroupList rgrpList = rGroupDefinitions.get(rgroupNum2);
if (rgrpList.getRequiredRGroupNumber() == rgroupNum) {
logger.info(" Rejecting >> all 0 for " + rgroupNum + " but requirement found from "
+ rgrpList.getRGroupNumber());
return false;
}
}
}
}
}
return true;
} | [
"private",
"boolean",
"checkIfThenConditionsMet",
"(",
"List",
"<",
"Integer",
">",
"rGroupNumbers",
",",
"List",
"<",
"Integer",
"[",
"]",
">",
"distributions",
")",
"{",
"for",
"(",
"int",
"outer",
"=",
"0",
";",
"outer",
"<",
"rGroupNumbers",
".",
"size... | Checks whether IF..THEN conditions that can be set for the R-groups are met.
It is used to filter away invalid configurations in {@link #findConfigurationsRecursively}.
<P>
Scenario: suppose R1 is substituted 0 times, whereas R2 is substituted.
Also suppose there is a condition IF R2 THEN R1. Because R1 does not
occur but R2 does, the IF..THEN condition is not met: this function
will return false, the configuration should be discarded.
@param rGroupNumbers
@param distributions
@return true if all IF..THEN RGroup conditions are met. | [
"Checks",
"whether",
"IF",
"..",
"THEN",
"conditions",
"that",
"can",
"be",
"set",
"for",
"the",
"R",
"-",
"groups",
"are",
"met",
".",
"It",
"is",
"used",
"to",
"filter",
"away",
"invalid",
"configurations",
"in",
"{"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/RGroupQuery.java#L543-L561 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java | ListManagementTermsImpl.deleteTermAsync | public Observable<String> deleteTermAsync(String listId, String term, String language) {
return deleteTermWithServiceResponseAsync(listId, term, language).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | java | public Observable<String> deleteTermAsync(String listId, String term, String language) {
return deleteTermWithServiceResponseAsync(listId, term, language).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"String",
">",
"deleteTermAsync",
"(",
"String",
"listId",
",",
"String",
"term",
",",
"String",
"language",
")",
"{",
"return",
"deleteTermWithServiceResponseAsync",
"(",
"listId",
",",
"term",
",",
"language",
")",
".",
"map",
"(... | Deletes a term from the list with list Id equal to the list Id passed.
@param listId List Id of the image list.
@param term Term to be deleted
@param language Language of the terms.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the String object | [
"Deletes",
"a",
"term",
"from",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"the",
"list",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java#L207-L214 |
op4j/op4j-jodatime | src/main/java/org/op4j/jodatime/functions/FnPeriod.java | FnPeriod.longFieldCollectionToPeriod | public static final Function<Collection<Long>, Period> longFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) {
return new LongFieldCollectionToPeriod(periodType, chronology);
} | java | public static final Function<Collection<Long>, Period> longFieldCollectionToPeriod(final PeriodType periodType, final Chronology chronology) {
return new LongFieldCollectionToPeriod(periodType, chronology);
} | [
"public",
"static",
"final",
"Function",
"<",
"Collection",
"<",
"Long",
">",
",",
"Period",
">",
"longFieldCollectionToPeriod",
"(",
"final",
"PeriodType",
"periodType",
",",
"final",
"Chronology",
"chronology",
")",
"{",
"return",
"new",
"LongFieldCollectionToPeri... | <p>
The given {@link Long} targets representing the time in milliseconds will be used as the start
and end instants of the {@link Period} returned
</p>
@param periodType the {@link PeriodType} to be created. It specifies which duration fields are to be used
@param chronology {@link Chronology} to be used
@return the {@link Period} created from the input and arguments | [
"<p",
">",
"The",
"given",
"{",
"@link",
"Long",
"}",
"targets",
"representing",
"the",
"time",
"in",
"milliseconds",
"will",
"be",
"used",
"as",
"the",
"start",
"and",
"end",
"instants",
"of",
"the",
"{",
"@link",
"Period",
"}",
"returned",
"<",
"/",
... | train | https://github.com/op4j/op4j-jodatime/blob/26e5b8cda8553fb3b5a4a64b3109dbbf5df21194/src/main/java/org/op4j/jodatime/functions/FnPeriod.java#L408-L410 |
line/armeria | logback/src/main/java/com/linecorp/armeria/common/logback/RequestContextExportingAppender.java | RequestContextExportingAppender.addAttribute | public void addAttribute(String alias, AttributeKey<?> attrKey) {
ensureNotStarted();
builder.addAttribute(alias, attrKey);
} | java | public void addAttribute(String alias, AttributeKey<?> attrKey) {
ensureNotStarted();
builder.addAttribute(alias, attrKey);
} | [
"public",
"void",
"addAttribute",
"(",
"String",
"alias",
",",
"AttributeKey",
"<",
"?",
">",
"attrKey",
")",
"{",
"ensureNotStarted",
"(",
")",
";",
"builder",
".",
"addAttribute",
"(",
"alias",
",",
"attrKey",
")",
";",
"}"
] | Adds the specified {@link AttributeKey} to the export list.
@param alias the alias of the attribute to export
@param attrKey the key of the attribute to export | [
"Adds",
"the",
"specified",
"{",
"@link",
"AttributeKey",
"}",
"to",
"the",
"export",
"list",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/logback/src/main/java/com/linecorp/armeria/common/logback/RequestContextExportingAppender.java#L103-L106 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java | DatePicker.zInternalSetLastValidDateAndNotifyListeners | private void zInternalSetLastValidDateAndNotifyListeners(LocalDate newDate) {
LocalDate oldDate = lastValidDate;
lastValidDate = newDate;
if (!PickerUtilities.isSameLocalDate(oldDate, newDate)) {
for (DateChangeListener dateChangeListener : dateChangeListeners) {
DateChangeEvent dateChangeEvent = new DateChangeEvent(this, oldDate, newDate);
dateChangeListener.dateChanged(dateChangeEvent);
}
// Fire a change event for beans binding.
firePropertyChange("date", oldDate, newDate);
}
} | java | private void zInternalSetLastValidDateAndNotifyListeners(LocalDate newDate) {
LocalDate oldDate = lastValidDate;
lastValidDate = newDate;
if (!PickerUtilities.isSameLocalDate(oldDate, newDate)) {
for (DateChangeListener dateChangeListener : dateChangeListeners) {
DateChangeEvent dateChangeEvent = new DateChangeEvent(this, oldDate, newDate);
dateChangeListener.dateChanged(dateChangeEvent);
}
// Fire a change event for beans binding.
firePropertyChange("date", oldDate, newDate);
}
} | [
"private",
"void",
"zInternalSetLastValidDateAndNotifyListeners",
"(",
"LocalDate",
"newDate",
")",
"{",
"LocalDate",
"oldDate",
"=",
"lastValidDate",
";",
"lastValidDate",
"=",
"newDate",
";",
"if",
"(",
"!",
"PickerUtilities",
".",
"isSameLocalDate",
"(",
"oldDate",... | zInternalSetLastValidDateAndNotifyListeners, This should be called whenever we need to change
the last valid date variable. This will store the supplied last valid date. If needed, this
will notify all date change listeners that the date has been changed. This does -not- update
the displayed calendar, and does not perform any other tasks besides those described here. | [
"zInternalSetLastValidDateAndNotifyListeners",
"This",
"should",
"be",
"called",
"whenever",
"we",
"need",
"to",
"change",
"the",
"last",
"valid",
"date",
"variable",
".",
"This",
"will",
"store",
"the",
"supplied",
"last",
"valid",
"date",
".",
"If",
"needed",
... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java#L840-L851 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java | PcsUtils.ensureContentTypeIsJson | public static void ensureContentTypeIsJson( CResponse response, boolean isRetriable )
throws CStorageException
{
String contentType = response.getContentType();
CStorageException ex = null;
if ( contentType == null ) {
ex = buildCStorageException( response, "Undefined Content-Type in server response", null );
} else if ( !contentType.contains( "application/json" ) && !contentType.contains( "text/javascript" ) ) {
ex = buildCStorageException( response, "Content-Type is not json: " + contentType, null );
}
if ( ex != null ) {
if ( isRetriable ) {
ex = new CRetriableException( ex );
}
throw ex;
}
} | java | public static void ensureContentTypeIsJson( CResponse response, boolean isRetriable )
throws CStorageException
{
String contentType = response.getContentType();
CStorageException ex = null;
if ( contentType == null ) {
ex = buildCStorageException( response, "Undefined Content-Type in server response", null );
} else if ( !contentType.contains( "application/json" ) && !contentType.contains( "text/javascript" ) ) {
ex = buildCStorageException( response, "Content-Type is not json: " + contentType, null );
}
if ( ex != null ) {
if ( isRetriable ) {
ex = new CRetriableException( ex );
}
throw ex;
}
} | [
"public",
"static",
"void",
"ensureContentTypeIsJson",
"(",
"CResponse",
"response",
",",
"boolean",
"isRetriable",
")",
"throws",
"CStorageException",
"{",
"String",
"contentType",
"=",
"response",
".",
"getContentType",
"(",
")",
";",
"CStorageException",
"ex",
"=... | Extract content type from response headers, and ensure it is application/json or text/javascript. If no
content-type is defined, or content-type is not json, raises a CHttpError.
@param response the response to check
@param isRetriable if True, raised exception is wrapped into a CRetriable | [
"Extract",
"content",
"type",
"from",
"response",
"headers",
"and",
"ensure",
"it",
"is",
"application",
"/",
"json",
"or",
"text",
"/",
"javascript",
".",
"If",
"no",
"content",
"-",
"type",
"is",
"defined",
"or",
"content",
"-",
"type",
"is",
"not",
"j... | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java#L59-L78 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java | VpnGatewaysInner.beginCreateOrUpdate | public VpnGatewayInner beginCreateOrUpdate(String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, vpnGatewayParameters).toBlocking().single().body();
} | java | public VpnGatewayInner beginCreateOrUpdate(String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, vpnGatewayParameters).toBlocking().single().body();
} | [
"public",
"VpnGatewayInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"gatewayName",
",",
"VpnGatewayInner",
"vpnGatewayParameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"gatewayName",... | Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway.
@param resourceGroupName The resource group name of the VpnGateway.
@param gatewayName The name of the gateway.
@param vpnGatewayParameters Parameters supplied to create or Update a virtual wan vpn gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VpnGatewayInner object if successful. | [
"Creates",
"a",
"virtual",
"wan",
"vpn",
"gateway",
"if",
"it",
"doesn",
"t",
"exist",
"else",
"updates",
"the",
"existing",
"gateway",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java#L286-L288 |
alkacon/opencms-core | src/org/opencms/workplace/explorer/CmsExplorerTypeSettings.java | CmsExplorerTypeSettings.isEditable | public boolean isEditable(CmsObject cms, CmsResource resource) {
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()
&& OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN)) {
return true;
}
// determine if this resource type is editable for the current user
CmsPermissionSet permissions = getAccess().getPermissions(cms, resource);
return permissions.requiresWritePermission();
} | java | public boolean isEditable(CmsObject cms, CmsResource resource) {
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()
&& OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN)) {
return true;
}
// determine if this resource type is editable for the current user
CmsPermissionSet permissions = getAccess().getPermissions(cms, resource);
return permissions.requiresWritePermission();
} | [
"public",
"boolean",
"isEditable",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"if",
"(",
"!",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentProject",
"(",
")",
".",
"isOnlineProject",
"(",
")",
"&&",
"OpenCms",
".",
"ge... | Checks if the current user has write permissions on the given resource.<p>
@param cms the current cms context
@param resource the resource to check
@return <code>true</code> if the current user has write permissions on the given resource | [
"Checks",
"if",
"the",
"current",
"user",
"has",
"write",
"permissions",
"on",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/explorer/CmsExplorerTypeSettings.java#L579-L588 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java | ImageMiscOps.insertBand | public static void insertBand( GrayF32 input, int band , InterleavedF32 output) {
final int numBands = output.numBands;
for (int y = 0; y < input.height; y++) {
int indexIn = input.getStartIndex() + y * input.getStride();
int indexOut = output.getStartIndex() + y * output.getStride() + band;
int end = indexOut + output.width*numBands - band;
for (; indexOut < end; indexOut += numBands , indexIn++ ) {
output.data[indexOut] = input.data[indexIn];
}
}
} | java | public static void insertBand( GrayF32 input, int band , InterleavedF32 output) {
final int numBands = output.numBands;
for (int y = 0; y < input.height; y++) {
int indexIn = input.getStartIndex() + y * input.getStride();
int indexOut = output.getStartIndex() + y * output.getStride() + band;
int end = indexOut + output.width*numBands - band;
for (; indexOut < end; indexOut += numBands , indexIn++ ) {
output.data[indexOut] = input.data[indexIn];
}
}
} | [
"public",
"static",
"void",
"insertBand",
"(",
"GrayF32",
"input",
",",
"int",
"band",
",",
"InterleavedF32",
"output",
")",
"{",
"final",
"int",
"numBands",
"=",
"output",
".",
"numBands",
";",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"input",... | Inserts a single band into a multi-band image overwriting the original band
@param input Single band image
@param band Which band the image is to be inserted into
@param output The multi-band image which the input image is to be inserted into | [
"Inserts",
"a",
"single",
"band",
"into",
"a",
"multi",
"-",
"band",
"image",
"overwriting",
"the",
"original",
"band"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2328-L2339 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java | AsyncLookupInBuilder.existsIn | private Observable<DocumentFragment<Lookup>> existsIn(final String id, final LookupSpec spec,
final long timeout, final TimeUnit timeUnit) {
return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {
@Override
public Observable<DocumentFragment<Lookup>> call() {
final SubExistRequest request = new SubExistRequest(id, spec.path(), bucketName);
request.xattr(spec.xattr());
request.accessDeleted(accessDeleted);
addRequestSpan(environment, request, "subdoc_exists");
return applyTimeout(deferAndWatch(new Func1<Subscriber, Observable<SimpleSubdocResponse>>() {
@Override
public Observable<SimpleSubdocResponse> call(Subscriber s) {
request.subscriber(s);
return core.send(request);
}
}).map(new Func1<SimpleSubdocResponse, DocumentFragment<Lookup>>() {
@Override
public DocumentFragment<Lookup> call(SimpleSubdocResponse response) {
try {
if (response.content() != null && response.content().refCnt() > 0) {
response.content().release();
}
if (response.status().isSuccess()) {
SubdocOperationResult<Lookup> result = SubdocOperationResult
.createResult(spec.path(), Lookup.EXIST, response.status(), true);
return new DocumentFragment<Lookup>(docId, response.cas(),
response.mutationToken(), Collections.singletonList(result));
} else if (response.status() == ResponseStatus.SUBDOC_PATH_NOT_FOUND) {
SubdocOperationResult<Lookup> result = SubdocOperationResult
.createResult(spec.path(), Lookup.EXIST, response.status(), false);
return new DocumentFragment<Lookup>(docId, response.cas(),
response.mutationToken(), Collections.singletonList(result));
}
throw SubdocHelper.commonSubdocErrors(response.status(), id, spec.path());
} finally {
if (environment.operationTracingEnabled()) {
environment.tracer().scopeManager()
.activate(response.request().span(), true)
.close();
}
}
}
}), request, environment, timeout, timeUnit);
}
});
} | java | private Observable<DocumentFragment<Lookup>> existsIn(final String id, final LookupSpec spec,
final long timeout, final TimeUnit timeUnit) {
return Observable.defer(new Func0<Observable<DocumentFragment<Lookup>>>() {
@Override
public Observable<DocumentFragment<Lookup>> call() {
final SubExistRequest request = new SubExistRequest(id, spec.path(), bucketName);
request.xattr(spec.xattr());
request.accessDeleted(accessDeleted);
addRequestSpan(environment, request, "subdoc_exists");
return applyTimeout(deferAndWatch(new Func1<Subscriber, Observable<SimpleSubdocResponse>>() {
@Override
public Observable<SimpleSubdocResponse> call(Subscriber s) {
request.subscriber(s);
return core.send(request);
}
}).map(new Func1<SimpleSubdocResponse, DocumentFragment<Lookup>>() {
@Override
public DocumentFragment<Lookup> call(SimpleSubdocResponse response) {
try {
if (response.content() != null && response.content().refCnt() > 0) {
response.content().release();
}
if (response.status().isSuccess()) {
SubdocOperationResult<Lookup> result = SubdocOperationResult
.createResult(spec.path(), Lookup.EXIST, response.status(), true);
return new DocumentFragment<Lookup>(docId, response.cas(),
response.mutationToken(), Collections.singletonList(result));
} else if (response.status() == ResponseStatus.SUBDOC_PATH_NOT_FOUND) {
SubdocOperationResult<Lookup> result = SubdocOperationResult
.createResult(spec.path(), Lookup.EXIST, response.status(), false);
return new DocumentFragment<Lookup>(docId, response.cas(),
response.mutationToken(), Collections.singletonList(result));
}
throw SubdocHelper.commonSubdocErrors(response.status(), id, spec.path());
} finally {
if (environment.operationTracingEnabled()) {
environment.tracer().scopeManager()
.activate(response.request().span(), true)
.close();
}
}
}
}), request, environment, timeout, timeUnit);
}
});
} | [
"private",
"Observable",
"<",
"DocumentFragment",
"<",
"Lookup",
">",
">",
"existsIn",
"(",
"final",
"String",
"id",
",",
"final",
"LookupSpec",
"spec",
",",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"Observable",
... | Helper method to actually perform the subdoc exists operation. | [
"Helper",
"method",
"to",
"actually",
"perform",
"the",
"subdoc",
"exists",
"operation",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncLookupInBuilder.java#L669-L716 |
cchabanois/transmorph | src/main/java/net/entropysoft/transmorph/type/TypeUtils.java | TypeUtils.isAssignableFrom | private static boolean isAssignableFrom(Type from, GenericArrayType to) {
Type toGenericComponentType = to.getGenericComponentType();
if (toGenericComponentType instanceof ParameterizedType) {
Type t = from;
if (from instanceof GenericArrayType) {
t = ((GenericArrayType) from).getGenericComponentType();
} else if (from instanceof Class) {
Class<?> classType = (Class<?>) from;
while (classType.isArray()) {
classType = classType.getComponentType();
}
t = classType;
}
return isAssignableFrom(t,
(ParameterizedType) toGenericComponentType,
new HashMap<String, Type>());
}
// No generic defined on "to"; therefore, return true and let other
// checks determine assignability
return true;
} | java | private static boolean isAssignableFrom(Type from, GenericArrayType to) {
Type toGenericComponentType = to.getGenericComponentType();
if (toGenericComponentType instanceof ParameterizedType) {
Type t = from;
if (from instanceof GenericArrayType) {
t = ((GenericArrayType) from).getGenericComponentType();
} else if (from instanceof Class) {
Class<?> classType = (Class<?>) from;
while (classType.isArray()) {
classType = classType.getComponentType();
}
t = classType;
}
return isAssignableFrom(t,
(ParameterizedType) toGenericComponentType,
new HashMap<String, Type>());
}
// No generic defined on "to"; therefore, return true and let other
// checks determine assignability
return true;
} | [
"private",
"static",
"boolean",
"isAssignableFrom",
"(",
"Type",
"from",
",",
"GenericArrayType",
"to",
")",
"{",
"Type",
"toGenericComponentType",
"=",
"to",
".",
"getGenericComponentType",
"(",
")",
";",
"if",
"(",
"toGenericComponentType",
"instanceof",
"Paramete... | Private helper function that performs some assignability checks for the
provided GenericArrayType. | [
"Private",
"helper",
"function",
"that",
"performs",
"some",
"assignability",
"checks",
"for",
"the",
"provided",
"GenericArrayType",
"."
] | train | https://github.com/cchabanois/transmorph/blob/118550f30b9680a84eab7496bd8b04118740dcec/src/main/java/net/entropysoft/transmorph/type/TypeUtils.java#L185-L205 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/InitFieldHandler.java | InitFieldHandler.syncClonedListener | public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled)
{
if (!bInitCalled)
{
BaseField fldSource = this.getSyncedListenersField(m_fldSource, listener);
((InitFieldHandler)listener).init(null, fldSource, m_objSource, m_bInitIfSourceNull, m_bOnlyInitIfDestNull);
}
return super.syncClonedListener(field, listener, true);
} | java | public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled)
{
if (!bInitCalled)
{
BaseField fldSource = this.getSyncedListenersField(m_fldSource, listener);
((InitFieldHandler)listener).init(null, fldSource, m_objSource, m_bInitIfSourceNull, m_bOnlyInitIfDestNull);
}
return super.syncClonedListener(field, listener, true);
} | [
"public",
"boolean",
"syncClonedListener",
"(",
"BaseField",
"field",
",",
"FieldListener",
"listener",
",",
"boolean",
"bInitCalled",
")",
"{",
"if",
"(",
"!",
"bInitCalled",
")",
"{",
"BaseField",
"fldSource",
"=",
"this",
".",
"getSyncedListenersField",
"(",
... | Set this cloned listener to the same state at this listener.
@param field The field this new listener will be added to.
@param The new listener to sync to this.
@param Has the init method been called?
@return True if I called init. | [
"Set",
"this",
"cloned",
"listener",
"to",
"the",
"same",
"state",
"at",
"this",
"listener",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitFieldHandler.java#L114-L122 |
elki-project/elki | elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/Logging.java | Logging.beginStep | public void beginStep(StepProgress prog, int step, String title) {
if(prog != null) {
prog.beginStep(step, title, this);
}
} | java | public void beginStep(StepProgress prog, int step, String title) {
if(prog != null) {
prog.beginStep(step, title, this);
}
} | [
"public",
"void",
"beginStep",
"(",
"StepProgress",
"prog",
",",
"int",
"step",
",",
"String",
"title",
")",
"{",
"if",
"(",
"prog",
"!=",
"null",
")",
"{",
"prog",
".",
"beginStep",
"(",
"step",
",",
"title",
",",
"this",
")",
";",
"}",
"}"
] | Begin a new algorithm step (unless {@code null}).
<b>Important:</b> Do not use this method when the parameter are not static.
In these cases, check whether logging is enabled first, to avoid computing
method parameters!
@param prog Progress to increment, may be {@code null}.
@param step Step number
@param title Step title | [
"Begin",
"a",
"new",
"algorithm",
"step",
"(",
"unless",
"{",
"@code",
"null",
"}",
")",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/Logging.java#L657-L661 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DigestUtils.java | DigestUtils.shaBase64 | public static String shaBase64(final String salt, final String data) {
return shaBase64(salt, data, null);
} | java | public static String shaBase64(final String salt, final String data) {
return shaBase64(salt, data, null);
} | [
"public",
"static",
"String",
"shaBase64",
"(",
"final",
"String",
"salt",
",",
"final",
"String",
"data",
")",
"{",
"return",
"shaBase64",
"(",
"salt",
",",
"data",
",",
"null",
")",
";",
"}"
] | Sha base 64 string.
@param salt the salt
@param data the data
@return the string | [
"Sha",
"base",
"64",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DigestUtils.java#L71-L73 |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java | PropertiesUtils.getProperty | public static String getProperty( Properties props, String key, String def )
{
String value = props.getProperty( key, def );
if( value == null )
{
return null;
}
if( "".equals( value ) )
{
return value;
}
value = PropertyResolver.resolve( props, value );
return value;
} | java | public static String getProperty( Properties props, String key, String def )
{
String value = props.getProperty( key, def );
if( value == null )
{
return null;
}
if( "".equals( value ) )
{
return value;
}
value = PropertyResolver.resolve( props, value );
return value;
} | [
"public",
"static",
"String",
"getProperty",
"(",
"Properties",
"props",
",",
"String",
"key",
",",
"String",
"def",
")",
"{",
"String",
"value",
"=",
"props",
".",
"getProperty",
"(",
"key",
",",
"def",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",... | Return the value of a property.
@param props the property file
@param key the property key to lookup
@param def the default value
@return the resolve value | [
"Return",
"the",
"value",
"of",
"a",
"property",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L153-L166 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java | Forward.initializeRelativePath | public void initializeRelativePath(ServletRequest request, String relativeTo)
{
if ( relativeTo == null )
{
relativeTo = _relativeTo;
}
if ( relativeTo == null ) return;
assert ! relativeTo.endsWith("/") : relativeTo;
String path = getPath();
// If this is a local (relative) path, prefix it with the given 'relativeTo' path, and save a flag.
// We save this flag in a local variable because the Forward object may be saved/restored for use again.
if (! getContextRelative() && ! FileUtils.isAbsoluteURI(path)) {
assert path.startsWith("/") : path;
setPath(relativeTo + path);
setContextRelative(true);
_outsidePageFlowDirectory = true;
}
// Store a flag in the request that will prevent another page flow from being initialized implicitly because
// we're hitting a path within it. We want to stay in the context of the current page flow.
if (_outsidePageFlowDirectory) {
PageFlowRequestWrapper.get(request).setStayInCurrentModule(true);
}
} | java | public void initializeRelativePath(ServletRequest request, String relativeTo)
{
if ( relativeTo == null )
{
relativeTo = _relativeTo;
}
if ( relativeTo == null ) return;
assert ! relativeTo.endsWith("/") : relativeTo;
String path = getPath();
// If this is a local (relative) path, prefix it with the given 'relativeTo' path, and save a flag.
// We save this flag in a local variable because the Forward object may be saved/restored for use again.
if (! getContextRelative() && ! FileUtils.isAbsoluteURI(path)) {
assert path.startsWith("/") : path;
setPath(relativeTo + path);
setContextRelative(true);
_outsidePageFlowDirectory = true;
}
// Store a flag in the request that will prevent another page flow from being initialized implicitly because
// we're hitting a path within it. We want to stay in the context of the current page flow.
if (_outsidePageFlowDirectory) {
PageFlowRequestWrapper.get(request).setStayInCurrentModule(true);
}
} | [
"public",
"void",
"initializeRelativePath",
"(",
"ServletRequest",
"request",
",",
"String",
"relativeTo",
")",
"{",
"if",
"(",
"relativeTo",
"==",
"null",
")",
"{",
"relativeTo",
"=",
"_relativeTo",
";",
"}",
"if",
"(",
"relativeTo",
"==",
"null",
")",
"ret... | If this is a local path, change it so it's relative to the given path prefix, and remember that we did it in
a flag (_outsidePageFlowDirectory). This is a framework-invoked method that should not normally be called
directly. | [
"If",
"this",
"is",
"a",
"local",
"path",
"change",
"it",
"so",
"it",
"s",
"relative",
"to",
"the",
"given",
"path",
"prefix",
"and",
"remember",
"that",
"we",
"did",
"it",
"in",
"a",
"flag",
"(",
"_outsidePageFlowDirectory",
")",
".",
"This",
"is",
"a... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java#L1096-L1122 |
aerogear/aerogear-unifiedpush-server | common/src/main/java/org/jboss/aerogear/unifiedpush/system/ConfigurationUtils.java | ConfigurationUtils.tryGetProperty | private static String tryGetProperty(String key, String defaultValue) {
try {
return System.getProperty(key, defaultValue);
} catch (SecurityException e) {
logger.error("Could not get value of property {} due to SecurityManager. Using default value.", key);
return null;
}
} | java | private static String tryGetProperty(String key, String defaultValue) {
try {
return System.getProperty(key, defaultValue);
} catch (SecurityException e) {
logger.error("Could not get value of property {} due to SecurityManager. Using default value.", key);
return null;
}
} | [
"private",
"static",
"String",
"tryGetProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"System",
".",
"getProperty",
"(",
"key",
",",
"defaultValue",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
... | Try to retrieve a system property and returns the defaultValue if SecurityManager blocks it.
@param key Name of the system property to get the string for.
@param defaultValue Value to be returned on unsuccessful operation or if the propety is not set.
@return the value of the System property | [
"Try",
"to",
"retrieve",
"a",
"system",
"property",
"and",
"returns",
"the",
"defaultValue",
"if",
"SecurityManager",
"blocks",
"it",
"."
] | train | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/common/src/main/java/org/jboss/aerogear/unifiedpush/system/ConfigurationUtils.java#L37-L44 |
threerings/narya | core/src/main/java/com/threerings/presents/server/LocalDObjectMgr.java | LocalDObjectMgr.getClientDObjectMgr | public DObjectManager getClientDObjectMgr (final int clientOid)
{
return new DObjectManager() {
public boolean isManager (DObject object) {
return LocalDObjectMgr.this.isManager(object);
}
public <T extends DObject> void subscribeToObject (int oid, Subscriber<T> target) {
LocalDObjectMgr.this.subscribeToObject(oid, target);
}
public <T extends DObject> void unsubscribeFromObject (int oid, Subscriber<T> target) {
LocalDObjectMgr.this.unsubscribeFromObject(oid, target);
}
public void postEvent (DEvent event) {
event.setSourceOid(clientOid);
LocalDObjectMgr.this.postEvent(event);
}
public void removedLastSubscriber (DObject obj, boolean deathWish) {
LocalDObjectMgr.this.removedLastSubscriber(obj, deathWish);
}
};
} | java | public DObjectManager getClientDObjectMgr (final int clientOid)
{
return new DObjectManager() {
public boolean isManager (DObject object) {
return LocalDObjectMgr.this.isManager(object);
}
public <T extends DObject> void subscribeToObject (int oid, Subscriber<T> target) {
LocalDObjectMgr.this.subscribeToObject(oid, target);
}
public <T extends DObject> void unsubscribeFromObject (int oid, Subscriber<T> target) {
LocalDObjectMgr.this.unsubscribeFromObject(oid, target);
}
public void postEvent (DEvent event) {
event.setSourceOid(clientOid);
LocalDObjectMgr.this.postEvent(event);
}
public void removedLastSubscriber (DObject obj, boolean deathWish) {
LocalDObjectMgr.this.removedLastSubscriber(obj, deathWish);
}
};
} | [
"public",
"DObjectManager",
"getClientDObjectMgr",
"(",
"final",
"int",
"clientOid",
")",
"{",
"return",
"new",
"DObjectManager",
"(",
")",
"{",
"public",
"boolean",
"isManager",
"(",
"DObject",
"object",
")",
"{",
"return",
"LocalDObjectMgr",
".",
"this",
".",
... | Creates a {@link DObjectManager} that posts directly to this local object manager, but first
sets the source oid of all events to properly identify them with the supplied client oid.
Normally this oid setting happens when an event is received on the server over the network,
but in local mode we have to do it by hand. | [
"Creates",
"a",
"{"
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/LocalDObjectMgr.java#L56-L76 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/HsqlDateTime.java | HsqlDateTime.getDateTimePart | public static int getDateTimePart(long m, int part) {
synchronized (tempCalGMT) {
tempCalGMT.setTimeInMillis(m);
return tempCalGMT.get(part);
}
} | java | public static int getDateTimePart(long m, int part) {
synchronized (tempCalGMT) {
tempCalGMT.setTimeInMillis(m);
return tempCalGMT.get(part);
}
} | [
"public",
"static",
"int",
"getDateTimePart",
"(",
"long",
"m",
",",
"int",
"part",
")",
"{",
"synchronized",
"(",
"tempCalGMT",
")",
"{",
"tempCalGMT",
".",
"setTimeInMillis",
"(",
"m",
")",
";",
"return",
"tempCalGMT",
".",
"get",
"(",
"part",
")",
";"... | Returns the indicated part of the given <code>java.util.Date</code> object.
@param m the millisecond time value from which to extract the indicated part
@param part an integer code corresponding to the desired date part
@return the indicated part of the given <code>java.util.Date</code> object | [
"Returns",
"the",
"indicated",
"part",
"of",
"the",
"given",
"<code",
">",
"java",
".",
"util",
".",
"Date<",
"/",
"code",
">",
"object",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/HsqlDateTime.java#L311-L318 |
CloudSlang/cs-actions | cs-vmware/src/main/java/io/cloudslang/content/vmware/services/ClusterComputeResourceService.java | ClusterComputeResourceService.getClusterConfiguration | private ClusterConfigInfoEx getClusterConfiguration(ConnectionResources connectionResources, ManagedObjectReference clusterMor,
String clusterName) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
ObjectContent[] objectContents = GetObjectProperties.getObjectProperties(connectionResources, clusterMor, new String[]{ClusterParameter.CONFIGURATION_EX.getValue()});
if (objectContents != null && objectContents.length == 1) {
List<DynamicProperty> dynamicProperties = objectContents[0].getPropSet();
if (dynamicProperties != null && dynamicProperties.size() == 1 && dynamicProperties.get(0).getVal() instanceof ClusterConfigInfoEx) {
return (ClusterConfigInfoEx) dynamicProperties.get(0).getVal();
}
}
throw new RuntimeException(String.format(ANOTHER_FAILURE_MSG, clusterName));
} | java | private ClusterConfigInfoEx getClusterConfiguration(ConnectionResources connectionResources, ManagedObjectReference clusterMor,
String clusterName) throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
ObjectContent[] objectContents = GetObjectProperties.getObjectProperties(connectionResources, clusterMor, new String[]{ClusterParameter.CONFIGURATION_EX.getValue()});
if (objectContents != null && objectContents.length == 1) {
List<DynamicProperty> dynamicProperties = objectContents[0].getPropSet();
if (dynamicProperties != null && dynamicProperties.size() == 1 && dynamicProperties.get(0).getVal() instanceof ClusterConfigInfoEx) {
return (ClusterConfigInfoEx) dynamicProperties.get(0).getVal();
}
}
throw new RuntimeException(String.format(ANOTHER_FAILURE_MSG, clusterName));
} | [
"private",
"ClusterConfigInfoEx",
"getClusterConfiguration",
"(",
"ConnectionResources",
"connectionResources",
",",
"ManagedObjectReference",
"clusterMor",
",",
"String",
"clusterName",
")",
"throws",
"RuntimeFaultFaultMsg",
",",
"InvalidPropertyFaultMsg",
"{",
"ObjectContent",
... | Das method gets the current cluster configurations.
@param connectionResources
@param clusterMor
@param clusterName
@return
@throws RuntimeFaultFaultMsg
@throws InvalidPropertyFaultMsg | [
"Das",
"method",
"gets",
"the",
"current",
"cluster",
"configurations",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-vmware/src/main/java/io/cloudslang/content/vmware/services/ClusterComputeResourceService.java#L483-L493 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.addRepo | public CompletableFuture<Revision> addRepo(Author author, String projectName, String repoName) {
return addRepo(author, projectName, repoName, PerRolePermissions.DEFAULT);
} | java | public CompletableFuture<Revision> addRepo(Author author, String projectName, String repoName) {
return addRepo(author, projectName, repoName, PerRolePermissions.DEFAULT);
} | [
"public",
"CompletableFuture",
"<",
"Revision",
">",
"addRepo",
"(",
"Author",
"author",
",",
"String",
"projectName",
",",
"String",
"repoName",
")",
"{",
"return",
"addRepo",
"(",
"author",
",",
"projectName",
",",
"repoName",
",",
"PerRolePermissions",
".",
... | Adds a {@link RepositoryMetadata} of the specified {@code repoName} to the specified {@code projectName}
with a default {@link PerRolePermissions}. | [
"Adds",
"a",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L225-L227 |
trellis-ldp/trellis | components/app/src/main/java/org/trellisldp/app/config/TrellisConfiguration.java | TrellisConfiguration.setAdditionalConfig | @JsonAnySetter
public TrellisConfiguration setAdditionalConfig(final String name, final Object value) {
extras.put(name, value);
return this;
} | java | @JsonAnySetter
public TrellisConfiguration setAdditionalConfig(final String name, final Object value) {
extras.put(name, value);
return this;
} | [
"@",
"JsonAnySetter",
"public",
"TrellisConfiguration",
"setAdditionalConfig",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"extras",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Set an extra configuration value.
@param name the name of this config value
@param value the value to set
@return this config for chaining | [
"Set",
"an",
"extra",
"configuration",
"value",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/app/src/main/java/org/trellisldp/app/config/TrellisConfiguration.java#L139-L143 |
kmi/iserve | iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java | AbstractMatcher.listMatchesAtLeastOfType | @Override
public Map<URI, MatchResult> listMatchesAtLeastOfType(URI origin, MatchType minType) {
return listMatchesWithinRange(origin, minType, this.matchTypesSupported.getHighest());
} | java | @Override
public Map<URI, MatchResult> listMatchesAtLeastOfType(URI origin, MatchType minType) {
return listMatchesWithinRange(origin, minType, this.matchTypesSupported.getHighest());
} | [
"@",
"Override",
"public",
"Map",
"<",
"URI",
",",
"MatchResult",
">",
"listMatchesAtLeastOfType",
"(",
"URI",
"origin",
",",
"MatchType",
"minType",
")",
"{",
"return",
"listMatchesWithinRange",
"(",
"origin",
",",
"minType",
",",
"this",
".",
"matchTypesSuppor... | Obtains all the matching resources that have a MatchType with the URI of {@code origin} of the type provided (inclusive) or more.
@param origin URI to match
@param minType the minimum MatchType we want to obtain
@return a Map containing indexed by the URI of the matching resource and containing the particular {@code MatchResult}. If no
result is found the Map should be empty not null. | [
"Obtains",
"all",
"the",
"matching",
"resources",
"that",
"have",
"a",
"MatchType",
"with",
"the",
"URI",
"of",
"{",
"@code",
"origin",
"}",
"of",
"the",
"type",
"provided",
"(",
"inclusive",
")",
"or",
"more",
"."
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java#L98-L101 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_adduser.java | br_adduser.adduser | public static br_adduser adduser(nitro_service client, br_adduser resource) throws Exception
{
return ((br_adduser[]) resource.perform_operation(client, "adduser"))[0];
} | java | public static br_adduser adduser(nitro_service client, br_adduser resource) throws Exception
{
return ((br_adduser[]) resource.perform_operation(client, "adduser"))[0];
} | [
"public",
"static",
"br_adduser",
"adduser",
"(",
"nitro_service",
"client",
",",
"br_adduser",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_adduser",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"adduser\"",... | <pre>
Use this operation to add user and assign privilege on Repeater Instances.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"add",
"user",
"and",
"assign",
"privilege",
"on",
"Repeater",
"Instances",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_adduser.java#L147-L150 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bolt/AmBaseBolt.java | AmBaseBolt.emitWithNoAnchorKeyAndStream | protected void emitWithNoAnchorKeyAndStream(StreamMessage message, String streamId)
{
getCollector().emit(streamId, new Values("", message));
} | java | protected void emitWithNoAnchorKeyAndStream(StreamMessage message, String streamId)
{
getCollector().emit(streamId, new Values("", message));
} | [
"protected",
"void",
"emitWithNoAnchorKeyAndStream",
"(",
"StreamMessage",
"message",
",",
"String",
"streamId",
")",
"{",
"getCollector",
"(",
")",
".",
"emit",
"(",
"streamId",
",",
"new",
"Values",
"(",
"\"\"",
",",
"message",
")",
")",
";",
"}"
] | Not use this class's key history function, and not use anchor function(child message failed. notify fail to parent message.).<br>
Send message to downstream component with streamId.<br>
Use following situation.
<ol>
<li>Not use this class's key history function.</li>
<li>Not use storm's fault detect function.</li>
</ol>
@param message sending message
@param streamId streamId | [
"Not",
"use",
"this",
"class",
"s",
"key",
"history",
"function",
"and",
"not",
"use",
"anchor",
"function",
"(",
"child",
"message",
"failed",
".",
"notify",
"fail",
"to",
"parent",
"message",
".",
")",
".",
"<br",
">",
"Send",
"message",
"to",
"downstr... | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/AmBaseBolt.java#L513-L516 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleContext.java | AuditorModuleContext.getAuditor | public synchronized IHEAuditor getAuditor(final Class<? extends IHEAuditor> clazz, boolean useContextAuditorRegistry)
{
if (null == clazz) {
return null;
}
IHEAuditor auditor = null;
if (useContextAuditorRegistry) {
auditor = getRegisteredAuditor(clazz.getName());
if (auditor != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Reusing auditor " + auditor.toString());
}
return auditor;
}
}
auditor = AuditorFactory.getAuditor(clazz, null, null);
if (useContextAuditorRegistry) {
registerAuditor(clazz.getName(), auditor);
}
return auditor;
} | java | public synchronized IHEAuditor getAuditor(final Class<? extends IHEAuditor> clazz, boolean useContextAuditorRegistry)
{
if (null == clazz) {
return null;
}
IHEAuditor auditor = null;
if (useContextAuditorRegistry) {
auditor = getRegisteredAuditor(clazz.getName());
if (auditor != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Reusing auditor " + auditor.toString());
}
return auditor;
}
}
auditor = AuditorFactory.getAuditor(clazz, null, null);
if (useContextAuditorRegistry) {
registerAuditor(clazz.getName(), auditor);
}
return auditor;
} | [
"public",
"synchronized",
"IHEAuditor",
"getAuditor",
"(",
"final",
"Class",
"<",
"?",
"extends",
"IHEAuditor",
">",
"clazz",
",",
"boolean",
"useContextAuditorRegistry",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"{",
"return",
"null",
";",
"}",
"IHEA... | Instantiate (or get from cache) an auditor instance for a given Class instance
@param clazz The class instance to instantiate the auditor for
@param useContextAuditorRegistry Whether to use a cached auditor
@return An auditor instance | [
"Instantiate",
"(",
"or",
"get",
"from",
"cache",
")",
"an",
"auditor",
"instance",
"for",
"a",
"given",
"Class",
"instance"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleContext.java#L243-L267 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisher.java | HystrixMetricsPublisher.getMetricsPublisherForCollapser | public HystrixMetricsPublisherCollapser getMetricsPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
return new HystrixMetricsPublisherCollapserDefault(collapserKey, metrics, properties);
} | java | public HystrixMetricsPublisherCollapser getMetricsPublisherForCollapser(HystrixCollapserKey collapserKey, HystrixCollapserMetrics metrics, HystrixCollapserProperties properties) {
return new HystrixMetricsPublisherCollapserDefault(collapserKey, metrics, properties);
} | [
"public",
"HystrixMetricsPublisherCollapser",
"getMetricsPublisherForCollapser",
"(",
"HystrixCollapserKey",
"collapserKey",
",",
"HystrixCollapserMetrics",
"metrics",
",",
"HystrixCollapserProperties",
"properties",
")",
"{",
"return",
"new",
"HystrixMetricsPublisherCollapserDefault... | Construct an implementation of {@link HystrixMetricsPublisherCollapser} for {@link HystrixCollapser} instances having key {@link HystrixCollapserKey}.
<p>
This will be invoked once per {@link HystrixCollapserKey} instance.
<p>
<b>Default Implementation</b>
<p>
Return instance of {@link HystrixMetricsPublisherCollapserDefault}
@param collapserKey
{@link HystrixCollapserKey} representing the name or type of {@link HystrixCollapser}
@param metrics
{@link HystrixCollapserMetrics} instance tracking metrics for the {@link HystrixCollapser} instance having the key as defined by {@link HystrixCollapserKey}
@param properties
{@link HystrixCollapserProperties} instance for the {@link HystrixCollapser} instance having the key as defined by {@link HystrixCollapserKey}
@return instance of {@link HystrixMetricsPublisherCollapser} that will have its <code>initialize</code> method invoked once. | [
"Construct",
"an",
"implementation",
"of",
"{",
"@link",
"HystrixMetricsPublisherCollapser",
"}",
"for",
"{",
"@link",
"HystrixCollapser",
"}",
"instances",
"having",
"key",
"{",
"@link",
"HystrixCollapserKey",
"}",
".",
"<p",
">",
"This",
"will",
"be",
"invoked",... | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisher.java#L111-L113 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java | AsyncRestBuilder.withParam | public AsyncRestBuilder withParam(String key, String value) {
this.params.put(key, value);
return this;
} | java | public AsyncRestBuilder withParam(String key, String value) {
this.params.put(key, value);
return this;
} | [
"public",
"AsyncRestBuilder",
"withParam",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"params",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds an URL query parameter to the request. Using a key twice will
result in the last call being taken into account.
@param key the parameter key.
@param value the parameter value. | [
"Adds",
"an",
"URL",
"query",
"parameter",
"to",
"the",
"request",
".",
"Using",
"a",
"key",
"twice",
"will",
"result",
"in",
"the",
"last",
"call",
"being",
"taken",
"into",
"account",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java#L91-L94 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/process/ProcessExecutorImpl.java | ProcessExecutorImpl.startProcessInstance | void startProcessInstance(ProcessInstance processInstanceVO, int delay)
throws ProcessException {
try {
Process process = getProcessDefinition(processInstanceVO);
edao.setProcessInstanceStatus(processInstanceVO.getId(), WorkStatus.STATUS_PENDING_PROCESS);
// setProcessInstanceStatus will really set to STATUS_IN_PROGRESS - hint to set START_DT as well
if (logger.isInfoEnabled()) {
logger.info(logtag(processInstanceVO.getProcessId(), processInstanceVO.getId(),
processInstanceVO.getMasterRequestId()),
WorkStatus.LOGMSG_PROC_START + " - " + process.getQualifiedName()
+ (processInstanceVO.isEmbedded() ?
(" (embedded process " + process.getId() + ")") :
("/" + process.getVersionString())));
}
notifyMonitors(processInstanceVO, WorkStatus.LOGMSG_PROC_START);
// get start activity ID
Long startActivityId;
if (processInstanceVO.isEmbedded()) {
edao.setProcessInstanceStatus(processInstanceVO.getId(), WorkStatus.STATUS_PENDING_PROCESS);
startActivityId = process.getStartActivity().getId();
} else {
Activity startActivity = process.getStartActivity();
if (startActivity == null) {
throw new ProcessException("Transition has not been defined for START event! ProcessID = " + process.getId());
}
startActivityId = startActivity.getId();
}
InternalEvent event = InternalEvent.createActivityStartMessage(
startActivityId, processInstanceVO.getId(),
null, processInstanceVO.getMasterRequestId(),
EventType.EVENTNAME_START + ":");
if (delay > 0) {
String msgid = ScheduledEvent.INTERNAL_EVENT_PREFIX + processInstanceVO.getId()
+ "start" + startActivityId;
this.sendDelayedInternalEvent(event, delay, msgid, false);
} else sendInternalEvent(event);
}
catch (Exception ex) {
logger.severeException(ex.getMessage(), ex);
throw new ProcessException(ex.getMessage());
}
} | java | void startProcessInstance(ProcessInstance processInstanceVO, int delay)
throws ProcessException {
try {
Process process = getProcessDefinition(processInstanceVO);
edao.setProcessInstanceStatus(processInstanceVO.getId(), WorkStatus.STATUS_PENDING_PROCESS);
// setProcessInstanceStatus will really set to STATUS_IN_PROGRESS - hint to set START_DT as well
if (logger.isInfoEnabled()) {
logger.info(logtag(processInstanceVO.getProcessId(), processInstanceVO.getId(),
processInstanceVO.getMasterRequestId()),
WorkStatus.LOGMSG_PROC_START + " - " + process.getQualifiedName()
+ (processInstanceVO.isEmbedded() ?
(" (embedded process " + process.getId() + ")") :
("/" + process.getVersionString())));
}
notifyMonitors(processInstanceVO, WorkStatus.LOGMSG_PROC_START);
// get start activity ID
Long startActivityId;
if (processInstanceVO.isEmbedded()) {
edao.setProcessInstanceStatus(processInstanceVO.getId(), WorkStatus.STATUS_PENDING_PROCESS);
startActivityId = process.getStartActivity().getId();
} else {
Activity startActivity = process.getStartActivity();
if (startActivity == null) {
throw new ProcessException("Transition has not been defined for START event! ProcessID = " + process.getId());
}
startActivityId = startActivity.getId();
}
InternalEvent event = InternalEvent.createActivityStartMessage(
startActivityId, processInstanceVO.getId(),
null, processInstanceVO.getMasterRequestId(),
EventType.EVENTNAME_START + ":");
if (delay > 0) {
String msgid = ScheduledEvent.INTERNAL_EVENT_PREFIX + processInstanceVO.getId()
+ "start" + startActivityId;
this.sendDelayedInternalEvent(event, delay, msgid, false);
} else sendInternalEvent(event);
}
catch (Exception ex) {
logger.severeException(ex.getMessage(), ex);
throw new ProcessException(ex.getMessage());
}
} | [
"void",
"startProcessInstance",
"(",
"ProcessInstance",
"processInstanceVO",
",",
"int",
"delay",
")",
"throws",
"ProcessException",
"{",
"try",
"{",
"Process",
"process",
"=",
"getProcessDefinition",
"(",
"processInstanceVO",
")",
";",
"edao",
".",
"setProcessInstanc... | Starting a process instance, which has been created already.
The method sets the status to "In Progress",
find the start activity, and sends an internal message to start the activity
@param processInstanceVO | [
"Starting",
"a",
"process",
"instance",
"which",
"has",
"been",
"created",
"already",
".",
"The",
"method",
"sets",
"the",
"status",
"to",
"In",
"Progress",
"find",
"the",
"start",
"activity",
"and",
"sends",
"an",
"internal",
"message",
"to",
"start",
"the"... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/process/ProcessExecutorImpl.java#L561-L603 |
apache/fluo | modules/accumulo/src/main/java/org/apache/fluo/accumulo/util/ZookeeperUtil.java | ZookeeperUtil.getGcTimestamp | public static long getGcTimestamp(String zookeepers) {
ZooKeeper zk = null;
try {
zk = new ZooKeeper(zookeepers, 30000, null);
// wait until zookeeper is connected
long start = System.currentTimeMillis();
while (!zk.getState().isConnected() && System.currentTimeMillis() - start < 30000) {
Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS);
}
byte[] d = zk.getData(ZookeeperPath.ORACLE_GC_TIMESTAMP, false, null);
return LongUtil.fromByteArray(d);
} catch (KeeperException | InterruptedException | IOException e) {
log.warn("Failed to get oldest timestamp of Oracle from Zookeeper", e);
return OLDEST_POSSIBLE;
} finally {
if (zk != null) {
try {
zk.close();
} catch (InterruptedException e) {
log.error("Failed to close zookeeper client", e);
}
}
}
} | java | public static long getGcTimestamp(String zookeepers) {
ZooKeeper zk = null;
try {
zk = new ZooKeeper(zookeepers, 30000, null);
// wait until zookeeper is connected
long start = System.currentTimeMillis();
while (!zk.getState().isConnected() && System.currentTimeMillis() - start < 30000) {
Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS);
}
byte[] d = zk.getData(ZookeeperPath.ORACLE_GC_TIMESTAMP, false, null);
return LongUtil.fromByteArray(d);
} catch (KeeperException | InterruptedException | IOException e) {
log.warn("Failed to get oldest timestamp of Oracle from Zookeeper", e);
return OLDEST_POSSIBLE;
} finally {
if (zk != null) {
try {
zk.close();
} catch (InterruptedException e) {
log.error("Failed to close zookeeper client", e);
}
}
}
} | [
"public",
"static",
"long",
"getGcTimestamp",
"(",
"String",
"zookeepers",
")",
"{",
"ZooKeeper",
"zk",
"=",
"null",
";",
"try",
"{",
"zk",
"=",
"new",
"ZooKeeper",
"(",
"zookeepers",
",",
"30000",
",",
"null",
")",
";",
"// wait until zookeeper is connected",... | Retrieves the GC timestamp, set by the Oracle, from zookeeper
@param zookeepers Zookeeper connection string
@return Oldest active timestamp or oldest possible ts (-1) if not found | [
"Retrieves",
"the",
"GC",
"timestamp",
"set",
"by",
"the",
"Oracle",
"from",
"zookeeper"
] | train | https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/accumulo/src/main/java/org/apache/fluo/accumulo/util/ZookeeperUtil.java#L69-L94 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/postprocessor/google/closure/ClosureGlobalPostProcessor.java | ClosureGlobalPostProcessor.initCompilerClosureArgumentsFromConfig | private void initCompilerClosureArgumentsFromConfig(List<String> args, JawrConfig config) {
Set<Entry<Object, Object>> entrySet = config.getConfigProperties().entrySet();
for (Entry<Object, Object> propEntry : entrySet) {
String key = (String) propEntry.getKey();
if (key.startsWith(JAWR_JS_CLOSURE_PREFIX) && !JAWR_JS_CLOSURE_SPECIFIC_PROPERTIES.contains(key)) {
String compilerArgName = key.substring(JAWR_JS_CLOSURE_PREFIX.length());
checkCompilerArgumentName(compilerArgName);
String compilerArgValue = (String) propEntry.getValue();
compilerArgValue = getCompilerArgValue(compilerArgName, compilerArgValue);
args.add(CLOSURE_ARGUMENT_NAME_PREFIX + compilerArgName);
args.add(propEntry.getValue().toString());
}
}
// Add default compilation level argument
if (!args.contains(COMPILATION_LEVEL_ARG)) {
args.add(COMPILATION_LEVEL_ARG);
args.add(WHITESPACE_ONLY_COMPILATION_LEVEL);
}
// Add default level warning argument if not defined
if (!args.contains(WARNING_LEVEL_ARG)) {
args.add(WARNING_LEVEL_ARG);
args.add(VERBOSE_WARNING_LEVEL);
}
} | java | private void initCompilerClosureArgumentsFromConfig(List<String> args, JawrConfig config) {
Set<Entry<Object, Object>> entrySet = config.getConfigProperties().entrySet();
for (Entry<Object, Object> propEntry : entrySet) {
String key = (String) propEntry.getKey();
if (key.startsWith(JAWR_JS_CLOSURE_PREFIX) && !JAWR_JS_CLOSURE_SPECIFIC_PROPERTIES.contains(key)) {
String compilerArgName = key.substring(JAWR_JS_CLOSURE_PREFIX.length());
checkCompilerArgumentName(compilerArgName);
String compilerArgValue = (String) propEntry.getValue();
compilerArgValue = getCompilerArgValue(compilerArgName, compilerArgValue);
args.add(CLOSURE_ARGUMENT_NAME_PREFIX + compilerArgName);
args.add(propEntry.getValue().toString());
}
}
// Add default compilation level argument
if (!args.contains(COMPILATION_LEVEL_ARG)) {
args.add(COMPILATION_LEVEL_ARG);
args.add(WHITESPACE_ONLY_COMPILATION_LEVEL);
}
// Add default level warning argument if not defined
if (!args.contains(WARNING_LEVEL_ARG)) {
args.add(WARNING_LEVEL_ARG);
args.add(VERBOSE_WARNING_LEVEL);
}
} | [
"private",
"void",
"initCompilerClosureArgumentsFromConfig",
"(",
"List",
"<",
"String",
">",
"args",
",",
"JawrConfig",
"config",
")",
"{",
"Set",
"<",
"Entry",
"<",
"Object",
",",
"Object",
">",
">",
"entrySet",
"=",
"config",
".",
"getConfigProperties",
"("... | Initialize the closure argument from the Jawr config
@param args
the arguments
@param config
the Jawr config | [
"Initialize",
"the",
"closure",
"argument",
"from",
"the",
"Jawr",
"config"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/postprocessor/google/closure/ClosureGlobalPostProcessor.java#L325-L351 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/Environment.java | Environment.doHttpFilePost | public void doHttpFilePost(String url, HttpResponse result, Map<String, Object> headers, File file) {
httpClient.post(url, result, headers, file);
} | java | public void doHttpFilePost(String url, HttpResponse result, Map<String, Object> headers, File file) {
httpClient.post(url, result, headers, file);
} | [
"public",
"void",
"doHttpFilePost",
"(",
"String",
"url",
",",
"HttpResponse",
"result",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"File",
"file",
")",
"{",
"httpClient",
".",
"post",
"(",
"url",
",",
"result",
",",
"headers",
",",
... | Performs POST to supplied url of a file as binary data.
@param url url to post to.
@param result result containing request, its response will be filled.
@param headers headers to add.
@param file file containing binary data to post. | [
"Performs",
"POST",
"to",
"supplied",
"url",
"of",
"a",
"file",
"as",
"binary",
"data",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L296-L298 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java | ControlBeanContextSupport.getResource | public URL getResource(String name, BeanContextChild bcc) throws IllegalArgumentException {
// bcc must be a child of this context
if (!contains(bcc)) {
throw new IllegalArgumentException("Child is not a member of this context");
}
ClassLoader cl = bcc.getClass().getClassLoader();
URL url;
if (cl != null && (url = cl.getResource(name)) != null) {
return url;
}
return ClassLoader.getSystemResource(name);
} | java | public URL getResource(String name, BeanContextChild bcc) throws IllegalArgumentException {
// bcc must be a child of this context
if (!contains(bcc)) {
throw new IllegalArgumentException("Child is not a member of this context");
}
ClassLoader cl = bcc.getClass().getClassLoader();
URL url;
if (cl != null && (url = cl.getResource(name)) != null) {
return url;
}
return ClassLoader.getSystemResource(name);
} | [
"public",
"URL",
"getResource",
"(",
"String",
"name",
",",
"BeanContextChild",
"bcc",
")",
"throws",
"IllegalArgumentException",
"{",
"// bcc must be a child of this context",
"if",
"(",
"!",
"contains",
"(",
"bcc",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentEx... | Analagous to <code>java.lang.ClassLoader.getResource()</code>, this
method allows a <code>BeanContext</code> implementation to interpose
behavior between the child <code>Component</code>
and underlying <code>ClassLoader</code>.
@param name the resource name
@param bcc the specified child
@return a <code>URL</code> for the named
resource for the specified child
@throws IllegalArgumentException if the resource is not valid | [
"Analagous",
"to",
"<code",
">",
"java",
".",
"lang",
".",
"ClassLoader",
".",
"getResource",
"()",
"<",
"/",
"code",
">",
"this",
"method",
"allows",
"a",
"<code",
">",
"BeanContext<",
"/",
"code",
">",
"implementation",
"to",
"interpose",
"behavior",
"be... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L145-L158 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/StringUtils.java | StringUtils.nthIndex | public static int nthIndex(String s, char ch, int n) {
int index = 0;
for (int i = 0; i < n; i++) {
// if we're already at the end of the string,
// and we need to find another ch, return -1
if (index == s.length() - 1) {
return -1;
}
index = s.indexOf(ch, index + 1);
if (index == -1) {
return (-1);
}
}
return index;
} | java | public static int nthIndex(String s, char ch, int n) {
int index = 0;
for (int i = 0; i < n; i++) {
// if we're already at the end of the string,
// and we need to find another ch, return -1
if (index == s.length() - 1) {
return -1;
}
index = s.indexOf(ch, index + 1);
if (index == -1) {
return (-1);
}
}
return index;
} | [
"public",
"static",
"int",
"nthIndex",
"(",
"String",
"s",
",",
"char",
"ch",
",",
"int",
"n",
")",
"{",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"// if we're already at the en... | Returns the index of the <i>n</i>th occurrence of ch in s, or -1
if there are less than n occurrences of ch. | [
"Returns",
"the",
"index",
"of",
"the",
"<i",
">",
"n<",
"/",
"i",
">",
"th",
"occurrence",
"of",
"ch",
"in",
"s",
"or",
"-",
"1",
"if",
"there",
"are",
"less",
"than",
"n",
"occurrences",
"of",
"ch",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L576-L590 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/expression/Uris.java | Uris.unescapeQueryParam | public String unescapeQueryParam(final String text, final String encoding) {
return UriEscape.unescapeUriQueryParam(text, encoding);
} | java | public String unescapeQueryParam(final String text, final String encoding) {
return UriEscape.unescapeUriQueryParam(text, encoding);
} | [
"public",
"String",
"unescapeQueryParam",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"encoding",
")",
"{",
"return",
"UriEscape",
".",
"unescapeUriQueryParam",
"(",
"text",
",",
"encoding",
")",
";",
"}"
] | <p>
Perform am URI query parameter (name or value) <strong>unescape</strong> operation
on a {@code String} input.
</p>
<p>
This method simply calls the equivalent method in the {@code UriEscape} class from the
<a href="http://www.unbescape.org">Unbescape</a> library.
</p>
<p>
This method will unescape every percent-encoded ({@code %HH}) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use specified {@code encoding} in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the {@code String} to be unescaped.
@param encoding the encoding to be used for unescaping.
@return The unescaped result {@code String}. As a memory-performance improvement, will return the exact
same object as the {@code text} input argument if no unescaping modifications were required (and
no additional {@code String} objects will be created during processing). Will
return {@code null} if {@code text} is {@code null}. | [
"<p",
">",
"Perform",
"am",
"URI",
"query",
"parameter",
"(",
"name",
"or",
"value",
")",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"{",
"@code",
"String",
"}",
"input",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"me... | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/expression/Uris.java#L623-L625 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java | PersonGroupPersonsImpl.updateFaceAsync | public Observable<Void> updateFaceAsync(String personGroupId, UUID personId, UUID persistedFaceId, UpdateFaceOptionalParameter updateFaceOptionalParameter) {
return updateFaceWithServiceResponseAsync(personGroupId, personId, persistedFaceId, updateFaceOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> updateFaceAsync(String personGroupId, UUID personId, UUID persistedFaceId, UpdateFaceOptionalParameter updateFaceOptionalParameter) {
return updateFaceWithServiceResponseAsync(personGroupId, personId, persistedFaceId, updateFaceOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"updateFaceAsync",
"(",
"String",
"personGroupId",
",",
"UUID",
"personId",
",",
"UUID",
"persistedFaceId",
",",
"UpdateFaceOptionalParameter",
"updateFaceOptionalParameter",
")",
"{",
"return",
"updateFaceWithServiceResponseAsync",... | Update a person persisted face's userData field.
@param personGroupId Id referencing a particular person group.
@param personId Id referencing a particular person.
@param persistedFaceId Id referencing a particular persistedFaceId of an existing face.
@param updateFaceOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Update",
"a",
"person",
"persisted",
"face",
"s",
"userData",
"field",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L1011-L1018 |
dmak/jaxb-xew-plugin | src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java | XmlElementWrapperPlugin.moveInnerClassToParent | private boolean moveInnerClassToParent(Outline outline, Candidate candidate) {
// Skip basic parametrisations like "List<String>":
if (candidate.getFieldParametrisationClass() == null) {
return false;
}
JDefinedClass fieldParametrisationImpl = candidate.getFieldParametrisationImpl();
if (candidate.getClazz() != fieldParametrisationImpl.parentContainer()) {
// Field parametrisation class is not inner class of the candidate:
return false;
}
JDefinedClass fieldParametrisationClass = candidate.getFieldParametrisationClass();
String oldFactoryMethodName = fieldParametrisationClass.outer().name() + fieldParametrisationClass.name();
moveClassLevelUp(outline, fieldParametrisationImpl);
renameFactoryMethod(fieldParametrisationImpl._package()._getClass(FACTORY_CLASS_NAME), oldFactoryMethodName,
fieldParametrisationClass.name());
if (candidate.isValueObjectDisabled()) {
moveClassLevelUp(outline, fieldParametrisationClass);
renameFactoryMethod(fieldParametrisationClass._package()._getClass(FACTORY_CLASS_NAME),
oldFactoryMethodName, fieldParametrisationClass.name());
}
return true;
} | java | private boolean moveInnerClassToParent(Outline outline, Candidate candidate) {
// Skip basic parametrisations like "List<String>":
if (candidate.getFieldParametrisationClass() == null) {
return false;
}
JDefinedClass fieldParametrisationImpl = candidate.getFieldParametrisationImpl();
if (candidate.getClazz() != fieldParametrisationImpl.parentContainer()) {
// Field parametrisation class is not inner class of the candidate:
return false;
}
JDefinedClass fieldParametrisationClass = candidate.getFieldParametrisationClass();
String oldFactoryMethodName = fieldParametrisationClass.outer().name() + fieldParametrisationClass.name();
moveClassLevelUp(outline, fieldParametrisationImpl);
renameFactoryMethod(fieldParametrisationImpl._package()._getClass(FACTORY_CLASS_NAME), oldFactoryMethodName,
fieldParametrisationClass.name());
if (candidate.isValueObjectDisabled()) {
moveClassLevelUp(outline, fieldParametrisationClass);
renameFactoryMethod(fieldParametrisationClass._package()._getClass(FACTORY_CLASS_NAME),
oldFactoryMethodName, fieldParametrisationClass.name());
}
return true;
} | [
"private",
"boolean",
"moveInnerClassToParent",
"(",
"Outline",
"outline",
",",
"Candidate",
"candidate",
")",
"{",
"// Skip basic parametrisations like \"List<String>\":",
"if",
"(",
"candidate",
".",
"getFieldParametrisationClass",
"(",
")",
"==",
"null",
")",
"{",
"r... | If candidate class contains the inner class which is collection parametrisation (type), then this inner class has
to be moved to top class. For example from<br>
{@code TypeClass (is a collection type) -> ContainerClass (marked for removal) -> ElementClass}<br>
we need to get<br>
{@code TypeClass -> ElementClass}.<br>
Also this move should be reflected on factory method names. | [
"If",
"candidate",
"class",
"contains",
"the",
"inner",
"class",
"which",
"is",
"collection",
"parametrisation",
"(",
"type",
")",
"then",
"this",
"inner",
"class",
"has",
"to",
"be",
"moved",
"to",
"top",
"class",
".",
"For",
"example",
"from<br",
">",
"{... | train | https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java#L540-L570 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java | DefaultPluginRegistry.downloadPlugin | protected void downloadPlugin(final PluginCoordinates coordinates, final IAsyncResultHandler<File> handler) {
if (pluginRepositories.isEmpty()) {
// Didn't find it - no repositories configured!
handler.handle(AsyncResultImpl.create((File) null));
return;
}
final Iterator<URI> iterator = pluginRepositories.iterator();
URI repoUrl = iterator.next();
final IAsyncResultHandler<File> handler2 = new IAsyncResultHandler<File>() {
@Override
public void handle(IAsyncResult<File> result) {
if (result.isSuccess() && result.getResult() == null && iterator.hasNext()) {
downloadFromMavenRepo(coordinates, iterator.next(), this);
} else {
handler.handle(result);
}
}
};
downloadFromMavenRepo(coordinates, repoUrl, handler2);
} | java | protected void downloadPlugin(final PluginCoordinates coordinates, final IAsyncResultHandler<File> handler) {
if (pluginRepositories.isEmpty()) {
// Didn't find it - no repositories configured!
handler.handle(AsyncResultImpl.create((File) null));
return;
}
final Iterator<URI> iterator = pluginRepositories.iterator();
URI repoUrl = iterator.next();
final IAsyncResultHandler<File> handler2 = new IAsyncResultHandler<File>() {
@Override
public void handle(IAsyncResult<File> result) {
if (result.isSuccess() && result.getResult() == null && iterator.hasNext()) {
downloadFromMavenRepo(coordinates, iterator.next(), this);
} else {
handler.handle(result);
}
}
};
downloadFromMavenRepo(coordinates, repoUrl, handler2);
} | [
"protected",
"void",
"downloadPlugin",
"(",
"final",
"PluginCoordinates",
"coordinates",
",",
"final",
"IAsyncResultHandler",
"<",
"File",
">",
"handler",
")",
"{",
"if",
"(",
"pluginRepositories",
".",
"isEmpty",
"(",
")",
")",
"{",
"// Didn't find it - no reposito... | Downloads the plugin via its maven GAV information. This will first look in the local
.m2 directory. If the plugin is not found there, then it will try to download the
plugin from one of the configured remote maven repositories. | [
"Downloads",
"the",
"plugin",
"via",
"its",
"maven",
"GAV",
"information",
".",
"This",
"will",
"first",
"look",
"in",
"the",
"local",
".",
"m2",
"directory",
".",
"If",
"the",
"plugin",
"is",
"not",
"found",
"there",
"then",
"it",
"will",
"try",
"to",
... | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java#L335-L355 |
windup/windup | reporting/api/src/main/java/org/jboss/windup/reporting/service/EffortReportService.java | EffortReportService.getEffortLevelDescription | public static String getEffortLevelDescription(Verbosity verbosity, int points)
{
EffortLevel level = EffortLevel.forPoints(points);
switch (verbosity)
{
case ID:
return level.name();
case VERBOSE:
return level.getVerboseDescription();
case SHORT:
default:
return level.getShortDescription();
}
} | java | public static String getEffortLevelDescription(Verbosity verbosity, int points)
{
EffortLevel level = EffortLevel.forPoints(points);
switch (verbosity)
{
case ID:
return level.name();
case VERBOSE:
return level.getVerboseDescription();
case SHORT:
default:
return level.getShortDescription();
}
} | [
"public",
"static",
"String",
"getEffortLevelDescription",
"(",
"Verbosity",
"verbosity",
",",
"int",
"points",
")",
"{",
"EffortLevel",
"level",
"=",
"EffortLevel",
".",
"forPoints",
"(",
"points",
")",
";",
"switch",
"(",
"verbosity",
")",
"{",
"case",
"ID",... | Returns the right string representation of the effort level based on given number of points. | [
"Returns",
"the",
"right",
"string",
"representation",
"of",
"the",
"effort",
"level",
"based",
"on",
"given",
"number",
"of",
"points",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/EffortReportService.java#L75-L89 |
JOML-CI/JOML | src/org/joml/Vector2i.java | Vector2i.set | public Vector2i set(int index, IntBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector2i set(int index, IntBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector2i",
"set",
"(",
"int",
"index",
",",
"IntBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link IntBuffer} starting at the
specified absolute buffer position/index.
<p>
This method will not increment the position of the given IntBuffer.
@param index
the absolute position into the IntBuffer
@param buffer
values will be read in <code>x, y</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"IntBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2i.java#L318-L321 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.cubicTo | public SVGPath cubicTo(double[] c1xy, double[] c2xy, double[] xy) {
return append(PATH_CUBIC_TO).append(c1xy[0]).append(c1xy[1]).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]);
} | java | public SVGPath cubicTo(double[] c1xy, double[] c2xy, double[] xy) {
return append(PATH_CUBIC_TO).append(c1xy[0]).append(c1xy[1]).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]);
} | [
"public",
"SVGPath",
"cubicTo",
"(",
"double",
"[",
"]",
"c1xy",
",",
"double",
"[",
"]",
"c2xy",
",",
"double",
"[",
"]",
"xy",
")",
"{",
"return",
"append",
"(",
"PATH_CUBIC_TO",
")",
".",
"append",
"(",
"c1xy",
"[",
"0",
"]",
")",
".",
"append",... | Cubic Bezier line to the given coordinates.
@param c1xy first control point
@param c2xy second control point
@param xy new coordinates
@return path object, for compact syntax. | [
"Cubic",
"Bezier",
"line",
"to",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L369-L371 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/util/JavaUtil.java | JavaUtil.equalsE | public static <T> boolean equalsE(T a, T b) {
if (a == null && b == null) {
return true;
}
if (a != null && b == null) {
return false;
}
if (a == null) {
return false;
}
return a.equals(b);
} | java | public static <T> boolean equalsE(T a, T b) {
if (a == null && b == null) {
return true;
}
if (a != null && b == null) {
return false;
}
if (a == null) {
return false;
}
return a.equals(b);
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"equalsE",
"(",
"T",
"a",
",",
"T",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"&&",
"b",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"a",
"!=",
"null",
"&&",
"b",
"==",
"nu... | Equals with null checking
@param a first argument
@param b second argument
@return is equals result | [
"Equals",
"with",
"null",
"checking"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/util/JavaUtil.java#L39-L50 |
ReactiveX/RxJavaGuava | src/main/java/rx/transformer/GuavaTransformers.java | GuavaTransformers.toImmutableSet | public static <T> Observable.Transformer<T,ImmutableSet<T>> toImmutableSet() {
return new Observable.Transformer<T, ImmutableSet<T>>() {
@Override
public Observable<ImmutableSet<T>> call(Observable<T> source) {
return source.collect(new Func0<ImmutableSet.Builder<T>>() {
@Override
public ImmutableSet.Builder<T> call() {
return ImmutableSet.builder();
}
}, new Action2<ImmutableSet.Builder<T>, T>() {
@Override
public void call(ImmutableSet.Builder<T> builder, T t) {
builder.add(t);
}
})
.map(new Func1<ImmutableSet.Builder<T>, ImmutableSet<T>>() {
@Override
public ImmutableSet<T> call(ImmutableSet.Builder<T> builder) {
return builder.build();
}
});
}
};
} | java | public static <T> Observable.Transformer<T,ImmutableSet<T>> toImmutableSet() {
return new Observable.Transformer<T, ImmutableSet<T>>() {
@Override
public Observable<ImmutableSet<T>> call(Observable<T> source) {
return source.collect(new Func0<ImmutableSet.Builder<T>>() {
@Override
public ImmutableSet.Builder<T> call() {
return ImmutableSet.builder();
}
}, new Action2<ImmutableSet.Builder<T>, T>() {
@Override
public void call(ImmutableSet.Builder<T> builder, T t) {
builder.add(t);
}
})
.map(new Func1<ImmutableSet.Builder<T>, ImmutableSet<T>>() {
@Override
public ImmutableSet<T> call(ImmutableSet.Builder<T> builder) {
return builder.build();
}
});
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
".",
"Transformer",
"<",
"T",
",",
"ImmutableSet",
"<",
"T",
">",
">",
"toImmutableSet",
"(",
")",
"{",
"return",
"new",
"Observable",
".",
"Transformer",
"<",
"T",
",",
"ImmutableSet",
"<",
"T",
">",
">... | Returns a Transformer<T,ImmutableSet<T>> that maps an Observable<T> to an Observable<ImmutableSet<T>> | [
"Returns",
"a",
"Transformer<",
";",
"T",
"ImmutableSet<",
";",
"T>",
";",
">",
"that",
"maps",
"an",
"Observable<",
";",
"T>",
";",
"to",
"an",
"Observable<",
";",
"ImmutableSet<",
";",
"T>",
";",
">",
";"
] | train | https://github.com/ReactiveX/RxJavaGuava/blob/bfb5da6e073364a96da23d57f47c6b706fb733aa/src/main/java/rx/transformer/GuavaTransformers.java#L65-L88 |
kaazing/java.client | net.api/src/main/java/org/kaazing/net/URLFactory.java | URLFactory.createURL | public static URL createURL(URL context, String spec)
throws MalformedURLException {
if ((spec == null) || (spec.trim().length() == 0)) {
return new URL(context, spec);
}
String protocol = URI.create(spec).getScheme();
URLStreamHandlerFactory factory = _factories.get(protocol);
// If there is no URLStreamHandlerFactory registered for the
// scheme/protocol, then we just use the regular URL constructor.
if (factory == null) {
return new URL(context, spec);
}
// If there is a URLStreamHandlerFactory associated for the
// scheme/protocol, then we create a URLStreamHandler. And, then use
// then use the URLStreamHandler to create a URL.
URLStreamHandler handler = factory.createURLStreamHandler(protocol);
return new URL(context, spec, handler);
} | java | public static URL createURL(URL context, String spec)
throws MalformedURLException {
if ((spec == null) || (spec.trim().length() == 0)) {
return new URL(context, spec);
}
String protocol = URI.create(spec).getScheme();
URLStreamHandlerFactory factory = _factories.get(protocol);
// If there is no URLStreamHandlerFactory registered for the
// scheme/protocol, then we just use the regular URL constructor.
if (factory == null) {
return new URL(context, spec);
}
// If there is a URLStreamHandlerFactory associated for the
// scheme/protocol, then we create a URLStreamHandler. And, then use
// then use the URLStreamHandler to create a URL.
URLStreamHandler handler = factory.createURLStreamHandler(protocol);
return new URL(context, spec, handler);
} | [
"public",
"static",
"URL",
"createURL",
"(",
"URL",
"context",
",",
"String",
"spec",
")",
"throws",
"MalformedURLException",
"{",
"if",
"(",
"(",
"spec",
"==",
"null",
")",
"||",
"(",
"spec",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0"... | Creates a URL by parsing the given spec within a specified context. The
new URL is created from the given context URL and the spec argument as
described in RFC2396 "Uniform Resource Identifiers : Generic Syntax" :
<p/>
{@code
<scheme>://<authority><path>?<query>#<fragment>
}
<p/>
The reference is parsed into the scheme, authority, path, query and
fragment parts. If the path component is empty and the scheme, authority,
and query components are undefined, then the new URL is a reference to
the current document. Otherwise, the fragment and query parts present in
the spec are used in the new URL.
<p/>
If the scheme component is defined in the given spec and does not match
the scheme of the context, then the new URL is created as an absolute URL
based on the spec alone. Otherwise the scheme component is inherited from
the context URL.
<p/>
If the authority component is present in the spec then the spec is
treated as absolute and the spec authority and path will replace the
context authority and path. If the authority component is absent in the
spec then the authority of the new URL will be inherited from the context.
<p/>
If the spec's path component begins with a slash character "/" then the
path is treated as absolute and the spec path replaces the context path.
<p/>
Otherwise, the path is treated as a relative path and is appended to the
context path, as described in RFC2396. Also, in this case, the path is
canonicalized through the removal of directory changes made by
occurrences of ".." and ".".
<p/>
For a more detailed description of URL parsing, refer to RFC2396.
@param context the context in which to parse the specification
@param spec the String to parse as a URL
@return URL created using the spec within the specified context
@throws MalformedURLException if no protocol is specified, or an unknown
protocol is found, or spec is null. | [
"Creates",
"a",
"URL",
"by",
"parsing",
"the",
"given",
"spec",
"within",
"a",
"specified",
"context",
".",
"The",
"new",
"URL",
"is",
"created",
"from",
"the",
"given",
"context",
"URL",
"and",
"the",
"spec",
"argument",
"as",
"described",
"in",
"RFC2396"... | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/net.api/src/main/java/org/kaazing/net/URLFactory.java#L127-L147 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/redis/Cache.java | Cache.expire | public Long expire(Object key, int seconds) {
Jedis jedis = getJedis();
try {
return jedis.expire(keyToBytes(key), seconds);
}
finally {close(jedis);}
} | java | public Long expire(Object key, int seconds) {
Jedis jedis = getJedis();
try {
return jedis.expire(keyToBytes(key), seconds);
}
finally {close(jedis);}
} | [
"public",
"Long",
"expire",
"(",
"Object",
"key",
",",
"int",
"seconds",
")",
"{",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
";",
"try",
"{",
"return",
"jedis",
".",
"expire",
"(",
"keyToBytes",
"(",
"key",
")",
",",
"seconds",
")",
";",
"}",
"f... | 为给定 key 设置生存时间,当 key 过期时(生存时间为 0 ),它会被自动删除。
在 Redis 中,带有生存时间的 key 被称为『易失的』(volatile)。 | [
"为给定",
"key",
"设置生存时间,当",
"key",
"过期时",
"(",
"生存时间为",
"0",
")",
",它会被自动删除。",
"在",
"Redis",
"中,带有生存时间的",
"key",
"被称为『易失的』",
"(",
"volatile",
")",
"。"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L318-L324 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.toSorted | public static <T> List<T> toSorted(Iterable<T> self) {
return toSorted(self, new NumberAwareComparator<T>());
} | java | public static <T> List<T> toSorted(Iterable<T> self) {
return toSorted(self, new NumberAwareComparator<T>());
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"toSorted",
"(",
"Iterable",
"<",
"T",
">",
"self",
")",
"{",
"return",
"toSorted",
"(",
"self",
",",
"new",
"NumberAwareComparator",
"<",
"T",
">",
"(",
")",
")",
";",
"}"
] | Sorts the Iterable. Assumes that the Iterable elements are
comparable and uses a {@link NumberAwareComparator} to determine the resulting order.
{@code NumberAwareComparator} has special treatment for numbers but otherwise uses the
natural ordering of the Iterable elements. The elements are first placed into a new list which
is then sorted and returned - leaving the original Iterable unchanged.
<pre class="groovyTestCase">
def orig = [1, 3, 2]
def sorted = orig.toSorted()
assert orig == [1, 3, 2]
assert sorted == [1, 2, 3]
</pre>
@param self the Iterable to be sorted
@return the sorted iterable as a List
@see #toSorted(Iterable, Comparator)
@since 2.4.0 | [
"Sorts",
"the",
"Iterable",
".",
"Assumes",
"that",
"the",
"Iterable",
"elements",
"are",
"comparable",
"and",
"uses",
"a",
"{",
"@link",
"NumberAwareComparator",
"}",
"to",
"determine",
"the",
"resulting",
"order",
".",
"{",
"@code",
"NumberAwareComparator",
"}... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L9392-L9394 |
kazocsaba/imageviewer | src/main/java/hu/kazocsaba/imageviewer/ImageComponent.java | ImageComponent.pointToPixel | public Point pointToPixel(Point p, boolean clipToImage) {
Point2D.Double fp=new Point2D.Double(p.x+.5, p.y+.5);
try {
getImageTransform().inverseTransform(fp, fp);
} catch (NoninvertibleTransformException ex) {
throw new Error("Image transformation not invertible");
}
p.x=(int)Math.floor(fp.x);
p.y=(int)Math.floor(fp.y);
if (clipToImage && (p.x < 0 || p.y < 0 || p.x >= image.getWidth() || p.y >= image.getHeight())) {
return null;
}
return p;
} | java | public Point pointToPixel(Point p, boolean clipToImage) {
Point2D.Double fp=new Point2D.Double(p.x+.5, p.y+.5);
try {
getImageTransform().inverseTransform(fp, fp);
} catch (NoninvertibleTransformException ex) {
throw new Error("Image transformation not invertible");
}
p.x=(int)Math.floor(fp.x);
p.y=(int)Math.floor(fp.y);
if (clipToImage && (p.x < 0 || p.y < 0 || p.x >= image.getWidth() || p.y >= image.getHeight())) {
return null;
}
return p;
} | [
"public",
"Point",
"pointToPixel",
"(",
"Point",
"p",
",",
"boolean",
"clipToImage",
")",
"{",
"Point2D",
".",
"Double",
"fp",
"=",
"new",
"Point2D",
".",
"Double",
"(",
"p",
".",
"x",
"+",
".5",
",",
"p",
".",
"y",
"+",
".5",
")",
";",
"try",
"{... | Returns the image pixel corresponding to the given point. If the <code>clipToImage</code>
parameter is <code>false</code>, then the function will return an appropriately positioned
pixel on an infinite plane, even if the point is outside the image bounds. If
<code>clipToImage</code> is <code>true</code> then the function will return <code>null</code>
for such positions, and any non-null return value will be a valid image pixel.
@param p a point in component coordinate system
@param clipToImage whether the function should return <code>null</code> for positions outside
the image bounds
@return the corresponding image pixel
@throws IllegalStateException if there is no image set or if the size of the viewer is 0 (for example because
it is not in a visible component) | [
"Returns",
"the",
"image",
"pixel",
"corresponding",
"to",
"the",
"given",
"point",
".",
"If",
"the",
"<code",
">",
"clipToImage<",
"/",
"code",
">",
"parameter",
"is",
"<code",
">",
"false<",
"/",
"code",
">",
"then",
"the",
"function",
"will",
"return",
... | train | https://github.com/kazocsaba/imageviewer/blob/59b8834c9dbf87bd9ca0898da3458ae592e3851e/src/main/java/hu/kazocsaba/imageviewer/ImageComponent.java#L296-L309 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.updateHtindex | void updateHtindex(int index, long value, int tableid) {
if (tableid == header.currentTableId()) {
htindex[index] = value;
} else {
new_htindex[index] = value;
}
} | java | void updateHtindex(int index, long value, int tableid) {
if (tableid == header.currentTableId()) {
htindex[index] = value;
} else {
new_htindex[index] = value;
}
} | [
"void",
"updateHtindex",
"(",
"int",
"index",
",",
"long",
"value",
",",
"int",
"tableid",
")",
"{",
"if",
"(",
"tableid",
"==",
"header",
".",
"currentTableId",
"(",
")",
")",
"{",
"htindex",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"else",
"{",
... | ************************************************************************
Write the object pointer to the table. If we are in the process of
doubling, this method finds the correct table to update (since there are
two tables active during the doubling process).
*********************************************************************** | [
"************************************************************************",
"Write",
"the",
"object",
"pointer",
"to",
"the",
"table",
".",
"If",
"we",
"are",
"in",
"the",
"process",
"of",
"doubling",
"this",
"method",
"finds",
"the",
"correct",
"table",
"to",
"update... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1433-L1439 |
seedstack/shed | src/main/java/org/seedstack/shed/reflect/ReflectUtils.java | ReflectUtils.getValue | @SuppressWarnings("unchecked")
public static <T> T getValue(Field field, Object self) {
try {
return (T) field.get(self);
} catch (IllegalAccessException e) {
throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_GET_FIELD)
.put("field", field.toGenericString());
}
} | java | @SuppressWarnings("unchecked")
public static <T> T getValue(Field field, Object self) {
try {
return (T) field.get(self);
} catch (IllegalAccessException e) {
throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_GET_FIELD)
.put("field", field.toGenericString());
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getValue",
"(",
"Field",
"field",
",",
"Object",
"self",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"field",
".",
"get",
"(",
"self",
")",
";",
"}",
"c... | Sets the specified field value while wrapping checked exception in a {@link ShedException}.
@param field the field.
@param self the instance to get the value from.
@param <T> the type of the field value.
@return the field value. | [
"Sets",
"the",
"specified",
"field",
"value",
"while",
"wrapping",
"checked",
"exception",
"in",
"a",
"{",
"@link",
"ShedException",
"}",
"."
] | train | https://github.com/seedstack/shed/blob/49ecb25aa3777539ab0f29f89abaae5ee93b572e/src/main/java/org/seedstack/shed/reflect/ReflectUtils.java#L85-L93 |
influxdata/influxdb-java | src/main/java/org/influxdb/impl/InfluxDBImpl.java | InfluxDBImpl.dropRetentionPolicy | @Override
public void dropRetentionPolicy(final String rpName, final String database) {
Preconditions.checkNonEmptyString(rpName, "retentionPolicyName");
Preconditions.checkNonEmptyString(database, "database");
StringBuilder queryBuilder = new StringBuilder("DROP RETENTION POLICY \"");
queryBuilder.append(rpName)
.append("\" ON \"")
.append(database)
.append("\"");
executeQuery(this.influxDBService.postQuery(Query.encode(queryBuilder.toString())));
} | java | @Override
public void dropRetentionPolicy(final String rpName, final String database) {
Preconditions.checkNonEmptyString(rpName, "retentionPolicyName");
Preconditions.checkNonEmptyString(database, "database");
StringBuilder queryBuilder = new StringBuilder("DROP RETENTION POLICY \"");
queryBuilder.append(rpName)
.append("\" ON \"")
.append(database)
.append("\"");
executeQuery(this.influxDBService.postQuery(Query.encode(queryBuilder.toString())));
} | [
"@",
"Override",
"public",
"void",
"dropRetentionPolicy",
"(",
"final",
"String",
"rpName",
",",
"final",
"String",
"database",
")",
"{",
"Preconditions",
".",
"checkNonEmptyString",
"(",
"rpName",
",",
"\"retentionPolicyName\"",
")",
";",
"Preconditions",
".",
"c... | {@inheritDoc}
@param rpName the name of the retentionPolicy
@param database the name of the database | [
"{"
] | train | https://github.com/influxdata/influxdb-java/blob/8ae777f34aa2e598f609208cf4fa12d4642f83f5/src/main/java/org/influxdb/impl/InfluxDBImpl.java#L917-L927 |
knowm/XChange | xchange-cryptonit/src/main/java/org/knowm/xchange/cryptonit2/service/CryptonitAccountService.java | CryptonitAccountService.requestDepositAddress | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
CryptonitDepositAddress response = null;
throw new NotYetImplementedForExchangeException();
// return response.getDepositAddress();
} | java | @Override
public String requestDepositAddress(Currency currency, String... arguments) throws IOException {
CryptonitDepositAddress response = null;
throw new NotYetImplementedForExchangeException();
// return response.getDepositAddress();
} | [
"@",
"Override",
"public",
"String",
"requestDepositAddress",
"(",
"Currency",
"currency",
",",
"String",
"...",
"arguments",
")",
"throws",
"IOException",
"{",
"CryptonitDepositAddress",
"response",
"=",
"null",
";",
"throw",
"new",
"NotYetImplementedForExchangeExcepti... | This returns the currently set deposit address. It will not generate a new address (ie.
repeated calls will return the same address). | [
"This",
"returns",
"the",
"currently",
"set",
"deposit",
"address",
".",
"It",
"will",
"not",
"generate",
"a",
"new",
"address",
"(",
"ie",
".",
"repeated",
"calls",
"will",
"return",
"the",
"same",
"address",
")",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cryptonit/src/main/java/org/knowm/xchange/cryptonit2/service/CryptonitAccountService.java#L77-L84 |
thiagokimo/Faker | faker-core/src/main/java/io/kimo/lib/faker/Faker.java | Faker.fillOnAndOffWithText | public void fillOnAndOffWithText(ToggleButton view, FakerTextComponent component) {
validateNotNullableView(view);
validateIfIsAToggleButton(view);
validateNotNullableFakerComponent(component);
String word = component.randomText();
view.setTextOff(word);
view.setTextOn(word);
} | java | public void fillOnAndOffWithText(ToggleButton view, FakerTextComponent component) {
validateNotNullableView(view);
validateIfIsAToggleButton(view);
validateNotNullableFakerComponent(component);
String word = component.randomText();
view.setTextOff(word);
view.setTextOn(word);
} | [
"public",
"void",
"fillOnAndOffWithText",
"(",
"ToggleButton",
"view",
",",
"FakerTextComponent",
"component",
")",
"{",
"validateNotNullableView",
"(",
"view",
")",
";",
"validateIfIsAToggleButton",
"(",
"view",
")",
";",
"validateNotNullableFakerComponent",
"(",
"comp... | Fill {@link ToggleButton} on and off text
@param view
@param component | [
"Fill",
"{"
] | train | https://github.com/thiagokimo/Faker/blob/8b0eccd499817a2bc3377db0c6e1b50736d0f034/faker-core/src/main/java/io/kimo/lib/faker/Faker.java#L161-L170 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java | HttpResponseStatus.parseLine | public static HttpResponseStatus parseLine(AsciiString line) {
try {
int space = line.forEachByte(FIND_ASCII_SPACE);
return space == -1 ? valueOf(line.parseInt()) : valueOf(line.parseInt(0, space), line.toString(space + 1));
} catch (Exception e) {
throw new IllegalArgumentException("malformed status line: " + line, e);
}
} | java | public static HttpResponseStatus parseLine(AsciiString line) {
try {
int space = line.forEachByte(FIND_ASCII_SPACE);
return space == -1 ? valueOf(line.parseInt()) : valueOf(line.parseInt(0, space), line.toString(space + 1));
} catch (Exception e) {
throw new IllegalArgumentException("malformed status line: " + line, e);
}
} | [
"public",
"static",
"HttpResponseStatus",
"parseLine",
"(",
"AsciiString",
"line",
")",
"{",
"try",
"{",
"int",
"space",
"=",
"line",
".",
"forEachByte",
"(",
"FIND_ASCII_SPACE",
")",
";",
"return",
"space",
"==",
"-",
"1",
"?",
"valueOf",
"(",
"line",
"."... | Parses the specified HTTP status line into a {@link HttpResponseStatus}. The expected formats of the line are:
<ul>
<li>{@code statusCode} (e.g. 200)</li>
<li>{@code statusCode} {@code reasonPhrase} (e.g. 404 Not Found)</li>
</ul>
@throws IllegalArgumentException if the specified status line is malformed | [
"Parses",
"the",
"specified",
"HTTP",
"status",
"line",
"into",
"a",
"{",
"@link",
"HttpResponseStatus",
"}",
".",
"The",
"expected",
"formats",
"of",
"the",
"line",
"are",
":",
"<ul",
">",
"<li",
">",
"{",
"@code",
"statusCode",
"}",
"(",
"e",
".",
"g... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java#L511-L518 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java | AtomContainerManipulator.suppressibleHydrogen | private static boolean suppressibleHydrogen(final IAtomContainer container, final IAtom atom) {
// is the atom a hydrogen
if (!"H".equals(atom.getSymbol())) return false;
// is the hydrogen an ion?
if (atom.getFormalCharge() != null && atom.getFormalCharge() != 0) return false;
// is the hydrogen deuterium / tritium?
if (atom.getMassNumber() != null) return false;
// molecule hydrogen with implicit H?
if (atom.getImplicitHydrogenCount() != null && atom.getImplicitHydrogenCount() != 0) return false;
// molecule hydrogen
List<IAtom> neighbors = container.getConnectedAtomsList(atom);
if (neighbors.size() == 1 && (neighbors.get(0).getSymbol().equals("H") ||
neighbors.get(0) instanceof IPseudoAtom)) return false;
// what about bridging hydrogens?
// hydrogens with atom-atom mapping?
return true;
} | java | private static boolean suppressibleHydrogen(final IAtomContainer container, final IAtom atom) {
// is the atom a hydrogen
if (!"H".equals(atom.getSymbol())) return false;
// is the hydrogen an ion?
if (atom.getFormalCharge() != null && atom.getFormalCharge() != 0) return false;
// is the hydrogen deuterium / tritium?
if (atom.getMassNumber() != null) return false;
// molecule hydrogen with implicit H?
if (atom.getImplicitHydrogenCount() != null && atom.getImplicitHydrogenCount() != 0) return false;
// molecule hydrogen
List<IAtom> neighbors = container.getConnectedAtomsList(atom);
if (neighbors.size() == 1 && (neighbors.get(0).getSymbol().equals("H") ||
neighbors.get(0) instanceof IPseudoAtom)) return false;
// what about bridging hydrogens?
// hydrogens with atom-atom mapping?
return true;
} | [
"private",
"static",
"boolean",
"suppressibleHydrogen",
"(",
"final",
"IAtomContainer",
"container",
",",
"final",
"IAtom",
"atom",
")",
"{",
"// is the atom a hydrogen",
"if",
"(",
"!",
"\"H\"",
".",
"equals",
"(",
"atom",
".",
"getSymbol",
"(",
")",
")",
")"... | Is the {@code atom} a suppressible hydrogen and can be represented as
implicit. A hydrogen is suppressible if it is not an ion, not the major
isotope (i.e. it is a deuterium or tritium atom) and is not molecular
hydrogen.
@param container the structure
@param atom an atom in the structure
@return the atom is a hydrogen and it can be suppressed (implicit) | [
"Is",
"the",
"{",
"@code",
"atom",
"}",
"a",
"suppressible",
"hydrogen",
"and",
"can",
"be",
"represented",
"as",
"implicit",
".",
"A",
"hydrogen",
"is",
"suppressible",
"if",
"it",
"is",
"not",
"an",
"ion",
"not",
"the",
"major",
"isotope",
"(",
"i",
... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java#L1171-L1187 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java | XMLAssert.assertXMLEqual | public static void assertXMLEqual(Reader control, Reader test)
throws SAXException, IOException {
assertXMLEqual(null, control, test);
} | java | public static void assertXMLEqual(Reader control, Reader test)
throws SAXException, IOException {
assertXMLEqual(null, control, test);
} | [
"public",
"static",
"void",
"assertXMLEqual",
"(",
"Reader",
"control",
",",
"Reader",
"test",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"assertXMLEqual",
"(",
"null",
",",
"control",
",",
"test",
")",
";",
"}"
] | Assert that two XML documents are similar
@param control XML to be compared against
@param test XML to be tested
@throws SAXException
@throws IOException | [
"Assert",
"that",
"two",
"XML",
"documents",
"are",
"similar"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L202-L205 |
SimonVT/android-menudrawer | menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java | MenuDrawer.setMenuView | public void setMenuView(View view, LayoutParams params) {
mMenuView = view;
mMenuContainer.removeAllViews();
mMenuContainer.addView(view, params);
} | java | public void setMenuView(View view, LayoutParams params) {
mMenuView = view;
mMenuContainer.removeAllViews();
mMenuContainer.addView(view, params);
} | [
"public",
"void",
"setMenuView",
"(",
"View",
"view",
",",
"LayoutParams",
"params",
")",
"{",
"mMenuView",
"=",
"view",
";",
"mMenuContainer",
".",
"removeAllViews",
"(",
")",
";",
"mMenuContainer",
".",
"addView",
"(",
"view",
",",
"params",
")",
";",
"}... | Set the menu view to an explicit view.
@param view The menu view.
@param params Layout parameters for the view. | [
"Set",
"the",
"menu",
"view",
"to",
"an",
"explicit",
"view",
"."
] | train | https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1431-L1435 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/util/Components.java | Components.getDescription | public static String getDescription(Class<?> comp, Locale loc) {
Description descr = (Description) comp.getAnnotation(Description.class);
if (descr != null) {
String lang = loc.getLanguage();
Method[] m = descr.getClass().getMethods();
for (Method method : m) {
// System.out.println(method);
if (method.getName().equals(lang)) {
try {
String d = (String) method.invoke(descr, (Object[]) null);
if (d != null && !d.isEmpty()) {
return d;
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
return descr.value();
}
return null;
} | java | public static String getDescription(Class<?> comp, Locale loc) {
Description descr = (Description) comp.getAnnotation(Description.class);
if (descr != null) {
String lang = loc.getLanguage();
Method[] m = descr.getClass().getMethods();
for (Method method : m) {
// System.out.println(method);
if (method.getName().equals(lang)) {
try {
String d = (String) method.invoke(descr, (Object[]) null);
if (d != null && !d.isEmpty()) {
return d;
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
return descr.value();
}
return null;
} | [
"public",
"static",
"String",
"getDescription",
"(",
"Class",
"<",
"?",
">",
"comp",
",",
"Locale",
"loc",
")",
"{",
"Description",
"descr",
"=",
"(",
"Description",
")",
"comp",
".",
"getAnnotation",
"(",
"Description",
".",
"class",
")",
";",
"if",
"("... | Get the Component Description
@param comp the component class
@param loc the locale
@return the localized description | [
"Get",
"the",
"Component",
"Description"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Components.java#L431-L452 |
JOML-CI/JOML | src/org/joml/Vector2f.java | Vector2f.setComponent | public Vector2f setComponent(int component, float value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | java | public Vector2f setComponent(int component, float value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | [
"public",
"Vector2f",
"setComponent",
"(",
"int",
"component",
",",
"float",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"component",
")",
"{",
"case",
"0",
":",
"x",
"=",
"value",
";",
"break",
";",
"case",
"1",
":",
"y",
"="... | Set the value of the specified component of this vector.
@param component
the component whose value to set, within <code>[0..1]</code>
@param value
the value to set
@return this
@throws IllegalArgumentException if <code>component</code> is not within <code>[0..1]</code> | [
"Set",
"the",
"value",
"of",
"the",
"specified",
"component",
"of",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2f.java#L380-L392 |
EsotericSoftware/kryo | src/com/esotericsoftware/kryo/util/IdentityObjectIntMap.java | IdentityObjectIntMap.getAndIncrement | public int getAndIncrement (K key, int defaultValue, int increment) {
int hashCode = System.identityHashCode(key);
int index = hashCode & mask;
if (key != keyTable[index]) {
index = hash2(hashCode);
if (key != keyTable[index]) {
index = hash3(hashCode);
if (key != keyTable[index]) {
if (bigTable) {
index = hash4(hashCode);
if (key != keyTable[index]) return getAndIncrementStash(key, defaultValue, increment);
} else {
return getAndIncrementStash(key, defaultValue, increment);
}
}
}
}
int value = valueTable[index];
valueTable[index] = value + increment;
return value;
} | java | public int getAndIncrement (K key, int defaultValue, int increment) {
int hashCode = System.identityHashCode(key);
int index = hashCode & mask;
if (key != keyTable[index]) {
index = hash2(hashCode);
if (key != keyTable[index]) {
index = hash3(hashCode);
if (key != keyTable[index]) {
if (bigTable) {
index = hash4(hashCode);
if (key != keyTable[index]) return getAndIncrementStash(key, defaultValue, increment);
} else {
return getAndIncrementStash(key, defaultValue, increment);
}
}
}
}
int value = valueTable[index];
valueTable[index] = value + increment;
return value;
} | [
"public",
"int",
"getAndIncrement",
"(",
"K",
"key",
",",
"int",
"defaultValue",
",",
"int",
"increment",
")",
"{",
"int",
"hashCode",
"=",
"System",
".",
"identityHashCode",
"(",
"key",
")",
";",
"int",
"index",
"=",
"hashCode",
"&",
"mask",
";",
"if",
... | Returns the key's current value and increments the stored value. If the key is not in the map, defaultValue + increment is
put into the map. | [
"Returns",
"the",
"key",
"s",
"current",
"value",
"and",
"increments",
"the",
"stored",
"value",
".",
"If",
"the",
"key",
"is",
"not",
"in",
"the",
"map",
"defaultValue",
"+",
"increment",
"is",
"put",
"into",
"the",
"map",
"."
] | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/util/IdentityObjectIntMap.java#L345-L365 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java | InsertAllRequest.newBuilder | public static Builder newBuilder(String datasetId, String tableId) {
return new Builder().setTable(TableId.of(datasetId, tableId));
} | java | public static Builder newBuilder(String datasetId, String tableId) {
return new Builder().setTable(TableId.of(datasetId, tableId));
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"String",
"datasetId",
",",
"String",
"tableId",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"setTable",
"(",
"TableId",
".",
"of",
"(",
"datasetId",
",",
"tableId",
")",
")",
";",
"}"
] | Returns a builder for an {@code InsertAllRequest} object given the destination table. | [
"Returns",
"a",
"builder",
"for",
"an",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java#L356-L358 |
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/writers/JdbcWriter.java | JdbcWriter.renderSql | private static String renderSql(final Map<String, String> properties, final String quote) throws SQLException {
StringBuilder builder = new StringBuilder();
builder.append("INSERT INTO ");
append(builder, getTable(properties), quote);
builder.append(" (");
int count = 0;
for (Entry<String, String> entry : properties.entrySet()) {
String key = entry.getKey();
if (key.toLowerCase(Locale.ROOT).startsWith(FIELD_PREFIX)) {
String column = key.substring(FIELD_PREFIX.length());
if (count++ != 0) {
builder.append(", ");
}
append(builder, column, quote);
}
}
builder.append(") VALUES (");
for (int i = 0; i < count; ++i) {
if (i > 0) {
builder.append(", ?");
} else {
builder.append("?");
}
}
builder.append(")");
return builder.toString();
} | java | private static String renderSql(final Map<String, String> properties, final String quote) throws SQLException {
StringBuilder builder = new StringBuilder();
builder.append("INSERT INTO ");
append(builder, getTable(properties), quote);
builder.append(" (");
int count = 0;
for (Entry<String, String> entry : properties.entrySet()) {
String key = entry.getKey();
if (key.toLowerCase(Locale.ROOT).startsWith(FIELD_PREFIX)) {
String column = key.substring(FIELD_PREFIX.length());
if (count++ != 0) {
builder.append(", ");
}
append(builder, column, quote);
}
}
builder.append(") VALUES (");
for (int i = 0; i < count; ++i) {
if (i > 0) {
builder.append(", ?");
} else {
builder.append("?");
}
}
builder.append(")");
return builder.toString();
} | [
"private",
"static",
"String",
"renderSql",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
",",
"final",
"String",
"quote",
")",
"throws",
"SQLException",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"bu... | Generates an insert SQL statement for the configured table and its fields.
@param properties
Properties that contains the configured table and fields
@param quote
Character for quoting identifiers (can be a space if the database doesn't support quote characters)
@return SQL statement for {@link PreparedStatement}
@throws SQLException
Table or field names contain illegal characters | [
"Generates",
"an",
"insert",
"SQL",
"statement",
"for",
"the",
"configured",
"table",
"and",
"its",
"fields",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/writers/JdbcWriter.java#L362-L396 |
Cleveroad/AdaptiveTableLayout | library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableLayout.java | AdaptiveTableLayout.shiftColumnsViews | private void shiftColumnsViews(final int fromColumn, final int toColumn) {
if (mAdapter != null) {
// change data
mAdapter.changeColumns(getBindColumn(fromColumn), getBindColumn(toColumn));
// change view holders
switchHeaders(mHeaderColumnViewHolders, fromColumn, toColumn, ViewHolderType.COLUMN_HEADER);
// change indexes in array with widths
mManager.switchTwoColumns(fromColumn, toColumn);
Collection<ViewHolder> fromHolders = mViewHolders.getColumnItems(fromColumn);
Collection<ViewHolder> toHolders = mViewHolders.getColumnItems(toColumn);
removeViewHolders(fromHolders);
removeViewHolders(toHolders);
for (ViewHolder holder : fromHolders) {
holder.setColumnIndex(toColumn);
mViewHolders.put(holder.getRowIndex(), holder.getColumnIndex(), holder);
}
for (ViewHolder holder : toHolders) {
holder.setColumnIndex(fromColumn);
mViewHolders.put(holder.getRowIndex(), holder.getColumnIndex(), holder);
}
}
} | java | private void shiftColumnsViews(final int fromColumn, final int toColumn) {
if (mAdapter != null) {
// change data
mAdapter.changeColumns(getBindColumn(fromColumn), getBindColumn(toColumn));
// change view holders
switchHeaders(mHeaderColumnViewHolders, fromColumn, toColumn, ViewHolderType.COLUMN_HEADER);
// change indexes in array with widths
mManager.switchTwoColumns(fromColumn, toColumn);
Collection<ViewHolder> fromHolders = mViewHolders.getColumnItems(fromColumn);
Collection<ViewHolder> toHolders = mViewHolders.getColumnItems(toColumn);
removeViewHolders(fromHolders);
removeViewHolders(toHolders);
for (ViewHolder holder : fromHolders) {
holder.setColumnIndex(toColumn);
mViewHolders.put(holder.getRowIndex(), holder.getColumnIndex(), holder);
}
for (ViewHolder holder : toHolders) {
holder.setColumnIndex(fromColumn);
mViewHolders.put(holder.getRowIndex(), holder.getColumnIndex(), holder);
}
}
} | [
"private",
"void",
"shiftColumnsViews",
"(",
"final",
"int",
"fromColumn",
",",
"final",
"int",
"toColumn",
")",
"{",
"if",
"(",
"mAdapter",
"!=",
"null",
")",
"{",
"// change data",
"mAdapter",
".",
"changeColumns",
"(",
"getBindColumn",
"(",
"fromColumn",
")... | Method change columns. Change view holders indexes, kay in map, init changing items in adapter.
@param fromColumn from column index which need to shift
@param toColumn to column index which need to shift | [
"Method",
"change",
"columns",
".",
"Change",
"view",
"holders",
"indexes",
"kay",
"in",
"map",
"init",
"changing",
"items",
"in",
"adapter",
"."
] | train | https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableLayout.java#L1141-L1169 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java | GlobalConfiguration.getIntegerInternal | private int getIntegerInternal(final String key, final int defaultValue) {
int retVal = defaultValue;
try {
synchronized (this.confData) {
if (this.confData.containsKey(key)) {
retVal = Integer.parseInt(this.confData.get(key));
}
}
} catch (NumberFormatException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(StringUtils.stringifyException(e));
}
}
return retVal;
} | java | private int getIntegerInternal(final String key, final int defaultValue) {
int retVal = defaultValue;
try {
synchronized (this.confData) {
if (this.confData.containsKey(key)) {
retVal = Integer.parseInt(this.confData.get(key));
}
}
} catch (NumberFormatException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(StringUtils.stringifyException(e));
}
}
return retVal;
} | [
"private",
"int",
"getIntegerInternal",
"(",
"final",
"String",
"key",
",",
"final",
"int",
"defaultValue",
")",
"{",
"int",
"retVal",
"=",
"defaultValue",
";",
"try",
"{",
"synchronized",
"(",
"this",
".",
"confData",
")",
"{",
"if",
"(",
"this",
".",
"... | Returns the value associated with the given key as an integer.
@param key
the key pointing to the associated value
@param defaultValue
the default value which is returned in case there is no value associated with the given key
@return the (default) value associated with the given key | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"an",
"integer",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java#L191-L210 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXTablesFactory.java | GPXTablesFactory.dropOSMTables | public static void dropOSMTables(Connection connection, boolean isH2, String tablePrefix) throws SQLException {
TableLocation requestedTable = TableLocation.parse(tablePrefix, isH2);
String gpxTableName = requestedTable.getTable();
String[] gpxTables = new String[]{WAYPOINT,ROUTE,ROUTEPOINT, TRACK, TRACKPOINT, TRACKSEGMENT};
StringBuilder sb = new StringBuilder("drop table if exists ");
String gpxTableSuffix = gpxTables[0];
String gpxTable = TableUtilities.caseIdentifier(requestedTable, gpxTableName + gpxTableSuffix, isH2);
sb.append(gpxTable);
for (int i = 1; i < gpxTables.length; i++) {
gpxTableSuffix = gpxTables[i];
gpxTable = TableUtilities.caseIdentifier(requestedTable, gpxTableName + gpxTableSuffix, isH2);
sb.append(",").append(gpxTable);
}
try (Statement stmt = connection.createStatement()) {
stmt.execute(sb.toString());
}
} | java | public static void dropOSMTables(Connection connection, boolean isH2, String tablePrefix) throws SQLException {
TableLocation requestedTable = TableLocation.parse(tablePrefix, isH2);
String gpxTableName = requestedTable.getTable();
String[] gpxTables = new String[]{WAYPOINT,ROUTE,ROUTEPOINT, TRACK, TRACKPOINT, TRACKSEGMENT};
StringBuilder sb = new StringBuilder("drop table if exists ");
String gpxTableSuffix = gpxTables[0];
String gpxTable = TableUtilities.caseIdentifier(requestedTable, gpxTableName + gpxTableSuffix, isH2);
sb.append(gpxTable);
for (int i = 1; i < gpxTables.length; i++) {
gpxTableSuffix = gpxTables[i];
gpxTable = TableUtilities.caseIdentifier(requestedTable, gpxTableName + gpxTableSuffix, isH2);
sb.append(",").append(gpxTable);
}
try (Statement stmt = connection.createStatement()) {
stmt.execute(sb.toString());
}
} | [
"public",
"static",
"void",
"dropOSMTables",
"(",
"Connection",
"connection",
",",
"boolean",
"isH2",
",",
"String",
"tablePrefix",
")",
"throws",
"SQLException",
"{",
"TableLocation",
"requestedTable",
"=",
"TableLocation",
".",
"parse",
"(",
"tablePrefix",
",",
... | Drop the existing GPX tables used to store the imported OSM GPX
@param connection
@param isH2
@param tablePrefix
@throws SQLException | [
"Drop",
"the",
"existing",
"GPX",
"tables",
"used",
"to",
"store",
"the",
"imported",
"OSM",
"GPX"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXTablesFactory.java#L331-L347 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/JobmanagerInfoServlet.java | JobmanagerInfoServlet.writeJsonForArchivedJobGroupvertex | private void writeJsonForArchivedJobGroupvertex(PrintWriter wrt, RecentJobEvent jobEvent, ManagementGroupVertexID groupvertexId) {
try {
ManagementGraph jobManagementGraph = jobmanager.getManagementGraph(jobEvent.getJobID());
ManagementGroupVertex groupvertex = jobManagementGraph.getGroupVertexByID(groupvertexId);
// Serialize ManagementGraph to json
wrt.write("{\"groupvertex\": "+groupvertex.toJson()+",");
wrt.write("\"verticetimes\": {");
boolean first = true;
for(ManagementGroupVertex groupVertex : jobManagementGraph.getGroupVerticesInTopologicalOrder()) {
for(int j = 0; j < groupVertex.getNumberOfGroupMembers(); j++) {
ManagementVertex vertex = groupVertex.getGroupMember(j);
if(first) {
first = false;
} else {
wrt.write(","); }
wrt.write("\""+vertex.getID()+"\": {");
wrt.write("\"vertexid\": \"" + vertex.getID() + "\",");
wrt.write("\"vertexname\": \"" + vertex + "\",");
wrt.write("\"CREATED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.CREATED) + ",");
wrt.write("\"SCHEDULED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.SCHEDULED) + ",");
wrt.write("\"ASSIGNED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.ASSIGNED) + ",");
wrt.write("\"READY\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.READY) + ",");
wrt.write("\"STARTING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.STARTING) + ",");
wrt.write("\"RUNNING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.RUNNING) + ",");
wrt.write("\"FINISHING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FINISHING) + ",");
wrt.write("\"FINISHED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FINISHED) + ",");
wrt.write("\"CANCELING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.CANCELING) + ",");
wrt.write("\"CANCELED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.CANCELED) + ",");
wrt.write("\"FAILED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FAILED) + "");
wrt.write("}");
}
}
wrt.write("}}");
} catch (EofException eof) { // Connection closed by client
LOG.info("Info server for jobmanager: Connection closed by client, EofException");
} catch (IOException ioe) { // Connection closed by client
LOG.info("Info server for jobmanager: Connection closed by client, IOException");
}
} | java | private void writeJsonForArchivedJobGroupvertex(PrintWriter wrt, RecentJobEvent jobEvent, ManagementGroupVertexID groupvertexId) {
try {
ManagementGraph jobManagementGraph = jobmanager.getManagementGraph(jobEvent.getJobID());
ManagementGroupVertex groupvertex = jobManagementGraph.getGroupVertexByID(groupvertexId);
// Serialize ManagementGraph to json
wrt.write("{\"groupvertex\": "+groupvertex.toJson()+",");
wrt.write("\"verticetimes\": {");
boolean first = true;
for(ManagementGroupVertex groupVertex : jobManagementGraph.getGroupVerticesInTopologicalOrder()) {
for(int j = 0; j < groupVertex.getNumberOfGroupMembers(); j++) {
ManagementVertex vertex = groupVertex.getGroupMember(j);
if(first) {
first = false;
} else {
wrt.write(","); }
wrt.write("\""+vertex.getID()+"\": {");
wrt.write("\"vertexid\": \"" + vertex.getID() + "\",");
wrt.write("\"vertexname\": \"" + vertex + "\",");
wrt.write("\"CREATED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.CREATED) + ",");
wrt.write("\"SCHEDULED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.SCHEDULED) + ",");
wrt.write("\"ASSIGNED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.ASSIGNED) + ",");
wrt.write("\"READY\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.READY) + ",");
wrt.write("\"STARTING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.STARTING) + ",");
wrt.write("\"RUNNING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.RUNNING) + ",");
wrt.write("\"FINISHING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FINISHING) + ",");
wrt.write("\"FINISHED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FINISHED) + ",");
wrt.write("\"CANCELING\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.CANCELING) + ",");
wrt.write("\"CANCELED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.CANCELED) + ",");
wrt.write("\"FAILED\": "+ jobmanager.getArchive().getVertexTime(jobEvent.getJobID(), vertex.getID(), ExecutionState.FAILED) + "");
wrt.write("}");
}
}
wrt.write("}}");
} catch (EofException eof) { // Connection closed by client
LOG.info("Info server for jobmanager: Connection closed by client, EofException");
} catch (IOException ioe) { // Connection closed by client
LOG.info("Info server for jobmanager: Connection closed by client, IOException");
}
} | [
"private",
"void",
"writeJsonForArchivedJobGroupvertex",
"(",
"PrintWriter",
"wrt",
",",
"RecentJobEvent",
"jobEvent",
",",
"ManagementGroupVertexID",
"groupvertexId",
")",
"{",
"try",
"{",
"ManagementGraph",
"jobManagementGraph",
"=",
"jobmanager",
".",
"getManagementGraph... | Writes infos about one particular archived groupvertex in a job, including all groupmembers, their times and status
@param wrt
@param jobEvent
@param groupvertexId | [
"Writes",
"infos",
"about",
"one",
"particular",
"archived",
"groupvertex",
"in",
"a",
"job",
"including",
"all",
"groupmembers",
"their",
"times",
"and",
"status"
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/JobmanagerInfoServlet.java#L457-L507 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.