repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java | Constraints.gteProperty | public PropertyConstraint gteProperty(String propertyName, String otherPropertyName) {
"""
Apply a "greater than or equal to" constraint to two properties.
@param propertyName The first property
@param otherPropertyName The other property
@return The constraint
"""
return valueProperties(propertyName, GreaterThanEqualTo.instance(), otherPropertyName);
} | java | public PropertyConstraint gteProperty(String propertyName, String otherPropertyName) {
return valueProperties(propertyName, GreaterThanEqualTo.instance(), otherPropertyName);
} | [
"public",
"PropertyConstraint",
"gteProperty",
"(",
"String",
"propertyName",
",",
"String",
"otherPropertyName",
")",
"{",
"return",
"valueProperties",
"(",
"propertyName",
",",
"GreaterThanEqualTo",
".",
"instance",
"(",
")",
",",
"otherPropertyName",
")",
";",
"}"
] | Apply a "greater than or equal to" constraint to two properties.
@param propertyName The first property
@param otherPropertyName The other property
@return The constraint | [
"Apply",
"a",
"greater",
"than",
"or",
"equal",
"to",
"constraint",
"to",
"two",
"properties",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L864-L866 |
apache/incubator-druid | server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java | DruidLeaderClient.makeRequest | public Request makeRequest(HttpMethod httpMethod, String urlPath, boolean cached) throws IOException {
"""
Make a Request object aimed at the leader. Throws IOException if the leader cannot be located.
@param cached Uses cached leader if true, else uses the current leader
"""
Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS));
return new Request(httpMethod, new URL(StringUtils.format("%s%s", getCurrentKnownLeader(cached), urlPath)));
} | java | public Request makeRequest(HttpMethod httpMethod, String urlPath, boolean cached) throws IOException
{
Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS));
return new Request(httpMethod, new URL(StringUtils.format("%s%s", getCurrentKnownLeader(cached), urlPath)));
} | [
"public",
"Request",
"makeRequest",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"urlPath",
",",
"boolean",
"cached",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"lifecycleLock",
".",
"awaitStarted",
"(",
"1",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
")",
";",
"return",
"new",
"Request",
"(",
"httpMethod",
",",
"new",
"URL",
"(",
"StringUtils",
".",
"format",
"(",
"\"%s%s\"",
",",
"getCurrentKnownLeader",
"(",
"cached",
")",
",",
"urlPath",
")",
")",
")",
";",
"}"
] | Make a Request object aimed at the leader. Throws IOException if the leader cannot be located.
@param cached Uses cached leader if true, else uses the current leader | [
"Make",
"a",
"Request",
"object",
"aimed",
"at",
"the",
"leader",
".",
"Throws",
"IOException",
"if",
"the",
"leader",
"cannot",
"be",
"located",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java#L128-L132 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/stylers/AbstractStyler.java | AbstractStyler.update | @Override
public void update(Observable o, Object arg) {
"""
Will be called when a {@link Parameter} changes (when {@link Parameter#setDefault(java.io.Serializable) } or {@link Parameter#setValue(java.io.Serializable)
} is called). This method will always be called because the parameter {@link #STYLEAFTER} has a default value.
Here settings of {@link #itextHelper} will be initialized. When the parameter's key is {@link #CONDITONS} a flag
is set that conditions should be initialized, this will be done in {@link #setConditionFactory(com.vectorprint.report.itext.style.ConditionFactory)
}.
@param o
@param arg
"""
Parameter p = (Parameter) o;
if (!iTextSettingsApplied) {
iTextSettingsApplied = true;
StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(itextHelper, getSettings());
}
if (CONDITONS.equals(p.getKey()) && p.getValue() != null) {
needConditions = true;
}
} | java | @Override
public void update(Observable o, Object arg) {
Parameter p = (Parameter) o;
if (!iTextSettingsApplied) {
iTextSettingsApplied = true;
StylerFactoryHelper.SETTINGS_ANNOTATION_PROCESSOR.initSettings(itextHelper, getSettings());
}
if (CONDITONS.equals(p.getKey()) && p.getValue() != null) {
needConditions = true;
}
} | [
"@",
"Override",
"public",
"void",
"update",
"(",
"Observable",
"o",
",",
"Object",
"arg",
")",
"{",
"Parameter",
"p",
"=",
"(",
"Parameter",
")",
"o",
";",
"if",
"(",
"!",
"iTextSettingsApplied",
")",
"{",
"iTextSettingsApplied",
"=",
"true",
";",
"StylerFactoryHelper",
".",
"SETTINGS_ANNOTATION_PROCESSOR",
".",
"initSettings",
"(",
"itextHelper",
",",
"getSettings",
"(",
")",
")",
";",
"}",
"if",
"(",
"CONDITONS",
".",
"equals",
"(",
"p",
".",
"getKey",
"(",
")",
")",
"&&",
"p",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
"{",
"needConditions",
"=",
"true",
";",
"}",
"}"
] | Will be called when a {@link Parameter} changes (when {@link Parameter#setDefault(java.io.Serializable) } or {@link Parameter#setValue(java.io.Serializable)
} is called). This method will always be called because the parameter {@link #STYLEAFTER} has a default value.
Here settings of {@link #itextHelper} will be initialized. When the parameter's key is {@link #CONDITONS} a flag
is set that conditions should be initialized, this will be done in {@link #setConditionFactory(com.vectorprint.report.itext.style.ConditionFactory)
}.
@param o
@param arg | [
"Will",
"be",
"called",
"when",
"a",
"{",
"@link",
"Parameter",
"}",
"changes",
"(",
"when",
"{",
"@link",
"Parameter#setDefault",
"(",
"java",
".",
"io",
".",
"Serializable",
")",
"}",
"or",
"{",
"@link",
"Parameter#setValue",
"(",
"java",
".",
"io",
".",
"Serializable",
")",
"}",
"is",
"called",
")",
".",
"This",
"method",
"will",
"always",
"be",
"called",
"because",
"the",
"parameter",
"{",
"@link",
"#STYLEAFTER",
"}",
"has",
"a",
"default",
"value",
".",
"Here",
"settings",
"of",
"{",
"@link",
"#itextHelper",
"}",
"will",
"be",
"initialized",
".",
"When",
"the",
"parameter",
"s",
"key",
"is",
"{",
"@link",
"#CONDITONS",
"}",
"a",
"flag",
"is",
"set",
"that",
"conditions",
"should",
"be",
"initialized",
"this",
"will",
"be",
"done",
"in",
"{",
"@link",
"#setConditionFactory",
"(",
"com",
".",
"vectorprint",
".",
"report",
".",
"itext",
".",
"style",
".",
"ConditionFactory",
")",
"}",
"."
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/AbstractStyler.java#L240-L250 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java | CmsInlineEditOverlay.addButton | public void addButton(CmsInlineEntityWidget widget, int absoluteTop) {
"""
Adds a button widget to the button panel.<p>
@param widget the button widget
@param absoluteTop the absolute top position
"""
setButtonBarVisible(true);
m_buttonPanel.add(widget);
setButtonPosition(widget, absoluteTop);
} | java | public void addButton(CmsInlineEntityWidget widget, int absoluteTop) {
setButtonBarVisible(true);
m_buttonPanel.add(widget);
setButtonPosition(widget, absoluteTop);
} | [
"public",
"void",
"addButton",
"(",
"CmsInlineEntityWidget",
"widget",
",",
"int",
"absoluteTop",
")",
"{",
"setButtonBarVisible",
"(",
"true",
")",
";",
"m_buttonPanel",
".",
"add",
"(",
"widget",
")",
";",
"setButtonPosition",
"(",
"widget",
",",
"absoluteTop",
")",
";",
"}"
] | Adds a button widget to the button panel.<p>
@param widget the button widget
@param absoluteTop the absolute top position | [
"Adds",
"a",
"button",
"widget",
"to",
"the",
"button",
"panel",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java#L259-L264 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java | StochasticSTLinearL1.setMaxScaled | public void setMaxScaled(double maxFeature) {
"""
Sets the maximum value of any feature after scaling is applied. This
value can be no greater than 1.
@param maxFeature the maximum feature value after scaling
"""
if(Double.isNaN(maxFeature))
throw new ArithmeticException("NaN is not a valid feature value");
else if(maxFeature > 1)
throw new ArithmeticException("Maximum possible feature value is 1, can not use " + maxFeature);
else if(maxFeature <= minScaled)
throw new ArithmeticException("Maximum feature value must be learger than the minimum");
this.maxScaled = maxFeature;
} | java | public void setMaxScaled(double maxFeature)
{
if(Double.isNaN(maxFeature))
throw new ArithmeticException("NaN is not a valid feature value");
else if(maxFeature > 1)
throw new ArithmeticException("Maximum possible feature value is 1, can not use " + maxFeature);
else if(maxFeature <= minScaled)
throw new ArithmeticException("Maximum feature value must be learger than the minimum");
this.maxScaled = maxFeature;
} | [
"public",
"void",
"setMaxScaled",
"(",
"double",
"maxFeature",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"maxFeature",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"NaN is not a valid feature value\"",
")",
";",
"else",
"if",
"(",
"maxFeature",
">",
"1",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Maximum possible feature value is 1, can not use \"",
"+",
"maxFeature",
")",
";",
"else",
"if",
"(",
"maxFeature",
"<=",
"minScaled",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Maximum feature value must be learger than the minimum\"",
")",
";",
"this",
".",
"maxScaled",
"=",
"maxFeature",
";",
"}"
] | Sets the maximum value of any feature after scaling is applied. This
value can be no greater than 1.
@param maxFeature the maximum feature value after scaling | [
"Sets",
"the",
"maximum",
"value",
"of",
"any",
"feature",
"after",
"scaling",
"is",
"applied",
".",
"This",
"value",
"can",
"be",
"no",
"greater",
"than",
"1",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java#L233-L242 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFile.java | SourceFile.getInputStreamFromOffset | public InputStream getInputStreamFromOffset(int offset) throws IOException {
"""
Get an InputStream on data starting at given offset.
@param offset
the start offset
@return an InputStream on the data in the source file, starting at the
given offset
"""
loadFileData();
return new ByteArrayInputStream(data, offset, data.length - offset);
} | java | public InputStream getInputStreamFromOffset(int offset) throws IOException {
loadFileData();
return new ByteArrayInputStream(data, offset, data.length - offset);
} | [
"public",
"InputStream",
"getInputStreamFromOffset",
"(",
"int",
"offset",
")",
"throws",
"IOException",
"{",
"loadFileData",
"(",
")",
";",
"return",
"new",
"ByteArrayInputStream",
"(",
"data",
",",
"offset",
",",
"data",
".",
"length",
"-",
"offset",
")",
";",
"}"
] | Get an InputStream on data starting at given offset.
@param offset
the start offset
@return an InputStream on the data in the source file, starting at the
given offset | [
"Get",
"an",
"InputStream",
"on",
"data",
"starting",
"at",
"given",
"offset",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFile.java#L141-L144 |
ludovicianul/selenium-on-steroids | src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java | WebDriverHelper.authenticateOnNextAlert | public void authenticateOnNextAlert(String username, String password) {
"""
Authenticates the user using the given username and password. This will
work only if the credentials are requested through an alert window.
@param username
the user name
@param password
the password
"""
Credentials credentials = new UserAndPassword(username, password);
Alert alert = driver.switchTo().alert();
alert.authenticateUsing(credentials);
} | java | public void authenticateOnNextAlert(String username, String password) {
Credentials credentials = new UserAndPassword(username, password);
Alert alert = driver.switchTo().alert();
alert.authenticateUsing(credentials);
} | [
"public",
"void",
"authenticateOnNextAlert",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"Credentials",
"credentials",
"=",
"new",
"UserAndPassword",
"(",
"username",
",",
"password",
")",
";",
"Alert",
"alert",
"=",
"driver",
".",
"switchTo",
"(",
")",
".",
"alert",
"(",
")",
";",
"alert",
".",
"authenticateUsing",
"(",
"credentials",
")",
";",
"}"
] | Authenticates the user using the given username and password. This will
work only if the credentials are requested through an alert window.
@param username
the user name
@param password
the password | [
"Authenticates",
"the",
"user",
"using",
"the",
"given",
"username",
"and",
"password",
".",
"This",
"will",
"work",
"only",
"if",
"the",
"credentials",
"are",
"requested",
"through",
"an",
"alert",
"window",
"."
] | train | https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L165-L170 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMLambda.java | JMLambda.biFunctionIfTrue | public static <T, U, R> Optional<R> biFunctionIfTrue(boolean bool,
T target1, U target2, BiFunction<T, U, R> biFunction) {
"""
Bi function if true optional.
@param <T> the type parameter
@param <U> the type parameter
@param <R> the type parameter
@param bool the bool
@param target1 the target 1
@param target2 the target 2
@param biFunction the bi function
@return the optional
"""
return supplierIfTrue(bool, () -> biFunction.apply(target1, target2));
} | java | public static <T, U, R> Optional<R> biFunctionIfTrue(boolean bool,
T target1, U target2, BiFunction<T, U, R> biFunction) {
return supplierIfTrue(bool, () -> biFunction.apply(target1, target2));
} | [
"public",
"static",
"<",
"T",
",",
"U",
",",
"R",
">",
"Optional",
"<",
"R",
">",
"biFunctionIfTrue",
"(",
"boolean",
"bool",
",",
"T",
"target1",
",",
"U",
"target2",
",",
"BiFunction",
"<",
"T",
",",
"U",
",",
"R",
">",
"biFunction",
")",
"{",
"return",
"supplierIfTrue",
"(",
"bool",
",",
"(",
")",
"->",
"biFunction",
".",
"apply",
"(",
"target1",
",",
"target2",
")",
")",
";",
"}"
] | Bi function if true optional.
@param <T> the type parameter
@param <U> the type parameter
@param <R> the type parameter
@param bool the bool
@param target1 the target 1
@param target2 the target 2
@param biFunction the bi function
@return the optional | [
"Bi",
"function",
"if",
"true",
"optional",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMLambda.java#L286-L289 |
motown-io/motown | domain/command-authorization/src/main/java/io/motown/domain/commandauthorization/CommandAuthorizationService.java | CommandAuthorizationService.isAuthorized | public boolean isAuthorized(ChargingStationId chargingStationId, UserIdentity userIdentity, Class commandClass) {
"""
Checks if a user identity has access to a command class for a certain charging station.
@param chargingStationId charging station identification.
@param userIdentity user identity.
@param commandClass command class.
@return true if the user is authorized to execute the command for the charging station, false if not.
"""
// first search for this specific authorization
boolean isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), commandClass) != null;
if (!isAuthorized) {
// maybe the user identity has access to 'allPermissions'
isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), AllPermissions.class) != null;
}
return isAuthorized;
} | java | public boolean isAuthorized(ChargingStationId chargingStationId, UserIdentity userIdentity, Class commandClass) {
// first search for this specific authorization
boolean isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), commandClass) != null;
if (!isAuthorized) {
// maybe the user identity has access to 'allPermissions'
isAuthorized = commandAuthorizationRepository.find(chargingStationId.getId(), userIdentity.getId(), AllPermissions.class) != null;
}
return isAuthorized;
} | [
"public",
"boolean",
"isAuthorized",
"(",
"ChargingStationId",
"chargingStationId",
",",
"UserIdentity",
"userIdentity",
",",
"Class",
"commandClass",
")",
"{",
"// first search for this specific authorization",
"boolean",
"isAuthorized",
"=",
"commandAuthorizationRepository",
".",
"find",
"(",
"chargingStationId",
".",
"getId",
"(",
")",
",",
"userIdentity",
".",
"getId",
"(",
")",
",",
"commandClass",
")",
"!=",
"null",
";",
"if",
"(",
"!",
"isAuthorized",
")",
"{",
"// maybe the user identity has access to 'allPermissions'",
"isAuthorized",
"=",
"commandAuthorizationRepository",
".",
"find",
"(",
"chargingStationId",
".",
"getId",
"(",
")",
",",
"userIdentity",
".",
"getId",
"(",
")",
",",
"AllPermissions",
".",
"class",
")",
"!=",
"null",
";",
"}",
"return",
"isAuthorized",
";",
"}"
] | Checks if a user identity has access to a command class for a certain charging station.
@param chargingStationId charging station identification.
@param userIdentity user identity.
@param commandClass command class.
@return true if the user is authorized to execute the command for the charging station, false if not. | [
"Checks",
"if",
"a",
"user",
"identity",
"has",
"access",
"to",
"a",
"command",
"class",
"for",
"a",
"certain",
"charging",
"station",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/domain/command-authorization/src/main/java/io/motown/domain/commandauthorization/CommandAuthorizationService.java#L35-L45 |
apache/incubator-heron | heron/uploaders/src/java/org/apache/heron/uploader/gcs/GcsUploader.java | GcsUploader.getDownloadUrl | private static String getDownloadUrl(String bucket, String objectName) {
"""
Returns a url to download an gcs object the given bucket and object name
@param bucket the name of the bucket
@param objectName the name of the object
@return a url to download the object
"""
return String.format(GCS_URL_FORMAT, bucket, objectName);
} | java | private static String getDownloadUrl(String bucket, String objectName) {
return String.format(GCS_URL_FORMAT, bucket, objectName);
} | [
"private",
"static",
"String",
"getDownloadUrl",
"(",
"String",
"bucket",
",",
"String",
"objectName",
")",
"{",
"return",
"String",
".",
"format",
"(",
"GCS_URL_FORMAT",
",",
"bucket",
",",
"objectName",
")",
";",
"}"
] | Returns a url to download an gcs object the given bucket and object name
@param bucket the name of the bucket
@param objectName the name of the object
@return a url to download the object | [
"Returns",
"a",
"url",
"to",
"download",
"an",
"gcs",
"object",
"the",
"given",
"bucket",
"and",
"object",
"name"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/uploaders/src/java/org/apache/heron/uploader/gcs/GcsUploader.java#L225-L227 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PRAcroForm.java | PRAcroForm.mergeAttrib | protected PdfDictionary mergeAttrib(PdfDictionary parent, PdfDictionary child) {
"""
merge field attributes from two dictionaries
@param parent one dictionary
@param child the other dictionary
@return a merged dictionary
"""
PdfDictionary targ = new PdfDictionary();
if (parent != null) targ.putAll(parent);
for (Iterator it = child.getKeys().iterator(); it.hasNext();) {
PdfName key = (PdfName) it.next();
if (key.equals(PdfName.DR) || key.equals(PdfName.DA) ||
key.equals(PdfName.Q) || key.equals(PdfName.FF) ||
key.equals(PdfName.DV) || key.equals(PdfName.V)
|| key.equals(PdfName.FT)
|| key.equals(PdfName.F)) {
targ.put(key,child.get(key));
}
}
return targ;
} | java | protected PdfDictionary mergeAttrib(PdfDictionary parent, PdfDictionary child) {
PdfDictionary targ = new PdfDictionary();
if (parent != null) targ.putAll(parent);
for (Iterator it = child.getKeys().iterator(); it.hasNext();) {
PdfName key = (PdfName) it.next();
if (key.equals(PdfName.DR) || key.equals(PdfName.DA) ||
key.equals(PdfName.Q) || key.equals(PdfName.FF) ||
key.equals(PdfName.DV) || key.equals(PdfName.V)
|| key.equals(PdfName.FT)
|| key.equals(PdfName.F)) {
targ.put(key,child.get(key));
}
}
return targ;
} | [
"protected",
"PdfDictionary",
"mergeAttrib",
"(",
"PdfDictionary",
"parent",
",",
"PdfDictionary",
"child",
")",
"{",
"PdfDictionary",
"targ",
"=",
"new",
"PdfDictionary",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"targ",
".",
"putAll",
"(",
"parent",
")",
";",
"for",
"(",
"Iterator",
"it",
"=",
"child",
".",
"getKeys",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"PdfName",
"key",
"=",
"(",
"PdfName",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"key",
".",
"equals",
"(",
"PdfName",
".",
"DR",
")",
"||",
"key",
".",
"equals",
"(",
"PdfName",
".",
"DA",
")",
"||",
"key",
".",
"equals",
"(",
"PdfName",
".",
"Q",
")",
"||",
"key",
".",
"equals",
"(",
"PdfName",
".",
"FF",
")",
"||",
"key",
".",
"equals",
"(",
"PdfName",
".",
"DV",
")",
"||",
"key",
".",
"equals",
"(",
"PdfName",
".",
"V",
")",
"||",
"key",
".",
"equals",
"(",
"PdfName",
".",
"FT",
")",
"||",
"key",
".",
"equals",
"(",
"PdfName",
".",
"F",
")",
")",
"{",
"targ",
".",
"put",
"(",
"key",
",",
"child",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
"return",
"targ",
";",
"}"
] | merge field attributes from two dictionaries
@param parent one dictionary
@param child the other dictionary
@return a merged dictionary | [
"merge",
"field",
"attributes",
"from",
"two",
"dictionaries"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PRAcroForm.java#L184-L199 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.appendActionsToActionStateExecutionList | public void appendActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final EvaluateAction... actions) {
"""
Append actions to action state execution list.
@param flow the flow
@param actionStateId the action state id
@param actions the actions
"""
addActionsToActionStateExecutionListAt(flow, actionStateId, Integer.MAX_VALUE, actions);
} | java | public void appendActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final EvaluateAction... actions) {
addActionsToActionStateExecutionListAt(flow, actionStateId, Integer.MAX_VALUE, actions);
} | [
"public",
"void",
"appendActionsToActionStateExecutionList",
"(",
"final",
"Flow",
"flow",
",",
"final",
"String",
"actionStateId",
",",
"final",
"EvaluateAction",
"...",
"actions",
")",
"{",
"addActionsToActionStateExecutionListAt",
"(",
"flow",
",",
"actionStateId",
",",
"Integer",
".",
"MAX_VALUE",
",",
"actions",
")",
";",
"}"
] | Append actions to action state execution list.
@param flow the flow
@param actionStateId the action state id
@param actions the actions | [
"Append",
"actions",
"to",
"action",
"state",
"execution",
"list",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L844-L846 |
walkmod/walkmod-core | src/main/java/org/walkmod/WalkModFacade.java | WalkModFacade.addChainConfig | public void addChainConfig(ChainConfig chainCfg, boolean recursive, String before) throws Exception {
"""
Adds a new chain configuration into the configuration file
@param chainCfg
chain configuration to add
@param recursive
Adds the new chain into all the submodules
@param before
Decides which is the next chain to execute.
@throws Exception
in case that the walkmod configuration file can't be read.
"""
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.addChainConfig(chainCfg, recursive, before);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | java | public void addChainConfig(ChainConfig chainCfg, boolean recursive, String before) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.addChainConfig(chainCfg, recursive, before);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | [
"public",
"void",
"addChainConfig",
"(",
"ChainConfig",
"chainCfg",
",",
"boolean",
"recursive",
",",
"String",
"before",
")",
"throws",
"Exception",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Exception",
"exception",
"=",
"null",
";",
"if",
"(",
"!",
"cfg",
".",
"exists",
"(",
")",
")",
"{",
"init",
"(",
")",
";",
"}",
"userDir",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"System",
".",
"setProperty",
"(",
"\"user.dir\"",
",",
"options",
".",
"getExecutionDirectory",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"try",
"{",
"ConfigurationManager",
"manager",
"=",
"new",
"ConfigurationManager",
"(",
"cfg",
",",
"false",
")",
";",
"ProjectConfigurationProvider",
"cfgProvider",
"=",
"manager",
".",
"getProjectConfigurationProvider",
"(",
")",
";",
"cfgProvider",
".",
"addChainConfig",
"(",
"chainCfg",
",",
"recursive",
",",
"before",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"exception",
"=",
"e",
";",
"}",
"finally",
"{",
"System",
".",
"setProperty",
"(",
"\"user.dir\"",
",",
"userDir",
")",
";",
"updateMsg",
"(",
"startTime",
",",
"exception",
")",
";",
"}",
"}"
] | Adds a new chain configuration into the configuration file
@param chainCfg
chain configuration to add
@param recursive
Adds the new chain into all the submodules
@param before
Decides which is the next chain to execute.
@throws Exception
in case that the walkmod configuration file can't be read. | [
"Adds",
"a",
"new",
"chain",
"configuration",
"into",
"the",
"configuration",
"file"
] | train | https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L389-L409 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/ImportApi.java | ImportApi.getImportStatus | public GetImportStatusResponse getImportStatus(String adminName, String tenantName) throws ApiException {
"""
Get import status.
Get all active imports for the specified tenant.
@param adminName The login name of an administrator for the tenant. (required)
@param tenantName The name of the tenant. (required)
@return GetImportStatusResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<GetImportStatusResponse> resp = getImportStatusWithHttpInfo(adminName, tenantName);
return resp.getData();
} | java | public GetImportStatusResponse getImportStatus(String adminName, String tenantName) throws ApiException {
ApiResponse<GetImportStatusResponse> resp = getImportStatusWithHttpInfo(adminName, tenantName);
return resp.getData();
} | [
"public",
"GetImportStatusResponse",
"getImportStatus",
"(",
"String",
"adminName",
",",
"String",
"tenantName",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"GetImportStatusResponse",
">",
"resp",
"=",
"getImportStatusWithHttpInfo",
"(",
"adminName",
",",
"tenantName",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | Get import status.
Get all active imports for the specified tenant.
@param adminName The login name of an administrator for the tenant. (required)
@param tenantName The name of the tenant. (required)
@return GetImportStatusResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"import",
"status",
".",
"Get",
"all",
"active",
"imports",
"for",
"the",
"specified",
"tenant",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/ImportApi.java#L141-L144 |
Netflix/concurrency-limits | concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java | ServletLimiterBuilder.partitionByPathInfo | public ServletLimiterBuilder partitionByPathInfo(Function<String, String> pathToGroup) {
"""
Partition the limit by the full path. Percentages of the limit are partitioned to named
groups. Group membership is derived from the provided mapping function.
@param pathToGroup Mapping function from full path to a named group.
@return Chainable builder
"""
return partitionResolver(request -> Optional.ofNullable(request.getPathInfo()).map(pathToGroup).orElse(null));
} | java | public ServletLimiterBuilder partitionByPathInfo(Function<String, String> pathToGroup) {
return partitionResolver(request -> Optional.ofNullable(request.getPathInfo()).map(pathToGroup).orElse(null));
} | [
"public",
"ServletLimiterBuilder",
"partitionByPathInfo",
"(",
"Function",
"<",
"String",
",",
"String",
">",
"pathToGroup",
")",
"{",
"return",
"partitionResolver",
"(",
"request",
"->",
"Optional",
".",
"ofNullable",
"(",
"request",
".",
"getPathInfo",
"(",
")",
")",
".",
"map",
"(",
"pathToGroup",
")",
".",
"orElse",
"(",
"null",
")",
")",
";",
"}"
] | Partition the limit by the full path. Percentages of the limit are partitioned to named
groups. Group membership is derived from the provided mapping function.
@param pathToGroup Mapping function from full path to a named group.
@return Chainable builder | [
"Partition",
"the",
"limit",
"by",
"the",
"full",
"path",
".",
"Percentages",
"of",
"the",
"limit",
"are",
"partitioned",
"to",
"named",
"groups",
".",
"Group",
"membership",
"is",
"derived",
"from",
"the",
"provided",
"mapping",
"function",
"."
] | train | https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java#L72-L74 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadBitmapOptimized | private static Bitmap loadBitmapOptimized(ImageSource source, int w, int h) throws ImageLoadException {
"""
Loading bitmap from ImageSource with limit of amout of pixels
@param source image source
@param w min width
@param h min height
@return loaded bitmap
@throws ImageLoadException if it is unable to load image
"""
int scale = getScaleFactor(source.getImageMetadata(), w, h);
return loadBitmap(source, scale);
} | java | private static Bitmap loadBitmapOptimized(ImageSource source, int w, int h) throws ImageLoadException {
int scale = getScaleFactor(source.getImageMetadata(), w, h);
return loadBitmap(source, scale);
} | [
"private",
"static",
"Bitmap",
"loadBitmapOptimized",
"(",
"ImageSource",
"source",
",",
"int",
"w",
",",
"int",
"h",
")",
"throws",
"ImageLoadException",
"{",
"int",
"scale",
"=",
"getScaleFactor",
"(",
"source",
".",
"getImageMetadata",
"(",
")",
",",
"w",
",",
"h",
")",
";",
"return",
"loadBitmap",
"(",
"source",
",",
"scale",
")",
";",
"}"
] | Loading bitmap from ImageSource with limit of amout of pixels
@param source image source
@param w min width
@param h min height
@return loaded bitmap
@throws ImageLoadException if it is unable to load image | [
"Loading",
"bitmap",
"from",
"ImageSource",
"with",
"limit",
"of",
"amout",
"of",
"pixels"
] | 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#L399-L402 |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java | GVRScriptManager.attachScriptFile | @Override
public void attachScriptFile(IScriptable target, IScriptFile scriptFile) {
"""
Attach a script file to a scriptable target.
@param target The scriptable target.
@param scriptFile The script file object.
"""
mScriptMap.put(target, scriptFile);
scriptFile.invokeFunction("onAttach", new Object[] { target });
} | java | @Override
public void attachScriptFile(IScriptable target, IScriptFile scriptFile) {
mScriptMap.put(target, scriptFile);
scriptFile.invokeFunction("onAttach", new Object[] { target });
} | [
"@",
"Override",
"public",
"void",
"attachScriptFile",
"(",
"IScriptable",
"target",
",",
"IScriptFile",
"scriptFile",
")",
"{",
"mScriptMap",
".",
"put",
"(",
"target",
",",
"scriptFile",
")",
";",
"scriptFile",
".",
"invokeFunction",
"(",
"\"onAttach\"",
",",
"new",
"Object",
"[",
"]",
"{",
"target",
"}",
")",
";",
"}"
] | Attach a script file to a scriptable target.
@param target The scriptable target.
@param scriptFile The script file object. | [
"Attach",
"a",
"script",
"file",
"to",
"a",
"scriptable",
"target",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L186-L190 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMail.java | GreenMail.createServices | protected Map<String, AbstractServer> createServices(ServerSetup[] config, Managers mgr) {
"""
Create the required services according to the server setup
@param config Service configuration
@return Services map
"""
Map<String, AbstractServer> srvc = new HashMap<>();
for (ServerSetup setup : config) {
if (srvc.containsKey(setup.getProtocol())) {
throw new IllegalArgumentException("Server '" + setup.getProtocol() + "' was found at least twice in the array");
}
final String protocol = setup.getProtocol();
if (protocol.startsWith(ServerSetup.PROTOCOL_SMTP)) {
srvc.put(protocol, new SmtpServer(setup, mgr));
} else if (protocol.startsWith(ServerSetup.PROTOCOL_POP3)) {
srvc.put(protocol, new Pop3Server(setup, mgr));
} else if (protocol.startsWith(ServerSetup.PROTOCOL_IMAP)) {
srvc.put(protocol, new ImapServer(setup, mgr));
}
}
return srvc;
} | java | protected Map<String, AbstractServer> createServices(ServerSetup[] config, Managers mgr) {
Map<String, AbstractServer> srvc = new HashMap<>();
for (ServerSetup setup : config) {
if (srvc.containsKey(setup.getProtocol())) {
throw new IllegalArgumentException("Server '" + setup.getProtocol() + "' was found at least twice in the array");
}
final String protocol = setup.getProtocol();
if (protocol.startsWith(ServerSetup.PROTOCOL_SMTP)) {
srvc.put(protocol, new SmtpServer(setup, mgr));
} else if (protocol.startsWith(ServerSetup.PROTOCOL_POP3)) {
srvc.put(protocol, new Pop3Server(setup, mgr));
} else if (protocol.startsWith(ServerSetup.PROTOCOL_IMAP)) {
srvc.put(protocol, new ImapServer(setup, mgr));
}
}
return srvc;
} | [
"protected",
"Map",
"<",
"String",
",",
"AbstractServer",
">",
"createServices",
"(",
"ServerSetup",
"[",
"]",
"config",
",",
"Managers",
"mgr",
")",
"{",
"Map",
"<",
"String",
",",
"AbstractServer",
">",
"srvc",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"ServerSetup",
"setup",
":",
"config",
")",
"{",
"if",
"(",
"srvc",
".",
"containsKey",
"(",
"setup",
".",
"getProtocol",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Server '\"",
"+",
"setup",
".",
"getProtocol",
"(",
")",
"+",
"\"' was found at least twice in the array\"",
")",
";",
"}",
"final",
"String",
"protocol",
"=",
"setup",
".",
"getProtocol",
"(",
")",
";",
"if",
"(",
"protocol",
".",
"startsWith",
"(",
"ServerSetup",
".",
"PROTOCOL_SMTP",
")",
")",
"{",
"srvc",
".",
"put",
"(",
"protocol",
",",
"new",
"SmtpServer",
"(",
"setup",
",",
"mgr",
")",
")",
";",
"}",
"else",
"if",
"(",
"protocol",
".",
"startsWith",
"(",
"ServerSetup",
".",
"PROTOCOL_POP3",
")",
")",
"{",
"srvc",
".",
"put",
"(",
"protocol",
",",
"new",
"Pop3Server",
"(",
"setup",
",",
"mgr",
")",
")",
";",
"}",
"else",
"if",
"(",
"protocol",
".",
"startsWith",
"(",
"ServerSetup",
".",
"PROTOCOL_IMAP",
")",
")",
"{",
"srvc",
".",
"put",
"(",
"protocol",
",",
"new",
"ImapServer",
"(",
"setup",
",",
"mgr",
")",
")",
";",
"}",
"}",
"return",
"srvc",
";",
"}"
] | Create the required services according to the server setup
@param config Service configuration
@return Services map | [
"Create",
"the",
"required",
"services",
"according",
"to",
"the",
"server",
"setup"
] | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMail.java#L138-L154 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java | Whitebox.setInternalStateFromContext | public static void setInternalStateFromContext(Object instance, Object context, FieldMatchingStrategy strategy) {
"""
Set the values of multiple instance fields defined in a context using
reflection and using an explicit {@link FieldMatchingStrategy}. The
values in the context will be assigned to values on the
{@code instance}. This method will traverse the class hierarchy when
searching for the fields. Example usage:
<p>
Given:
<pre>
public class MyContext {
private String myString = "myString";
protected int myInt = 9;
}
public class MyInstance {
private String myInstanceString;
private int myInstanceInt;
}
</pre>
then
<pre>
Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext());
</pre>
will set the instance variables of {@code myInstance} to the values
specified in {@code MyContext}.
@param instance
the object whose fields to modify.
@param context
The context where the fields are defined.
@param strategy
Which field matching strategy to use.
"""
WhiteboxImpl.setInternalStateFromContext(instance, context, strategy);
} | java | public static void setInternalStateFromContext(Object instance, Object context, FieldMatchingStrategy strategy) {
WhiteboxImpl.setInternalStateFromContext(instance, context, strategy);
} | [
"public",
"static",
"void",
"setInternalStateFromContext",
"(",
"Object",
"instance",
",",
"Object",
"context",
",",
"FieldMatchingStrategy",
"strategy",
")",
"{",
"WhiteboxImpl",
".",
"setInternalStateFromContext",
"(",
"instance",
",",
"context",
",",
"strategy",
")",
";",
"}"
] | Set the values of multiple instance fields defined in a context using
reflection and using an explicit {@link FieldMatchingStrategy}. The
values in the context will be assigned to values on the
{@code instance}. This method will traverse the class hierarchy when
searching for the fields. Example usage:
<p>
Given:
<pre>
public class MyContext {
private String myString = "myString";
protected int myInt = 9;
}
public class MyInstance {
private String myInstanceString;
private int myInstanceInt;
}
</pre>
then
<pre>
Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext());
</pre>
will set the instance variables of {@code myInstance} to the values
specified in {@code MyContext}.
@param instance
the object whose fields to modify.
@param context
The context where the fields are defined.
@param strategy
Which field matching strategy to use. | [
"Set",
"the",
"values",
"of",
"multiple",
"instance",
"fields",
"defined",
"in",
"a",
"context",
"using",
"reflection",
"and",
"using",
"an",
"explicit",
"{",
"@link",
"FieldMatchingStrategy",
"}",
".",
"The",
"values",
"in",
"the",
"context",
"will",
"be",
"assigned",
"to",
"values",
"on",
"the",
"{",
"@code",
"instance",
"}",
".",
"This",
"method",
"will",
"traverse",
"the",
"class",
"hierarchy",
"when",
"searching",
"for",
"the",
"fields",
".",
"Example",
"usage",
":",
"<p",
">",
"Given",
":"
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L821-L823 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/comm/AbstractCommPortConnectionFactory.java | AbstractCommPortConnectionFactory.releaseResourceImpl | @Override
protected void releaseResourceImpl(CommPortAdapter resource) {
"""
Releases the resource from the connection.
@param resource
The resource
"""
try
{
resource.close();
}
catch(IOException exception)
{
throw new FaxException("Unable to close COMM port adapter.",exception);
}
} | java | @Override
protected void releaseResourceImpl(CommPortAdapter resource)
{
try
{
resource.close();
}
catch(IOException exception)
{
throw new FaxException("Unable to close COMM port adapter.",exception);
}
} | [
"@",
"Override",
"protected",
"void",
"releaseResourceImpl",
"(",
"CommPortAdapter",
"resource",
")",
"{",
"try",
"{",
"resource",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"exception",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Unable to close COMM port adapter.\"",
",",
"exception",
")",
";",
"}",
"}"
] | Releases the resource from the connection.
@param resource
The resource | [
"Releases",
"the",
"resource",
"from",
"the",
"connection",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/comm/AbstractCommPortConnectionFactory.java#L69-L80 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedIndexReader.java | SharedIndexReader.getParent | public DocId getParent(int n, BitSet deleted) throws IOException {
"""
Returns the <code>DocId</code> of the parent of <code>n</code> or
{@link DocId#NULL} if <code>n</code> does not have a parent
(<code>n</code> is the root node).
@param n the document number.
@param deleted the documents that should be regarded as deleted.
@return the <code>DocId</code> of <code>n</code>'s parent.
@throws IOException if an error occurs while reading from the index.
"""
return getBase().getParent(n, deleted);
} | java | public DocId getParent(int n, BitSet deleted) throws IOException {
return getBase().getParent(n, deleted);
} | [
"public",
"DocId",
"getParent",
"(",
"int",
"n",
",",
"BitSet",
"deleted",
")",
"throws",
"IOException",
"{",
"return",
"getBase",
"(",
")",
".",
"getParent",
"(",
"n",
",",
"deleted",
")",
";",
"}"
] | Returns the <code>DocId</code> of the parent of <code>n</code> or
{@link DocId#NULL} if <code>n</code> does not have a parent
(<code>n</code> is the root node).
@param n the document number.
@param deleted the documents that should be regarded as deleted.
@return the <code>DocId</code> of <code>n</code>'s parent.
@throws IOException if an error occurs while reading from the index. | [
"Returns",
"the",
"<code",
">",
"DocId<",
"/",
"code",
">",
"of",
"the",
"parent",
"of",
"<code",
">",
"n<",
"/",
"code",
">",
"or",
"{",
"@link",
"DocId#NULL",
"}",
"if",
"<code",
">",
"n<",
"/",
"code",
">",
"does",
"not",
"have",
"a",
"parent",
"(",
"<code",
">",
"n<",
"/",
"code",
">",
"is",
"the",
"root",
"node",
")",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SharedIndexReader.java#L61-L63 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getFormBeanName | public static String getFormBeanName( ActionForm formInstance, HttpServletRequest request ) {
"""
Get the name for the type of a ActionForm instance. Use a name looked up from
the current Struts module, or, if none is found, create one.
@param formInstance the ActionForm instance whose type will determine the name.
@param request the current HttpServletRequest, which contains a reference to the current Struts module.
@return the name found in the Struts module, or, if none is found, a name that is either:
<ul>
<li>a camel-cased version of the base class name (minus any package or outer-class
qualifiers, or, if that name is already taken,</li>
<li>the full class name, with '.' and '$' replaced by '_'.</li>
</ul>
"""
return getFormBeanName( formInstance.getClass(), request );
} | java | public static String getFormBeanName( ActionForm formInstance, HttpServletRequest request )
{
return getFormBeanName( formInstance.getClass(), request );
} | [
"public",
"static",
"String",
"getFormBeanName",
"(",
"ActionForm",
"formInstance",
",",
"HttpServletRequest",
"request",
")",
"{",
"return",
"getFormBeanName",
"(",
"formInstance",
".",
"getClass",
"(",
")",
",",
"request",
")",
";",
"}"
] | Get the name for the type of a ActionForm instance. Use a name looked up from
the current Struts module, or, if none is found, create one.
@param formInstance the ActionForm instance whose type will determine the name.
@param request the current HttpServletRequest, which contains a reference to the current Struts module.
@return the name found in the Struts module, or, if none is found, a name that is either:
<ul>
<li>a camel-cased version of the base class name (minus any package or outer-class
qualifiers, or, if that name is already taken,</li>
<li>the full class name, with '.' and '$' replaced by '_'.</li>
</ul> | [
"Get",
"the",
"name",
"for",
"the",
"type",
"of",
"a",
"ActionForm",
"instance",
".",
"Use",
"a",
"name",
"looked",
"up",
"from",
"the",
"current",
"Struts",
"module",
"or",
"if",
"none",
"is",
"found",
"create",
"one",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L715-L718 |
Whiley/WhileyCompiler | src/main/java/wyil/type/util/TypeSubtractor.java | TypeSubtractor.apply | @Override
protected Type apply(Record lhs, Record rhs, LifetimeRelation lifetimes, LinkageStack stack) {
"""
<p>
Subtract one record from another. For example, subtracting
<code>{null f}</code> from <code>{int|null f}</code> leaves
<code>{int f}</code>. Unfortunately, there are relatively limited conditions
when a genuine subtraction can occur. For example, subtracting
<code>{null f, null g}</code> from <code>{int|null f, int|null g}</code>
leaves <code>{int|null f, int|null g}</code>! This may seem surprising but it
makes sense if we consider that without <code>{null f, null g}</code> the
type <code>{int|null f, int|null g}</code> still contains
<code>{int f, int|null g}</code> and <code>{int|null f, int g}</code>.
</p>
<p>
What are the conditions under which a subtraction can take place? When
subtracting <code>{S1 f1, ..., Sn fn}</code> from
<code>{T1 f1, ..., Tn fn}</code> we can have at most one "pivot". That is
some <code>i</code> where <code>Ti - Si != void</code>. For example,
subtracting <code>{int|null f, int g}</code> from
<code>{int|null f, int|null g}</code> the pivot is field <code>g</code>. The
final result is then (perhaps surprisingly)
<code>{int|null f, null g}</code>.
</p>
"""
Tuple<Type.Field> lhsFields = lhs.getFields();
Tuple<Type.Field> rhsFields = rhs.getFields();
// Check the number of field matches
int matches = countFieldMatches(lhsFields,rhsFields);
if(matches < rhsFields.size()) {
// At least one field in rhs has no match in lhs. This is definitely a redundant
// subtraction.
return lhs;
} else if(matches < lhsFields.size() && !rhs.isOpen()) {
// At least one field in lhs has not match in rhs. If the rhs is open, this is
// fine as it will auto-fill. But, if its not open, then this is redundant.
return lhs;
}
// Extract all pivot fields (i.e. fields with non-void subtraction)
Type.Field[] pivots = determinePivotFields(lhsFields, rhsFields, lifetimes, stack);
// Check how many pivots we have actuallyfound
int count = countPivots(pivots);
// Act on number of pivots found
switch(count) {
case 0:
// no pivots found means everything was void.
return lhs.isOpen() == rhs.isOpen() ? Type.Void : lhs;
case 1:
// Exactly one pivot found. This is something we can work with!
for(int i=0;i!=pivots.length;++i) {
if(pivots[i] == null) {
pivots[i] = lhsFields.get(i);
}
}
return new Type.Record(lhs.isOpen(),new Tuple<>(pivots));
default:
// All other cases basically are redundant.
return lhs;
}
} | java | @Override
protected Type apply(Record lhs, Record rhs, LifetimeRelation lifetimes, LinkageStack stack) {
Tuple<Type.Field> lhsFields = lhs.getFields();
Tuple<Type.Field> rhsFields = rhs.getFields();
// Check the number of field matches
int matches = countFieldMatches(lhsFields,rhsFields);
if(matches < rhsFields.size()) {
// At least one field in rhs has no match in lhs. This is definitely a redundant
// subtraction.
return lhs;
} else if(matches < lhsFields.size() && !rhs.isOpen()) {
// At least one field in lhs has not match in rhs. If the rhs is open, this is
// fine as it will auto-fill. But, if its not open, then this is redundant.
return lhs;
}
// Extract all pivot fields (i.e. fields with non-void subtraction)
Type.Field[] pivots = determinePivotFields(lhsFields, rhsFields, lifetimes, stack);
// Check how many pivots we have actuallyfound
int count = countPivots(pivots);
// Act on number of pivots found
switch(count) {
case 0:
// no pivots found means everything was void.
return lhs.isOpen() == rhs.isOpen() ? Type.Void : lhs;
case 1:
// Exactly one pivot found. This is something we can work with!
for(int i=0;i!=pivots.length;++i) {
if(pivots[i] == null) {
pivots[i] = lhsFields.get(i);
}
}
return new Type.Record(lhs.isOpen(),new Tuple<>(pivots));
default:
// All other cases basically are redundant.
return lhs;
}
} | [
"@",
"Override",
"protected",
"Type",
"apply",
"(",
"Record",
"lhs",
",",
"Record",
"rhs",
",",
"LifetimeRelation",
"lifetimes",
",",
"LinkageStack",
"stack",
")",
"{",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"lhsFields",
"=",
"lhs",
".",
"getFields",
"(",
")",
";",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"rhsFields",
"=",
"rhs",
".",
"getFields",
"(",
")",
";",
"// Check the number of field matches",
"int",
"matches",
"=",
"countFieldMatches",
"(",
"lhsFields",
",",
"rhsFields",
")",
";",
"if",
"(",
"matches",
"<",
"rhsFields",
".",
"size",
"(",
")",
")",
"{",
"// At least one field in rhs has no match in lhs. This is definitely a redundant",
"// subtraction.",
"return",
"lhs",
";",
"}",
"else",
"if",
"(",
"matches",
"<",
"lhsFields",
".",
"size",
"(",
")",
"&&",
"!",
"rhs",
".",
"isOpen",
"(",
")",
")",
"{",
"// At least one field in lhs has not match in rhs. If the rhs is open, this is",
"// fine as it will auto-fill. But, if its not open, then this is redundant.",
"return",
"lhs",
";",
"}",
"// Extract all pivot fields (i.e. fields with non-void subtraction)",
"Type",
".",
"Field",
"[",
"]",
"pivots",
"=",
"determinePivotFields",
"(",
"lhsFields",
",",
"rhsFields",
",",
"lifetimes",
",",
"stack",
")",
";",
"// Check how many pivots we have actuallyfound",
"int",
"count",
"=",
"countPivots",
"(",
"pivots",
")",
";",
"// Act on number of pivots found",
"switch",
"(",
"count",
")",
"{",
"case",
"0",
":",
"// no pivots found means everything was void.",
"return",
"lhs",
".",
"isOpen",
"(",
")",
"==",
"rhs",
".",
"isOpen",
"(",
")",
"?",
"Type",
".",
"Void",
":",
"lhs",
";",
"case",
"1",
":",
"// Exactly one pivot found. This is something we can work with!",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"pivots",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"pivots",
"[",
"i",
"]",
"==",
"null",
")",
"{",
"pivots",
"[",
"i",
"]",
"=",
"lhsFields",
".",
"get",
"(",
"i",
")",
";",
"}",
"}",
"return",
"new",
"Type",
".",
"Record",
"(",
"lhs",
".",
"isOpen",
"(",
")",
",",
"new",
"Tuple",
"<>",
"(",
"pivots",
")",
")",
";",
"default",
":",
"// All other cases basically are redundant.",
"return",
"lhs",
";",
"}",
"}"
] | <p>
Subtract one record from another. For example, subtracting
<code>{null f}</code> from <code>{int|null f}</code> leaves
<code>{int f}</code>. Unfortunately, there are relatively limited conditions
when a genuine subtraction can occur. For example, subtracting
<code>{null f, null g}</code> from <code>{int|null f, int|null g}</code>
leaves <code>{int|null f, int|null g}</code>! This may seem surprising but it
makes sense if we consider that without <code>{null f, null g}</code> the
type <code>{int|null f, int|null g}</code> still contains
<code>{int f, int|null g}</code> and <code>{int|null f, int g}</code>.
</p>
<p>
What are the conditions under which a subtraction can take place? When
subtracting <code>{S1 f1, ..., Sn fn}</code> from
<code>{T1 f1, ..., Tn fn}</code> we can have at most one "pivot". That is
some <code>i</code> where <code>Ti - Si != void</code>. For example,
subtracting <code>{int|null f, int g}</code> from
<code>{int|null f, int|null g}</code> the pivot is field <code>g</code>. The
final result is then (perhaps surprisingly)
<code>{int|null f, null g}</code>.
</p> | [
"<p",
">",
"Subtract",
"one",
"record",
"from",
"another",
".",
"For",
"example",
"subtracting",
"<code",
">",
"{",
"null",
"f",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"int|null",
"f",
"}",
"<",
"/",
"code",
">",
"leaves",
"<code",
">",
"{",
"int",
"f",
"}",
"<",
"/",
"code",
">",
".",
"Unfortunately",
"there",
"are",
"relatively",
"limited",
"conditions",
"when",
"a",
"genuine",
"subtraction",
"can",
"occur",
".",
"For",
"example",
"subtracting",
"<code",
">",
"{",
"null",
"f",
"null",
"g",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"leaves",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"!",
"This",
"may",
"seem",
"surprising",
"but",
"it",
"makes",
"sense",
"if",
"we",
"consider",
"that",
"without",
"<code",
">",
"{",
"null",
"f",
"null",
"g",
"}",
"<",
"/",
"code",
">",
"the",
"type",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"still",
"contains",
"<code",
">",
"{",
"int",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"{",
"int|null",
"f",
"int",
"g",
"}",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"What",
"are",
"the",
"conditions",
"under",
"which",
"a",
"subtraction",
"can",
"take",
"place?",
"When",
"subtracting",
"<code",
">",
"{",
"S1",
"f1",
"...",
"Sn",
"fn",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"T1",
"f1",
"...",
"Tn",
"fn",
"}",
"<",
"/",
"code",
">",
"we",
"can",
"have",
"at",
"most",
"one",
"pivot",
".",
"That",
"is",
"some",
"<code",
">",
"i<",
"/",
"code",
">",
"where",
"<code",
">",
"Ti",
"-",
"Si",
"!",
"=",
"void<",
"/",
"code",
">",
".",
"For",
"example",
"subtracting",
"<code",
">",
"{",
"int|null",
"f",
"int",
"g",
"}",
"<",
"/",
"code",
">",
"from",
"<code",
">",
"{",
"int|null",
"f",
"int|null",
"g",
"}",
"<",
"/",
"code",
">",
"the",
"pivot",
"is",
"field",
"<code",
">",
"g<",
"/",
"code",
">",
".",
"The",
"final",
"result",
"is",
"then",
"(",
"perhaps",
"surprisingly",
")",
"<code",
">",
"{",
"int|null",
"f",
"null",
"g",
"}",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/TypeSubtractor.java#L107-L143 |
akarnokd/akarnokd-xml | src/main/java/hu/akarnokd/xml/XNElement.java | XNElement.getDouble | public double getDouble(String name, String namespace, double defaultValue) {
"""
Returns the attribute as a double value or the default.
@param name the attribute name
@param namespace the attribute namespace
@param defaultValue the default if the attribute is missing
@return the value
"""
String v = get(name, namespace);
return v != null ? Double.parseDouble(v) : defaultValue;
} | java | public double getDouble(String name, String namespace, double defaultValue) {
String v = get(name, namespace);
return v != null ? Double.parseDouble(v) : defaultValue;
} | [
"public",
"double",
"getDouble",
"(",
"String",
"name",
",",
"String",
"namespace",
",",
"double",
"defaultValue",
")",
"{",
"String",
"v",
"=",
"get",
"(",
"name",
",",
"namespace",
")",
";",
"return",
"v",
"!=",
"null",
"?",
"Double",
".",
"parseDouble",
"(",
"v",
")",
":",
"defaultValue",
";",
"}"
] | Returns the attribute as a double value or the default.
@param name the attribute name
@param namespace the attribute namespace
@param defaultValue the default if the attribute is missing
@return the value | [
"Returns",
"the",
"attribute",
"as",
"a",
"double",
"value",
"or",
"the",
"default",
"."
] | train | https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L797-L800 |
open-pay/openpay-java | src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java | OpenpayFeesOperations.getSummary | public OpenpayFeesSummary getSummary(final int year, final int month) throws OpenpayServiceException,
ServiceUnavailableException {
"""
Retrieve the summary of the charged fees in the given month. The amounts retrieved in the current month may
change on a daily basis.
@param year Year of the date to retrieve
@param month Month to retrieve
@return The summary of the fees charged by Openpay.
@throws OpenpayServiceException If the service returns an error
@throws ServiceUnavailableException If the service is not available
"""
String path = String.format(FEES_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
return this.getJsonClient().get(path, params, OpenpayFeesSummary.class);
} | java | public OpenpayFeesSummary getSummary(final int year, final int month) throws OpenpayServiceException,
ServiceUnavailableException {
String path = String.format(FEES_PATH, this.getMerchantId());
Map<String, String> params = new HashMap<String, String>();
params.put("year", String.valueOf(year));
params.put("month", String.valueOf(month));
return this.getJsonClient().get(path, params, OpenpayFeesSummary.class);
} | [
"public",
"OpenpayFeesSummary",
"getSummary",
"(",
"final",
"int",
"year",
",",
"final",
"int",
"month",
")",
"throws",
"OpenpayServiceException",
",",
"ServiceUnavailableException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"FEES_PATH",
",",
"this",
".",
"getMerchantId",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"year\"",
",",
"String",
".",
"valueOf",
"(",
"year",
")",
")",
";",
"params",
".",
"put",
"(",
"\"month\"",
",",
"String",
".",
"valueOf",
"(",
"month",
")",
")",
";",
"return",
"this",
".",
"getJsonClient",
"(",
")",
".",
"get",
"(",
"path",
",",
"params",
",",
"OpenpayFeesSummary",
".",
"class",
")",
";",
"}"
] | Retrieve the summary of the charged fees in the given month. The amounts retrieved in the current month may
change on a daily basis.
@param year Year of the date to retrieve
@param month Month to retrieve
@return The summary of the fees charged by Openpay.
@throws OpenpayServiceException If the service returns an error
@throws ServiceUnavailableException If the service is not available | [
"Retrieve",
"the",
"summary",
"of",
"the",
"charged",
"fees",
"in",
"the",
"given",
"month",
".",
"The",
"amounts",
"retrieved",
"in",
"the",
"current",
"month",
"may",
"change",
"on",
"a",
"daily",
"basis",
"."
] | train | https://github.com/open-pay/openpay-java/blob/7f4220466b394dd54e2b1642821dde7daebc5433/src/main/java/mx/openpay/client/core/operations/OpenpayFeesOperations.java#L58-L65 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java | ThreadLocalRandom.doubles | public DoubleStream doubles(long streamSize, double randomNumberOrigin,
double randomNumberBound) {
"""
Returns a stream producing the given {@code streamSize} number of
pseudorandom {@code double} values, each conforming to the given origin
(inclusive) and bound (exclusive).
@param streamSize the number of values to generate
@param randomNumberOrigin the origin (inclusive) of each random value
@param randomNumberBound the bound (exclusive) of each random value
@return a stream of pseudorandom {@code double} values,
each with the given origin (inclusive) and bound (exclusive)
@throws IllegalArgumentException if {@code streamSize} is
less than zero
@throws IllegalArgumentException if {@code randomNumberOrigin}
is greater than or equal to {@code randomNumberBound}
@since 1.8
"""
if (streamSize < 0L)
throw new IllegalArgumentException(BAD_SIZE);
if (!(randomNumberOrigin < randomNumberBound))
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.doubleStream
(new RandomDoublesSpliterator
(0L, streamSize, randomNumberOrigin, randomNumberBound),
false);
} | java | public DoubleStream doubles(long streamSize, double randomNumberOrigin,
double randomNumberBound) {
if (streamSize < 0L)
throw new IllegalArgumentException(BAD_SIZE);
if (!(randomNumberOrigin < randomNumberBound))
throw new IllegalArgumentException(BAD_RANGE);
return StreamSupport.doubleStream
(new RandomDoublesSpliterator
(0L, streamSize, randomNumberOrigin, randomNumberBound),
false);
} | [
"public",
"DoubleStream",
"doubles",
"(",
"long",
"streamSize",
",",
"double",
"randomNumberOrigin",
",",
"double",
"randomNumberBound",
")",
"{",
"if",
"(",
"streamSize",
"<",
"0L",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"BAD_SIZE",
")",
";",
"if",
"(",
"!",
"(",
"randomNumberOrigin",
"<",
"randomNumberBound",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"BAD_RANGE",
")",
";",
"return",
"StreamSupport",
".",
"doubleStream",
"(",
"new",
"RandomDoublesSpliterator",
"(",
"0L",
",",
"streamSize",
",",
"randomNumberOrigin",
",",
"randomNumberBound",
")",
",",
"false",
")",
";",
"}"
] | Returns a stream producing the given {@code streamSize} number of
pseudorandom {@code double} values, each conforming to the given origin
(inclusive) and bound (exclusive).
@param streamSize the number of values to generate
@param randomNumberOrigin the origin (inclusive) of each random value
@param randomNumberBound the bound (exclusive) of each random value
@return a stream of pseudorandom {@code double} values,
each with the given origin (inclusive) and bound (exclusive)
@throws IllegalArgumentException if {@code streamSize} is
less than zero
@throws IllegalArgumentException if {@code randomNumberOrigin}
is greater than or equal to {@code randomNumberBound}
@since 1.8 | [
"Returns",
"a",
"stream",
"producing",
"the",
"given",
"{",
"@code",
"streamSize",
"}",
"number",
"of",
"pseudorandom",
"{",
"@code",
"double",
"}",
"values",
"each",
"conforming",
"to",
"the",
"given",
"origin",
"(",
"inclusive",
")",
"and",
"bound",
"(",
"exclusive",
")",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L694-L704 |
damianszczepanik/cucumber-reporting | src/main/java/net/masterthought/cucumber/Configuration.java | Configuration.addClassifications | public void addClassifications(String name, String value) {
"""
Adds metadata that will be displayed at the main page of the report. It is useful when there is a few reports are
generated at the same time but with different parameters/configurations.
@param name name of the property
@param value value of the property
"""
classifications.add(new AbstractMap.SimpleEntry<>(name, value));
} | java | public void addClassifications(String name, String value) {
classifications.add(new AbstractMap.SimpleEntry<>(name, value));
} | [
"public",
"void",
"addClassifications",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"classifications",
".",
"add",
"(",
"new",
"AbstractMap",
".",
"SimpleEntry",
"<>",
"(",
"name",
",",
"value",
")",
")",
";",
"}"
] | Adds metadata that will be displayed at the main page of the report. It is useful when there is a few reports are
generated at the same time but with different parameters/configurations.
@param name name of the property
@param value value of the property | [
"Adds",
"metadata",
"that",
"will",
"be",
"displayed",
"at",
"the",
"main",
"page",
"of",
"the",
"report",
".",
"It",
"is",
"useful",
"when",
"there",
"is",
"a",
"few",
"reports",
"are",
"generated",
"at",
"the",
"same",
"time",
"but",
"with",
"different",
"parameters",
"/",
"configurations",
"."
] | train | https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/Configuration.java#L197-L199 |
nuun-io/kernel | core/src/main/java/io/nuun/kernel/core/internal/utils/AssertUtils.java | AssertUtils.hasAnnotationDeep | public static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate) {
"""
Indicates if a class or at least one of its annotations is annotated by a given annotation.
<p>
Notice that the classes with a package name starting with "java.lang" will be ignored.
</p>
@param memberDeclaringClass the class to check
@param candidate the annotation to find
@return true if the annotation is found, false otherwise
"""
if (memberDeclaringClass.equals(candidate))
{
return true;
}
for (Annotation anno : memberDeclaringClass.getAnnotations())
{
Class<? extends Annotation> annoClass = anno.annotationType();
if (!annoClass.getPackage().getName().startsWith("java.lang") && hasAnnotationDeep(annoClass, candidate))
{
return true;
}
}
return false;
} | java | public static boolean hasAnnotationDeep(Class<?> memberDeclaringClass, Class<? extends Annotation> candidate)
{
if (memberDeclaringClass.equals(candidate))
{
return true;
}
for (Annotation anno : memberDeclaringClass.getAnnotations())
{
Class<? extends Annotation> annoClass = anno.annotationType();
if (!annoClass.getPackage().getName().startsWith("java.lang") && hasAnnotationDeep(annoClass, candidate))
{
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasAnnotationDeep",
"(",
"Class",
"<",
"?",
">",
"memberDeclaringClass",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"candidate",
")",
"{",
"if",
"(",
"memberDeclaringClass",
".",
"equals",
"(",
"candidate",
")",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"Annotation",
"anno",
":",
"memberDeclaringClass",
".",
"getAnnotations",
"(",
")",
")",
"{",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annoClass",
"=",
"anno",
".",
"annotationType",
"(",
")",
";",
"if",
"(",
"!",
"annoClass",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"\"java.lang\"",
")",
"&&",
"hasAnnotationDeep",
"(",
"annoClass",
",",
"candidate",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Indicates if a class or at least one of its annotations is annotated by a given annotation.
<p>
Notice that the classes with a package name starting with "java.lang" will be ignored.
</p>
@param memberDeclaringClass the class to check
@param candidate the annotation to find
@return true if the annotation is found, false otherwise | [
"Indicates",
"if",
"a",
"class",
"or",
"at",
"least",
"one",
"of",
"its",
"annotations",
"is",
"annotated",
"by",
"a",
"given",
"annotation",
".",
"<p",
">",
"Notice",
"that",
"the",
"classes",
"with",
"a",
"package",
"name",
"starting",
"with",
"java",
".",
"lang",
"will",
"be",
"ignored",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/nuun-io/kernel/blob/116a7664fe2a9323e280574803d273699a333732/core/src/main/java/io/nuun/kernel/core/internal/utils/AssertUtils.java#L89-L107 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsole.java | GVRConsole.setCanvasWidthHeight | public void setCanvasWidthHeight(int width, int height) {
"""
Sets the width and height of the canvas the text is drawn to.
@param width
width of the new canvas.
@param height
hegiht of the new canvas.
"""
hudWidth = width;
hudHeight = height;
HUD = Bitmap.createBitmap(width, height, Config.ARGB_8888);
canvas = new Canvas(HUD);
texture = null;
} | java | public void setCanvasWidthHeight(int width, int height) {
hudWidth = width;
hudHeight = height;
HUD = Bitmap.createBitmap(width, height, Config.ARGB_8888);
canvas = new Canvas(HUD);
texture = null;
} | [
"public",
"void",
"setCanvasWidthHeight",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"hudWidth",
"=",
"width",
";",
"hudHeight",
"=",
"height",
";",
"HUD",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"width",
",",
"height",
",",
"Config",
".",
"ARGB_8888",
")",
";",
"canvas",
"=",
"new",
"Canvas",
"(",
"HUD",
")",
";",
"texture",
"=",
"null",
";",
"}"
] | Sets the width and height of the canvas the text is drawn to.
@param width
width of the new canvas.
@param height
hegiht of the new canvas. | [
"Sets",
"the",
"width",
"and",
"height",
"of",
"the",
"canvas",
"the",
"text",
"is",
"drawn",
"to",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsole.java#L336-L342 |
JavaKoan/koan-annotations | src/main/java/com/javakoan/fixture/io/KoanReader.java | KoanReader.getSolutionFromFile | public static String getSolutionFromFile(Class<?> koanClass, String methodName) {
"""
Gets solution for a koan by method name.
@param koanClass the koan class
@param methodName the method name of the solution required
@return the solution content to be inserted between the koan start and end markers
"""
return getSourceFromFile(koanClass, methodName, SOLUTION_EXTENSION);
} | java | public static String getSolutionFromFile(Class<?> koanClass, String methodName){
return getSourceFromFile(koanClass, methodName, SOLUTION_EXTENSION);
} | [
"public",
"static",
"String",
"getSolutionFromFile",
"(",
"Class",
"<",
"?",
">",
"koanClass",
",",
"String",
"methodName",
")",
"{",
"return",
"getSourceFromFile",
"(",
"koanClass",
",",
"methodName",
",",
"SOLUTION_EXTENSION",
")",
";",
"}"
] | Gets solution for a koan by method name.
@param koanClass the koan class
@param methodName the method name of the solution required
@return the solution content to be inserted between the koan start and end markers | [
"Gets",
"solution",
"for",
"a",
"koan",
"by",
"method",
"name",
"."
] | train | https://github.com/JavaKoan/koan-annotations/blob/e3c4872ae57051a0b74b2efa6f15f4ee9e37d263/src/main/java/com/javakoan/fixture/io/KoanReader.java#L103-L105 |
threerings/playn | java/src/playn/java/JavaGraphics.java | JavaGraphics.registerFont | public void registerFont(String name, String path) {
"""
Registers a font with the graphics system.
@param name the name under which to register the font.
@param path the path to the font resource (relative to the asset manager's path prefix).
Currently only TrueType ({@code .ttf}) fonts are supported.
"""
try {
_fonts.put(name, ((JavaAssets) assets()).requireResource(path).createFont());
} catch (Exception e) {
platform.reportError("Failed to load font [name=" + name + ", path=" + path + "]", e);
}
} | java | public void registerFont(String name, String path) {
try {
_fonts.put(name, ((JavaAssets) assets()).requireResource(path).createFont());
} catch (Exception e) {
platform.reportError("Failed to load font [name=" + name + ", path=" + path + "]", e);
}
} | [
"public",
"void",
"registerFont",
"(",
"String",
"name",
",",
"String",
"path",
")",
"{",
"try",
"{",
"_fonts",
".",
"put",
"(",
"name",
",",
"(",
"(",
"JavaAssets",
")",
"assets",
"(",
")",
")",
".",
"requireResource",
"(",
"path",
")",
".",
"createFont",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"platform",
".",
"reportError",
"(",
"\"Failed to load font [name=\"",
"+",
"name",
"+",
"\", path=\"",
"+",
"path",
"+",
"\"]\"",
",",
"e",
")",
";",
"}",
"}"
] | Registers a font with the graphics system.
@param name the name under which to register the font.
@param path the path to the font resource (relative to the asset manager's path prefix).
Currently only TrueType ({@code .ttf}) fonts are supported. | [
"Registers",
"a",
"font",
"with",
"the",
"graphics",
"system",
"."
] | train | https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/java/src/playn/java/JavaGraphics.java#L83-L89 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.findAll | @Override
public List<CPFriendlyURLEntry> findAll() {
"""
Returns all the cp friendly url entries.
@return the cp friendly url entries
"""
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPFriendlyURLEntry> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPFriendlyURLEntry",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp friendly url entries.
@return the cp friendly url entries | [
"Returns",
"all",
"the",
"cp",
"friendly",
"url",
"entries",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L5818-L5821 |
landawn/AbacusUtil | src/com/landawn/abacus/util/CouchbaseExecutor.java | CouchbaseExecutor.asyncExists | @SafeVarargs
public final ContinuableFuture<Boolean> asyncExists(final String query, final Object... parameters) {
"""
Always remember to set "<code>LIMIT 1</code>" in the sql statement for better performance.
@param query
@param parameters
@return
"""
return asyncExecutor.execute(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return exists(query, parameters);
}
});
} | java | @SafeVarargs
public final ContinuableFuture<Boolean> asyncExists(final String query, final Object... parameters) {
return asyncExecutor.execute(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return exists(query, parameters);
}
});
} | [
"@",
"SafeVarargs",
"public",
"final",
"ContinuableFuture",
"<",
"Boolean",
">",
"asyncExists",
"(",
"final",
"String",
"query",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"return",
"asyncExecutor",
".",
"execute",
"(",
"new",
"Callable",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"call",
"(",
")",
"throws",
"Exception",
"{",
"return",
"exists",
"(",
"query",
",",
"parameters",
")",
";",
"}",
"}",
")",
";",
"}"
] | Always remember to set "<code>LIMIT 1</code>" in the sql statement for better performance.
@param query
@param parameters
@return | [
"Always",
"remember",
"to",
"set",
"<code",
">",
"LIMIT",
"1<",
"/",
"code",
">",
"in",
"the",
"sql",
"statement",
"for",
"better",
"performance",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CouchbaseExecutor.java#L1201-L1209 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/FormDataParser.java | FormDataParser.getObject | private static JsonObject getObject(JsonObject object, String key)
throws IOException {
"""
Get a child JSON Object from an incoming JSON object. If the child does
not exist it will be created.
@param object The incoming object we are to look inside
@param key The child node we are looking for
@return JsonObject The child we found or created
@throws IOException if there is a type mismatch on existing data
"""
// Get the existing one
if (object.containsKey(key)) {
Object existing = object.get(key);
if (!(existing instanceof JsonObject)) {
throw new IOException("Invalid field structure, '" + key +
"' expected to be an object, but incompatible "
+ "data type already present.");
}
return (JsonObject) existing;
// Or add a new one
} else {
JsonObject newObject = new JsonObject();
object.put(key, newObject);
return newObject;
}
} | java | private static JsonObject getObject(JsonObject object, String key)
throws IOException {
// Get the existing one
if (object.containsKey(key)) {
Object existing = object.get(key);
if (!(existing instanceof JsonObject)) {
throw new IOException("Invalid field structure, '" + key +
"' expected to be an object, but incompatible "
+ "data type already present.");
}
return (JsonObject) existing;
// Or add a new one
} else {
JsonObject newObject = new JsonObject();
object.put(key, newObject);
return newObject;
}
} | [
"private",
"static",
"JsonObject",
"getObject",
"(",
"JsonObject",
"object",
",",
"String",
"key",
")",
"throws",
"IOException",
"{",
"// Get the existing one",
"if",
"(",
"object",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"Object",
"existing",
"=",
"object",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"!",
"(",
"existing",
"instanceof",
"JsonObject",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Invalid field structure, '\"",
"+",
"key",
"+",
"\"' expected to be an object, but incompatible \"",
"+",
"\"data type already present.\"",
")",
";",
"}",
"return",
"(",
"JsonObject",
")",
"existing",
";",
"// Or add a new one",
"}",
"else",
"{",
"JsonObject",
"newObject",
"=",
"new",
"JsonObject",
"(",
")",
";",
"object",
".",
"put",
"(",
"key",
",",
"newObject",
")",
";",
"return",
"newObject",
";",
"}",
"}"
] | Get a child JSON Object from an incoming JSON object. If the child does
not exist it will be created.
@param object The incoming object we are to look inside
@param key The child node we are looking for
@return JsonObject The child we found or created
@throws IOException if there is a type mismatch on existing data | [
"Get",
"a",
"child",
"JSON",
"Object",
"from",
"an",
"incoming",
"JSON",
"object",
".",
"If",
"the",
"child",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"."
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/FormDataParser.java#L300-L318 |
mediathekview/MServer | src/main/java/mServer/crawler/sender/hr/HrSendungenListDeserializer.java | HrSendungenListDeserializer.prepareUrl | private String prepareUrl(String theme, String url) {
"""
URL anpassen, so dass diese direkt die Übersicht der Folgen beinhaltet,
sofern diese Seite existiert!
Damit wird das unnötige Einlesen einer Zwischenseite gespart.
@param theme Thema der Sendung
@param url URL zu Startseite der Sendung
@return URL zu der Folgenübersicht der Sendung
"""
// Sonderseite für Hessenschau verwenden
if (theme.contains("hessenschau")) {
return "http://www.hessenschau.de/tv-sendung/sendungsarchiv/index.html";
}
// bei allen anderen, probieren, ob eine URL mit "sendungen" vor index.html existiert
String preparedUrl = url.replaceAll("index.html", "sendungen/index.html");
if (MediathekReader.urlExists(preparedUrl)) {
return preparedUrl;
}
return url;
} | java | private String prepareUrl(String theme, String url) {
// Sonderseite für Hessenschau verwenden
if (theme.contains("hessenschau")) {
return "http://www.hessenschau.de/tv-sendung/sendungsarchiv/index.html";
}
// bei allen anderen, probieren, ob eine URL mit "sendungen" vor index.html existiert
String preparedUrl = url.replaceAll("index.html", "sendungen/index.html");
if (MediathekReader.urlExists(preparedUrl)) {
return preparedUrl;
}
return url;
} | [
"private",
"String",
"prepareUrl",
"(",
"String",
"theme",
",",
"String",
"url",
")",
"{",
"// Sonderseite für Hessenschau verwenden",
"if",
"(",
"theme",
".",
"contains",
"(",
"\"hessenschau\"",
")",
")",
"{",
"return",
"\"http://www.hessenschau.de/tv-sendung/sendungsarchiv/index.html\"",
";",
"}",
"// bei allen anderen, probieren, ob eine URL mit \"sendungen\" vor index.html existiert",
"String",
"preparedUrl",
"=",
"url",
".",
"replaceAll",
"(",
"\"index.html\"",
",",
"\"sendungen/index.html\"",
")",
";",
"if",
"(",
"MediathekReader",
".",
"urlExists",
"(",
"preparedUrl",
")",
")",
"{",
"return",
"preparedUrl",
";",
"}",
"return",
"url",
";",
"}"
] | URL anpassen, so dass diese direkt die Übersicht der Folgen beinhaltet,
sofern diese Seite existiert!
Damit wird das unnötige Einlesen einer Zwischenseite gespart.
@param theme Thema der Sendung
@param url URL zu Startseite der Sendung
@return URL zu der Folgenübersicht der Sendung | [
"URL",
"anpassen",
"so",
"dass",
"diese",
"direkt",
"die",
"Übersicht",
"der",
"Folgen",
"beinhaltet",
"sofern",
"diese",
"Seite",
"existiert!",
"Damit",
"wird",
"das",
"unnötige",
"Einlesen",
"einer",
"Zwischenseite",
"gespart",
"."
] | train | https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/sender/hr/HrSendungenListDeserializer.java#L53-L66 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java | CacheManager.downloadAreaAsyncNoUI | public CacheManagerTask downloadAreaAsyncNoUI(Context ctx, BoundingBox bb, final int zoomMin, final int zoomMax, final CacheManagerCallback callback) {
"""
Download in background all tiles of the specified area in osmdroid cache without a user interface.
@param ctx
@param bb
@param zoomMin
@param zoomMax
@since 5.3
"""
final CacheManagerTask task = new CacheManagerTask(this, getDownloadingAction(), bb, zoomMin, zoomMax);
task.addCallback(callback);
execute(task);
return task;
} | java | public CacheManagerTask downloadAreaAsyncNoUI(Context ctx, BoundingBox bb, final int zoomMin, final int zoomMax, final CacheManagerCallback callback) {
final CacheManagerTask task = new CacheManagerTask(this, getDownloadingAction(), bb, zoomMin, zoomMax);
task.addCallback(callback);
execute(task);
return task;
} | [
"public",
"CacheManagerTask",
"downloadAreaAsyncNoUI",
"(",
"Context",
"ctx",
",",
"BoundingBox",
"bb",
",",
"final",
"int",
"zoomMin",
",",
"final",
"int",
"zoomMax",
",",
"final",
"CacheManagerCallback",
"callback",
")",
"{",
"final",
"CacheManagerTask",
"task",
"=",
"new",
"CacheManagerTask",
"(",
"this",
",",
"getDownloadingAction",
"(",
")",
",",
"bb",
",",
"zoomMin",
",",
"zoomMax",
")",
";",
"task",
".",
"addCallback",
"(",
"callback",
")",
";",
"execute",
"(",
"task",
")",
";",
"return",
"task",
";",
"}"
] | Download in background all tiles of the specified area in osmdroid cache without a user interface.
@param ctx
@param bb
@param zoomMin
@param zoomMax
@since 5.3 | [
"Download",
"in",
"background",
"all",
"tiles",
"of",
"the",
"specified",
"area",
"in",
"osmdroid",
"cache",
"without",
"a",
"user",
"interface",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java#L467-L472 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java | ExpressRouteCrossConnectionPeeringsInner.listAsync | public Observable<Page<ExpressRouteCrossConnectionPeeringInner>> listAsync(final String resourceGroupName, final String crossConnectionName) {
"""
Gets all peerings in a specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ExpressRouteCrossConnectionPeeringInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, crossConnectionName)
.map(new Func1<ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>>, Page<ExpressRouteCrossConnectionPeeringInner>>() {
@Override
public Page<ExpressRouteCrossConnectionPeeringInner> call(ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ExpressRouteCrossConnectionPeeringInner>> listAsync(final String resourceGroupName, final String crossConnectionName) {
return listWithServiceResponseAsync(resourceGroupName, crossConnectionName)
.map(new Func1<ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>>, Page<ExpressRouteCrossConnectionPeeringInner>>() {
@Override
public Page<ExpressRouteCrossConnectionPeeringInner> call(ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ExpressRouteCrossConnectionPeeringInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"crossConnectionName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"crossConnectionName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ExpressRouteCrossConnectionPeeringInner",
">",
">",
",",
"Page",
"<",
"ExpressRouteCrossConnectionPeeringInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"ExpressRouteCrossConnectionPeeringInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"ExpressRouteCrossConnectionPeeringInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets all peerings in a specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ExpressRouteCrossConnectionPeeringInner> object | [
"Gets",
"all",
"peerings",
"in",
"a",
"specified",
"ExpressRouteCrossConnection",
"."
] | 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/ExpressRouteCrossConnectionPeeringsInner.java#L143-L151 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java | Normalizer.getFC_NFKC_Closure | @Deprecated
public static int getFC_NFKC_Closure(int c,char[] dest) {
"""
Gets the FC_NFKC closure value.
@param c The code point whose closure value is to be retrieved
@param dest The char array to receive the closure value
@return the length of the closure value; 0 if there is none
@deprecated ICU 56
@hide original deprecated declaration
"""
String closure=getFC_NFKC_Closure(c);
int length=closure.length();
if(length!=0 && dest!=null && length<=dest.length) {
closure.getChars(0, length, dest, 0);
}
return length;
} | java | @Deprecated
public static int getFC_NFKC_Closure(int c,char[] dest) {
String closure=getFC_NFKC_Closure(c);
int length=closure.length();
if(length!=0 && dest!=null && length<=dest.length) {
closure.getChars(0, length, dest, 0);
}
return length;
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"getFC_NFKC_Closure",
"(",
"int",
"c",
",",
"char",
"[",
"]",
"dest",
")",
"{",
"String",
"closure",
"=",
"getFC_NFKC_Closure",
"(",
"c",
")",
";",
"int",
"length",
"=",
"closure",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"!=",
"0",
"&&",
"dest",
"!=",
"null",
"&&",
"length",
"<=",
"dest",
".",
"length",
")",
"{",
"closure",
".",
"getChars",
"(",
"0",
",",
"length",
",",
"dest",
",",
"0",
")",
";",
"}",
"return",
"length",
";",
"}"
] | Gets the FC_NFKC closure value.
@param c The code point whose closure value is to be retrieved
@param dest The char array to receive the closure value
@return the length of the closure value; 0 if there is none
@deprecated ICU 56
@hide original deprecated declaration | [
"Gets",
"the",
"FC_NFKC",
"closure",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L1459-L1467 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java | TableMgr.createTable | public void createTable(String tblName, Schema sch, Transaction tx) {
"""
Creates a new table having the specified name and schema.
@param tblName
the name of the new table
@param sch
the table's schema
@param tx
the transaction creating the table
"""
if (tblName != TCAT_TBLNAME && tblName != FCAT_TBLNAME)
formatFileHeader(tblName, tx);
// Optimization: store the ti
tiMap.put(tblName, new TableInfo(tblName, sch));
// insert one record into tblcat
RecordFile tcatfile = tcatInfo.open(tx, true);
tcatfile.insert();
tcatfile.setVal(TCAT_TBLNAME, new VarcharConstant(tblName));
tcatfile.close();
// insert a record into fldcat for each field
RecordFile fcatfile = fcatInfo.open(tx, true);
for (String fldname : sch.fields()) {
fcatfile.insert();
fcatfile.setVal(FCAT_TBLNAME, new VarcharConstant(tblName));
fcatfile.setVal(FCAT_FLDNAME, new VarcharConstant(fldname));
fcatfile.setVal(FCAT_TYPE, new IntegerConstant(sch.type(fldname)
.getSqlType()));
fcatfile.setVal(FCAT_TYPEARG, new IntegerConstant(sch.type(fldname)
.getArgument()));
}
fcatfile.close();
} | java | public void createTable(String tblName, Schema sch, Transaction tx) {
if (tblName != TCAT_TBLNAME && tblName != FCAT_TBLNAME)
formatFileHeader(tblName, tx);
// Optimization: store the ti
tiMap.put(tblName, new TableInfo(tblName, sch));
// insert one record into tblcat
RecordFile tcatfile = tcatInfo.open(tx, true);
tcatfile.insert();
tcatfile.setVal(TCAT_TBLNAME, new VarcharConstant(tblName));
tcatfile.close();
// insert a record into fldcat for each field
RecordFile fcatfile = fcatInfo.open(tx, true);
for (String fldname : sch.fields()) {
fcatfile.insert();
fcatfile.setVal(FCAT_TBLNAME, new VarcharConstant(tblName));
fcatfile.setVal(FCAT_FLDNAME, new VarcharConstant(fldname));
fcatfile.setVal(FCAT_TYPE, new IntegerConstant(sch.type(fldname)
.getSqlType()));
fcatfile.setVal(FCAT_TYPEARG, new IntegerConstant(sch.type(fldname)
.getArgument()));
}
fcatfile.close();
} | [
"public",
"void",
"createTable",
"(",
"String",
"tblName",
",",
"Schema",
"sch",
",",
"Transaction",
"tx",
")",
"{",
"if",
"(",
"tblName",
"!=",
"TCAT_TBLNAME",
"&&",
"tblName",
"!=",
"FCAT_TBLNAME",
")",
"formatFileHeader",
"(",
"tblName",
",",
"tx",
")",
";",
"// Optimization: store the ti\r",
"tiMap",
".",
"put",
"(",
"tblName",
",",
"new",
"TableInfo",
"(",
"tblName",
",",
"sch",
")",
")",
";",
"// insert one record into tblcat\r",
"RecordFile",
"tcatfile",
"=",
"tcatInfo",
".",
"open",
"(",
"tx",
",",
"true",
")",
";",
"tcatfile",
".",
"insert",
"(",
")",
";",
"tcatfile",
".",
"setVal",
"(",
"TCAT_TBLNAME",
",",
"new",
"VarcharConstant",
"(",
"tblName",
")",
")",
";",
"tcatfile",
".",
"close",
"(",
")",
";",
"// insert a record into fldcat for each field\r",
"RecordFile",
"fcatfile",
"=",
"fcatInfo",
".",
"open",
"(",
"tx",
",",
"true",
")",
";",
"for",
"(",
"String",
"fldname",
":",
"sch",
".",
"fields",
"(",
")",
")",
"{",
"fcatfile",
".",
"insert",
"(",
")",
";",
"fcatfile",
".",
"setVal",
"(",
"FCAT_TBLNAME",
",",
"new",
"VarcharConstant",
"(",
"tblName",
")",
")",
";",
"fcatfile",
".",
"setVal",
"(",
"FCAT_FLDNAME",
",",
"new",
"VarcharConstant",
"(",
"fldname",
")",
")",
";",
"fcatfile",
".",
"setVal",
"(",
"FCAT_TYPE",
",",
"new",
"IntegerConstant",
"(",
"sch",
".",
"type",
"(",
"fldname",
")",
".",
"getSqlType",
"(",
")",
")",
")",
";",
"fcatfile",
".",
"setVal",
"(",
"FCAT_TYPEARG",
",",
"new",
"IntegerConstant",
"(",
"sch",
".",
"type",
"(",
"fldname",
")",
".",
"getArgument",
"(",
")",
")",
")",
";",
"}",
"fcatfile",
".",
"close",
"(",
")",
";",
"}"
] | Creates a new table having the specified name and schema.
@param tblName
the name of the new table
@param sch
the table's schema
@param tx
the transaction creating the table | [
"Creates",
"a",
"new",
"table",
"having",
"the",
"specified",
"name",
"and",
"schema",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/TableMgr.java#L121-L145 |
michael-rapp/AndroidPreferenceActivity | library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java | HideViewOnScrollAnimation.notifyOnScrollingDown | private void notifyOnScrollingDown(@NonNull final View animatedView, final int scrollPosition) {
"""
Notifies all listeners, which have been registered to be notified about the animation's
internal state, when the observed list view is scrolling downwards.
@param animatedView
The view, which is animated by the observed animation, as an instance of the class
{@link View}
@param scrollPosition
The current scroll position of the list view's first item in pixels as an {@link
Integer} value
"""
for (HideViewOnScrollAnimationListener listener : listeners) {
listener.onScrollingDown(this, animatedView, scrollPosition);
}
} | java | private void notifyOnScrollingDown(@NonNull final View animatedView, final int scrollPosition) {
for (HideViewOnScrollAnimationListener listener : listeners) {
listener.onScrollingDown(this, animatedView, scrollPosition);
}
} | [
"private",
"void",
"notifyOnScrollingDown",
"(",
"@",
"NonNull",
"final",
"View",
"animatedView",
",",
"final",
"int",
"scrollPosition",
")",
"{",
"for",
"(",
"HideViewOnScrollAnimationListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"onScrollingDown",
"(",
"this",
",",
"animatedView",
",",
"scrollPosition",
")",
";",
"}",
"}"
] | Notifies all listeners, which have been registered to be notified about the animation's
internal state, when the observed list view is scrolling downwards.
@param animatedView
The view, which is animated by the observed animation, as an instance of the class
{@link View}
@param scrollPosition
The current scroll position of the list view's first item in pixels as an {@link
Integer} value | [
"Notifies",
"all",
"listeners",
"which",
"have",
"been",
"registered",
"to",
"be",
"notified",
"about",
"the",
"animation",
"s",
"internal",
"state",
"when",
"the",
"observed",
"list",
"view",
"is",
"scrolling",
"downwards",
"."
] | train | https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/library/src/main/java/de/mrapp/android/preference/activity/animation/HideViewOnScrollAnimation.java#L107-L111 |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTable | private void readTable(InputStream is, SynchroTable table) throws IOException {
"""
Read data for a single table and store it.
@param is input stream
@param table table header
"""
int skip = table.getOffset() - m_offset;
if (skip != 0)
{
StreamHelper.skip(is, skip);
m_offset += skip;
}
String tableName = DatatypeConverter.getString(is);
int tableNameLength = 2 + tableName.length();
m_offset += tableNameLength;
int dataLength;
if (table.getLength() == -1)
{
dataLength = is.available();
}
else
{
dataLength = table.getLength() - tableNameLength;
}
SynchroLogger.log("READ", tableName);
byte[] compressedTableData = new byte[dataLength];
is.read(compressedTableData);
m_offset += dataLength;
Inflater inflater = new Inflater();
inflater.setInput(compressedTableData);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
byte[] buffer = new byte[1024];
while (!inflater.finished())
{
int count;
try
{
count = inflater.inflate(buffer);
}
catch (DataFormatException ex)
{
throw new IOException(ex);
}
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] uncompressedTableData = outputStream.toByteArray();
SynchroLogger.log(uncompressedTableData);
m_tableData.put(table.getName(), uncompressedTableData);
} | java | private void readTable(InputStream is, SynchroTable table) throws IOException
{
int skip = table.getOffset() - m_offset;
if (skip != 0)
{
StreamHelper.skip(is, skip);
m_offset += skip;
}
String tableName = DatatypeConverter.getString(is);
int tableNameLength = 2 + tableName.length();
m_offset += tableNameLength;
int dataLength;
if (table.getLength() == -1)
{
dataLength = is.available();
}
else
{
dataLength = table.getLength() - tableNameLength;
}
SynchroLogger.log("READ", tableName);
byte[] compressedTableData = new byte[dataLength];
is.read(compressedTableData);
m_offset += dataLength;
Inflater inflater = new Inflater();
inflater.setInput(compressedTableData);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
byte[] buffer = new byte[1024];
while (!inflater.finished())
{
int count;
try
{
count = inflater.inflate(buffer);
}
catch (DataFormatException ex)
{
throw new IOException(ex);
}
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] uncompressedTableData = outputStream.toByteArray();
SynchroLogger.log(uncompressedTableData);
m_tableData.put(table.getName(), uncompressedTableData);
} | [
"private",
"void",
"readTable",
"(",
"InputStream",
"is",
",",
"SynchroTable",
"table",
")",
"throws",
"IOException",
"{",
"int",
"skip",
"=",
"table",
".",
"getOffset",
"(",
")",
"-",
"m_offset",
";",
"if",
"(",
"skip",
"!=",
"0",
")",
"{",
"StreamHelper",
".",
"skip",
"(",
"is",
",",
"skip",
")",
";",
"m_offset",
"+=",
"skip",
";",
"}",
"String",
"tableName",
"=",
"DatatypeConverter",
".",
"getString",
"(",
"is",
")",
";",
"int",
"tableNameLength",
"=",
"2",
"+",
"tableName",
".",
"length",
"(",
")",
";",
"m_offset",
"+=",
"tableNameLength",
";",
"int",
"dataLength",
";",
"if",
"(",
"table",
".",
"getLength",
"(",
")",
"==",
"-",
"1",
")",
"{",
"dataLength",
"=",
"is",
".",
"available",
"(",
")",
";",
"}",
"else",
"{",
"dataLength",
"=",
"table",
".",
"getLength",
"(",
")",
"-",
"tableNameLength",
";",
"}",
"SynchroLogger",
".",
"log",
"(",
"\"READ\"",
",",
"tableName",
")",
";",
"byte",
"[",
"]",
"compressedTableData",
"=",
"new",
"byte",
"[",
"dataLength",
"]",
";",
"is",
".",
"read",
"(",
"compressedTableData",
")",
";",
"m_offset",
"+=",
"dataLength",
";",
"Inflater",
"inflater",
"=",
"new",
"Inflater",
"(",
")",
";",
"inflater",
".",
"setInput",
"(",
"compressedTableData",
")",
";",
"ByteArrayOutputStream",
"outputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
"compressedTableData",
".",
"length",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"while",
"(",
"!",
"inflater",
".",
"finished",
"(",
")",
")",
"{",
"int",
"count",
";",
"try",
"{",
"count",
"=",
"inflater",
".",
"inflate",
"(",
"buffer",
")",
";",
"}",
"catch",
"(",
"DataFormatException",
"ex",
")",
"{",
"throw",
"new",
"IOException",
"(",
"ex",
")",
";",
"}",
"outputStream",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"count",
")",
";",
"}",
"outputStream",
".",
"close",
"(",
")",
";",
"byte",
"[",
"]",
"uncompressedTableData",
"=",
"outputStream",
".",
"toByteArray",
"(",
")",
";",
"SynchroLogger",
".",
"log",
"(",
"uncompressedTableData",
")",
";",
"m_tableData",
".",
"put",
"(",
"table",
".",
"getName",
"(",
")",
",",
"uncompressedTableData",
")",
";",
"}"
] | Read data for a single table and store it.
@param is input stream
@param table table header | [
"Read",
"data",
"for",
"a",
"single",
"table",
"and",
"store",
"it",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L175-L228 |
pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Services.java | Services.onStop | public static void onStop(Service service, Runnable terminatedCallback, Consumer<Throwable> failureCallback, Executor executor) {
"""
Attaches the given callbacks which will be invoked when the given Service enters a TERMINATED or FAILED state.
The callbacks are optional and may be invoked synchronously if the Service is already in one of these states.
@param service The Service to attach to.
@param terminatedCallback (Optional) A Runnable that will be invoked if the Service enters a TERMINATED state.
@param failureCallback (Optional) A Runnable that will be invoked if the Service enters a FAILED state.
@param executor An Executor to use for callback invocations.
"""
ShutdownListener listener = new ShutdownListener(terminatedCallback, failureCallback);
service.addListener(listener, executor);
// addListener() will not invoke the callbacks if the service is already in a terminal state. As such, we need to
// manually check for these states after registering the listener and invoke the appropriate callback. The
// ShutdownListener will make sure they are not invoked multiple times.
Service.State state = service.state();
if (state == Service.State.FAILED) {
// We don't care (or know) the state from which we came, so we just pass some random one.
listener.failed(Service.State.FAILED, service.failureCause());
} else if (state == Service.State.TERMINATED) {
listener.terminated(Service.State.TERMINATED);
}
} | java | public static void onStop(Service service, Runnable terminatedCallback, Consumer<Throwable> failureCallback, Executor executor) {
ShutdownListener listener = new ShutdownListener(terminatedCallback, failureCallback);
service.addListener(listener, executor);
// addListener() will not invoke the callbacks if the service is already in a terminal state. As such, we need to
// manually check for these states after registering the listener and invoke the appropriate callback. The
// ShutdownListener will make sure they are not invoked multiple times.
Service.State state = service.state();
if (state == Service.State.FAILED) {
// We don't care (or know) the state from which we came, so we just pass some random one.
listener.failed(Service.State.FAILED, service.failureCause());
} else if (state == Service.State.TERMINATED) {
listener.terminated(Service.State.TERMINATED);
}
} | [
"public",
"static",
"void",
"onStop",
"(",
"Service",
"service",
",",
"Runnable",
"terminatedCallback",
",",
"Consumer",
"<",
"Throwable",
">",
"failureCallback",
",",
"Executor",
"executor",
")",
"{",
"ShutdownListener",
"listener",
"=",
"new",
"ShutdownListener",
"(",
"terminatedCallback",
",",
"failureCallback",
")",
";",
"service",
".",
"addListener",
"(",
"listener",
",",
"executor",
")",
";",
"// addListener() will not invoke the callbacks if the service is already in a terminal state. As such, we need to",
"// manually check for these states after registering the listener and invoke the appropriate callback. The",
"// ShutdownListener will make sure they are not invoked multiple times.",
"Service",
".",
"State",
"state",
"=",
"service",
".",
"state",
"(",
")",
";",
"if",
"(",
"state",
"==",
"Service",
".",
"State",
".",
"FAILED",
")",
"{",
"// We don't care (or know) the state from which we came, so we just pass some random one.",
"listener",
".",
"failed",
"(",
"Service",
".",
"State",
".",
"FAILED",
",",
"service",
".",
"failureCause",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"state",
"==",
"Service",
".",
"State",
".",
"TERMINATED",
")",
"{",
"listener",
".",
"terminated",
"(",
"Service",
".",
"State",
".",
"TERMINATED",
")",
";",
"}",
"}"
] | Attaches the given callbacks which will be invoked when the given Service enters a TERMINATED or FAILED state.
The callbacks are optional and may be invoked synchronously if the Service is already in one of these states.
@param service The Service to attach to.
@param terminatedCallback (Optional) A Runnable that will be invoked if the Service enters a TERMINATED state.
@param failureCallback (Optional) A Runnable that will be invoked if the Service enters a FAILED state.
@param executor An Executor to use for callback invocations. | [
"Attaches",
"the",
"given",
"callbacks",
"which",
"will",
"be",
"invoked",
"when",
"the",
"given",
"Service",
"enters",
"a",
"TERMINATED",
"or",
"FAILED",
"state",
".",
"The",
"callbacks",
"are",
"optional",
"and",
"may",
"be",
"invoked",
"synchronously",
"if",
"the",
"Service",
"is",
"already",
"in",
"one",
"of",
"these",
"states",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Services.java#L74-L88 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.booleanTemplate | @Deprecated
public static BooleanTemplate booleanTemplate(Template template, ImmutableList<?> args) {
"""
Create a new Template expression
@deprecated Use {@link #booleanTemplate(Template, List)} instead.
@param template template
@param args template parameters
@return template expression
"""
return new BooleanTemplate(template, args);
} | java | @Deprecated
public static BooleanTemplate booleanTemplate(Template template, ImmutableList<?> args) {
return new BooleanTemplate(template, args);
} | [
"@",
"Deprecated",
"public",
"static",
"BooleanTemplate",
"booleanTemplate",
"(",
"Template",
"template",
",",
"ImmutableList",
"<",
"?",
">",
"args",
")",
"{",
"return",
"new",
"BooleanTemplate",
"(",
"template",
",",
"args",
")",
";",
"}"
] | Create a new Template expression
@deprecated Use {@link #booleanTemplate(Template, List)} instead.
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L1009-L1012 |
JOML-CI/JOML | src/org/joml/Vector2f.java | Vector2f.set | public Vector2f set(int index, ByteBuffer buffer) {
"""
Read this vector from the supplied {@link ByteBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given ByteBuffer.
@param index
the absolute position into the ByteBuffer
@param buffer
values will be read in <code>x, y</code> order
@return this
"""
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector2f set(int index, ByteBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector2f",
"set",
"(",
"int",
"index",
",",
"ByteBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link ByteBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given ByteBuffer.
@param index
the absolute position into the ByteBuffer
@param buffer
values will be read in <code>x, y</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"ByteBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",
"the",
"given",
"ByteBuffer",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2f.java#L292-L295 |
domaframework/doma-gen | src/main/java/org/seasar/doma/extension/gen/SqlDescFactory.java | SqlDescFactory.createSqlDesc | protected SqlDesc createSqlDesc(EntityDesc entityDesc, String fileName, String templateName) {
"""
SQL記述を返します。
@param entityDesc エンティティ記述
@param fileName ファイル名
@param templateName テンプレート名
@return SQL記述
"""
SqlDesc sqlFileDesc = new SqlDesc();
sqlFileDesc.setFileName(fileName);
sqlFileDesc.setTemplateName(templateName);
sqlFileDesc.setEntityDesc(entityDesc);
sqlFileDesc.setDialect(dialect);
return sqlFileDesc;
} | java | protected SqlDesc createSqlDesc(EntityDesc entityDesc, String fileName, String templateName) {
SqlDesc sqlFileDesc = new SqlDesc();
sqlFileDesc.setFileName(fileName);
sqlFileDesc.setTemplateName(templateName);
sqlFileDesc.setEntityDesc(entityDesc);
sqlFileDesc.setDialect(dialect);
return sqlFileDesc;
} | [
"protected",
"SqlDesc",
"createSqlDesc",
"(",
"EntityDesc",
"entityDesc",
",",
"String",
"fileName",
",",
"String",
"templateName",
")",
"{",
"SqlDesc",
"sqlFileDesc",
"=",
"new",
"SqlDesc",
"(",
")",
";",
"sqlFileDesc",
".",
"setFileName",
"(",
"fileName",
")",
";",
"sqlFileDesc",
".",
"setTemplateName",
"(",
"templateName",
")",
";",
"sqlFileDesc",
".",
"setEntityDesc",
"(",
"entityDesc",
")",
";",
"sqlFileDesc",
".",
"setDialect",
"(",
"dialect",
")",
";",
"return",
"sqlFileDesc",
";",
"}"
] | SQL記述を返します。
@param entityDesc エンティティ記述
@param fileName ファイル名
@param templateName テンプレート名
@return SQL記述 | [
"SQL記述を返します。"
] | train | https://github.com/domaframework/doma-gen/blob/8046e0b28d2167d444125f206ce36e554b3ee616/src/main/java/org/seasar/doma/extension/gen/SqlDescFactory.java#L104-L111 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java | ContentSpecParser.processNewSpec | protected ParserResults processNewSpec(final ParserData parserData, final boolean processProcesses) {
"""
Process a New Content Specification. That is that it should start with a Title, instead of a CHECKSUM and ID.
@param parserData
@param processProcesses If processes should be processed to populate the relationships.
@return True if the content spec was processed successfully otherwise false.
"""
final String input = parserData.getLines().poll();
parserData.setLineCount(parserData.getLineCount() + 1);
try {
final Pair<String, String> keyValuePair = ProcessorUtilities.getAndValidateKeyValuePair(input);
final String key = keyValuePair.getFirst();
final String value = keyValuePair.getSecond();
if (key.equalsIgnoreCase(CommonConstants.CS_TITLE_TITLE)) {
parserData.getContentSpec().setTitle(value);
// Process the rest of the spec now that we know the start is correct
return processSpecContents(parserData, processProcesses);
} else if (key.equalsIgnoreCase(CommonConstants.CS_CHECKSUM_TITLE)) {
log.error(ProcessorConstants.ERROR_INCORRECT_NEW_MODE_MSG);
return new ParserResults(false, null);
} else {
log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG);
return new ParserResults(false, null);
}
} catch (InvalidKeyValueException e) {
log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG, e);
return new ParserResults(false, null);
}
} | java | protected ParserResults processNewSpec(final ParserData parserData, final boolean processProcesses) {
final String input = parserData.getLines().poll();
parserData.setLineCount(parserData.getLineCount() + 1);
try {
final Pair<String, String> keyValuePair = ProcessorUtilities.getAndValidateKeyValuePair(input);
final String key = keyValuePair.getFirst();
final String value = keyValuePair.getSecond();
if (key.equalsIgnoreCase(CommonConstants.CS_TITLE_TITLE)) {
parserData.getContentSpec().setTitle(value);
// Process the rest of the spec now that we know the start is correct
return processSpecContents(parserData, processProcesses);
} else if (key.equalsIgnoreCase(CommonConstants.CS_CHECKSUM_TITLE)) {
log.error(ProcessorConstants.ERROR_INCORRECT_NEW_MODE_MSG);
return new ParserResults(false, null);
} else {
log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG);
return new ParserResults(false, null);
}
} catch (InvalidKeyValueException e) {
log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG, e);
return new ParserResults(false, null);
}
} | [
"protected",
"ParserResults",
"processNewSpec",
"(",
"final",
"ParserData",
"parserData",
",",
"final",
"boolean",
"processProcesses",
")",
"{",
"final",
"String",
"input",
"=",
"parserData",
".",
"getLines",
"(",
")",
".",
"poll",
"(",
")",
";",
"parserData",
".",
"setLineCount",
"(",
"parserData",
".",
"getLineCount",
"(",
")",
"+",
"1",
")",
";",
"try",
"{",
"final",
"Pair",
"<",
"String",
",",
"String",
">",
"keyValuePair",
"=",
"ProcessorUtilities",
".",
"getAndValidateKeyValuePair",
"(",
"input",
")",
";",
"final",
"String",
"key",
"=",
"keyValuePair",
".",
"getFirst",
"(",
")",
";",
"final",
"String",
"value",
"=",
"keyValuePair",
".",
"getSecond",
"(",
")",
";",
"if",
"(",
"key",
".",
"equalsIgnoreCase",
"(",
"CommonConstants",
".",
"CS_TITLE_TITLE",
")",
")",
"{",
"parserData",
".",
"getContentSpec",
"(",
")",
".",
"setTitle",
"(",
"value",
")",
";",
"// Process the rest of the spec now that we know the start is correct",
"return",
"processSpecContents",
"(",
"parserData",
",",
"processProcesses",
")",
";",
"}",
"else",
"if",
"(",
"key",
".",
"equalsIgnoreCase",
"(",
"CommonConstants",
".",
"CS_CHECKSUM_TITLE",
")",
")",
"{",
"log",
".",
"error",
"(",
"ProcessorConstants",
".",
"ERROR_INCORRECT_NEW_MODE_MSG",
")",
";",
"return",
"new",
"ParserResults",
"(",
"false",
",",
"null",
")",
";",
"}",
"else",
"{",
"log",
".",
"error",
"(",
"ProcessorConstants",
".",
"ERROR_INCORRECT_FILE_FORMAT_MSG",
")",
";",
"return",
"new",
"ParserResults",
"(",
"false",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"InvalidKeyValueException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"ProcessorConstants",
".",
"ERROR_INCORRECT_FILE_FORMAT_MSG",
",",
"e",
")",
";",
"return",
"new",
"ParserResults",
"(",
"false",
",",
"null",
")",
";",
"}",
"}"
] | Process a New Content Specification. That is that it should start with a Title, instead of a CHECKSUM and ID.
@param parserData
@param processProcesses If processes should be processed to populate the relationships.
@return True if the content spec was processed successfully otherwise false. | [
"Process",
"a",
"New",
"Content",
"Specification",
".",
"That",
"is",
"that",
"it",
"should",
"start",
"with",
"a",
"Title",
"instead",
"of",
"a",
"CHECKSUM",
"and",
"ID",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L252-L277 |
kiegroup/drools | kie-pmml/src/main/java/org/kie/pmml/assembler/PMMLAssemblerService.java | PMMLAssemblerService.generatedResourcesToPackageDescr | private List<PackageDescr> generatedResourcesToPackageDescr(Resource resource, List<PMMLResource> resources)
throws DroolsParserException {
"""
Creates a list of PackageDescr objects from the PMMLResources (which includes the generated DRL)
@param resource
@param resources
@return
@throws DroolsParserException
"""
List<PackageDescr> pkgDescrs = new ArrayList<>();
DrlParser parser = new DrlParser(configuration.getLanguageLevel());
for (PMMLResource res : resources) {
for (Map.Entry<String, String> entry : res.getRules().entrySet()) {
String key = entry.getKey();
String src = entry.getValue();
PackageDescr descr = null;
descr = parser.parse(false, src);
if (descr != null) {
descr.setResource(resource);
pkgDescrs.add(descr);
dumpGeneratedRule(descr, key, src);
} else {
kbuilder.addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0));
}
}
}
return pkgDescrs;
} | java | private List<PackageDescr> generatedResourcesToPackageDescr(Resource resource, List<PMMLResource> resources)
throws DroolsParserException {
List<PackageDescr> pkgDescrs = new ArrayList<>();
DrlParser parser = new DrlParser(configuration.getLanguageLevel());
for (PMMLResource res : resources) {
for (Map.Entry<String, String> entry : res.getRules().entrySet()) {
String key = entry.getKey();
String src = entry.getValue();
PackageDescr descr = null;
descr = parser.parse(false, src);
if (descr != null) {
descr.setResource(resource);
pkgDescrs.add(descr);
dumpGeneratedRule(descr, key, src);
} else {
kbuilder.addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0));
}
}
}
return pkgDescrs;
} | [
"private",
"List",
"<",
"PackageDescr",
">",
"generatedResourcesToPackageDescr",
"(",
"Resource",
"resource",
",",
"List",
"<",
"PMMLResource",
">",
"resources",
")",
"throws",
"DroolsParserException",
"{",
"List",
"<",
"PackageDescr",
">",
"pkgDescrs",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"DrlParser",
"parser",
"=",
"new",
"DrlParser",
"(",
"configuration",
".",
"getLanguageLevel",
"(",
")",
")",
";",
"for",
"(",
"PMMLResource",
"res",
":",
"resources",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"res",
".",
"getRules",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"String",
"src",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"PackageDescr",
"descr",
"=",
"null",
";",
"descr",
"=",
"parser",
".",
"parse",
"(",
"false",
",",
"src",
")",
";",
"if",
"(",
"descr",
"!=",
"null",
")",
"{",
"descr",
".",
"setResource",
"(",
"resource",
")",
";",
"pkgDescrs",
".",
"add",
"(",
"descr",
")",
";",
"dumpGeneratedRule",
"(",
"descr",
",",
"key",
",",
"src",
")",
";",
"}",
"else",
"{",
"kbuilder",
".",
"addBuilderResult",
"(",
"new",
"ParserError",
"(",
"resource",
",",
"\"Parser returned a null Package\"",
",",
"0",
",",
"0",
")",
")",
";",
"}",
"}",
"}",
"return",
"pkgDescrs",
";",
"}"
] | Creates a list of PackageDescr objects from the PMMLResources (which includes the generated DRL)
@param resource
@param resources
@return
@throws DroolsParserException | [
"Creates",
"a",
"list",
"of",
"PackageDescr",
"objects",
"from",
"the",
"PMMLResources",
"(",
"which",
"includes",
"the",
"generated",
"DRL",
")"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-pmml/src/main/java/org/kie/pmml/assembler/PMMLAssemblerService.java#L139-L159 |
drapostolos/rdp4j | src/main/java/com/github/drapostolos/rdp4j/DirectoryPollerBuilder.java | DirectoryPollerBuilder.setPollingInterval | public DirectoryPollerBuilder setPollingInterval(long interval, TimeUnit timeUnit) {
"""
Set the interval between each poll cycle. Optional parameter.
Default value is 1000 milliseconds.
@param interval - the interval between two poll-cycles.
@param timeUnit - the unit of the interval. Example: TimeUnit.MINUTES
@return {@link DirectoryPollerBuilder}
@throws IllegalArgumentException if <code>interval</code> is negative.
"""
if (interval < 0) {
throw new IllegalArgumentException("Argument 'interval' is negative: " + interval);
}
pollingIntervalInMillis = timeUnit.toMillis(interval);
return this;
} | java | public DirectoryPollerBuilder setPollingInterval(long interval, TimeUnit timeUnit) {
if (interval < 0) {
throw new IllegalArgumentException("Argument 'interval' is negative: " + interval);
}
pollingIntervalInMillis = timeUnit.toMillis(interval);
return this;
} | [
"public",
"DirectoryPollerBuilder",
"setPollingInterval",
"(",
"long",
"interval",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"if",
"(",
"interval",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'interval' is negative: \"",
"+",
"interval",
")",
";",
"}",
"pollingIntervalInMillis",
"=",
"timeUnit",
".",
"toMillis",
"(",
"interval",
")",
";",
"return",
"this",
";",
"}"
] | Set the interval between each poll cycle. Optional parameter.
Default value is 1000 milliseconds.
@param interval - the interval between two poll-cycles.
@param timeUnit - the unit of the interval. Example: TimeUnit.MINUTES
@return {@link DirectoryPollerBuilder}
@throws IllegalArgumentException if <code>interval</code> is negative. | [
"Set",
"the",
"interval",
"between",
"each",
"poll",
"cycle",
".",
"Optional",
"parameter",
".",
"Default",
"value",
"is",
"1000",
"milliseconds",
"."
] | train | https://github.com/drapostolos/rdp4j/blob/ec1db2444d245b7ccd6607182bb56a027fa66d6b/src/main/java/com/github/drapostolos/rdp4j/DirectoryPollerBuilder.java#L95-L101 |
h2oai/h2o-3 | h2o-core/src/main/java/water/parser/ParserProvider.java | ParserProvider.guessSetup_impl | protected ParseSetup guessSetup_impl(ByteVec v, byte[] bits, ParseSetup userSetup) {
"""
Actual implementation of the guessSetup method. Should almost never be overridden (the only
exception is the GuessParserProvider).
@param v
@param bits
@param userSetup
@return
"""
ParseSetup ps = guessInitSetup(v, bits, userSetup);
return guessFinalSetup(v, bits, ps);
} | java | protected ParseSetup guessSetup_impl(ByteVec v, byte[] bits, ParseSetup userSetup) {
ParseSetup ps = guessInitSetup(v, bits, userSetup);
return guessFinalSetup(v, bits, ps);
} | [
"protected",
"ParseSetup",
"guessSetup_impl",
"(",
"ByteVec",
"v",
",",
"byte",
"[",
"]",
"bits",
",",
"ParseSetup",
"userSetup",
")",
"{",
"ParseSetup",
"ps",
"=",
"guessInitSetup",
"(",
"v",
",",
"bits",
",",
"userSetup",
")",
";",
"return",
"guessFinalSetup",
"(",
"v",
",",
"bits",
",",
"ps",
")",
";",
"}"
] | Actual implementation of the guessSetup method. Should almost never be overridden (the only
exception is the GuessParserProvider).
@param v
@param bits
@param userSetup
@return | [
"Actual",
"implementation",
"of",
"the",
"guessSetup",
"method",
".",
"Should",
"almost",
"never",
"be",
"overridden",
"(",
"the",
"only",
"exception",
"is",
"the",
"GuessParserProvider",
")",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/ParserProvider.java#L38-L41 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/StoreException.java | StoreException.create | public static StoreException create(final Type type, final Throwable cause) {
"""
Factory method to construct Store exceptions.
@param type Type of Exception.
@param cause Exception cause.
@return Instance of StoreException.
"""
Preconditions.checkNotNull(cause, "cause");
return create(type, cause, null);
} | java | public static StoreException create(final Type type, final Throwable cause) {
Preconditions.checkNotNull(cause, "cause");
return create(type, cause, null);
} | [
"public",
"static",
"StoreException",
"create",
"(",
"final",
"Type",
"type",
",",
"final",
"Throwable",
"cause",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"cause",
",",
"\"cause\"",
")",
";",
"return",
"create",
"(",
"type",
",",
"cause",
",",
"null",
")",
";",
"}"
] | Factory method to construct Store exceptions.
@param type Type of Exception.
@param cause Exception cause.
@return Instance of StoreException. | [
"Factory",
"method",
"to",
"construct",
"Store",
"exceptions",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/StoreException.java#L56-L59 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java | LogViewer.execute | public int execute(String[] args) {
"""
Runs LogViewer using values in System Properties to find custom levels and header.
@param args
- command line arguments to LogViewer
@return code indicating status of the execution: 0 on success, 1 otherwise.
"""
Map<String, LevelDetails> levels = readLevels(System.getProperty("logviewer.custom.levels"));
String[] header = readHeader(System.getProperty("logviewer.custom.header"));
return execute(args, levels, header);
} | java | public int execute(String[] args) {
Map<String, LevelDetails> levels = readLevels(System.getProperty("logviewer.custom.levels"));
String[] header = readHeader(System.getProperty("logviewer.custom.header"));
return execute(args, levels, header);
} | [
"public",
"int",
"execute",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Map",
"<",
"String",
",",
"LevelDetails",
">",
"levels",
"=",
"readLevels",
"(",
"System",
".",
"getProperty",
"(",
"\"logviewer.custom.levels\"",
")",
")",
";",
"String",
"[",
"]",
"header",
"=",
"readHeader",
"(",
"System",
".",
"getProperty",
"(",
"\"logviewer.custom.header\"",
")",
")",
";",
"return",
"execute",
"(",
"args",
",",
"levels",
",",
"header",
")",
";",
"}"
] | Runs LogViewer using values in System Properties to find custom levels and header.
@param args
- command line arguments to LogViewer
@return code indicating status of the execution: 0 on success, 1 otherwise. | [
"Runs",
"LogViewer",
"using",
"values",
"in",
"System",
"Properties",
"to",
"find",
"custom",
"levels",
"and",
"header",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/viewer/LogViewer.java#L271-L276 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.updateForNewAxes | public static void updateForNewAxes(INDArray arr, INDArrayIndex... indexes) {
"""
Set the shape and stride for
new axes based dimensions
@param arr the array to update
the shape/strides for
@param indexes the indexes to update based on
"""
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (numNewAxes >= 1 && (indexes[0].length() > 1 || indexes[0] instanceof NDArrayIndexAll)) {
List<Long> newShape = new ArrayList<>();
List<Long> newStrides = new ArrayList<>();
int currDimension = 0;
for (int i = 0; i < indexes.length; i++) {
if (indexes[i] instanceof NewAxis) {
newShape.add(1L);
newStrides.add(0L);
} else {
newShape.add(arr.size(currDimension));
newStrides.add(arr.size(currDimension));
currDimension++;
}
}
while (currDimension < arr.rank()) {
newShape.add((long) currDimension);
newStrides.add((long) currDimension);
currDimension++;
}
long[] newShapeArr = Longs.toArray(newShape);
long[] newStrideArr = Longs.toArray(newStrides);
// FIXME: this is wrong, it breaks shapeInfo immutability
arr.setShape(newShapeArr);
arr.setStride(newStrideArr);
} else {
if (numNewAxes > 0) {
long[] newShape = Longs.concat(ArrayUtil.toLongArray(ArrayUtil.nTimes(numNewAxes, 1)), arr.shape());
long[] newStrides = Longs.concat(new long[numNewAxes], arr.stride());
arr.setShape(newShape);
arr.setStride(newStrides);
}
}
} | java | public static void updateForNewAxes(INDArray arr, INDArrayIndex... indexes) {
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (numNewAxes >= 1 && (indexes[0].length() > 1 || indexes[0] instanceof NDArrayIndexAll)) {
List<Long> newShape = new ArrayList<>();
List<Long> newStrides = new ArrayList<>();
int currDimension = 0;
for (int i = 0; i < indexes.length; i++) {
if (indexes[i] instanceof NewAxis) {
newShape.add(1L);
newStrides.add(0L);
} else {
newShape.add(arr.size(currDimension));
newStrides.add(arr.size(currDimension));
currDimension++;
}
}
while (currDimension < arr.rank()) {
newShape.add((long) currDimension);
newStrides.add((long) currDimension);
currDimension++;
}
long[] newShapeArr = Longs.toArray(newShape);
long[] newStrideArr = Longs.toArray(newStrides);
// FIXME: this is wrong, it breaks shapeInfo immutability
arr.setShape(newShapeArr);
arr.setStride(newStrideArr);
} else {
if (numNewAxes > 0) {
long[] newShape = Longs.concat(ArrayUtil.toLongArray(ArrayUtil.nTimes(numNewAxes, 1)), arr.shape());
long[] newStrides = Longs.concat(new long[numNewAxes], arr.stride());
arr.setShape(newShape);
arr.setStride(newStrides);
}
}
} | [
"public",
"static",
"void",
"updateForNewAxes",
"(",
"INDArray",
"arr",
",",
"INDArrayIndex",
"...",
"indexes",
")",
"{",
"int",
"numNewAxes",
"=",
"NDArrayIndex",
".",
"numNewAxis",
"(",
"indexes",
")",
";",
"if",
"(",
"numNewAxes",
">=",
"1",
"&&",
"(",
"indexes",
"[",
"0",
"]",
".",
"length",
"(",
")",
">",
"1",
"||",
"indexes",
"[",
"0",
"]",
"instanceof",
"NDArrayIndexAll",
")",
")",
"{",
"List",
"<",
"Long",
">",
"newShape",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"Long",
">",
"newStrides",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"currDimension",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indexes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"indexes",
"[",
"i",
"]",
"instanceof",
"NewAxis",
")",
"{",
"newShape",
".",
"add",
"(",
"1L",
")",
";",
"newStrides",
".",
"add",
"(",
"0L",
")",
";",
"}",
"else",
"{",
"newShape",
".",
"add",
"(",
"arr",
".",
"size",
"(",
"currDimension",
")",
")",
";",
"newStrides",
".",
"add",
"(",
"arr",
".",
"size",
"(",
"currDimension",
")",
")",
";",
"currDimension",
"++",
";",
"}",
"}",
"while",
"(",
"currDimension",
"<",
"arr",
".",
"rank",
"(",
")",
")",
"{",
"newShape",
".",
"add",
"(",
"(",
"long",
")",
"currDimension",
")",
";",
"newStrides",
".",
"add",
"(",
"(",
"long",
")",
"currDimension",
")",
";",
"currDimension",
"++",
";",
"}",
"long",
"[",
"]",
"newShapeArr",
"=",
"Longs",
".",
"toArray",
"(",
"newShape",
")",
";",
"long",
"[",
"]",
"newStrideArr",
"=",
"Longs",
".",
"toArray",
"(",
"newStrides",
")",
";",
"// FIXME: this is wrong, it breaks shapeInfo immutability",
"arr",
".",
"setShape",
"(",
"newShapeArr",
")",
";",
"arr",
".",
"setStride",
"(",
"newStrideArr",
")",
";",
"}",
"else",
"{",
"if",
"(",
"numNewAxes",
">",
"0",
")",
"{",
"long",
"[",
"]",
"newShape",
"=",
"Longs",
".",
"concat",
"(",
"ArrayUtil",
".",
"toLongArray",
"(",
"ArrayUtil",
".",
"nTimes",
"(",
"numNewAxes",
",",
"1",
")",
")",
",",
"arr",
".",
"shape",
"(",
")",
")",
";",
"long",
"[",
"]",
"newStrides",
"=",
"Longs",
".",
"concat",
"(",
"new",
"long",
"[",
"numNewAxes",
"]",
",",
"arr",
".",
"stride",
"(",
")",
")",
";",
"arr",
".",
"setShape",
"(",
"newShape",
")",
";",
"arr",
".",
"setStride",
"(",
"newStrides",
")",
";",
"}",
"}",
"}"
] | Set the shape and stride for
new axes based dimensions
@param arr the array to update
the shape/strides for
@param indexes the indexes to update based on | [
"Set",
"the",
"shape",
"and",
"stride",
"for",
"new",
"axes",
"based",
"dimensions"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L106-L146 |
vdmeer/asciitable | src/main/java/de/vandermeer/asciitable/AT_Row.java | AT_Row.setPaddingLeftRight | public AT_Row setPaddingLeftRight(int paddingLeft, int paddingRight) {
"""
Sets left and right padding for all cells in the row (only if both values are not smaller than 0).
@param paddingLeft new left padding, ignored if smaller than 0
@param paddingRight new right padding, ignored if smaller than 0
@return this to allow chaining
"""
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(paddingLeft, paddingRight);
}
}
return this;
} | java | public AT_Row setPaddingLeftRight(int paddingLeft, int paddingRight){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(paddingLeft, paddingRight);
}
}
return this;
} | [
"public",
"AT_Row",
"setPaddingLeftRight",
"(",
"int",
"paddingLeft",
",",
"int",
"paddingRight",
")",
"{",
"if",
"(",
"this",
".",
"hasCells",
"(",
")",
")",
"{",
"for",
"(",
"AT_Cell",
"cell",
":",
"this",
".",
"getCells",
"(",
")",
")",
"{",
"cell",
".",
"getContext",
"(",
")",
".",
"setPaddingLeftRight",
"(",
"paddingLeft",
",",
"paddingRight",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Sets left and right padding for all cells in the row (only if both values are not smaller than 0).
@param paddingLeft new left padding, ignored if smaller than 0
@param paddingRight new right padding, ignored if smaller than 0
@return this to allow chaining | [
"Sets",
"left",
"and",
"right",
"padding",
"for",
"all",
"cells",
"in",
"the",
"row",
"(",
"only",
"if",
"both",
"values",
"are",
"not",
"smaller",
"than",
"0",
")",
"."
] | train | https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AT_Row.java#L214-L221 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/base/Preconditions.java | Preconditions.checkArgument | public static void checkArgument(boolean b, @Nullable String errorMessageTemplate, char p1) {
"""
Ensures the truth of an expression involving one or more parameters to the calling method.
<p>See {@link #checkArgument(boolean, String, Object...)} for details.
"""
if (!b) {
throw new IllegalArgumentException(format(errorMessageTemplate, p1));
}
} | java | public static void checkArgument(boolean b, @Nullable String errorMessageTemplate, char p1) {
if (!b) {
throw new IllegalArgumentException(format(errorMessageTemplate, p1));
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"boolean",
"b",
",",
"@",
"Nullable",
"String",
"errorMessageTemplate",
",",
"char",
"p1",
")",
"{",
"if",
"(",
"!",
"b",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"errorMessageTemplate",
",",
"p1",
")",
")",
";",
"}",
"}"
] | Ensures the truth of an expression involving one or more parameters to the calling method.
<p>See {@link #checkArgument(boolean, String, Object...)} for details. | [
"Ensures",
"the",
"truth",
"of",
"an",
"expression",
"involving",
"one",
"or",
"more",
"parameters",
"to",
"the",
"calling",
"method",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/base/Preconditions.java#L155-L159 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONObject.java | JSONObject.elementOpt | public JSONObject elementOpt( String key, Object value ) {
"""
Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null.
@param key A key string.
@param value An object which is the value. It should be of one of these
types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
String, or the JSONNull object.
@return this.
@throws JSONException If the value is a non-finite number.
"""
return elementOpt( key, value, new JsonConfig() );
} | java | public JSONObject elementOpt( String key, Object value ) {
return elementOpt( key, value, new JsonConfig() );
} | [
"public",
"JSONObject",
"elementOpt",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"return",
"elementOpt",
"(",
"key",
",",
"value",
",",
"new",
"JsonConfig",
"(",
")",
")",
";",
"}"
] | Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null.
@param key A key string.
@param value An object which is the value. It should be of one of these
types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
String, or the JSONNull object.
@return this.
@throws JSONException If the value is a non-finite number. | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"but",
"only",
"if",
"the",
"key",
"and",
"the",
"value",
"are",
"both",
"non",
"-",
"null",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1731-L1733 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java | WebhooksInner.getCallbackConfigAsync | public Observable<CallbackConfigInner> getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName) {
"""
Gets the configuration of service URI and custom headers for the webhook.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CallbackConfigInner object
"""
return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<CallbackConfigInner>, CallbackConfigInner>() {
@Override
public CallbackConfigInner call(ServiceResponse<CallbackConfigInner> response) {
return response.body();
}
});
} | java | public Observable<CallbackConfigInner> getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName) {
return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<CallbackConfigInner>, CallbackConfigInner>() {
@Override
public CallbackConfigInner call(ServiceResponse<CallbackConfigInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CallbackConfigInner",
">",
"getCallbackConfigAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"webhookName",
")",
"{",
"return",
"getCallbackConfigWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"webhookName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"CallbackConfigInner",
">",
",",
"CallbackConfigInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"CallbackConfigInner",
"call",
"(",
"ServiceResponse",
"<",
"CallbackConfigInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the configuration of service URI and custom headers for the webhook.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CallbackConfigInner object | [
"Gets",
"the",
"configuration",
"of",
"service",
"URI",
"and",
"custom",
"headers",
"for",
"the",
"webhook",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L992-L999 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java | TermOfUsePanel.newFulfilmentAndJurisdictionPlacePanel | protected Component newFulfilmentAndJurisdictionPlacePanel(final String id,
final IModel<HeaderContentListModelBean> model) {
"""
Factory method for creating the new {@link Component} for the fulfilment and jurisdiction
place. This method is invoked in the constructor from the derived classes and can be
overridden so users can provide their own version of a new {@link Component} for the
fulfilment and jurisdiction place.
@param id
the id
@param model
the model
@return the new {@link Component} for the fulfilment and jurisdiction place
"""
return new FulfilmentAndJurisdictionPlacePanel(id, Model.of(model.getObject()));
} | java | protected Component newFulfilmentAndJurisdictionPlacePanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new FulfilmentAndJurisdictionPlacePanel(id, Model.of(model.getObject()));
} | [
"protected",
"Component",
"newFulfilmentAndJurisdictionPlacePanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"HeaderContentListModelBean",
">",
"model",
")",
"{",
"return",
"new",
"FulfilmentAndJurisdictionPlacePanel",
"(",
"id",
",",
"Model",
".",
"of",
"(",
"model",
".",
"getObject",
"(",
")",
")",
")",
";",
"}"
] | Factory method for creating the new {@link Component} for the fulfilment and jurisdiction
place. This method is invoked in the constructor from the derived classes and can be
overridden so users can provide their own version of a new {@link Component} for the
fulfilment and jurisdiction place.
@param id
the id
@param model
the model
@return the new {@link Component} for the fulfilment and jurisdiction place | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"fulfilment",
"and",
"jurisdiction",
"place",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"fulfilment",
"and",
"jurisdiction",
"place",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L260-L264 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/DateUtils.java | DateUtils.getDateOfMinutesBack | public static Date getDateOfMinutesBack(final int minutesBack, final Date date) {
"""
Get specify minutes back form given date.
@param minutesBack how many minutes want to be back.
@param date date to be handled.
@return a new Date object.
"""
return dateBack(Calendar.MINUTE, minutesBack, date);
} | java | public static Date getDateOfMinutesBack(final int minutesBack, final Date date) {
return dateBack(Calendar.MINUTE, minutesBack, date);
} | [
"public",
"static",
"Date",
"getDateOfMinutesBack",
"(",
"final",
"int",
"minutesBack",
",",
"final",
"Date",
"date",
")",
"{",
"return",
"dateBack",
"(",
"Calendar",
".",
"MINUTE",
",",
"minutesBack",
",",
"date",
")",
";",
"}"
] | Get specify minutes back form given date.
@param minutesBack how many minutes want to be back.
@param date date to be handled.
@return a new Date object. | [
"Get",
"specify",
"minutes",
"back",
"form",
"given",
"date",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L161-L164 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/StatefulSessionActivationStrategy.java | StatefulSessionActivationStrategy.cacheInsert | private void cacheInsert(MasterKey key, StatefulBeanO sfbean) {
"""
Insert a stateful bean with the specified key into the cache. The caller
must be holding the lock associated with the key.
"""
CacheElement cacheElement = cache.insert(key, sfbean);
sfbean.ivCacheElement = cacheElement;
sfbean.ivCacheKey = key;
if (!sfbean.getHome().getBeanMetaData().isPassivationCapable()) {
cache.markElementEvictionIneligible(cacheElement);
}
} | java | private void cacheInsert(MasterKey key, StatefulBeanO sfbean) {
CacheElement cacheElement = cache.insert(key, sfbean);
sfbean.ivCacheElement = cacheElement;
sfbean.ivCacheKey = key;
if (!sfbean.getHome().getBeanMetaData().isPassivationCapable()) {
cache.markElementEvictionIneligible(cacheElement);
}
} | [
"private",
"void",
"cacheInsert",
"(",
"MasterKey",
"key",
",",
"StatefulBeanO",
"sfbean",
")",
"{",
"CacheElement",
"cacheElement",
"=",
"cache",
".",
"insert",
"(",
"key",
",",
"sfbean",
")",
";",
"sfbean",
".",
"ivCacheElement",
"=",
"cacheElement",
";",
"sfbean",
".",
"ivCacheKey",
"=",
"key",
";",
"if",
"(",
"!",
"sfbean",
".",
"getHome",
"(",
")",
".",
"getBeanMetaData",
"(",
")",
".",
"isPassivationCapable",
"(",
")",
")",
"{",
"cache",
".",
"markElementEvictionIneligible",
"(",
"cacheElement",
")",
";",
"}",
"}"
] | Insert a stateful bean with the specified key into the cache. The caller
must be holding the lock associated with the key. | [
"Insert",
"a",
"stateful",
"bean",
"with",
"the",
"specified",
"key",
"into",
"the",
"cache",
".",
"The",
"caller",
"must",
"be",
"holding",
"the",
"lock",
"associated",
"with",
"the",
"key",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/StatefulSessionActivationStrategy.java#L93-L101 |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/UUIDSet.java | UUIDSet.parse | public static UUIDSet parse(String str) {
"""
解析如下格式字符串为UUIDSet: 726757ad-4455-11e8-ae04-0242ac110002:1 => UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:2}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3 => UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3:4 UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:5}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3:7-9 UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4},
{start:7, stop:10}]}
@param str
@return
"""
String[] ss = str.split(":");
if (ss.length < 2) {
throw new RuntimeException(String.format("parseUUIDSet failed due to wrong format: %s", str));
}
List<Interval> intervals = new ArrayList<Interval>();
for (int i = 1; i < ss.length; i++) {
intervals.add(parseInterval(ss[i]));
}
UUIDSet uuidSet = new UUIDSet();
uuidSet.SID = UUID.fromString(ss[0]);
uuidSet.intervals = combine(intervals);
return uuidSet;
} | java | public static UUIDSet parse(String str) {
String[] ss = str.split(":");
if (ss.length < 2) {
throw new RuntimeException(String.format("parseUUIDSet failed due to wrong format: %s", str));
}
List<Interval> intervals = new ArrayList<Interval>();
for (int i = 1; i < ss.length; i++) {
intervals.add(parseInterval(ss[i]));
}
UUIDSet uuidSet = new UUIDSet();
uuidSet.SID = UUID.fromString(ss[0]);
uuidSet.intervals = combine(intervals);
return uuidSet;
} | [
"public",
"static",
"UUIDSet",
"parse",
"(",
"String",
"str",
")",
"{",
"String",
"[",
"]",
"ss",
"=",
"str",
".",
"split",
"(",
"\":\"",
")",
";",
"if",
"(",
"ss",
".",
"length",
"<",
"2",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"parseUUIDSet failed due to wrong format: %s\"",
",",
"str",
")",
")",
";",
"}",
"List",
"<",
"Interval",
">",
"intervals",
"=",
"new",
"ArrayList",
"<",
"Interval",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"ss",
".",
"length",
";",
"i",
"++",
")",
"{",
"intervals",
".",
"add",
"(",
"parseInterval",
"(",
"ss",
"[",
"i",
"]",
")",
")",
";",
"}",
"UUIDSet",
"uuidSet",
"=",
"new",
"UUIDSet",
"(",
")",
";",
"uuidSet",
".",
"SID",
"=",
"UUID",
".",
"fromString",
"(",
"ss",
"[",
"0",
"]",
")",
";",
"uuidSet",
".",
"intervals",
"=",
"combine",
"(",
"intervals",
")",
";",
"return",
"uuidSet",
";",
"}"
] | 解析如下格式字符串为UUIDSet: 726757ad-4455-11e8-ae04-0242ac110002:1 => UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:2}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3 => UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3:4 UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:5}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3:7-9 UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4},
{start:7, stop:10}]}
@param str
@return | [
"解析如下格式字符串为UUIDSet",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"1",
"=",
">",
"UUIDSet",
"{",
"SID",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
"intervals",
":",
"[",
"{",
"start",
":",
"1",
"stop",
":",
"2",
"}",
"]",
"}",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"1",
"-",
"3",
"=",
">",
"UUIDSet",
"{",
"SID",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
"intervals",
":",
"[",
"{",
"start",
":",
"1",
"stop",
":",
"4",
"}",
"]",
"}",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"1",
"-",
"3",
":",
"4",
"UUIDSet",
"{",
"SID",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
"intervals",
":",
"[",
"{",
"start",
":",
"1",
"stop",
":",
"5",
"}",
"]",
"}",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"1",
"-",
"3",
":",
"7",
"-",
"9",
"UUIDSet",
"{",
"SID",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
"intervals",
":",
"[",
"{",
"start",
":",
"1",
"stop",
":",
"4",
"}",
"{",
"start",
":",
"7",
"stop",
":",
"10",
"}",
"]",
"}"
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/UUIDSet.java#L101-L118 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog2/plugin/Tools.java | Tools.silenceUncaughtExceptionsInThisThread | public static void silenceUncaughtExceptionsInThisThread() {
"""
The default uncaught exception handler will print to STDERR, which we don't always want for threads.
Using this utility method you can avoid writing to STDERR on a per-thread basis
"""
Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread ignored, Throwable ignored1) {
}
});
} | java | public static void silenceUncaughtExceptionsInThisThread() {
Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread ignored, Throwable ignored1) {
}
});
} | [
"public",
"static",
"void",
"silenceUncaughtExceptionsInThisThread",
"(",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"setUncaughtExceptionHandler",
"(",
"new",
"Thread",
".",
"UncaughtExceptionHandler",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"uncaughtException",
"(",
"Thread",
"ignored",
",",
"Throwable",
"ignored1",
")",
"{",
"}",
"}",
")",
";",
"}"
] | The default uncaught exception handler will print to STDERR, which we don't always want for threads.
Using this utility method you can avoid writing to STDERR on a per-thread basis | [
"The",
"default",
"uncaught",
"exception",
"handler",
"will",
"print",
"to",
"STDERR",
"which",
"we",
"don",
"t",
"always",
"want",
"for",
"threads",
".",
"Using",
"this",
"utility",
"method",
"you",
"can",
"avoid",
"writing",
"to",
"STDERR",
"on",
"a",
"per",
"-",
"thread",
"basis"
] | train | https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Tools.java#L622-L628 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java | ServerAzureADAdministratorsInner.createOrUpdate | public ServerAzureADAdministratorInner createOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) {
"""
Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param properties The required parameters for creating or updating an Active Directory Administrator.
@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 ServerAzureADAdministratorInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().last().body();
} | java | public ServerAzureADAdministratorInner createOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().last().body();
} | [
"public",
"ServerAzureADAdministratorInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerAzureADAdministratorInner",
"properties",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"properties",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param properties The required parameters for creating or updating an Active Directory Administrator.
@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 ServerAzureADAdministratorInner object if successful. | [
"Creates",
"a",
"new",
"Server",
"Active",
"Directory",
"Administrator",
"or",
"updates",
"an",
"existing",
"server",
"Active",
"Directory",
"Administrator",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java#L97-L99 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseCsrsv_analysisEx | public static int cusparseCsrsv_analysisEx(
cusparseHandle handle,
int transA,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrSortedValA,
int csrSortedValAtype,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseSolveAnalysisInfo info,
int executiontype) {
"""
Description: Solution of triangular linear system op(A) * x = alpha * f,
where A is a sparse matrix in CSR storage format, rhs f and solution x
are dense vectors. This routine implements algorithm 1 for the solve.
"""
return checkResult(cusparseCsrsv_analysisExNative(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedValAtype, csrSortedRowPtrA, csrSortedColIndA, info, executiontype));
} | java | public static int cusparseCsrsv_analysisEx(
cusparseHandle handle,
int transA,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrSortedValA,
int csrSortedValAtype,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseSolveAnalysisInfo info,
int executiontype)
{
return checkResult(cusparseCsrsv_analysisExNative(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedValAtype, csrSortedRowPtrA, csrSortedColIndA, info, executiontype));
} | [
"public",
"static",
"int",
"cusparseCsrsv_analysisEx",
"(",
"cusparseHandle",
"handle",
",",
"int",
"transA",
",",
"int",
"m",
",",
"int",
"nnz",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrSortedValA",
",",
"int",
"csrSortedValAtype",
",",
"Pointer",
"csrSortedRowPtrA",
",",
"Pointer",
"csrSortedColIndA",
",",
"cusparseSolveAnalysisInfo",
"info",
",",
"int",
"executiontype",
")",
"{",
"return",
"checkResult",
"(",
"cusparseCsrsv_analysisExNative",
"(",
"handle",
",",
"transA",
",",
"m",
",",
"nnz",
",",
"descrA",
",",
"csrSortedValA",
",",
"csrSortedValAtype",
",",
"csrSortedRowPtrA",
",",
"csrSortedColIndA",
",",
"info",
",",
"executiontype",
")",
")",
";",
"}"
] | Description: Solution of triangular linear system op(A) * x = alpha * f,
where A is a sparse matrix in CSR storage format, rhs f and solution x
are dense vectors. This routine implements algorithm 1 for the solve. | [
"Description",
":",
"Solution",
"of",
"triangular",
"linear",
"system",
"op",
"(",
"A",
")",
"*",
"x",
"=",
"alpha",
"*",
"f",
"where",
"A",
"is",
"a",
"sparse",
"matrix",
"in",
"CSR",
"storage",
"format",
"rhs",
"f",
"and",
"solution",
"x",
"are",
"dense",
"vectors",
".",
"This",
"routine",
"implements",
"algorithm",
"1",
"for",
"the",
"solve",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L2143-L2157 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java | MethodDelegation.toField | public static MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory) {
"""
Delegates any intercepted method to invoke a non-{@code static} method on the instance of the supplied field. To be
considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.
@param name The field's name.
@param fieldLocatorFactory The field locator factory to use.
@return A delegation that redirects invocations to a method of the specified field's instance.
"""
return withDefaultConfiguration().toField(name, fieldLocatorFactory);
} | java | public static MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory) {
return withDefaultConfiguration().toField(name, fieldLocatorFactory);
} | [
"public",
"static",
"MethodDelegation",
"toField",
"(",
"String",
"name",
",",
"FieldLocator",
".",
"Factory",
"fieldLocatorFactory",
")",
"{",
"return",
"withDefaultConfiguration",
"(",
")",
".",
"toField",
"(",
"name",
",",
"fieldLocatorFactory",
")",
";",
"}"
] | Delegates any intercepted method to invoke a non-{@code static} method on the instance of the supplied field. To be
considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.
@param name The field's name.
@param fieldLocatorFactory The field locator factory to use.
@return A delegation that redirects invocations to a method of the specified field's instance. | [
"Delegates",
"any",
"intercepted",
"method",
"to",
"invoke",
"a",
"non",
"-",
"{",
"@code",
"static",
"}",
"method",
"on",
"the",
"instance",
"of",
"the",
"supplied",
"field",
".",
"To",
"be",
"considered",
"a",
"valid",
"delegation",
"target",
"a",
"method",
"must",
"be",
"visible",
"and",
"accessible",
"to",
"the",
"instrumented",
"type",
".",
"This",
"is",
"the",
"case",
"if",
"the",
"method",
"s",
"declaring",
"type",
"is",
"either",
"public",
"or",
"in",
"the",
"same",
"package",
"as",
"the",
"instrumented",
"type",
"and",
"if",
"the",
"method",
"is",
"either",
"public",
"or",
"non",
"-",
"private",
"and",
"in",
"the",
"same",
"package",
"as",
"the",
"instrumented",
"type",
".",
"Private",
"methods",
"can",
"only",
"be",
"used",
"as",
"a",
"delegation",
"target",
"if",
"the",
"delegation",
"is",
"targeting",
"the",
"instrumented",
"type",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java#L465-L467 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java | CommerceNotificationQueueEntryPersistenceImpl.findByLtS | @Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate) {
"""
Returns all the commerce notification queue entries where sentDate < ?.
@param sentDate the sent date
@return the matching commerce notification queue entries
"""
return findByLtS(sentDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate) {
return findByLtS(sentDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationQueueEntry",
">",
"findByLtS",
"(",
"Date",
"sentDate",
")",
"{",
"return",
"findByLtS",
"(",
"sentDate",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce notification queue entries where sentDate < ?.
@param sentDate the sent date
@return the matching commerce notification queue entries | [
"Returns",
"all",
"the",
"commerce",
"notification",
"queue",
"entries",
"where",
"sentDate",
"<",
";",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L1686-L1689 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.codePointAt | public static final int codePointAt(CharSequence seq, int index) {
"""
Same as {@link Character#codePointAt(CharSequence, int)}.
Returns the code point at index.
This examines only the characters at index and index+1.
@param seq the characters to check
@param index the index of the first or only char forming the code point
@return the code point at the index
"""
char c1 = seq.charAt(index++);
if (isHighSurrogate(c1)) {
if (index < seq.length()) {
char c2 = seq.charAt(index);
if (isLowSurrogate(c2)) {
return toCodePoint(c1, c2);
}
}
}
return c1;
} | java | public static final int codePointAt(CharSequence seq, int index) {
char c1 = seq.charAt(index++);
if (isHighSurrogate(c1)) {
if (index < seq.length()) {
char c2 = seq.charAt(index);
if (isLowSurrogate(c2)) {
return toCodePoint(c1, c2);
}
}
}
return c1;
} | [
"public",
"static",
"final",
"int",
"codePointAt",
"(",
"CharSequence",
"seq",
",",
"int",
"index",
")",
"{",
"char",
"c1",
"=",
"seq",
".",
"charAt",
"(",
"index",
"++",
")",
";",
"if",
"(",
"isHighSurrogate",
"(",
"c1",
")",
")",
"{",
"if",
"(",
"index",
"<",
"seq",
".",
"length",
"(",
")",
")",
"{",
"char",
"c2",
"=",
"seq",
".",
"charAt",
"(",
"index",
")",
";",
"if",
"(",
"isLowSurrogate",
"(",
"c2",
")",
")",
"{",
"return",
"toCodePoint",
"(",
"c1",
",",
"c2",
")",
";",
"}",
"}",
"}",
"return",
"c1",
";",
"}"
] | Same as {@link Character#codePointAt(CharSequence, int)}.
Returns the code point at index.
This examines only the characters at index and index+1.
@param seq the characters to check
@param index the index of the first or only char forming the code point
@return the code point at the index | [
"Same",
"as",
"{",
"@link",
"Character#codePointAt",
"(",
"CharSequence",
"int",
")",
"}",
".",
"Returns",
"the",
"code",
"point",
"at",
"index",
".",
"This",
"examines",
"only",
"the",
"characters",
"at",
"index",
"and",
"index",
"+",
"1",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L5322-L5333 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.getBulk | @Override
public Map<String, Object> getBulk(Iterator<String> keyIter) {
"""
Get the values for multiple keys from the cache.
@param keyIter Iterator that produces the keys
@return a map of the values (for each value that exists)
@throws OperationTimeoutException if the global operation timeout is
exceeded
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests
"""
return getBulk(keyIter, transcoder);
} | java | @Override
public Map<String, Object> getBulk(Iterator<String> keyIter) {
return getBulk(keyIter, transcoder);
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getBulk",
"(",
"Iterator",
"<",
"String",
">",
"keyIter",
")",
"{",
"return",
"getBulk",
"(",
"keyIter",
",",
"transcoder",
")",
";",
"}"
] | Get the values for multiple keys from the cache.
@param keyIter Iterator that produces the keys
@return a map of the values (for each value that exists)
@throws OperationTimeoutException if the global operation timeout is
exceeded
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Get",
"the",
"values",
"for",
"multiple",
"keys",
"from",
"the",
"cache",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1581-L1584 |
netty/netty | resolver/src/main/java/io/netty/resolver/HostsFileParser.java | HostsFileParser.parseSilently | public static HostsFileEntries parseSilently(Charset... charsets) {
"""
Parse hosts file at standard OS location using the given {@link Charset}s one after each other until
we were able to parse something or none is left.
@param charsets the {@link Charset}s to try as file encodings when parsing.
@return a {@link HostsFileEntries}
"""
File hostsFile = locateHostsFile();
try {
return parse(hostsFile, charsets);
} catch (IOException e) {
if (logger.isWarnEnabled()) {
logger.warn("Failed to load and parse hosts file at " + hostsFile.getPath(), e);
}
return HostsFileEntries.EMPTY;
}
} | java | public static HostsFileEntries parseSilently(Charset... charsets) {
File hostsFile = locateHostsFile();
try {
return parse(hostsFile, charsets);
} catch (IOException e) {
if (logger.isWarnEnabled()) {
logger.warn("Failed to load and parse hosts file at " + hostsFile.getPath(), e);
}
return HostsFileEntries.EMPTY;
}
} | [
"public",
"static",
"HostsFileEntries",
"parseSilently",
"(",
"Charset",
"...",
"charsets",
")",
"{",
"File",
"hostsFile",
"=",
"locateHostsFile",
"(",
")",
";",
"try",
"{",
"return",
"parse",
"(",
"hostsFile",
",",
"charsets",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"if",
"(",
"logger",
".",
"isWarnEnabled",
"(",
")",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Failed to load and parse hosts file at \"",
"+",
"hostsFile",
".",
"getPath",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"HostsFileEntries",
".",
"EMPTY",
";",
"}",
"}"
] | Parse hosts file at standard OS location using the given {@link Charset}s one after each other until
we were able to parse something or none is left.
@param charsets the {@link Charset}s to try as file encodings when parsing.
@return a {@link HostsFileEntries} | [
"Parse",
"hosts",
"file",
"at",
"standard",
"OS",
"location",
"using",
"the",
"given",
"{",
"@link",
"Charset",
"}",
"s",
"one",
"after",
"each",
"other",
"until",
"we",
"were",
"able",
"to",
"parse",
"something",
"or",
"none",
"is",
"left",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver/src/main/java/io/netty/resolver/HostsFileParser.java#L86-L96 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.getEntitySetByEntity | public static EntitySet getEntitySetByEntity(EntityDataModel entityDataModel, Object entity)
throws ODataEdmException {
"""
Get the Entity Set of a given entity through the Entity Data Model.
@param entityDataModel The Entity Data Model.
@param entity The given entity.
@return The Entity Set.
@throws ODataEdmException If unable to get entity set
"""
return getEntitySetByEntityTypeName(entityDataModel,
getAndCheckEntityType(entityDataModel, entity.getClass()).getFullyQualifiedName());
} | java | public static EntitySet getEntitySetByEntity(EntityDataModel entityDataModel, Object entity)
throws ODataEdmException {
return getEntitySetByEntityTypeName(entityDataModel,
getAndCheckEntityType(entityDataModel, entity.getClass()).getFullyQualifiedName());
} | [
"public",
"static",
"EntitySet",
"getEntitySetByEntity",
"(",
"EntityDataModel",
"entityDataModel",
",",
"Object",
"entity",
")",
"throws",
"ODataEdmException",
"{",
"return",
"getEntitySetByEntityTypeName",
"(",
"entityDataModel",
",",
"getAndCheckEntityType",
"(",
"entityDataModel",
",",
"entity",
".",
"getClass",
"(",
")",
")",
".",
"getFullyQualifiedName",
"(",
")",
")",
";",
"}"
] | Get the Entity Set of a given entity through the Entity Data Model.
@param entityDataModel The Entity Data Model.
@param entity The given entity.
@return The Entity Set.
@throws ODataEdmException If unable to get entity set | [
"Get",
"the",
"Entity",
"Set",
"of",
"a",
"given",
"entity",
"through",
"the",
"Entity",
"Data",
"Model",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L506-L510 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java | PROCLUS.computeM_current | private ArrayDBIDs computeM_current(DBIDs m, DBIDs m_best, DBIDs m_bad, Random random) {
"""
Computes the set of medoids in current iteration.
@param m the medoids
@param m_best the best set of medoids found so far
@param m_bad the bad medoids
@param random random number generator
@return m_current, the set of medoids in current iteration
"""
ArrayModifiableDBIDs m_list = DBIDUtil.newArray(m);
m_list.removeDBIDs(m_best);
DBIDArrayMIter it = m_list.iter();
ArrayModifiableDBIDs m_current = DBIDUtil.newArray();
for(DBIDIter iter = m_best.iter(); iter.valid(); iter.advance()) {
if(m_bad.contains(iter)) {
int currentSize = m_current.size();
while(m_current.size() == currentSize) {
m_current.add(it.seek(random.nextInt(m_list.size())));
it.remove();
}
}
else {
m_current.add(iter);
}
}
return m_current;
} | java | private ArrayDBIDs computeM_current(DBIDs m, DBIDs m_best, DBIDs m_bad, Random random) {
ArrayModifiableDBIDs m_list = DBIDUtil.newArray(m);
m_list.removeDBIDs(m_best);
DBIDArrayMIter it = m_list.iter();
ArrayModifiableDBIDs m_current = DBIDUtil.newArray();
for(DBIDIter iter = m_best.iter(); iter.valid(); iter.advance()) {
if(m_bad.contains(iter)) {
int currentSize = m_current.size();
while(m_current.size() == currentSize) {
m_current.add(it.seek(random.nextInt(m_list.size())));
it.remove();
}
}
else {
m_current.add(iter);
}
}
return m_current;
} | [
"private",
"ArrayDBIDs",
"computeM_current",
"(",
"DBIDs",
"m",
",",
"DBIDs",
"m_best",
",",
"DBIDs",
"m_bad",
",",
"Random",
"random",
")",
"{",
"ArrayModifiableDBIDs",
"m_list",
"=",
"DBIDUtil",
".",
"newArray",
"(",
"m",
")",
";",
"m_list",
".",
"removeDBIDs",
"(",
"m_best",
")",
";",
"DBIDArrayMIter",
"it",
"=",
"m_list",
".",
"iter",
"(",
")",
";",
"ArrayModifiableDBIDs",
"m_current",
"=",
"DBIDUtil",
".",
"newArray",
"(",
")",
";",
"for",
"(",
"DBIDIter",
"iter",
"=",
"m_best",
".",
"iter",
"(",
")",
";",
"iter",
".",
"valid",
"(",
")",
";",
"iter",
".",
"advance",
"(",
")",
")",
"{",
"if",
"(",
"m_bad",
".",
"contains",
"(",
"iter",
")",
")",
"{",
"int",
"currentSize",
"=",
"m_current",
".",
"size",
"(",
")",
";",
"while",
"(",
"m_current",
".",
"size",
"(",
")",
"==",
"currentSize",
")",
"{",
"m_current",
".",
"add",
"(",
"it",
".",
"seek",
"(",
"random",
".",
"nextInt",
"(",
"m_list",
".",
"size",
"(",
")",
")",
")",
")",
";",
"it",
".",
"remove",
"(",
")",
";",
"}",
"}",
"else",
"{",
"m_current",
".",
"add",
"(",
"iter",
")",
";",
"}",
"}",
"return",
"m_current",
";",
"}"
] | Computes the set of medoids in current iteration.
@param m the medoids
@param m_best the best set of medoids found so far
@param m_bad the bad medoids
@param random random number generator
@return m_current, the set of medoids in current iteration | [
"Computes",
"the",
"set",
"of",
"medoids",
"in",
"current",
"iteration",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java#L311-L331 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java | Preconditions.checkPrecondition | public static <T> T checkPrecondition(
final T value,
final boolean condition,
final Function<T, String> describer) {
"""
<p>Evaluate the given {@code predicate} using {@code value} as input.</p>
<p>The function throws {@link PreconditionViolationException} if the
predicate is false.</p>
@param value The value
@param condition The predicate
@param describer A describer for the predicate
@param <T> The type of values
@return value
@throws PreconditionViolationException If the predicate is false
"""
return innerCheck(value, condition, describer);
} | java | public static <T> T checkPrecondition(
final T value,
final boolean condition,
final Function<T, String> describer)
{
return innerCheck(value, condition, describer);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkPrecondition",
"(",
"final",
"T",
"value",
",",
"final",
"boolean",
"condition",
",",
"final",
"Function",
"<",
"T",
",",
"String",
">",
"describer",
")",
"{",
"return",
"innerCheck",
"(",
"value",
",",
"condition",
",",
"describer",
")",
";",
"}"
] | <p>Evaluate the given {@code predicate} using {@code value} as input.</p>
<p>The function throws {@link PreconditionViolationException} if the
predicate is false.</p>
@param value The value
@param condition The predicate
@param describer A describer for the predicate
@param <T> The type of values
@return value
@throws PreconditionViolationException If the predicate is false | [
"<p",
">",
"Evaluate",
"the",
"given",
"{",
"@code",
"predicate",
"}",
"using",
"{",
"@code",
"value",
"}",
"as",
"input",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java#L235-L241 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/HandlerList.java | HandlerList.insertHandler | public void insertHandler(Class<?> restrictionClass, H handler) {
"""
Insert a handler to the beginning of the stack.
@param restrictionClass restriction class
@param handler handler
"""
// note that the handlers list is kept in a list that is traversed in
// backwards order.
handlers.add(new Pair<Class<?>, H>(restrictionClass, handler));
} | java | public void insertHandler(Class<?> restrictionClass, H handler) {
// note that the handlers list is kept in a list that is traversed in
// backwards order.
handlers.add(new Pair<Class<?>, H>(restrictionClass, handler));
} | [
"public",
"void",
"insertHandler",
"(",
"Class",
"<",
"?",
">",
"restrictionClass",
",",
"H",
"handler",
")",
"{",
"// note that the handlers list is kept in a list that is traversed in",
"// backwards order.",
"handlers",
".",
"add",
"(",
"new",
"Pair",
"<",
"Class",
"<",
"?",
">",
",",
"H",
">",
"(",
"restrictionClass",
",",
"handler",
")",
")",
";",
"}"
] | Insert a handler to the beginning of the stack.
@param restrictionClass restriction class
@param handler handler | [
"Insert",
"a",
"handler",
"to",
"the",
"beginning",
"of",
"the",
"stack",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/HandlerList.java#L51-L55 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java | EnvironmentSettingsInner.createOrUpdateAsync | public Observable<EnvironmentSettingInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingInner environmentSetting) {
"""
Create or replace an existing Environment Setting. This operation can take a while to complete.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@param environmentSetting Represents settings of an environment, from which environment instances would be created
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() {
@Override
public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) {
return response.body();
}
});
} | java | public Observable<EnvironmentSettingInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, EnvironmentSettingInner environmentSetting) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting).map(new Func1<ServiceResponse<EnvironmentSettingInner>, EnvironmentSettingInner>() {
@Override
public EnvironmentSettingInner call(ServiceResponse<EnvironmentSettingInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EnvironmentSettingInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
",",
"EnvironmentSettingInner",
"environmentSetting",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"labName",
",",
"environmentSettingName",
",",
"environmentSetting",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"EnvironmentSettingInner",
">",
",",
"EnvironmentSettingInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"EnvironmentSettingInner",
"call",
"(",
"ServiceResponse",
"<",
"EnvironmentSettingInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create or replace an existing Environment Setting. This operation can take a while to complete.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@param environmentSetting Represents settings of an environment, from which environment instances would be created
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"replace",
"an",
"existing",
"Environment",
"Setting",
".",
"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/EnvironmentSettingsInner.java#L647-L654 |
jayantk/jklol | src/com/jayantkrish/jklol/evaluation/Example.java | Example.outputGetter | public static <B> Function<Example<?, B>, B> outputGetter() {
"""
Gets a function which maps {@code Example}s to their output value.
@return
"""
return new Function<Example<?, B>, B>() {
@Override
public B apply(Example<?, B> item) {
return item.getOutput();
}
};
} | java | public static <B> Function<Example<?, B>, B> outputGetter() {
return new Function<Example<?, B>, B>() {
@Override
public B apply(Example<?, B> item) {
return item.getOutput();
}
};
} | [
"public",
"static",
"<",
"B",
">",
"Function",
"<",
"Example",
"<",
"?",
",",
"B",
">",
",",
"B",
">",
"outputGetter",
"(",
")",
"{",
"return",
"new",
"Function",
"<",
"Example",
"<",
"?",
",",
"B",
">",
",",
"B",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"B",
"apply",
"(",
"Example",
"<",
"?",
",",
"B",
">",
"item",
")",
"{",
"return",
"item",
".",
"getOutput",
"(",
")",
";",
"}",
"}",
";",
"}"
] | Gets a function which maps {@code Example}s to their output value.
@return | [
"Gets",
"a",
"function",
"which",
"maps",
"{",
"@code",
"Example",
"}",
"s",
"to",
"their",
"output",
"value",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/evaluation/Example.java#L108-L115 |
dasein-cloud/dasein-cloud-aws | src/main/java/org/dasein/cloud/aws/platform/RDS.java | RDS.authorizeClassicDbSecurityGroup | private void authorizeClassicDbSecurityGroup(String groupName, String sourceCidr) throws CloudException, InternalException {
"""
Use this to authorize with security groups in EC2-Classic
@param groupName
@param sourceCidr
@throws CloudException
@throws InternalException
"""
Map<String,String> parameters = getProvider().getStandardRdsParameters(getProvider().getContext(), AUTHORIZE_DB_SECURITY_GROUP_INGRESS);
parameters.put("DBSecurityGroupName", groupName);
parameters.put("CIDRIP", sourceCidr);
EC2Method method = new EC2Method(SERVICE_ID, getProvider(), parameters);
try {
method.invoke();
}
catch( EC2Exception e ) {
String code = e.getCode();
if( code != null && code.equals("AuthorizationAlreadyExists") ) {
return;
}
throw new CloudException(e);
}
} | java | private void authorizeClassicDbSecurityGroup(String groupName, String sourceCidr) throws CloudException, InternalException {
Map<String,String> parameters = getProvider().getStandardRdsParameters(getProvider().getContext(), AUTHORIZE_DB_SECURITY_GROUP_INGRESS);
parameters.put("DBSecurityGroupName", groupName);
parameters.put("CIDRIP", sourceCidr);
EC2Method method = new EC2Method(SERVICE_ID, getProvider(), parameters);
try {
method.invoke();
}
catch( EC2Exception e ) {
String code = e.getCode();
if( code != null && code.equals("AuthorizationAlreadyExists") ) {
return;
}
throw new CloudException(e);
}
} | [
"private",
"void",
"authorizeClassicDbSecurityGroup",
"(",
"String",
"groupName",
",",
"String",
"sourceCidr",
")",
"throws",
"CloudException",
",",
"InternalException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
"=",
"getProvider",
"(",
")",
".",
"getStandardRdsParameters",
"(",
"getProvider",
"(",
")",
".",
"getContext",
"(",
")",
",",
"AUTHORIZE_DB_SECURITY_GROUP_INGRESS",
")",
";",
"parameters",
".",
"put",
"(",
"\"DBSecurityGroupName\"",
",",
"groupName",
")",
";",
"parameters",
".",
"put",
"(",
"\"CIDRIP\"",
",",
"sourceCidr",
")",
";",
"EC2Method",
"method",
"=",
"new",
"EC2Method",
"(",
"SERVICE_ID",
",",
"getProvider",
"(",
")",
",",
"parameters",
")",
";",
"try",
"{",
"method",
".",
"invoke",
"(",
")",
";",
"}",
"catch",
"(",
"EC2Exception",
"e",
")",
"{",
"String",
"code",
"=",
"e",
".",
"getCode",
"(",
")",
";",
"if",
"(",
"code",
"!=",
"null",
"&&",
"code",
".",
"equals",
"(",
"\"AuthorizationAlreadyExists\"",
")",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"CloudException",
"(",
"e",
")",
";",
"}",
"}"
] | Use this to authorize with security groups in EC2-Classic
@param groupName
@param sourceCidr
@throws CloudException
@throws InternalException | [
"Use",
"this",
"to",
"authorize",
"with",
"security",
"groups",
"in",
"EC2",
"-",
"Classic"
] | train | https://github.com/dasein-cloud/dasein-cloud-aws/blob/05098574197a1f573f77447cadc39a76bf00b99d/src/main/java/org/dasein/cloud/aws/platform/RDS.java#L121-L136 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java | XFactory.createXField | public static XField createXField(String className, Field field) {
"""
Create an XField object from a BCEL Field.
@param className
the name of the Java class containing the field
@param field
the Field within the JavaClass
@return the created XField
"""
String fieldName = field.getName();
String fieldSig = field.getSignature();
XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic());
assert xfield.isResolved() : "Could not exactly resolve " + xfield;
return xfield;
} | java | public static XField createXField(String className, Field field) {
String fieldName = field.getName();
String fieldSig = field.getSignature();
XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic());
assert xfield.isResolved() : "Could not exactly resolve " + xfield;
return xfield;
} | [
"public",
"static",
"XField",
"createXField",
"(",
"String",
"className",
",",
"Field",
"field",
")",
"{",
"String",
"fieldName",
"=",
"field",
".",
"getName",
"(",
")",
";",
"String",
"fieldSig",
"=",
"field",
".",
"getSignature",
"(",
")",
";",
"XField",
"xfield",
"=",
"getExactXField",
"(",
"className",
",",
"fieldName",
",",
"fieldSig",
",",
"field",
".",
"isStatic",
"(",
")",
")",
";",
"assert",
"xfield",
".",
"isResolved",
"(",
")",
":",
"\"Could not exactly resolve \"",
"+",
"xfield",
";",
"return",
"xfield",
";",
"}"
] | Create an XField object from a BCEL Field.
@param className
the name of the Java class containing the field
@param field
the Field within the JavaClass
@return the created XField | [
"Create",
"an",
"XField",
"object",
"from",
"a",
"BCEL",
"Field",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L509-L516 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java | ProcessContextProperties.addDataUsage | private String addDataUsage(String attribute, Set<DataUsage> usages) throws PropertyException {
"""
Adds the given data usage to the context properties.<br>
This requires to generate a new name for the data usage (e.g.
DATA_USAGE_1) <br>
and storing a string-representation of this data usage under this
name.<br>
Additionally, the new data usage name is stored in the property field
which is summing up all data usage names (ACTIVITY_DATA_USAGES).
@return The newly generated name for the data usage under which it is
accessible.
@throws ParameterException if the given data usage parameters are
invalid.
@throws PropertyException if the data usage property name cannot be
generated or the data usage cannot be stored.
@see #getNextDataUsageIndex()
@see #addDataUsageNameToList(String)
"""
Validate.notNull(attribute);
Validate.notEmpty(attribute);
Validate.notNull(usages);
Validate.noNullElements(usages);
String dataUsageName = String.format(DATA_USAGE_FORMAT, getNextDataUsageIndex());
props.setProperty(dataUsageName, String.format(DATA_USAGE_VALUE_FORMAT, attribute, ArrayUtils.toString(usages.toArray())));
addDataUsageNameToList(dataUsageName);
return dataUsageName;
} | java | private String addDataUsage(String attribute, Set<DataUsage> usages) throws PropertyException {
Validate.notNull(attribute);
Validate.notEmpty(attribute);
Validate.notNull(usages);
Validate.noNullElements(usages);
String dataUsageName = String.format(DATA_USAGE_FORMAT, getNextDataUsageIndex());
props.setProperty(dataUsageName, String.format(DATA_USAGE_VALUE_FORMAT, attribute, ArrayUtils.toString(usages.toArray())));
addDataUsageNameToList(dataUsageName);
return dataUsageName;
} | [
"private",
"String",
"addDataUsage",
"(",
"String",
"attribute",
",",
"Set",
"<",
"DataUsage",
">",
"usages",
")",
"throws",
"PropertyException",
"{",
"Validate",
".",
"notNull",
"(",
"attribute",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"attribute",
")",
";",
"Validate",
".",
"notNull",
"(",
"usages",
")",
";",
"Validate",
".",
"noNullElements",
"(",
"usages",
")",
";",
"String",
"dataUsageName",
"=",
"String",
".",
"format",
"(",
"DATA_USAGE_FORMAT",
",",
"getNextDataUsageIndex",
"(",
")",
")",
";",
"props",
".",
"setProperty",
"(",
"dataUsageName",
",",
"String",
".",
"format",
"(",
"DATA_USAGE_VALUE_FORMAT",
",",
"attribute",
",",
"ArrayUtils",
".",
"toString",
"(",
"usages",
".",
"toArray",
"(",
")",
")",
")",
")",
";",
"addDataUsageNameToList",
"(",
"dataUsageName",
")",
";",
"return",
"dataUsageName",
";",
"}"
] | Adds the given data usage to the context properties.<br>
This requires to generate a new name for the data usage (e.g.
DATA_USAGE_1) <br>
and storing a string-representation of this data usage under this
name.<br>
Additionally, the new data usage name is stored in the property field
which is summing up all data usage names (ACTIVITY_DATA_USAGES).
@return The newly generated name for the data usage under which it is
accessible.
@throws ParameterException if the given data usage parameters are
invalid.
@throws PropertyException if the data usage property name cannot be
generated or the data usage cannot be stored.
@see #getNextDataUsageIndex()
@see #addDataUsageNameToList(String) | [
"Adds",
"the",
"given",
"data",
"usage",
"to",
"the",
"context",
"properties",
".",
"<br",
">",
"This",
"requires",
"to",
"generate",
"a",
"new",
"name",
"for",
"the",
"data",
"usage",
"(",
"e",
".",
"g",
".",
"DATA_USAGE_1",
")",
"<br",
">",
"and",
"storing",
"a",
"string",
"-",
"representation",
"of",
"this",
"data",
"usage",
"under",
"this",
"name",
".",
"<br",
">",
"Additionally",
"the",
"new",
"data",
"usage",
"name",
"is",
"stored",
"in",
"the",
"property",
"field",
"which",
"is",
"summing",
"up",
"all",
"data",
"usage",
"names",
"(",
"ACTIVITY_DATA_USAGES",
")",
"."
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java#L103-L112 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.configNotPresent | public static void configNotPresent(Class<?> destination,Class<?> source,XML xml) {
"""
Thrown when the xml configuration doesn't contains the classes configuration.
@param destination destination class name
@param source source class name
@param xml xml path
"""
throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2path,destination.getSimpleName(), source.getSimpleName(),xml.getXmlPath()));
} | java | public static void configNotPresent(Class<?> destination,Class<?> source,XML xml){
throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2path,destination.getSimpleName(), source.getSimpleName(),xml.getXmlPath()));
} | [
"public",
"static",
"void",
"configNotPresent",
"(",
"Class",
"<",
"?",
">",
"destination",
",",
"Class",
"<",
"?",
">",
"source",
",",
"XML",
"xml",
")",
"{",
"throw",
"new",
"MappingNotFoundException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"Constants",
".",
"mappingNotFoundException2path",
",",
"destination",
".",
"getSimpleName",
"(",
")",
",",
"source",
".",
"getSimpleName",
"(",
")",
",",
"xml",
".",
"getXmlPath",
"(",
")",
")",
")",
";",
"}"
] | Thrown when the xml configuration doesn't contains the classes configuration.
@param destination destination class name
@param source source class name
@param xml xml path | [
"Thrown",
"when",
"the",
"xml",
"configuration",
"doesn",
"t",
"contains",
"the",
"classes",
"configuration",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L514-L516 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/PGStream.java | PGStream.receiveEOF | public void receiveEOF() throws SQLException, IOException {
"""
Consume an expected EOF from the backend.
@throws IOException if an I/O error occurs
@throws SQLException if we get something other than an EOF
"""
int c = pgInput.read();
if (c < 0) {
return;
}
throw new PSQLException(GT.tr("Expected an EOF from server, got: {0}", c),
PSQLState.COMMUNICATION_ERROR);
} | java | public void receiveEOF() throws SQLException, IOException {
int c = pgInput.read();
if (c < 0) {
return;
}
throw new PSQLException(GT.tr("Expected an EOF from server, got: {0}", c),
PSQLState.COMMUNICATION_ERROR);
} | [
"public",
"void",
"receiveEOF",
"(",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"int",
"c",
"=",
"pgInput",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"<",
"0",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Expected an EOF from server, got: {0}\"",
",",
"c",
")",
",",
"PSQLState",
".",
"COMMUNICATION_ERROR",
")",
";",
"}"
] | Consume an expected EOF from the backend.
@throws IOException if an I/O error occurs
@throws SQLException if we get something other than an EOF | [
"Consume",
"an",
"expected",
"EOF",
"from",
"the",
"backend",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/PGStream.java#L550-L557 |
simplifycom/ink-android | ink/src/main/java/com/simplify/ink/InkView.java | InkView.drawBitmap | public void drawBitmap(Bitmap bitmap, float x, float y, Paint paint) {
"""
Draws a bitmap to the view, with its top left corner at (x,y)
@param bitmap The bitmap to draw
@param x The destination x coordinate of the bitmap in relation to the view
@param y The destination y coordinate of the bitmap in relation to the view
@param paint The paint used to draw the bitmap (may be null)
"""
canvas.drawBitmap(bitmap, x, y, paint);
invalidate();
} | java | public void drawBitmap(Bitmap bitmap, float x, float y, Paint paint) {
canvas.drawBitmap(bitmap, x, y, paint);
invalidate();
} | [
"public",
"void",
"drawBitmap",
"(",
"Bitmap",
"bitmap",
",",
"float",
"x",
",",
"float",
"y",
",",
"Paint",
"paint",
")",
"{",
"canvas",
".",
"drawBitmap",
"(",
"bitmap",
",",
"x",
",",
"y",
",",
"paint",
")",
";",
"invalidate",
"(",
")",
";",
"}"
] | Draws a bitmap to the view, with its top left corner at (x,y)
@param bitmap The bitmap to draw
@param x The destination x coordinate of the bitmap in relation to the view
@param y The destination y coordinate of the bitmap in relation to the view
@param paint The paint used to draw the bitmap (may be null) | [
"Draws",
"a",
"bitmap",
"to",
"the",
"view",
"with",
"its",
"top",
"left",
"corner",
"at",
"(",
"x",
"y",
")"
] | train | https://github.com/simplifycom/ink-android/blob/1a365e656b496554e7ee2e735bb775367f5eac0b/ink/src/main/java/com/simplify/ink/InkView.java#L445-L449 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/util/SourceSnippets.java | SourceSnippets.asMethod | public static InjectorMethod asMethod(boolean isNative, String signature, String pkg,
final SourceSnippet body) {
"""
Creates an {@link InjectorMethod} using the given {@link SourceSnippet} as
its body.
@param isNative whether the returned method is a native method
@param signature the signature of the returned method
@param pkg the package in which the returned method should be created
@param body the body text of the new method
"""
return new AbstractInjectorMethod(isNative, signature, pkg) {
public String getMethodBody(InjectorWriteContext writeContext) {
return body.getSource(writeContext);
}
};
} | java | public static InjectorMethod asMethod(boolean isNative, String signature, String pkg,
final SourceSnippet body) {
return new AbstractInjectorMethod(isNative, signature, pkg) {
public String getMethodBody(InjectorWriteContext writeContext) {
return body.getSource(writeContext);
}
};
} | [
"public",
"static",
"InjectorMethod",
"asMethod",
"(",
"boolean",
"isNative",
",",
"String",
"signature",
",",
"String",
"pkg",
",",
"final",
"SourceSnippet",
"body",
")",
"{",
"return",
"new",
"AbstractInjectorMethod",
"(",
"isNative",
",",
"signature",
",",
"pkg",
")",
"{",
"public",
"String",
"getMethodBody",
"(",
"InjectorWriteContext",
"writeContext",
")",
"{",
"return",
"body",
".",
"getSource",
"(",
"writeContext",
")",
";",
"}",
"}",
";",
"}"
] | Creates an {@link InjectorMethod} using the given {@link SourceSnippet} as
its body.
@param isNative whether the returned method is a native method
@param signature the signature of the returned method
@param pkg the package in which the returned method should be created
@param body the body text of the new method | [
"Creates",
"an",
"{",
"@link",
"InjectorMethod",
"}",
"using",
"the",
"given",
"{",
"@link",
"SourceSnippet",
"}",
"as",
"its",
"body",
"."
] | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/SourceSnippets.java#L132-L139 |
h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/hex/tree/xgboost/XGBoostModel.java | XGBoostModel.doScoring | final void doScoring(Frame _train, Frame _trainOrig, Frame _valid, Frame _validOrig) {
"""
Score an XGBoost model on training and validation data (optional)
Note: every row is scored, all observation weights are assumed to be equal
@param _train training data in the form of matrix
@param _valid validation data (optional, can be null)
"""
ModelMetrics mm = makeMetrics(_train, _trainOrig, true, "Metrics reported on training frame");
_output._training_metrics = mm;
_output._scored_train[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
// Optional validation part
if (_valid!=null) {
mm = makeMetrics(_valid, _validOrig, false, "Metrics reported on validation frame");
_output._validation_metrics = mm;
_output._scored_valid[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
}
} | java | final void doScoring(Frame _train, Frame _trainOrig, Frame _valid, Frame _validOrig) {
ModelMetrics mm = makeMetrics(_train, _trainOrig, true, "Metrics reported on training frame");
_output._training_metrics = mm;
_output._scored_train[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
// Optional validation part
if (_valid!=null) {
mm = makeMetrics(_valid, _validOrig, false, "Metrics reported on validation frame");
_output._validation_metrics = mm;
_output._scored_valid[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
}
} | [
"final",
"void",
"doScoring",
"(",
"Frame",
"_train",
",",
"Frame",
"_trainOrig",
",",
"Frame",
"_valid",
",",
"Frame",
"_validOrig",
")",
"{",
"ModelMetrics",
"mm",
"=",
"makeMetrics",
"(",
"_train",
",",
"_trainOrig",
",",
"true",
",",
"\"Metrics reported on training frame\"",
")",
";",
"_output",
".",
"_training_metrics",
"=",
"mm",
";",
"_output",
".",
"_scored_train",
"[",
"_output",
".",
"_ntrees",
"]",
".",
"fillFrom",
"(",
"mm",
")",
";",
"addModelMetrics",
"(",
"mm",
")",
";",
"// Optional validation part",
"if",
"(",
"_valid",
"!=",
"null",
")",
"{",
"mm",
"=",
"makeMetrics",
"(",
"_valid",
",",
"_validOrig",
",",
"false",
",",
"\"Metrics reported on validation frame\"",
")",
";",
"_output",
".",
"_validation_metrics",
"=",
"mm",
";",
"_output",
".",
"_scored_valid",
"[",
"_output",
".",
"_ntrees",
"]",
".",
"fillFrom",
"(",
"mm",
")",
";",
"addModelMetrics",
"(",
"mm",
")",
";",
"}",
"}"
] | Score an XGBoost model on training and validation data (optional)
Note: every row is scored, all observation weights are assumed to be equal
@param _train training data in the form of matrix
@param _valid validation data (optional, can be null) | [
"Score",
"an",
"XGBoost",
"model",
"on",
"training",
"and",
"validation",
"data",
"(",
"optional",
")",
"Note",
":",
"every",
"row",
"is",
"scored",
"all",
"observation",
"weights",
"are",
"assumed",
"to",
"be",
"equal"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/hex/tree/xgboost/XGBoostModel.java#L398-L410 |
googleads/googleads-java-lib | modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java | AxisHandler.setEndpointAddress | @Override
public void setEndpointAddress(Stub soapClient, String endpointAddress) {
"""
Sets the endpoint address of the given SOAP client.
@param soapClient the SOAP client to set the endpoint address for
@param endpointAddress the target endpoint address
"""
soapClient._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
} | java | @Override
public void setEndpointAddress(Stub soapClient, String endpointAddress) {
soapClient._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
} | [
"@",
"Override",
"public",
"void",
"setEndpointAddress",
"(",
"Stub",
"soapClient",
",",
"String",
"endpointAddress",
")",
"{",
"soapClient",
".",
"_setProperty",
"(",
"Stub",
".",
"ENDPOINT_ADDRESS_PROPERTY",
",",
"endpointAddress",
")",
";",
"}"
] | Sets the endpoint address of the given SOAP client.
@param soapClient the SOAP client to set the endpoint address for
@param endpointAddress the target endpoint address | [
"Sets",
"the",
"endpoint",
"address",
"of",
"the",
"given",
"SOAP",
"client",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java#L68-L71 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizePrintedTextInStreamWithServiceResponseAsync | public Observable<ServiceResponse<OcrResult>> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
"""
Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param image An image stream.
@param recognizePrintedTextInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OcrResult object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (image == null) {
throw new IllegalArgumentException("Parameter image is required and cannot be null.");
}
final OcrLanguages language = recognizePrintedTextInStreamOptionalParameter != null ? recognizePrintedTextInStreamOptionalParameter.language() : null;
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language);
} | java | public Observable<ServiceResponse<OcrResult>> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (image == null) {
throw new IllegalArgumentException("Parameter image is required and cannot be null.");
}
final OcrLanguages language = recognizePrintedTextInStreamOptionalParameter != null ? recognizePrintedTextInStreamOptionalParameter.language() : null;
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OcrResult",
">",
">",
"recognizePrintedTextInStreamWithServiceResponseAsync",
"(",
"boolean",
"detectOrientation",
",",
"byte",
"[",
"]",
"image",
",",
"RecognizePrintedTextInStreamOptionalParameter",
"recognizePrintedTextInStreamOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.endpoint() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter image is required and cannot be null.\"",
")",
";",
"}",
"final",
"OcrLanguages",
"language",
"=",
"recognizePrintedTextInStreamOptionalParameter",
"!=",
"null",
"?",
"recognizePrintedTextInStreamOptionalParameter",
".",
"language",
"(",
")",
":",
"null",
";",
"return",
"recognizePrintedTextInStreamWithServiceResponseAsync",
"(",
"detectOrientation",
",",
"image",
",",
"language",
")",
";",
"}"
] | Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param image An image stream.
@param recognizePrintedTextInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OcrResult object | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"printed",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",
"results",
"will",
"be",
"returned",
".",
"Upon",
"failure",
"the",
"error",
"code",
"together",
"with",
"an",
"error",
"message",
"will",
"be",
"returned",
".",
"The",
"error",
"code",
"can",
"be",
"one",
"of",
"InvalidImageUrl",
"InvalidImageFormat",
"InvalidImageSize",
"NotSupportedImage",
"NotSupportedLanguage",
"or",
"InternalServerError",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L785-L795 |
patrickfav/bcrypt | modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java | BCryptOpenBSDProtocol.streamToWord | private static int streamToWord(byte[] data, int[] offp) {
"""
Cyclically extract a word of key material
@param data the string to extract the data from
@param offp a "pointer" (as a one-entry array) to the
current offset into data
@return the next word of material from data
"""
int i;
int word = 0;
int off = offp[0];
for (i = 0; i < 4; i++) {
word = (word << 8) | (data[off] & 0xff);
off = (off + 1) % data.length;
}
offp[0] = off;
return word;
} | java | private static int streamToWord(byte[] data, int[] offp) {
int i;
int word = 0;
int off = offp[0];
for (i = 0; i < 4; i++) {
word = (word << 8) | (data[off] & 0xff);
off = (off + 1) % data.length;
}
offp[0] = off;
return word;
} | [
"private",
"static",
"int",
"streamToWord",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"[",
"]",
"offp",
")",
"{",
"int",
"i",
";",
"int",
"word",
"=",
"0",
";",
"int",
"off",
"=",
"offp",
"[",
"0",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"word",
"=",
"(",
"word",
"<<",
"8",
")",
"|",
"(",
"data",
"[",
"off",
"]",
"&",
"0xff",
")",
";",
"off",
"=",
"(",
"off",
"+",
"1",
")",
"%",
"data",
".",
"length",
";",
"}",
"offp",
"[",
"0",
"]",
"=",
"off",
";",
"return",
"word",
";",
"}"
] | Cyclically extract a word of key material
@param data the string to extract the data from
@param offp a "pointer" (as a one-entry array) to the
current offset into data
@return the next word of material from data | [
"Cyclically",
"extract",
"a",
"word",
"of",
"key",
"material"
] | train | https://github.com/patrickfav/bcrypt/blob/40e75be395b4e1b57b9872b22d98a9fb560e0184/modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java#L403-L415 |
codegist/crest | core/src/main/java/org/codegist/crest/CRestBuilder.java | CRestBuilder.bindSerializer | public CRestBuilder bindSerializer(Class<? extends Serializer> serializer, Class<?>[] classes, Map<String, Object> config) {
"""
<p>Binds a serializer to a list of interface method's parameter types</p>
<p>By default, <b>CRest</b> handle the following types:</p>
<ul>
<li>java.util.Date</li>
<li>java.lang.Boolean</li>
<li>java.io.File</li>
<li>java.io.InputStream</li>
<li>java.io.Reader</li>
</ul>
<p>Meaning any interface method parameter type can be by default one of these types and be serialized properly.</p>
@param serializer Serializer class to use to serialize the given interface method's parameter types
@param classes Interface method's parameter types to bind the serializer to
@param config State that will be passed to the serializer along with the CRestConfig object if the serializer has declared a single argument constructor with CRestConfig parameter type
@return current builder
@see CRestConfig#getDateFormat()
@see CRestConfig#getBooleanTrue()
@see CRestConfig#getBooleanFalse()
"""
classSerializerBuilder.register(serializer, classes, config);
return this;
} | java | public CRestBuilder bindSerializer(Class<? extends Serializer> serializer, Class<?>[] classes, Map<String, Object> config){
classSerializerBuilder.register(serializer, classes, config);
return this;
} | [
"public",
"CRestBuilder",
"bindSerializer",
"(",
"Class",
"<",
"?",
"extends",
"Serializer",
">",
"serializer",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"config",
")",
"{",
"classSerializerBuilder",
".",
"register",
"(",
"serializer",
",",
"classes",
",",
"config",
")",
";",
"return",
"this",
";",
"}"
] | <p>Binds a serializer to a list of interface method's parameter types</p>
<p>By default, <b>CRest</b> handle the following types:</p>
<ul>
<li>java.util.Date</li>
<li>java.lang.Boolean</li>
<li>java.io.File</li>
<li>java.io.InputStream</li>
<li>java.io.Reader</li>
</ul>
<p>Meaning any interface method parameter type can be by default one of these types and be serialized properly.</p>
@param serializer Serializer class to use to serialize the given interface method's parameter types
@param classes Interface method's parameter types to bind the serializer to
@param config State that will be passed to the serializer along with the CRestConfig object if the serializer has declared a single argument constructor with CRestConfig parameter type
@return current builder
@see CRestConfig#getDateFormat()
@see CRestConfig#getBooleanTrue()
@see CRestConfig#getBooleanFalse() | [
"<p",
">",
"Binds",
"a",
"serializer",
"to",
"a",
"list",
"of",
"interface",
"method",
"s",
"parameter",
"types<",
"/",
"p",
">",
"<p",
">",
"By",
"default",
"<b",
">",
"CRest<",
"/",
"b",
">",
"handle",
"the",
"following",
"types",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"java",
".",
"util",
".",
"Date<",
"/",
"li",
">",
"<li",
">",
"java",
".",
"lang",
".",
"Boolean<",
"/",
"li",
">",
"<li",
">",
"java",
".",
"io",
".",
"File<",
"/",
"li",
">",
"<li",
">",
"java",
".",
"io",
".",
"InputStream<",
"/",
"li",
">",
"<li",
">",
"java",
".",
"io",
".",
"Reader<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<p",
">",
"Meaning",
"any",
"interface",
"method",
"parameter",
"type",
"can",
"be",
"by",
"default",
"one",
"of",
"these",
"types",
"and",
"be",
"serialized",
"properly",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L611-L614 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseAbuttingOffsetFields | private int parseAbuttingOffsetFields(String text, int start, int[] parsedLen) {
"""
Parses abutting localized GMT offset fields (such as 0800) into offset.
@param text the input text
@param start the start index
@param parsedLen the parsed length, or 0 on failure
@return the parsed offset in milliseconds.
"""
final int MAXDIGITS = 6;
int[] digits = new int[MAXDIGITS];
int[] parsed = new int[MAXDIGITS]; // accumulative offsets
// Parse digits into int[]
int idx = start;
int[] len = {0};
int numDigits = 0;
for (int i = 0; i < MAXDIGITS; i++) {
digits[i] = parseSingleLocalizedDigit(text, idx, len);
if (digits[i] < 0) {
break;
}
idx += len[0];
parsed[i] = idx - start;
numDigits++;
}
if (numDigits == 0) {
parsedLen[0] = 0;
return 0;
}
int offset = 0;
while (numDigits > 0) {
int hour = 0;
int min = 0;
int sec = 0;
assert(numDigits > 0 && numDigits <= 6);
switch (numDigits) {
case 1: // H
hour = digits[0];
break;
case 2: // HH
hour = digits[0] * 10 + digits[1];
break;
case 3: // Hmm
hour = digits[0];
min = digits[1] * 10 + digits[2];
break;
case 4: // HHmm
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
break;
case 5: // Hmmss
hour = digits[0];
min = digits[1] * 10 + digits[2];
sec = digits[3] * 10 + digits[4];
break;
case 6: // HHmmss
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
sec = digits[4] * 10 + digits[5];
break;
}
if (hour <= MAX_OFFSET_HOUR && min <= MAX_OFFSET_MINUTE && sec <= MAX_OFFSET_SECOND) {
// found a valid combination
offset = hour * MILLIS_PER_HOUR + min * MILLIS_PER_MINUTE + sec * MILLIS_PER_SECOND;
parsedLen[0] = parsed[numDigits - 1];
break;
}
numDigits--;
}
return offset;
} | java | private int parseAbuttingOffsetFields(String text, int start, int[] parsedLen) {
final int MAXDIGITS = 6;
int[] digits = new int[MAXDIGITS];
int[] parsed = new int[MAXDIGITS]; // accumulative offsets
// Parse digits into int[]
int idx = start;
int[] len = {0};
int numDigits = 0;
for (int i = 0; i < MAXDIGITS; i++) {
digits[i] = parseSingleLocalizedDigit(text, idx, len);
if (digits[i] < 0) {
break;
}
idx += len[0];
parsed[i] = idx - start;
numDigits++;
}
if (numDigits == 0) {
parsedLen[0] = 0;
return 0;
}
int offset = 0;
while (numDigits > 0) {
int hour = 0;
int min = 0;
int sec = 0;
assert(numDigits > 0 && numDigits <= 6);
switch (numDigits) {
case 1: // H
hour = digits[0];
break;
case 2: // HH
hour = digits[0] * 10 + digits[1];
break;
case 3: // Hmm
hour = digits[0];
min = digits[1] * 10 + digits[2];
break;
case 4: // HHmm
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
break;
case 5: // Hmmss
hour = digits[0];
min = digits[1] * 10 + digits[2];
sec = digits[3] * 10 + digits[4];
break;
case 6: // HHmmss
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
sec = digits[4] * 10 + digits[5];
break;
}
if (hour <= MAX_OFFSET_HOUR && min <= MAX_OFFSET_MINUTE && sec <= MAX_OFFSET_SECOND) {
// found a valid combination
offset = hour * MILLIS_PER_HOUR + min * MILLIS_PER_MINUTE + sec * MILLIS_PER_SECOND;
parsedLen[0] = parsed[numDigits - 1];
break;
}
numDigits--;
}
return offset;
} | [
"private",
"int",
"parseAbuttingOffsetFields",
"(",
"String",
"text",
",",
"int",
"start",
",",
"int",
"[",
"]",
"parsedLen",
")",
"{",
"final",
"int",
"MAXDIGITS",
"=",
"6",
";",
"int",
"[",
"]",
"digits",
"=",
"new",
"int",
"[",
"MAXDIGITS",
"]",
";",
"int",
"[",
"]",
"parsed",
"=",
"new",
"int",
"[",
"MAXDIGITS",
"]",
";",
"// accumulative offsets",
"// Parse digits into int[]",
"int",
"idx",
"=",
"start",
";",
"int",
"[",
"]",
"len",
"=",
"{",
"0",
"}",
";",
"int",
"numDigits",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"MAXDIGITS",
";",
"i",
"++",
")",
"{",
"digits",
"[",
"i",
"]",
"=",
"parseSingleLocalizedDigit",
"(",
"text",
",",
"idx",
",",
"len",
")",
";",
"if",
"(",
"digits",
"[",
"i",
"]",
"<",
"0",
")",
"{",
"break",
";",
"}",
"idx",
"+=",
"len",
"[",
"0",
"]",
";",
"parsed",
"[",
"i",
"]",
"=",
"idx",
"-",
"start",
";",
"numDigits",
"++",
";",
"}",
"if",
"(",
"numDigits",
"==",
"0",
")",
"{",
"parsedLen",
"[",
"0",
"]",
"=",
"0",
";",
"return",
"0",
";",
"}",
"int",
"offset",
"=",
"0",
";",
"while",
"(",
"numDigits",
">",
"0",
")",
"{",
"int",
"hour",
"=",
"0",
";",
"int",
"min",
"=",
"0",
";",
"int",
"sec",
"=",
"0",
";",
"assert",
"(",
"numDigits",
">",
"0",
"&&",
"numDigits",
"<=",
"6",
")",
";",
"switch",
"(",
"numDigits",
")",
"{",
"case",
"1",
":",
"// H",
"hour",
"=",
"digits",
"[",
"0",
"]",
";",
"break",
";",
"case",
"2",
":",
"// HH",
"hour",
"=",
"digits",
"[",
"0",
"]",
"*",
"10",
"+",
"digits",
"[",
"1",
"]",
";",
"break",
";",
"case",
"3",
":",
"// Hmm",
"hour",
"=",
"digits",
"[",
"0",
"]",
";",
"min",
"=",
"digits",
"[",
"1",
"]",
"*",
"10",
"+",
"digits",
"[",
"2",
"]",
";",
"break",
";",
"case",
"4",
":",
"// HHmm",
"hour",
"=",
"digits",
"[",
"0",
"]",
"*",
"10",
"+",
"digits",
"[",
"1",
"]",
";",
"min",
"=",
"digits",
"[",
"2",
"]",
"*",
"10",
"+",
"digits",
"[",
"3",
"]",
";",
"break",
";",
"case",
"5",
":",
"// Hmmss",
"hour",
"=",
"digits",
"[",
"0",
"]",
";",
"min",
"=",
"digits",
"[",
"1",
"]",
"*",
"10",
"+",
"digits",
"[",
"2",
"]",
";",
"sec",
"=",
"digits",
"[",
"3",
"]",
"*",
"10",
"+",
"digits",
"[",
"4",
"]",
";",
"break",
";",
"case",
"6",
":",
"// HHmmss",
"hour",
"=",
"digits",
"[",
"0",
"]",
"*",
"10",
"+",
"digits",
"[",
"1",
"]",
";",
"min",
"=",
"digits",
"[",
"2",
"]",
"*",
"10",
"+",
"digits",
"[",
"3",
"]",
";",
"sec",
"=",
"digits",
"[",
"4",
"]",
"*",
"10",
"+",
"digits",
"[",
"5",
"]",
";",
"break",
";",
"}",
"if",
"(",
"hour",
"<=",
"MAX_OFFSET_HOUR",
"&&",
"min",
"<=",
"MAX_OFFSET_MINUTE",
"&&",
"sec",
"<=",
"MAX_OFFSET_SECOND",
")",
"{",
"// found a valid combination",
"offset",
"=",
"hour",
"*",
"MILLIS_PER_HOUR",
"+",
"min",
"*",
"MILLIS_PER_MINUTE",
"+",
"sec",
"*",
"MILLIS_PER_SECOND",
";",
"parsedLen",
"[",
"0",
"]",
"=",
"parsed",
"[",
"numDigits",
"-",
"1",
"]",
";",
"break",
";",
"}",
"numDigits",
"--",
";",
"}",
"return",
"offset",
";",
"}"
] | Parses abutting localized GMT offset fields (such as 0800) into offset.
@param text the input text
@param start the start index
@param parsedLen the parsed length, or 0 on failure
@return the parsed offset in milliseconds. | [
"Parses",
"abutting",
"localized",
"GMT",
"offset",
"fields",
"(",
"such",
"as",
"0800",
")",
"into",
"offset",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2492-L2558 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java | _ArrayMap.getByIdentity | static public Object getByIdentity(Object[] array, Object key) {
"""
Gets the object stored with the given key, using
only object identity.
"""
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
if (array[i] == key)
{
return array[i + 1];
}
}
}
return null;
} | java | static public Object getByIdentity(Object[] array, Object key)
{
if (array != null)
{
int length = array.length;
for (int i = 0; i < length; i += 2)
{
if (array[i] == key)
{
return array[i + 1];
}
}
}
return null;
} | [
"static",
"public",
"Object",
"getByIdentity",
"(",
"Object",
"[",
"]",
"array",
",",
"Object",
"key",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
")",
"{",
"int",
"length",
"=",
"array",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"key",
")",
"{",
"return",
"array",
"[",
"i",
"+",
"1",
"]",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the object stored with the given key, using
only object identity. | [
"Gets",
"the",
"object",
"stored",
"with",
"the",
"given",
"key",
"using",
"only",
"object",
"identity",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ArrayMap.java#L150-L165 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/FreeOnFreeHandler.java | FreeOnFreeHandler.init | public void init(Record record, Freeable freeable, Record recDependent, boolean bCloseOnFree) {
"""
Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param freeable A object to free when this record is freed.
@param recDependent The record to free when this record is freed.
@param bCloseOnFree If true, the record is freed.
"""
super.init(record);
m_freeable = freeable;
m_recDependent = recDependent;
m_bCloseOnFree = bCloseOnFree;
if (m_recDependent != null)
m_recDependent.addListener(new FileRemoveBOnCloseHandler(this));
} | java | public void init(Record record, Freeable freeable, Record recDependent, boolean bCloseOnFree)
{
super.init(record);
m_freeable = freeable;
m_recDependent = recDependent;
m_bCloseOnFree = bCloseOnFree;
if (m_recDependent != null)
m_recDependent.addListener(new FileRemoveBOnCloseHandler(this));
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"Freeable",
"freeable",
",",
"Record",
"recDependent",
",",
"boolean",
"bCloseOnFree",
")",
"{",
"super",
".",
"init",
"(",
"record",
")",
";",
"m_freeable",
"=",
"freeable",
";",
"m_recDependent",
"=",
"recDependent",
";",
"m_bCloseOnFree",
"=",
"bCloseOnFree",
";",
"if",
"(",
"m_recDependent",
"!=",
"null",
")",
"m_recDependent",
".",
"addListener",
"(",
"new",
"FileRemoveBOnCloseHandler",
"(",
"this",
")",
")",
";",
"}"
] | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param freeable A object to free when this record is freed.
@param recDependent The record to free when this record is freed.
@param bCloseOnFree If true, the record is freed. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/FreeOnFreeHandler.java#L85-L93 |
reactor/reactor-netty | src/main/java/reactor/netty/channel/BootstrapHandlers.java | BootstrapHandlers.removeConfiguration | public static Bootstrap removeConfiguration(Bootstrap b, String name) {
"""
Remove a configuration given its unique name from the given {@link
Bootstrap}
@param b a bootstrap
@param name a configuration name
"""
Objects.requireNonNull(b, "bootstrap");
Objects.requireNonNull(name, "name");
if (b.config().handler() != null) {
b.handler(removeConfiguration(b.config().handler(), name));
}
return b;
} | java | public static Bootstrap removeConfiguration(Bootstrap b, String name) {
Objects.requireNonNull(b, "bootstrap");
Objects.requireNonNull(name, "name");
if (b.config().handler() != null) {
b.handler(removeConfiguration(b.config().handler(), name));
}
return b;
} | [
"public",
"static",
"Bootstrap",
"removeConfiguration",
"(",
"Bootstrap",
"b",
",",
"String",
"name",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"b",
",",
"\"bootstrap\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"name",
",",
"\"name\"",
")",
";",
"if",
"(",
"b",
".",
"config",
"(",
")",
".",
"handler",
"(",
")",
"!=",
"null",
")",
"{",
"b",
".",
"handler",
"(",
"removeConfiguration",
"(",
"b",
".",
"config",
"(",
")",
".",
"handler",
"(",
")",
",",
"name",
")",
")",
";",
"}",
"return",
"b",
";",
"}"
] | Remove a configuration given its unique name from the given {@link
Bootstrap}
@param b a bootstrap
@param name a configuration name | [
"Remove",
"a",
"configuration",
"given",
"its",
"unique",
"name",
"from",
"the",
"given",
"{",
"@link",
"Bootstrap",
"}"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/channel/BootstrapHandlers.java#L182-L189 |
xsonorg/xson | src/main/java/org/xson/core/asm/MethodWriter.java | MethodWriter.writeShort | static void writeShort(final byte[] b, final int index, final int s) {
"""
Writes a short value in the given byte array.
@param b a byte array.
@param index where the first byte of the short value must be written.
@param s the value to be written in the given byte array.
"""
b[index] = (byte) (s >>> 8);
b[index + 1] = (byte) s;
} | java | static void writeShort(final byte[] b, final int index, final int s) {
b[index] = (byte) (s >>> 8);
b[index + 1] = (byte) s;
} | [
"static",
"void",
"writeShort",
"(",
"final",
"byte",
"[",
"]",
"b",
",",
"final",
"int",
"index",
",",
"final",
"int",
"s",
")",
"{",
"b",
"[",
"index",
"]",
"=",
"(",
"byte",
")",
"(",
"s",
">>>",
"8",
")",
";",
"b",
"[",
"index",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"s",
";",
"}"
] | Writes a short value in the given byte array.
@param b a byte array.
@param index where the first byte of the short value must be written.
@param s the value to be written in the given byte array. | [
"Writes",
"a",
"short",
"value",
"in",
"the",
"given",
"byte",
"array",
"."
] | train | https://github.com/xsonorg/xson/blob/ce1e197ec4ef9be448ed6ca96513e886151f83a9/src/main/java/org/xson/core/asm/MethodWriter.java#L2530-L2533 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java | BaseHttp2ServerBuilder.setServerCredentials | public BaseHttp2ServerBuilder setServerCredentials(final File certificatePemFile, final File privateKeyPkcs8File, final String privateKeyPassword) {
"""
<p>Sets the credentials for the server under construction using the certificates in the given PEM file and the
private key in the given PKCS#8 file.</p>
@param certificatePemFile a PEM file containing the certificate chain for the server under construction
@param privateKeyPkcs8File a PKCS#8 file containing the private key for the server under construction
@param privateKeyPassword the password for the given private key, or {@code null} if the key is not
password-protected
@return a reference to this builder
@since 0.8
"""
this.certificateChain = null;
this.privateKey = null;
this.certificateChainPemFile = certificatePemFile;
this.privateKeyPkcs8File = privateKeyPkcs8File;
this.certificateChainInputStream = null;
this.privateKeyPkcs8InputStream = null;
this.privateKeyPassword = privateKeyPassword;
return this;
} | java | public BaseHttp2ServerBuilder setServerCredentials(final File certificatePemFile, final File privateKeyPkcs8File, final String privateKeyPassword) {
this.certificateChain = null;
this.privateKey = null;
this.certificateChainPemFile = certificatePemFile;
this.privateKeyPkcs8File = privateKeyPkcs8File;
this.certificateChainInputStream = null;
this.privateKeyPkcs8InputStream = null;
this.privateKeyPassword = privateKeyPassword;
return this;
} | [
"public",
"BaseHttp2ServerBuilder",
"setServerCredentials",
"(",
"final",
"File",
"certificatePemFile",
",",
"final",
"File",
"privateKeyPkcs8File",
",",
"final",
"String",
"privateKeyPassword",
")",
"{",
"this",
".",
"certificateChain",
"=",
"null",
";",
"this",
".",
"privateKey",
"=",
"null",
";",
"this",
".",
"certificateChainPemFile",
"=",
"certificatePemFile",
";",
"this",
".",
"privateKeyPkcs8File",
"=",
"privateKeyPkcs8File",
";",
"this",
".",
"certificateChainInputStream",
"=",
"null",
";",
"this",
".",
"privateKeyPkcs8InputStream",
"=",
"null",
";",
"this",
".",
"privateKeyPassword",
"=",
"privateKeyPassword",
";",
"return",
"this",
";",
"}"
] | <p>Sets the credentials for the server under construction using the certificates in the given PEM file and the
private key in the given PKCS#8 file.</p>
@param certificatePemFile a PEM file containing the certificate chain for the server under construction
@param privateKeyPkcs8File a PKCS#8 file containing the private key for the server under construction
@param privateKeyPassword the password for the given private key, or {@code null} if the key is not
password-protected
@return a reference to this builder
@since 0.8 | [
"<p",
">",
"Sets",
"the",
"credentials",
"for",
"the",
"server",
"under",
"construction",
"using",
"the",
"certificates",
"in",
"the",
"given",
"PEM",
"file",
"and",
"the",
"private",
"key",
"in",
"the",
"given",
"PKCS#8",
"file",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java#L82-L95 |
twilio/twilio-java | src/main/java/com/twilio/rest/video/v1/RecordingReader.java | RecordingReader.firstPage | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<Recording> firstPage(final TwilioRestClient client) {
"""
Make the request to the Twilio API to perform the read.
@param client TwilioRestClient with which to make the request
@return Recording ResourceSet
"""
Request request = new Request(
HttpMethod.GET,
Domains.VIDEO.toString(),
"/v1/Recordings",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | java | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<Recording> firstPage(final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
Domains.VIDEO.toString(),
"/v1/Recordings",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:linelength\"",
")",
"public",
"Page",
"<",
"Recording",
">",
"firstPage",
"(",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
"Domains",
".",
"VIDEO",
".",
"toString",
"(",
")",
",",
"\"/v1/Recordings\"",
",",
"client",
".",
"getRegion",
"(",
")",
")",
";",
"addQueryParams",
"(",
"request",
")",
";",
"return",
"pageForRequest",
"(",
"client",
",",
"request",
")",
";",
"}"
] | Make the request to the Twilio API to perform the read.
@param client TwilioRestClient with which to make the request
@return Recording ResourceSet | [
"Make",
"the",
"request",
"to",
"the",
"Twilio",
"API",
"to",
"perform",
"the",
"read",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/video/v1/RecordingReader.java#L136-L148 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java | RegistriesInner.listPolicies | public RegistryPoliciesInner listPolicies(String resourceGroupName, String registryName) {
"""
Lists the policies for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegistryPoliciesInner object if successful.
"""
return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | java | public RegistryPoliciesInner listPolicies(String resourceGroupName, String registryName) {
return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | [
"public",
"RegistryPoliciesInner",
"listPolicies",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
")",
"{",
"return",
"listPoliciesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Lists the policies for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegistryPoliciesInner object if successful. | [
"Lists",
"the",
"policies",
"for",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L1491-L1493 |
maxirosson/jdroid-android | jdroid-android-core/src/main/java/com/jdroid/android/utils/SharedPreferencesHelper.java | SharedPreferencesHelper.loadPreferenceAsBoolean | public Boolean loadPreferenceAsBoolean(String key, Boolean defaultValue) {
"""
Retrieve a boolean value from the preferences.
@param key The name of the preference to retrieve
@param defaultValue Value to return if this preference does not exist
@return the preference value if it exists, or defaultValue.
"""
Boolean value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getBoolean(key, false);
}
logLoad(key, value);
return value;
} | java | public Boolean loadPreferenceAsBoolean(String key, Boolean defaultValue) {
Boolean value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getBoolean(key, false);
}
logLoad(key, value);
return value;
} | [
"public",
"Boolean",
"loadPreferenceAsBoolean",
"(",
"String",
"key",
",",
"Boolean",
"defaultValue",
")",
"{",
"Boolean",
"value",
"=",
"defaultValue",
";",
"if",
"(",
"hasPreference",
"(",
"key",
")",
")",
"{",
"value",
"=",
"getSharedPreferences",
"(",
")",
".",
"getBoolean",
"(",
"key",
",",
"false",
")",
";",
"}",
"logLoad",
"(",
"key",
",",
"value",
")",
";",
"return",
"value",
";",
"}"
] | Retrieve a boolean value from the preferences.
@param key The name of the preference to retrieve
@param defaultValue Value to return if this preference does not exist
@return the preference value if it exists, or defaultValue. | [
"Retrieve",
"a",
"boolean",
"value",
"from",
"the",
"preferences",
"."
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/SharedPreferencesHelper.java#L202-L209 |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/HadoopUtils.java | HadoopUtils.getSanitizedPath | public static Path getSanitizedPath(FileSystem fs, Path directory) throws IOException {
"""
Does the same thing as getLatestVersionedPath, but checks to see if the
directory contains #LATEST. If it doesn't, it just returns what was
passed in.
@param fs
@param directory
@return
@throws IOException
"""
if(directory.getName().endsWith("#LATEST")) {
// getparent strips out #LATEST
return getLatestVersionedPath(fs, directory.getParent(), null);
}
return directory;
} | java | public static Path getSanitizedPath(FileSystem fs, Path directory) throws IOException {
if(directory.getName().endsWith("#LATEST")) {
// getparent strips out #LATEST
return getLatestVersionedPath(fs, directory.getParent(), null);
}
return directory;
} | [
"public",
"static",
"Path",
"getSanitizedPath",
"(",
"FileSystem",
"fs",
",",
"Path",
"directory",
")",
"throws",
"IOException",
"{",
"if",
"(",
"directory",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\"#LATEST\"",
")",
")",
"{",
"// getparent strips out #LATEST",
"return",
"getLatestVersionedPath",
"(",
"fs",
",",
"directory",
".",
"getParent",
"(",
")",
",",
"null",
")",
";",
"}",
"return",
"directory",
";",
"}"
] | Does the same thing as getLatestVersionedPath, but checks to see if the
directory contains #LATEST. If it doesn't, it just returns what was
passed in.
@param fs
@param directory
@return
@throws IOException | [
"Does",
"the",
"same",
"thing",
"as",
"getLatestVersionedPath",
"but",
"checks",
"to",
"see",
"if",
"the",
"directory",
"contains",
"#LATEST",
".",
"If",
"it",
"doesn",
"t",
"it",
"just",
"returns",
"what",
"was",
"passed",
"in",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/HadoopUtils.java#L317-L324 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java | B2BAccountUrl.removeUserRoleAsyncUrl | public static MozuUrl removeUserRoleAsyncUrl(Integer accountId, Integer roleId, String userId) {
"""
Get Resource Url for RemoveUserRoleAsync
@param accountId Unique identifier of the customer account.
@param roleId
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles/{roleId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("roleId", roleId);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl removeUserRoleAsyncUrl(Integer accountId, Integer roleId, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles/{roleId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("roleId", roleId);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"removeUserRoleAsyncUrl",
"(",
"Integer",
"accountId",
",",
"Integer",
"roleId",
",",
"String",
"userId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles/{roleId}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"accountId\"",
",",
"accountId",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"roleId\"",
",",
"roleId",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"userId\"",
",",
"userId",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"TENANT_POD",
")",
";",
"}"
] | Get Resource Url for RemoveUserRoleAsync
@param accountId Unique identifier of the customer account.
@param roleId
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RemoveUserRoleAsync"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java#L273-L280 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/TextSimilarity.java | TextSimilarity.shinglerSimilarity | public static double shinglerSimilarity(String text1, String text2, int w) {
"""
Estimates the w-shingler similarity between two texts. The w is the number
of word sequences that are used for the estimation.
References:
http://phpir.com/shingling-near-duplicate-detection
http://www.std.org/~msm/common/clustering.html
@param text1
@param text2
@param w
@return
"""
preprocessDocument(text1);
preprocessDocument(text2);
NgramsExtractor.Parameters parameters = new NgramsExtractor.Parameters();
parameters.setMaxCombinations(w);
parameters.setMaxDistanceBetweenKwds(0);
parameters.setExaminationWindowLength(w);
NgramsExtractor ngrams = new NgramsExtractor(parameters);
Map<String, Double> keywords1 = ngrams.extract(text1);
Map<String, Double> keywords2 = ngrams.extract(text2);
//remove all the other combinations except of the w-grams
filterKeywordCombinations(keywords1, w);
filterKeywordCombinations(keywords2, w);
//ngrams=null;
//parameters=null;
double totalKeywords=0.0;
double commonKeywords=0.0;
Set<String> union = new HashSet<>(keywords1.keySet());
union.addAll(keywords2.keySet());
totalKeywords+=union.size();
//union=null;
Set<String> intersect = new HashSet<>(keywords1.keySet());
intersect.retainAll(keywords2.keySet());
commonKeywords+=intersect.size();
//intersect=null;
double resemblance=commonKeywords/totalKeywords;
//keywords1=null;
//keywords2=null;
return resemblance;
} | java | public static double shinglerSimilarity(String text1, String text2, int w) {
preprocessDocument(text1);
preprocessDocument(text2);
NgramsExtractor.Parameters parameters = new NgramsExtractor.Parameters();
parameters.setMaxCombinations(w);
parameters.setMaxDistanceBetweenKwds(0);
parameters.setExaminationWindowLength(w);
NgramsExtractor ngrams = new NgramsExtractor(parameters);
Map<String, Double> keywords1 = ngrams.extract(text1);
Map<String, Double> keywords2 = ngrams.extract(text2);
//remove all the other combinations except of the w-grams
filterKeywordCombinations(keywords1, w);
filterKeywordCombinations(keywords2, w);
//ngrams=null;
//parameters=null;
double totalKeywords=0.0;
double commonKeywords=0.0;
Set<String> union = new HashSet<>(keywords1.keySet());
union.addAll(keywords2.keySet());
totalKeywords+=union.size();
//union=null;
Set<String> intersect = new HashSet<>(keywords1.keySet());
intersect.retainAll(keywords2.keySet());
commonKeywords+=intersect.size();
//intersect=null;
double resemblance=commonKeywords/totalKeywords;
//keywords1=null;
//keywords2=null;
return resemblance;
} | [
"public",
"static",
"double",
"shinglerSimilarity",
"(",
"String",
"text1",
",",
"String",
"text2",
",",
"int",
"w",
")",
"{",
"preprocessDocument",
"(",
"text1",
")",
";",
"preprocessDocument",
"(",
"text2",
")",
";",
"NgramsExtractor",
".",
"Parameters",
"parameters",
"=",
"new",
"NgramsExtractor",
".",
"Parameters",
"(",
")",
";",
"parameters",
".",
"setMaxCombinations",
"(",
"w",
")",
";",
"parameters",
".",
"setMaxDistanceBetweenKwds",
"(",
"0",
")",
";",
"parameters",
".",
"setExaminationWindowLength",
"(",
"w",
")",
";",
"NgramsExtractor",
"ngrams",
"=",
"new",
"NgramsExtractor",
"(",
"parameters",
")",
";",
"Map",
"<",
"String",
",",
"Double",
">",
"keywords1",
"=",
"ngrams",
".",
"extract",
"(",
"text1",
")",
";",
"Map",
"<",
"String",
",",
"Double",
">",
"keywords2",
"=",
"ngrams",
".",
"extract",
"(",
"text2",
")",
";",
"//remove all the other combinations except of the w-grams",
"filterKeywordCombinations",
"(",
"keywords1",
",",
"w",
")",
";",
"filterKeywordCombinations",
"(",
"keywords2",
",",
"w",
")",
";",
"//ngrams=null;",
"//parameters=null;",
"double",
"totalKeywords",
"=",
"0.0",
";",
"double",
"commonKeywords",
"=",
"0.0",
";",
"Set",
"<",
"String",
">",
"union",
"=",
"new",
"HashSet",
"<>",
"(",
"keywords1",
".",
"keySet",
"(",
")",
")",
";",
"union",
".",
"addAll",
"(",
"keywords2",
".",
"keySet",
"(",
")",
")",
";",
"totalKeywords",
"+=",
"union",
".",
"size",
"(",
")",
";",
"//union=null;",
"Set",
"<",
"String",
">",
"intersect",
"=",
"new",
"HashSet",
"<>",
"(",
"keywords1",
".",
"keySet",
"(",
")",
")",
";",
"intersect",
".",
"retainAll",
"(",
"keywords2",
".",
"keySet",
"(",
")",
")",
";",
"commonKeywords",
"+=",
"intersect",
".",
"size",
"(",
")",
";",
"//intersect=null;",
"double",
"resemblance",
"=",
"commonKeywords",
"/",
"totalKeywords",
";",
"//keywords1=null;",
"//keywords2=null;",
"return",
"resemblance",
";",
"}"
] | Estimates the w-shingler similarity between two texts. The w is the number
of word sequences that are used for the estimation.
References:
http://phpir.com/shingling-near-duplicate-detection
http://www.std.org/~msm/common/clustering.html
@param text1
@param text2
@param w
@return | [
"Estimates",
"the",
"w",
"-",
"shingler",
"similarity",
"between",
"two",
"texts",
".",
"The",
"w",
"is",
"the",
"number",
"of",
"word",
"sequences",
"that",
"are",
"used",
"for",
"the",
"estimation",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/TextSimilarity.java#L74-L116 |
ziccardi/jnrpe | jnrpe-lib/src/main/java/it/jnrpe/net/JNRPEServerHandler.java | JNRPEServerHandler.channelRead | @Override
public final void channelRead(final ChannelHandlerContext ctx, final Object msg) {
"""
Method channelRead.
@param ctx ChannelHandlerContext
@param msg Object
@see io.netty.channel.ChannelInboundHandler#channelRead(ChannelHandlerContext, Object)
"""
try {
JNRPERequest req = (JNRPERequest) msg;
ReturnValue ret = commandInvoker.invoke(req.getCommand(), req.getArguments());
JNRPEResponse res = new JNRPEResponse();
res.setResult(ret.getStatus().intValue(), ret.getMessage());
ChannelFuture channelFuture = ctx.writeAndFlush(res);
channelFuture.addListener(ChannelFutureListener.CLOSE);
} catch ( RuntimeException re ) {
re.printStackTrace();
} finally {
ReferenceCountUtil.release(msg);
}
} | java | @Override
public final void channelRead(final ChannelHandlerContext ctx, final Object msg) {
try {
JNRPERequest req = (JNRPERequest) msg;
ReturnValue ret = commandInvoker.invoke(req.getCommand(), req.getArguments());
JNRPEResponse res = new JNRPEResponse();
res.setResult(ret.getStatus().intValue(), ret.getMessage());
ChannelFuture channelFuture = ctx.writeAndFlush(res);
channelFuture.addListener(ChannelFutureListener.CLOSE);
} catch ( RuntimeException re ) {
re.printStackTrace();
} finally {
ReferenceCountUtil.release(msg);
}
} | [
"@",
"Override",
"public",
"final",
"void",
"channelRead",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"Object",
"msg",
")",
"{",
"try",
"{",
"JNRPERequest",
"req",
"=",
"(",
"JNRPERequest",
")",
"msg",
";",
"ReturnValue",
"ret",
"=",
"commandInvoker",
".",
"invoke",
"(",
"req",
".",
"getCommand",
"(",
")",
",",
"req",
".",
"getArguments",
"(",
")",
")",
";",
"JNRPEResponse",
"res",
"=",
"new",
"JNRPEResponse",
"(",
")",
";",
"res",
".",
"setResult",
"(",
"ret",
".",
"getStatus",
"(",
")",
".",
"intValue",
"(",
")",
",",
"ret",
".",
"getMessage",
"(",
")",
")",
";",
"ChannelFuture",
"channelFuture",
"=",
"ctx",
".",
"writeAndFlush",
"(",
"res",
")",
";",
"channelFuture",
".",
"addListener",
"(",
"ChannelFutureListener",
".",
"CLOSE",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"re",
")",
"{",
"re",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"ReferenceCountUtil",
".",
"release",
"(",
"msg",
")",
";",
"}",
"}"
] | Method channelRead.
@param ctx ChannelHandlerContext
@param msg Object
@see io.netty.channel.ChannelInboundHandler#channelRead(ChannelHandlerContext, Object) | [
"Method",
"channelRead",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/net/JNRPEServerHandler.java#L70-L87 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/OWLOntologyID_CustomFieldSerializer.java | OWLOntologyID_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLOntologyID instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLOntologyID instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLOntologyID",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/OWLOntologyID_CustomFieldSerializer.java#L88-L91 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.