repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.matrixInverse | public SDVariable matrixInverse(String name, SDVariable in) {
validateFloatingPoint("matrix inverse", in);
SDVariable ret = f().matrixInverse(in);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable matrixInverse(String name, SDVariable in) {
validateFloatingPoint("matrix inverse", in);
SDVariable ret = f().matrixInverse(in);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"matrixInverse",
"(",
"String",
"name",
",",
"SDVariable",
"in",
")",
"{",
"validateFloatingPoint",
"(",
"\"matrix inverse\"",
",",
"in",
")",
";",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"matrixInverse",
"(",
"in",
")",
";",
... | Matrix inverse op. For 2D input, this returns the standard matrix inverse.
For higher dimensional input with shape [..., m, m] the matrix inverse is returned for each
shape [m,m] sub-matrix.
@param name Name of the output variable
@param in Input
@return Matrix inverse variable | [
"Matrix",
"inverse",
"op",
".",
"For",
"2D",
"input",
"this",
"returns",
"the",
"standard",
"matrix",
"inverse",
".",
"For",
"higher",
"dimensional",
"input",
"with",
"shape",
"[",
"...",
"m",
"m",
"]",
"the",
"matrix",
"inverse",
"is",
"returned",
"for",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1702-L1706 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectSphereSphere | public static boolean intersectSphereSphere(Spheref sphereA, Spheref sphereB, Vector4f centerAndRadiusOfIntersectionCircle) {
return intersectSphereSphere(sphereA.x, sphereA.y, sphereA.z, sphereA.r*sphereA.r, sphereB.x, sphereB.y, sphereB.z, sphereB.r*sphereB.r, centerAndRadiusOfIntersectionCircle);
} | java | public static boolean intersectSphereSphere(Spheref sphereA, Spheref sphereB, Vector4f centerAndRadiusOfIntersectionCircle) {
return intersectSphereSphere(sphereA.x, sphereA.y, sphereA.z, sphereA.r*sphereA.r, sphereB.x, sphereB.y, sphereB.z, sphereB.r*sphereB.r, centerAndRadiusOfIntersectionCircle);
} | [
"public",
"static",
"boolean",
"intersectSphereSphere",
"(",
"Spheref",
"sphereA",
",",
"Spheref",
"sphereB",
",",
"Vector4f",
"centerAndRadiusOfIntersectionCircle",
")",
"{",
"return",
"intersectSphereSphere",
"(",
"sphereA",
".",
"x",
",",
"sphereA",
".",
"y",
","... | Test whether the one sphere with intersects the other sphere, and store the center of the circle of
intersection in the <code>(x, y, z)</code> components of the supplied vector and the radius of that circle in the w component.
<p>
The normal vector of the circle of intersection can simply be obtained by subtracting the center of either sphere from the other.
<p>
Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a>
@param sphereA
the first sphere
@param sphereB
the second sphere
@param centerAndRadiusOfIntersectionCircle
will hold the center of the circle of intersection in the <code>(x, y, z)</code> components and the radius in the w component
@return <code>true</code> iff both spheres intersect; <code>false</code> otherwise | [
"Test",
"whether",
"the",
"one",
"sphere",
"with",
"intersects",
"the",
"other",
"sphere",
"and",
"store",
"the",
"center",
"of",
"the",
"circle",
"of",
"intersection",
"in",
"the",
"<code",
">",
"(",
"x",
"y",
"z",
")",
"<",
"/",
"code",
">",
"compone... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L825-L827 |
basho/riak-java-client | src/main/java/com/basho/riak/client/core/query/UserMetadata/RiakUserMetadata.java | RiakUserMetadata.containsKey | public boolean containsKey(String key, Charset charset)
{
return meta.containsKey(BinaryValue.unsafeCreate(key.getBytes(charset)));
} | java | public boolean containsKey(String key, Charset charset)
{
return meta.containsKey(BinaryValue.unsafeCreate(key.getBytes(charset)));
} | [
"public",
"boolean",
"containsKey",
"(",
"String",
"key",
",",
"Charset",
"charset",
")",
"{",
"return",
"meta",
".",
"containsKey",
"(",
"BinaryValue",
".",
"unsafeCreate",
"(",
"key",
".",
"getBytes",
"(",
"charset",
")",
")",
")",
";",
"}"
] | Determine if a specific usermeta entry is present.
<p>
This method uses the supplied {@code Charset} to convert the supplied key.
</p>
@param key the metadata key
@return {@code true} if the entry is present, {@code false} otherwise. | [
"Determine",
"if",
"a",
"specific",
"usermeta",
"entry",
"is",
"present",
".",
"<p",
">",
"This",
"method",
"uses",
"the",
"supplied",
"{",
"@code",
"Charset",
"}",
"to",
"convert",
"the",
"supplied",
"key",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/core/query/UserMetadata/RiakUserMetadata.java#L81-L84 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/GImageDerivativeOps.java | GImageDerivativeOps.derivativeForScaleSpace | public static <I extends ImageGray<I>, D extends ImageGray<D>>
AnyImageDerivative<I,D> derivativeForScaleSpace( Class<I> inputType , Class<D> derivType ) {
return createAnyDerivatives(DerivativeType.THREE,inputType,derivType);
} | java | public static <I extends ImageGray<I>, D extends ImageGray<D>>
AnyImageDerivative<I,D> derivativeForScaleSpace( Class<I> inputType , Class<D> derivType ) {
return createAnyDerivatives(DerivativeType.THREE,inputType,derivType);
} | [
"public",
"static",
"<",
"I",
"extends",
"ImageGray",
"<",
"I",
">",
",",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"AnyImageDerivative",
"<",
"I",
",",
"D",
">",
"derivativeForScaleSpace",
"(",
"Class",
"<",
"I",
">",
"inputType",
",",
"Class",
... | Creates an instance of {@link AnyImageDerivative} which is intended for use of calculating scale-spaces.
It uses {@link DerivativeType#THREE} since it does not blur the image. More typical operators, such as Sobel and
Prewitt, blur the image.
@param inputType Type of input image.
@param derivType Type of derivative image
@param <I> Image type.
@param <D> Image derivative type.
@return AnyImageDerivative | [
"Creates",
"an",
"instance",
"of",
"{",
"@link",
"AnyImageDerivative",
"}",
"which",
"is",
"intended",
"for",
"use",
"of",
"calculating",
"scale",
"-",
"spaces",
".",
"It",
"uses",
"{",
"@link",
"DerivativeType#THREE",
"}",
"since",
"it",
"does",
"not",
"blu... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/GImageDerivativeOps.java#L326-L329 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.countByC_LtD_S | @Override
public int countByC_LtD_S(long CPDefinitionId, Date displayDate, int status) {
FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S;
Object[] finderArgs = new Object[] {
CPDefinitionId, _getTime(displayDate), status
};
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_CPINSTANCE_WHERE);
query.append(_FINDER_COLUMN_C_LTD_S_CPDEFINITIONID_2);
boolean bindDisplayDate = false;
if (displayDate == null) {
query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
}
else {
bindDisplayDate = true;
query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
}
query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CPDefinitionId);
if (bindDisplayDate) {
qPos.add(new Timestamp(displayDate.getTime()));
}
qPos.add(status);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByC_LtD_S(long CPDefinitionId, Date displayDate, int status) {
FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S;
Object[] finderArgs = new Object[] {
CPDefinitionId, _getTime(displayDate), status
};
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_CPINSTANCE_WHERE);
query.append(_FINDER_COLUMN_C_LTD_S_CPDEFINITIONID_2);
boolean bindDisplayDate = false;
if (displayDate == null) {
query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1);
}
else {
bindDisplayDate = true;
query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2);
}
query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(CPDefinitionId);
if (bindDisplayDate) {
qPos.add(new Timestamp(displayDate.getTime()));
}
qPos.add(status);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByC_LtD_S",
"(",
"long",
"CPDefinitionId",
",",
"Date",
"displayDate",
",",
"int",
"status",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_WITH_PAGINATION_COUNT_BY_C_LTD_S",
";",
"Object",
"[",
"]",
"finderArgs",
"="... | Returns the number of cp instances where CPDefinitionId = ? and displayDate < ? and status = ?.
@param CPDefinitionId the cp definition ID
@param displayDate the display date
@param status the status
@return the number of matching cp instances | [
"Returns",
"the",
"number",
"of",
"cp",
"instances",
"where",
"CPDefinitionId",
"=",
"?",
";",
"and",
"displayDate",
"<",
";",
"?",
";",
"and",
"status",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L6737-L6801 |
bugsnag/bugsnag-java | bugsnag/src/main/java/com/bugsnag/Report.java | Report.setAppInfo | @Deprecated
public Report setAppInfo(String key, Object value) {
diagnostics.app.put(key, value);
return this;
} | java | @Deprecated
public Report setAppInfo(String key, Object value) {
diagnostics.app.put(key, value);
return this;
} | [
"@",
"Deprecated",
"public",
"Report",
"setAppInfo",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"diagnostics",
".",
"app",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add some application info on the report.
@param key the key of app info to add
@param value the value of app info to add
@return the modified report
@deprecated use {@link #addToTab(String, String, Object)} instead | [
"Add",
"some",
"application",
"info",
"on",
"the",
"report",
"."
] | train | https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/Report.java#L214-L218 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/constraint/SelfOrThis.java | SelfOrThis.satisfies | @Override
public boolean satisfies(Match match, int... ind)
{
return match.get(ind[selfIndex]) == match.get(ind[ind.length-1]) ||
super.satisfies(match, ind);
} | java | @Override
public boolean satisfies(Match match, int... ind)
{
return match.get(ind[selfIndex]) == match.get(ind[ind.length-1]) ||
super.satisfies(match, ind);
} | [
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"return",
"match",
".",
"get",
"(",
"ind",
"[",
"selfIndex",
"]",
")",
"==",
"match",
".",
"get",
"(",
"ind",
"[",
"ind",
".",
"length",
"... | Checks if the last index is either generated or equal to the first element.
@param match current pattern match
@param ind mapped indices
@return true if the last index is either generated or equal to the first element | [
"Checks",
"if",
"the",
"last",
"index",
"is",
"either",
"generated",
"or",
"equal",
"to",
"the",
"first",
"element",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/SelfOrThis.java#L90-L95 |
datacleaner/AnalyzerBeans | env/xml-config/src/main/java/org/eobjects/analyzer/configuration/JaxbConfigurationReader.java | JaxbConfigurationReader.checkName | private static void checkName(final String name, Class<?> type, final Map<String, ?> previousEntries)
throws IllegalStateException {
if (StringUtils.isNullOrEmpty(name)) {
throw new IllegalStateException(type.getSimpleName() + " name cannot be null");
}
if (previousEntries.containsKey(name)) {
throw new IllegalStateException(type.getSimpleName() + " name is not unique: " + name);
}
} | java | private static void checkName(final String name, Class<?> type, final Map<String, ?> previousEntries)
throws IllegalStateException {
if (StringUtils.isNullOrEmpty(name)) {
throw new IllegalStateException(type.getSimpleName() + " name cannot be null");
}
if (previousEntries.containsKey(name)) {
throw new IllegalStateException(type.getSimpleName() + " name is not unique: " + name);
}
} | [
"private",
"static",
"void",
"checkName",
"(",
"final",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"Map",
"<",
"String",
",",
"?",
">",
"previousEntries",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"StringUtils",
".",... | Checks if a string is a valid name of a component.
@param name
the name to be validated
@param type
the type of component (used for error messages)
@param previousEntries
the previous entries of that component type (for uniqueness
check)
@throws IllegalStateException
if the name is invalid | [
"Checks",
"if",
"a",
"string",
"is",
"a",
"valid",
"name",
"of",
"a",
"component",
"."
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/xml-config/src/main/java/org/eobjects/analyzer/configuration/JaxbConfigurationReader.java#L1227-L1235 |
javamelody/javamelody | javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyAutoConfiguration.java | JavaMelodyAutoConfiguration.monitoringSpringScheduledAdvisor | @Bean
@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "scheduled-monitoring-enabled", matchIfMissing = true)
@ConditionalOnMissingBean(DefaultAdvisorAutoProxyCreator.class)
public MonitoringSpringAdvisor monitoringSpringScheduledAdvisor() {
// scheduled-monitoring-enabled was false by default because of #643,
// pending https://jira.spring.io/browse/SPR-15562,
// but true by default since 1.76 after adding dependency spring-boot-starter-aop
return new MonitoringSpringAdvisor(
Pointcuts.union(new AnnotationMatchingPointcut(null, Scheduled.class),
new AnnotationMatchingPointcut(null, Schedules.class)));
} | java | @Bean
@ConditionalOnProperty(prefix = JavaMelodyConfigurationProperties.PREFIX, name = "scheduled-monitoring-enabled", matchIfMissing = true)
@ConditionalOnMissingBean(DefaultAdvisorAutoProxyCreator.class)
public MonitoringSpringAdvisor monitoringSpringScheduledAdvisor() {
// scheduled-monitoring-enabled was false by default because of #643,
// pending https://jira.spring.io/browse/SPR-15562,
// but true by default since 1.76 after adding dependency spring-boot-starter-aop
return new MonitoringSpringAdvisor(
Pointcuts.union(new AnnotationMatchingPointcut(null, Scheduled.class),
new AnnotationMatchingPointcut(null, Schedules.class)));
} | [
"@",
"Bean",
"@",
"ConditionalOnProperty",
"(",
"prefix",
"=",
"JavaMelodyConfigurationProperties",
".",
"PREFIX",
",",
"name",
"=",
"\"scheduled-monitoring-enabled\"",
",",
"matchIfMissing",
"=",
"true",
")",
"@",
"ConditionalOnMissingBean",
"(",
"DefaultAdvisorAutoProxy... | Monitoring of beans methods having the {@link Scheduled} or {@link Schedules} annotations.
@return MonitoringSpringAdvisor | [
"Monitoring",
"of",
"beans",
"methods",
"having",
"the",
"{"
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-spring-boot-starter/src/main/java/net/bull/javamelody/JavaMelodyAutoConfiguration.java#L262-L272 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java | GrailsHibernateUtil.ensureCorrectGroovyMetaClass | @Deprecated
public static void ensureCorrectGroovyMetaClass(Object target, Class<?> persistentClass) {
if (target instanceof GroovyObject) {
GroovyObject go = ((GroovyObject)target);
if (!go.getMetaClass().getTheClass().equals(persistentClass)) {
go.setMetaClass(GroovySystem.getMetaClassRegistry().getMetaClass(persistentClass));
}
}
} | java | @Deprecated
public static void ensureCorrectGroovyMetaClass(Object target, Class<?> persistentClass) {
if (target instanceof GroovyObject) {
GroovyObject go = ((GroovyObject)target);
if (!go.getMetaClass().getTheClass().equals(persistentClass)) {
go.setMetaClass(GroovySystem.getMetaClassRegistry().getMetaClass(persistentClass));
}
}
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"ensureCorrectGroovyMetaClass",
"(",
"Object",
"target",
",",
"Class",
"<",
"?",
">",
"persistentClass",
")",
"{",
"if",
"(",
"target",
"instanceof",
"GroovyObject",
")",
"{",
"GroovyObject",
"go",
"=",
"(",
"(",
... | Ensures the meta class is correct for a given class
@param target The GroovyObject
@param persistentClass The persistent class | [
"Ensures",
"the",
"meta",
"class",
"is",
"correct",
"for",
"a",
"given",
"class"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L363-L371 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.jsonPath | public T jsonPath(String jsonPathExpression, Object controlValue) {
validate(jsonPathExpression, controlValue);
return self;
} | java | public T jsonPath(String jsonPathExpression, Object controlValue) {
validate(jsonPathExpression, controlValue);
return self;
} | [
"public",
"T",
"jsonPath",
"(",
"String",
"jsonPathExpression",
",",
"Object",
"controlValue",
")",
"{",
"validate",
"(",
"jsonPathExpression",
",",
"controlValue",
")",
";",
"return",
"self",
";",
"}"
] | Adds JsonPath message element validation.
@param jsonPathExpression
@param controlValue
@return | [
"Adds",
"JsonPath",
"message",
"element",
"validation",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L606-L609 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/util/VerUtil.java | VerUtil.getTargetNameSpace | public static String getTargetNameSpace(String target) throws IOException {
String version = "";
String urlStr = "https://" + target + "/sdk/vimService?wsdl";
try {
trustAllHttpsCertificates();
}
catch (Exception e) {
throw new RuntimeException(e);
}
HttpsURLConnection.setDefaultHostnameVerifier(
new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
return true;
}
});
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String xmlWSDL = "";
String line;
while ((line = in.readLine()) != null) {
xmlWSDL = xmlWSDL + line;
}
int start = xmlWSDL.indexOf("targetNamespace") + "targetNamespace".length();
start = xmlWSDL.indexOf("\"", start);
int end = xmlWSDL.indexOf("\"", start + 1);
version = xmlWSDL.substring(start + 1, end);
return version;
} | java | public static String getTargetNameSpace(String target) throws IOException {
String version = "";
String urlStr = "https://" + target + "/sdk/vimService?wsdl";
try {
trustAllHttpsCertificates();
}
catch (Exception e) {
throw new RuntimeException(e);
}
HttpsURLConnection.setDefaultHostnameVerifier(
new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
return true;
}
});
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String xmlWSDL = "";
String line;
while ((line = in.readLine()) != null) {
xmlWSDL = xmlWSDL + line;
}
int start = xmlWSDL.indexOf("targetNamespace") + "targetNamespace".length();
start = xmlWSDL.indexOf("\"", start);
int end = xmlWSDL.indexOf("\"", start + 1);
version = xmlWSDL.substring(start + 1, end);
return version;
} | [
"public",
"static",
"String",
"getTargetNameSpace",
"(",
"String",
"target",
")",
"throws",
"IOException",
"{",
"String",
"version",
"=",
"\"\"",
";",
"String",
"urlStr",
"=",
"\"https://\"",
"+",
"target",
"+",
"\"/sdk/vimService?wsdl\"",
";",
"try",
"{",
"trus... | Retrieve the target server's name space
@param target either IP or host name
@return the namespace, e.g. urn:vim25Service
@throws IOException when there is a network issue or service issue on the target server
@throws RuntimeException wrapping NoSuchAlgorithmException, KeyManagementException which are
not likely to happen. If it happens, you can catch the runtime exception and unwrap it
for the real exceptions. | [
"Retrieve",
"the",
"target",
"server",
"s",
"name",
"space"
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/util/VerUtil.java#L82-L117 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createNicePartialMock | public static synchronized <T> T createNicePartialMock(Class<T> type, String methodNameToMock,
Class<?> firstArgumentType, Class<?>... additionalArgumentTypes) {
return doMockSpecific(type, new NiceMockStrategy(), new String[]{methodNameToMock}, null,
mergeArgumentTypes(firstArgumentType, additionalArgumentTypes));
} | java | public static synchronized <T> T createNicePartialMock(Class<T> type, String methodNameToMock,
Class<?> firstArgumentType, Class<?>... additionalArgumentTypes) {
return doMockSpecific(type, new NiceMockStrategy(), new String[]{methodNameToMock}, null,
mergeArgumentTypes(firstArgumentType, additionalArgumentTypes));
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"createNicePartialMock",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"methodNameToMock",
",",
"Class",
"<",
"?",
">",
"firstArgumentType",
",",
"Class",
"<",
"?",
">",
"...",
"additionalArgument... | Nicely mock a single specific method. Use this to handle overloaded
methods.
@param <T> The type of the mock.
@param type The type that'll be used to create a mock instance.
@param methodNameToMock The name of the method to mock
@param firstArgumentType The type of the first parameter of the method to mock
@param additionalArgumentTypes Optionally more parameter types that defines the method. Note
that this is only needed to separate overloaded methods.
@return A mock object of type <T>. | [
"Nicely",
"mock",
"a",
"single",
"specific",
"method",
".",
"Use",
"this",
"to",
"handle",
"overloaded",
"methods",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L503-L507 |
roboconf/roboconf-platform | core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/internal/utils/RestServicesUtils.java | RestServicesUtils.handleError | public static ResponseBuilder handleError( Status status, RestError restError, String lang ) {
return handleError( status.getStatusCode(), restError, lang );
} | java | public static ResponseBuilder handleError( Status status, RestError restError, String lang ) {
return handleError( status.getStatusCode(), restError, lang );
} | [
"public",
"static",
"ResponseBuilder",
"handleError",
"(",
"Status",
"status",
",",
"RestError",
"restError",
",",
"String",
"lang",
")",
"{",
"return",
"handleError",
"(",
"status",
".",
"getStatusCode",
"(",
")",
",",
"restError",
",",
"lang",
")",
";",
"}... | Handles an error and makes the magic stuff so that users can understand it.
@param status the response's status
@param restError a REST error
@param lang the user language
@return a response builder | [
"Handles",
"an",
"error",
"and",
"makes",
"the",
"magic",
"stuff",
"so",
"that",
"users",
"can",
"understand",
"it",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-rest-services/src/main/java/net/roboconf/dm/rest/services/internal/utils/RestServicesUtils.java#L98-L100 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java | XBasePanel.printXmlTrailer | public void printXmlTrailer(PrintWriter out, ResourceBundle reg)
throws DBException
{
String strTrailer = reg.getString("xmlTrailer");
if ((strTrailer == null) || (strTrailer.length() == 0))
strTrailer =
" <trailer>" +
" </trailer>";
out.println(strTrailer);
} | java | public void printXmlTrailer(PrintWriter out, ResourceBundle reg)
throws DBException
{
String strTrailer = reg.getString("xmlTrailer");
if ((strTrailer == null) || (strTrailer.length() == 0))
strTrailer =
" <trailer>" +
" </trailer>";
out.println(strTrailer);
} | [
"public",
"void",
"printXmlTrailer",
"(",
"PrintWriter",
"out",
",",
"ResourceBundle",
"reg",
")",
"throws",
"DBException",
"{",
"String",
"strTrailer",
"=",
"reg",
".",
"getString",
"(",
"\"xmlTrailer\"",
")",
";",
"if",
"(",
"(",
"strTrailer",
"==",
"null",
... | Code to display the side Menu.
@param out The http output stream.
@param reg Local resource bundle.
@exception DBException File exception. | [
"Code",
"to",
"display",
"the",
"side",
"Menu",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L359-L368 |
JetBrains/xodus | entity-store/src/main/java/jetbrains/exodus/entitystore/StoreNamingRules.java | StoreNamingRules.getFQName | @NotNull
private String getFQName(@NotNull final String localName, Object... params) {
final StringBuilder builder = new StringBuilder();
builder.append(storeName);
builder.append('.');
builder.append(localName);
for (final Object param : params) {
builder.append('#');
builder.append(param);
}
//noinspection ConstantConditions
return StringInterner.intern(builder.toString());
} | java | @NotNull
private String getFQName(@NotNull final String localName, Object... params) {
final StringBuilder builder = new StringBuilder();
builder.append(storeName);
builder.append('.');
builder.append(localName);
for (final Object param : params) {
builder.append('#');
builder.append(param);
}
//noinspection ConstantConditions
return StringInterner.intern(builder.toString());
} | [
"@",
"NotNull",
"private",
"String",
"getFQName",
"(",
"@",
"NotNull",
"final",
"String",
"localName",
",",
"Object",
"...",
"params",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
... | Gets fully-qualified name of a table or sequence.
@param localName local table name.
@param params params.
@return fully-qualified table name. | [
"Gets",
"fully",
"-",
"qualified",
"name",
"of",
"a",
"table",
"or",
"sequence",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/entity-store/src/main/java/jetbrains/exodus/entitystore/StoreNamingRules.java#L144-L156 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/json/JsonParser.java | JsonParser.parseArray | public final <T> Collection<T> parseArray(
Class<?> destinationCollectionClass, Class<T> destinationItemClass) throws IOException {
return parseArray(destinationCollectionClass, destinationItemClass, null);
} | java | public final <T> Collection<T> parseArray(
Class<?> destinationCollectionClass, Class<T> destinationItemClass) throws IOException {
return parseArray(destinationCollectionClass, destinationItemClass, null);
} | [
"public",
"final",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"parseArray",
"(",
"Class",
"<",
"?",
">",
"destinationCollectionClass",
",",
"Class",
"<",
"T",
">",
"destinationItemClass",
")",
"throws",
"IOException",
"{",
"return",
"parseArray",
"(",
"dest... | Parse a JSON Array from the given JSON parser into the given destination collection.
@param destinationCollectionClass class of destination collection (must have a public default
constructor)
@param destinationItemClass class of destination collection item (must have a public default
constructor)
@since 1.15 | [
"Parse",
"a",
"JSON",
"Array",
"from",
"the",
"given",
"JSON",
"parser",
"into",
"the",
"given",
"destination",
"collection",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/json/JsonParser.java#L558-L561 |
milaboratory/milib | src/main/java/com/milaboratory/core/mutations/Mutations.java | Mutations.extractRelativeMutationsForRange | public Mutations<S> extractRelativeMutationsForRange(int from, int to) {
if (to < from)
throw new IllegalArgumentException("Reversed ranges are not supported.");
long indexRange = getIndexRange(from, to);
// If range size is 0 return empty array
if (indexRange == 0)
return empty(alphabet);
// Unpacking
int fromIndex = (int) (indexRange >>> 32),
toIndex = (int) (indexRange & 0xFFFFFFFF);
// Don't create new object if result will be equal to this
if (from == 0 && fromIndex == 0 && toIndex == mutations.length)
return this;
// Creating result
int[] result = new int[toIndex - fromIndex];
// Constant to move positions in the output array
int offset;
if (from == -1)
offset = 0;
else
offset = ((-from) << POSITION_OFFSET);
// Copy and move mutations
for (int i = result.length - 1, j = toIndex - 1; i >= 0; --i, --j)
result[i] = mutations[j] + offset;
return new Mutations<>(alphabet, result, true);
} | java | public Mutations<S> extractRelativeMutationsForRange(int from, int to) {
if (to < from)
throw new IllegalArgumentException("Reversed ranges are not supported.");
long indexRange = getIndexRange(from, to);
// If range size is 0 return empty array
if (indexRange == 0)
return empty(alphabet);
// Unpacking
int fromIndex = (int) (indexRange >>> 32),
toIndex = (int) (indexRange & 0xFFFFFFFF);
// Don't create new object if result will be equal to this
if (from == 0 && fromIndex == 0 && toIndex == mutations.length)
return this;
// Creating result
int[] result = new int[toIndex - fromIndex];
// Constant to move positions in the output array
int offset;
if (from == -1)
offset = 0;
else
offset = ((-from) << POSITION_OFFSET);
// Copy and move mutations
for (int i = result.length - 1, j = toIndex - 1; i >= 0; --i, --j)
result[i] = mutations[j] + offset;
return new Mutations<>(alphabet, result, true);
} | [
"public",
"Mutations",
"<",
"S",
">",
"extractRelativeMutationsForRange",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"if",
"(",
"to",
"<",
"from",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Reversed ranges are not supported.\"",
")",
";",
"lon... | Extracts mutations for a range of positions in the original sequence and performs shift of corresponding
positions (moves them to {@code -from}).
<p>Insertions before {@code from} excluded. Insertions after {@code (to - 1)} included.</p>
<p>
<b>Important:</b> to extract leftmost insertions (trailing insertions) use {@code from = -1}. E.g.
{@code extractRelativeMutationsForRange(mut, -1, seqLength) == mut}.
</p>
@param from left bound of range, inclusive. Use -1 to extract leftmost insertions.
@param to right bound of range, exclusive
@return mutations for a range of positions | [
"Extracts",
"mutations",
"for",
"a",
"range",
"of",
"positions",
"in",
"the",
"original",
"sequence",
"and",
"performs",
"shift",
"of",
"corresponding",
"positions",
"(",
"moves",
"them",
"to",
"{",
"@code",
"-",
"from",
"}",
")",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/mutations/Mutations.java#L389-L422 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Factory.java | Factory.createFeaturable | private <O extends Featurable> O createFeaturable(Class<O> type, Setup setup) throws NoSuchMethodException
{
final O featurable = UtilReflection.createReduce(type, services, setup);
addFeatures(featurable, services, setup);
for (final Feature feature : featurable.getFeatures())
{
featurable.checkListener(feature);
for (final Feature other : featurable.getFeatures())
{
if (feature != other)
{
other.checkListener(feature);
}
}
}
return featurable;
} | java | private <O extends Featurable> O createFeaturable(Class<O> type, Setup setup) throws NoSuchMethodException
{
final O featurable = UtilReflection.createReduce(type, services, setup);
addFeatures(featurable, services, setup);
for (final Feature feature : featurable.getFeatures())
{
featurable.checkListener(feature);
for (final Feature other : featurable.getFeatures())
{
if (feature != other)
{
other.checkListener(feature);
}
}
}
return featurable;
} | [
"private",
"<",
"O",
"extends",
"Featurable",
">",
"O",
"createFeaturable",
"(",
"Class",
"<",
"O",
">",
"type",
",",
"Setup",
"setup",
")",
"throws",
"NoSuchMethodException",
"{",
"final",
"O",
"featurable",
"=",
"UtilReflection",
".",
"createReduce",
"(",
... | Create the featurable.
@param <O> The featurable type.
@param type The featurable type.
@param setup The associated setup.
@return The featurable instance.
@throws NoSuchMethodException If missing constructor. | [
"Create",
"the",
"featurable",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Factory.java#L261-L277 |
qspin/qtaste | kernel/src/main/java/com/qspin/qtaste/ui/treetable/AbstractTreeTableModel.java | AbstractTreeTableModel.fireTreeStructureChanged | protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TreeModelListener.class) {
// Lazily create the event:
if (e == null) {
e = new TreeModelEvent(source, path, childIndices, children);
}
((TreeModelListener) listeners[i + 1]).treeStructureChanged(e);
}
}
} | java | protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TreeModelListener.class) {
// Lazily create the event:
if (e == null) {
e = new TreeModelEvent(source, path, childIndices, children);
}
((TreeModelListener) listeners[i + 1]).treeStructureChanged(e);
}
}
} | [
"protected",
"void",
"fireTreeStructureChanged",
"(",
"Object",
"source",
",",
"Object",
"[",
"]",
"path",
",",
"int",
"[",
"]",
"childIndices",
",",
"Object",
"[",
"]",
"children",
")",
"{",
"// Guaranteed to return a non-null array",
"Object",
"[",
"]",
"liste... | /*
Notify all listeners that have registered interest for
notification on this event type. The event instance
is lazily created using the parameters passed into
the fire method.
@see EventListenerList | [
"/",
"*",
"Notify",
"all",
"listeners",
"that",
"have",
"registered",
"interest",
"for",
"notification",
"on",
"this",
"event",
"type",
".",
"The",
"event",
"instance",
"is",
"lazily",
"created",
"using",
"the",
"parameters",
"passed",
"into",
"the",
"fire",
... | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/ui/treetable/AbstractTreeTableModel.java#L152-L167 |
jbundle/jbundle | base/model/src/main/java/org/jbundle/base/model/Utility.java | Utility.getAs | public static Object getAs(Map<String,Object> properties, String strKey, Class<?> classData, Object objDefault)
{
if (properties == null)
return objDefault;
Object objData = properties.get(strKey);
try {
return Converter.convertObjectToDatatype(objData, classData, objDefault);
} catch (Exception ex) {
return null;
}
} | java | public static Object getAs(Map<String,Object> properties, String strKey, Class<?> classData, Object objDefault)
{
if (properties == null)
return objDefault;
Object objData = properties.get(strKey);
try {
return Converter.convertObjectToDatatype(objData, classData, objDefault);
} catch (Exception ex) {
return null;
}
} | [
"public",
"static",
"Object",
"getAs",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"strKey",
",",
"Class",
"<",
"?",
">",
"classData",
",",
"Object",
"objDefault",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"r... | Get this property from the map and convert it to the target class.
@param properties The map object to get the property from.
@param strKey The key of the property.
@param classData The target class to convert the property to.
@param objDefault The default value.
@return The data in the correct class. | [
"Get",
"this",
"property",
"from",
"the",
"map",
"and",
"convert",
"it",
"to",
"the",
"target",
"class",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L459-L469 |
m-m-m/util | io/src/main/java/net/sf/mmm/util/file/base/FileUtilImpl.java | FileUtilImpl.copyRecursive | private void copyRecursive(File source, File destination, FileFilter filter) {
if (source.isDirectory()) {
boolean okay = destination.mkdir();
if (!okay) {
throw new FileCreationFailedException(destination.getAbsolutePath(), true);
}
File[] children;
if (filter == null) {
children = source.listFiles();
} else {
children = source.listFiles(filter);
}
for (File file : children) {
copyRecursive(file, new File(destination, file.getName()), filter);
}
} else {
copyFile(source, destination);
}
} | java | private void copyRecursive(File source, File destination, FileFilter filter) {
if (source.isDirectory()) {
boolean okay = destination.mkdir();
if (!okay) {
throw new FileCreationFailedException(destination.getAbsolutePath(), true);
}
File[] children;
if (filter == null) {
children = source.listFiles();
} else {
children = source.listFiles(filter);
}
for (File file : children) {
copyRecursive(file, new File(destination, file.getName()), filter);
}
} else {
copyFile(source, destination);
}
} | [
"private",
"void",
"copyRecursive",
"(",
"File",
"source",
",",
"File",
"destination",
",",
"FileFilter",
"filter",
")",
"{",
"if",
"(",
"source",
".",
"isDirectory",
"(",
")",
")",
"{",
"boolean",
"okay",
"=",
"destination",
".",
"mkdir",
"(",
")",
";",... | This method copies the file or directory given by {@code source} into the given {@code destination}. <br>
<b>ATTENTION:</b><br>
In order to allow giving the copy of {@code source} a new {@link File#getName() name}, the {@code destination} has
to point to the final place where the copy should appear rather than the directory where the copy will be located
in. <br>
<br>
E.g. the following code copies the folder "foo" located in "/usr/local" recursively to the directory "/tmp". The
copy will have the same name "foo".
<pre>
{@link File} source = new {@link File}("/usr/local/foo");
{@link File} destination = new {@link File}("/tmp", source.getName()); // file: "/tmp/foo"
{@link FileUtilImpl}.copyRecursive(source, destination, true);
</pre>
@param source is the file or directory to copy.
@param destination is the final place where the copy should appear.
@param filter is a {@link FileFilter} that {@link FileFilter#accept(File) decides} which files should be copied.
Only {@link FileFilter#accept(File) accepted} files and directories are copied, others will be ignored. | [
"This",
"method",
"copies",
"the",
"file",
"or",
"directory",
"given",
"by",
"{",
"@code",
"source",
"}",
"into",
"the",
"given",
"{",
"@code",
"destination",
"}",
".",
"<br",
">",
"<b",
">",
"ATTENTION",
":",
"<",
"/",
"b",
">",
"<br",
">",
"In",
... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/io/src/main/java/net/sf/mmm/util/file/base/FileUtilImpl.java#L245-L264 |
apiman/apiman | common/plugin/src/main/java/io/apiman/common/plugin/PluginUtils.java | PluginUtils.getM2Path | public static File getM2Path(File m2Dir, PluginCoordinates coordinates) {
String artifactSubPath = getMavenPath(coordinates);
return new File(m2Dir, artifactSubPath);
} | java | public static File getM2Path(File m2Dir, PluginCoordinates coordinates) {
String artifactSubPath = getMavenPath(coordinates);
return new File(m2Dir, artifactSubPath);
} | [
"public",
"static",
"File",
"getM2Path",
"(",
"File",
"m2Dir",
",",
"PluginCoordinates",
"coordinates",
")",
"{",
"String",
"artifactSubPath",
"=",
"getMavenPath",
"(",
"coordinates",
")",
";",
"return",
"new",
"File",
"(",
"m2Dir",
",",
"artifactSubPath",
")",
... | Find the plugin artifact in the local .m2 directory.
@param m2Dir the maven m2 directory
@param coordinates the coordinates
@return the M2 path | [
"Find",
"the",
"plugin",
"artifact",
"in",
"the",
"local",
".",
"m2",
"directory",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/plugin/src/main/java/io/apiman/common/plugin/PluginUtils.java#L126-L129 |
facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/RaidShell.java | RaidShell.showConfig | private int showConfig(String cmd, String argv[], int startindex)
throws IOException {
int exitCode = 0;
PolicyInfo[] all = raidnode.getAllPolicies();
for (PolicyInfo p: all) {
out.println(p);
}
return exitCode;
} | java | private int showConfig(String cmd, String argv[], int startindex)
throws IOException {
int exitCode = 0;
PolicyInfo[] all = raidnode.getAllPolicies();
for (PolicyInfo p: all) {
out.println(p);
}
return exitCode;
} | [
"private",
"int",
"showConfig",
"(",
"String",
"cmd",
",",
"String",
"argv",
"[",
"]",
",",
"int",
"startindex",
")",
"throws",
"IOException",
"{",
"int",
"exitCode",
"=",
"0",
";",
"PolicyInfo",
"[",
"]",
"all",
"=",
"raidnode",
".",
"getAllPolicies",
"... | Apply operation specified by 'cmd' on all parameters
starting from argv[startindex]. | [
"Apply",
"operation",
"specified",
"by",
"cmd",
"on",
"all",
"parameters",
"starting",
"from",
"argv",
"[",
"startindex",
"]",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidShell.java#L780-L788 |
codegist/crest | core/src/main/java/org/codegist/crest/interceptor/AbstractRequestInterceptor.java | AbstractRequestInterceptor.newParamConfig | public ParamConfigBuilder newParamConfig(Class<?> type, Type genericType){
return paramConfigBuilderFactory.newInstance(type, genericType);
} | java | public ParamConfigBuilder newParamConfig(Class<?> type, Type genericType){
return paramConfigBuilderFactory.newInstance(type, genericType);
} | [
"public",
"ParamConfigBuilder",
"newParamConfig",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Type",
"genericType",
")",
"{",
"return",
"paramConfigBuilderFactory",
".",
"newInstance",
"(",
"type",
",",
"genericType",
")",
";",
"}"
] | Returns a new param config for the given class and generic type
@param type param config class
@param genericType param config generic type
@return the new param config | [
"Returns",
"a",
"new",
"param",
"config",
"for",
"the",
"given",
"class",
"and",
"generic",
"type"
] | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/interceptor/AbstractRequestInterceptor.java#L59-L61 |
tzaeschke/zoodb | src/org/zoodb/internal/util/FormattedStringBuilder.java | FormattedStringBuilder.appendRightAligned | public FormattedStringBuilder appendRightAligned(String s, int alignPosition) {
int lineStart = _delegate.lastIndexOf(NL);
int currentLength = _delegate.length();
int rightPosition = alignPosition;
if(lineStart != -1) {
lineStart += NL.length();
rightPosition = lineStart + alignPosition;
}
int fillPosition = rightPosition - s.length();
if(fillPosition<currentLength) {
throw new IllegalArgumentException("String \"" + s + "\" to right "
+ "align is longer than the unfilled buffer space ["
+ (rightPosition - currentLength) + "]");
} else {
fillBuffer(fillPosition, ' ');
}
return append(s);
} | java | public FormattedStringBuilder appendRightAligned(String s, int alignPosition) {
int lineStart = _delegate.lastIndexOf(NL);
int currentLength = _delegate.length();
int rightPosition = alignPosition;
if(lineStart != -1) {
lineStart += NL.length();
rightPosition = lineStart + alignPosition;
}
int fillPosition = rightPosition - s.length();
if(fillPosition<currentLength) {
throw new IllegalArgumentException("String \"" + s + "\" to right "
+ "align is longer than the unfilled buffer space ["
+ (rightPosition - currentLength) + "]");
} else {
fillBuffer(fillPosition, ' ');
}
return append(s);
} | [
"public",
"FormattedStringBuilder",
"appendRightAligned",
"(",
"String",
"s",
",",
"int",
"alignPosition",
")",
"{",
"int",
"lineStart",
"=",
"_delegate",
".",
"lastIndexOf",
"(",
"NL",
")",
";",
"int",
"currentLength",
"=",
"_delegate",
".",
"length",
"(",
")... | Appends to the line the white spaces and then the string <tt>s</tt>
so that the end of the string <tt>s</tt> is at the position
<tt>alignPosition</tt>. If the string is longer than the free space
in the buffer to the align position then an IllegalArgumentException
is thrown.
@param s String to append.
@param alignPosition index of the last character of the string
relative to the current line in the buffer.
@return The updated instance of FormattedStringBuilder.
@throws IllegalArgumentException if not enough space is allocated for
the string. | [
"Appends",
"to",
"the",
"line",
"the",
"white",
"spaces",
"and",
"then",
"the",
"string",
"<tt",
">",
"s<",
"/",
"tt",
">",
"so",
"that",
"the",
"end",
"of",
"the",
"string",
"<tt",
">",
"s<",
"/",
"tt",
">",
"is",
"at",
"the",
"position",
"<tt",
... | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/FormattedStringBuilder.java#L149-L166 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.putRegisteredService | public static void putRegisteredService(final RequestContext context, final RegisteredService registeredService) {
context.getFlowScope().put(PARAMETER_REGISTERED_SERVICE, registeredService);
} | java | public static void putRegisteredService(final RequestContext context, final RegisteredService registeredService) {
context.getFlowScope().put(PARAMETER_REGISTERED_SERVICE, registeredService);
} | [
"public",
"static",
"void",
"putRegisteredService",
"(",
"final",
"RequestContext",
"context",
",",
"final",
"RegisteredService",
"registeredService",
")",
"{",
"context",
".",
"getFlowScope",
"(",
")",
".",
"put",
"(",
"PARAMETER_REGISTERED_SERVICE",
",",
"registered... | Put registered service into flowscope.
@param context the context
@param registeredService the service | [
"Put",
"registered",
"service",
"into",
"flowscope",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L340-L342 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java | Boot.startJanus | public static Kernel startJanus(Class<? extends Agent> agentCls, Object... params)
throws Exception {
return startJanusWithModuleType(null, agentCls, params);
} | java | public static Kernel startJanus(Class<? extends Agent> agentCls, Object... params)
throws Exception {
return startJanusWithModuleType(null, agentCls, params);
} | [
"public",
"static",
"Kernel",
"startJanus",
"(",
"Class",
"<",
"?",
"extends",
"Agent",
">",
"agentCls",
",",
"Object",
"...",
"params",
")",
"throws",
"Exception",
"{",
"return",
"startJanusWithModuleType",
"(",
"null",
",",
"agentCls",
",",
"params",
")",
... | Launch the Janus kernel and the first agent in the kernel.
<p>Thus function does not parse the command line. See {@link #main(String[])} for the command line management. When this
function is called, it is assumed that all the system's properties are correctly set.
<p>The platformModule parameter permits to specify the injection module to use. The injection module is in change of
creating/injecting all the components of the platform. The default injection module is retreived from the system property
with the name stored in {@link JanusConfig#INJECTION_MODULE_NAME}. The default type for the injection module is stored in
the constant {@link JanusConfig#INJECTION_MODULE_NAME_VALUE}.
<p>The function {@link #getBootAgentIdentifier()} permits to retreive the identifier of the launched agent.
@param agentCls type of the first agent to launch.
@param params parameters to pass to the agent as its initliazation parameters.
@return the kernel that was launched.
@throws Exception - if it is impossible to start the platform.
@see #main(String[])
@see #getBootAgentIdentifier() | [
"Launch",
"the",
"Janus",
"kernel",
"and",
"the",
"first",
"agent",
"in",
"the",
"kernel",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L922-L925 |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java | AmqpMessageHandlerService.onMessage | @RabbitListener(queues = "${hawkbit.dmf.rabbitmq.receiverQueue:dmf_receiver}", containerFactory = "listenerContainerFactory")
public Message onMessage(final Message message,
@Header(name = MessageHeaderKey.TYPE, required = false) final String type,
@Header(name = MessageHeaderKey.TENANT, required = false) final String tenant) {
return onMessage(message, type, tenant, getRabbitTemplate().getConnectionFactory().getVirtualHost());
} | java | @RabbitListener(queues = "${hawkbit.dmf.rabbitmq.receiverQueue:dmf_receiver}", containerFactory = "listenerContainerFactory")
public Message onMessage(final Message message,
@Header(name = MessageHeaderKey.TYPE, required = false) final String type,
@Header(name = MessageHeaderKey.TENANT, required = false) final String tenant) {
return onMessage(message, type, tenant, getRabbitTemplate().getConnectionFactory().getVirtualHost());
} | [
"@",
"RabbitListener",
"(",
"queues",
"=",
"\"${hawkbit.dmf.rabbitmq.receiverQueue:dmf_receiver}\"",
",",
"containerFactory",
"=",
"\"listenerContainerFactory\"",
")",
"public",
"Message",
"onMessage",
"(",
"final",
"Message",
"message",
",",
"@",
"Header",
"(",
"name",
... | Method to handle all incoming DMF amqp messages.
@param message
incoming message
@param type
the message type
@param tenant
the contentType of the message
@return a message if <null> no message is send back to sender | [
"Method",
"to",
"handle",
"all",
"incoming",
"DMF",
"amqp",
"messages",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java#L106-L111 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.enableJobSchedule | public void enableJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleEnableOptions options = new JobScheduleEnableOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobSchedules().enable(jobScheduleId, options);
} | java | public void enableJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleEnableOptions options = new JobScheduleEnableOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobSchedules().enable(jobScheduleId, options);
} | [
"public",
"void",
"enableJobSchedule",
"(",
"String",
"jobScheduleId",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobScheduleEnableOptions",
"options",
"=",
"new",
"JobScheduleEn... | Enables the specified job schedule, allowing jobs to be created according to its {@link Schedule}.
@param jobScheduleId The ID of the job schedule.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Enables",
"the",
"specified",
"job",
"schedule",
"allowing",
"jobs",
"to",
"be",
"created",
"according",
"to",
"its",
"{",
"@link",
"Schedule",
"}",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L320-L326 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java | MLEDependencyGrammar.readData | @Override
public void readData(BufferedReader in) throws IOException {
final String LEFT = "left";
int lineNum = 1;
// all lines have one rule per line
boolean doingStop = false;
for (String line = in.readLine(); line != null && line.length() > 0; line = in.readLine()) {
try {
if (line.equals("BEGIN_STOP")) {
doingStop = true;
continue;
}
String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\'); // split on spaces, quote with doublequote, and escape with backslash
// System.out.println("fields:\n" + fields[0] + "\n" + fields[1] + "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4] + "\n" + fields[5]);
short distance = (short)Integer.parseInt(fields[4]);
IntTaggedWord tempHead = new IntTaggedWord(fields[0], '/', wordIndex, tagIndex);
IntTaggedWord tempArg = new IntTaggedWord(fields[2], '/', wordIndex, tagIndex);
IntDependency tempDependency = new IntDependency(tempHead, tempArg, fields[3].equals(LEFT), distance);
double count = Double.parseDouble(fields[5]);
if (doingStop) {
expandStop(tempDependency, distance, count, false);
} else {
expandArg(tempDependency, distance, count);
}
} catch (Exception e) {
IOException ioe = new IOException("Error on line " + lineNum + ": " + line);
ioe.initCause(e);
throw ioe;
}
// System.out.println("read line " + lineNum + ": " + line);
lineNum++;
}
} | java | @Override
public void readData(BufferedReader in) throws IOException {
final String LEFT = "left";
int lineNum = 1;
// all lines have one rule per line
boolean doingStop = false;
for (String line = in.readLine(); line != null && line.length() > 0; line = in.readLine()) {
try {
if (line.equals("BEGIN_STOP")) {
doingStop = true;
continue;
}
String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\'); // split on spaces, quote with doublequote, and escape with backslash
// System.out.println("fields:\n" + fields[0] + "\n" + fields[1] + "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4] + "\n" + fields[5]);
short distance = (short)Integer.parseInt(fields[4]);
IntTaggedWord tempHead = new IntTaggedWord(fields[0], '/', wordIndex, tagIndex);
IntTaggedWord tempArg = new IntTaggedWord(fields[2], '/', wordIndex, tagIndex);
IntDependency tempDependency = new IntDependency(tempHead, tempArg, fields[3].equals(LEFT), distance);
double count = Double.parseDouble(fields[5]);
if (doingStop) {
expandStop(tempDependency, distance, count, false);
} else {
expandArg(tempDependency, distance, count);
}
} catch (Exception e) {
IOException ioe = new IOException("Error on line " + lineNum + ": " + line);
ioe.initCause(e);
throw ioe;
}
// System.out.println("read line " + lineNum + ": " + line);
lineNum++;
}
} | [
"@",
"Override",
"public",
"void",
"readData",
"(",
"BufferedReader",
"in",
")",
"throws",
"IOException",
"{",
"final",
"String",
"LEFT",
"=",
"\"left\"",
";",
"int",
"lineNum",
"=",
"1",
";",
"// all lines have one rule per line\r",
"boolean",
"doingStop",
"=",
... | Populates data in this DependencyGrammar from the character stream
given by the Reader r. | [
"Populates",
"data",
"in",
"this",
"DependencyGrammar",
"from",
"the",
"character",
"stream",
"given",
"by",
"the",
"Reader",
"r",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L804-L840 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/module/ScriptModuleLoader.java | ScriptModuleLoader.notifyArchiveRejected | protected void notifyArchiveRejected(ScriptArchive scriptArchive, ArchiveRejectedReason reason, @Nullable Throwable cause) {
for (ScriptModuleListener listener : listeners) {
listener.archiveRejected(scriptArchive, reason, cause);
}
} | java | protected void notifyArchiveRejected(ScriptArchive scriptArchive, ArchiveRejectedReason reason, @Nullable Throwable cause) {
for (ScriptModuleListener listener : listeners) {
listener.archiveRejected(scriptArchive, reason, cause);
}
} | [
"protected",
"void",
"notifyArchiveRejected",
"(",
"ScriptArchive",
"scriptArchive",
",",
"ArchiveRejectedReason",
"reason",
",",
"@",
"Nullable",
"Throwable",
"cause",
")",
"{",
"for",
"(",
"ScriptModuleListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
... | Notify listeners that a script archive was rejected by this loader
@param scriptArchive archive that was rejected
@param reason reason it was rejected
@param cause underlying exception which triggered the rejection | [
"Notify",
"listeners",
"that",
"a",
"script",
"archive",
"was",
"rejected",
"by",
"this",
"loader"
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/module/ScriptModuleLoader.java#L501-L505 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toPolyhedralSurface | public PolyhedralSurface toPolyhedralSurface(
List<com.google.android.gms.maps.model.Polygon> polygonList,
boolean hasZ, boolean hasM) {
PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);
for (com.google.android.gms.maps.model.Polygon mapPolygon : polygonList) {
Polygon polygon = toPolygon(mapPolygon);
polyhedralSurface.addPolygon(polygon);
}
return polyhedralSurface;
} | java | public PolyhedralSurface toPolyhedralSurface(
List<com.google.android.gms.maps.model.Polygon> polygonList,
boolean hasZ, boolean hasM) {
PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);
for (com.google.android.gms.maps.model.Polygon mapPolygon : polygonList) {
Polygon polygon = toPolygon(mapPolygon);
polyhedralSurface.addPolygon(polygon);
}
return polyhedralSurface;
} | [
"public",
"PolyhedralSurface",
"toPolyhedralSurface",
"(",
"List",
"<",
"com",
".",
"google",
".",
"android",
".",
"gms",
".",
"maps",
".",
"model",
".",
"Polygon",
">",
"polygonList",
",",
"boolean",
"hasZ",
",",
"boolean",
"hasM",
")",
"{",
"PolyhedralSurf... | Convert a list of {@link Polygon} to a {@link PolyhedralSurface}
@param polygonList polygon list
@param hasZ has z flag
@param hasM has m flag
@return polyhedral surface | [
"Convert",
"a",
"list",
"of",
"{",
"@link",
"Polygon",
"}",
"to",
"a",
"{",
"@link",
"PolyhedralSurface",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1220-L1232 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArrayFor | public static <T> Level0ArrayOperator<Calendar[],Calendar> onArrayFor(final Calendar... elements) {
return onArrayOf(Types.CALENDAR, VarArgsUtil.asRequiredObjectArray(elements));
} | java | public static <T> Level0ArrayOperator<Calendar[],Calendar> onArrayFor(final Calendar... elements) {
return onArrayOf(Types.CALENDAR, VarArgsUtil.asRequiredObjectArray(elements));
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Calendar",
"[",
"]",
",",
"Calendar",
">",
"onArrayFor",
"(",
"final",
"Calendar",
"...",
"elements",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"CALENDAR",
",",
"VarArgsUtil",
".",
"... | <p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"array",
"with",
"the",
"specified",
"elements",
"and",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"it",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L1023-L1025 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/util/KeyUtils.java | KeyUtils.generateHashFunction | public static String generateHashFunction(byte[] min, byte[] max, int buckets, String suffix, String prefix)
throws Exception {
String[] Sbuckets = new String[buckets];
for (int i = 0; i < buckets; i++) {
Sbuckets[i] = i + "";
}
return generateRangeHashFunction(min, max, Sbuckets, suffix, prefix);
} | java | public static String generateHashFunction(byte[] min, byte[] max, int buckets, String suffix, String prefix)
throws Exception {
String[] Sbuckets = new String[buckets];
for (int i = 0; i < buckets; i++) {
Sbuckets[i] = i + "";
}
return generateRangeHashFunction(min, max, Sbuckets, suffix, prefix);
} | [
"public",
"static",
"String",
"generateHashFunction",
"(",
"byte",
"[",
"]",
"min",
",",
"byte",
"[",
"]",
"max",
",",
"int",
"buckets",
",",
"String",
"suffix",
",",
"String",
"prefix",
")",
"throws",
"Exception",
"{",
"String",
"[",
"]",
"Sbuckets",
"=... | Generates a {@link RangeHashFunction}.
@param min
the minimal value to expect
@param max
the maximal value to expect
@param buckets
the number of buckets
@param suffix
the suffix for all files
@param prefix
a prefix for all files
@return String representation of the the RangeHashFunction
@throws Exception | [
"Generates",
"a",
"{",
"@link",
"RangeHashFunction",
"}",
"."
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/util/KeyUtils.java#L127-L134 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuMoranScatterplotOutlier.java | CTLuMoranScatterplotOutlier.run | public OutlierResult run(Database database, Relation<N> nrel, Relation<? extends NumberVector> relation) {
final NeighborSetPredicate npred = getNeighborSetPredicateFactory().instantiate(database, nrel);
// Compute the global mean and variance
MeanVariance globalmv = new MeanVariance();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
globalmv.put(relation.get(iditer).doubleValue(0));
}
DoubleMinMax minmax = new DoubleMinMax();
WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC);
// calculate normalized attribute values
// calculate neighborhood average of normalized attribute values.
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
// Compute global z score
final double globalZ = (relation.get(iditer).doubleValue(0) - globalmv.getMean()) / globalmv.getNaiveStddev();
// Compute local average z score
Mean localm = new Mean();
for(DBIDIter iter = npred.getNeighborDBIDs(iditer).iter(); iter.valid(); iter.advance()) {
if(DBIDUtil.equal(iditer, iter)) {
continue;
}
localm.put((relation.get(iter).doubleValue(0) - globalmv.getMean()) / globalmv.getNaiveStddev());
}
// if neighors.size == 0
final double localZ;
if(localm.getCount() > 0) {
localZ = localm.getMean();
}
else {
// if s has no neighbors => Wzi = zi
localZ = globalZ;
}
// compute score
// Note: in the original moran scatterplot, any object with a score < 0
// would be an outlier.
final double score = Math.max(-globalZ * localZ, 0);
minmax.put(score);
scores.putDouble(iditer, score);
}
DoubleRelation scoreResult = new MaterializedDoubleRelation("MoranOutlier", "Moran Scatterplot Outlier", scores, relation.getDBIDs());
OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta(minmax.getMin(), minmax.getMax(), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 0);
OutlierResult or = new OutlierResult(scoreMeta, scoreResult);
or.addChildResult(npred);
return or;
} | java | public OutlierResult run(Database database, Relation<N> nrel, Relation<? extends NumberVector> relation) {
final NeighborSetPredicate npred = getNeighborSetPredicateFactory().instantiate(database, nrel);
// Compute the global mean and variance
MeanVariance globalmv = new MeanVariance();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
globalmv.put(relation.get(iditer).doubleValue(0));
}
DoubleMinMax minmax = new DoubleMinMax();
WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC);
// calculate normalized attribute values
// calculate neighborhood average of normalized attribute values.
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
// Compute global z score
final double globalZ = (relation.get(iditer).doubleValue(0) - globalmv.getMean()) / globalmv.getNaiveStddev();
// Compute local average z score
Mean localm = new Mean();
for(DBIDIter iter = npred.getNeighborDBIDs(iditer).iter(); iter.valid(); iter.advance()) {
if(DBIDUtil.equal(iditer, iter)) {
continue;
}
localm.put((relation.get(iter).doubleValue(0) - globalmv.getMean()) / globalmv.getNaiveStddev());
}
// if neighors.size == 0
final double localZ;
if(localm.getCount() > 0) {
localZ = localm.getMean();
}
else {
// if s has no neighbors => Wzi = zi
localZ = globalZ;
}
// compute score
// Note: in the original moran scatterplot, any object with a score < 0
// would be an outlier.
final double score = Math.max(-globalZ * localZ, 0);
minmax.put(score);
scores.putDouble(iditer, score);
}
DoubleRelation scoreResult = new MaterializedDoubleRelation("MoranOutlier", "Moran Scatterplot Outlier", scores, relation.getDBIDs());
OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta(minmax.getMin(), minmax.getMax(), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 0);
OutlierResult or = new OutlierResult(scoreMeta, scoreResult);
or.addChildResult(npred);
return or;
} | [
"public",
"OutlierResult",
"run",
"(",
"Database",
"database",
",",
"Relation",
"<",
"N",
">",
"nrel",
",",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"relation",
")",
"{",
"final",
"NeighborSetPredicate",
"npred",
"=",
"getNeighborSetPredicateFactory",... | Main method.
@param database Database
@param nrel Neighborhood relation
@param relation Data relation (1d!)
@return Outlier detection result | [
"Main",
"method",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/spatial/CTLuMoranScatterplotOutlier.java#L102-L150 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java | SecureDfuImpl.setObjectSize | private void setObjectSize(@NonNull final byte[] data, final int value) {
data[2] = (byte) (value & 0xFF);
data[3] = (byte) ((value >> 8) & 0xFF);
data[4] = (byte) ((value >> 16) & 0xFF);
data[5] = (byte) ((value >> 24) & 0xFF);
} | java | private void setObjectSize(@NonNull final byte[] data, final int value) {
data[2] = (byte) (value & 0xFF);
data[3] = (byte) ((value >> 8) & 0xFF);
data[4] = (byte) ((value >> 16) & 0xFF);
data[5] = (byte) ((value >> 24) & 0xFF);
} | [
"private",
"void",
"setObjectSize",
"(",
"@",
"NonNull",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"int",
"value",
")",
"{",
"data",
"[",
"2",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
"&",
"0xFF",
")",
";",
"data",
"[",
"3",
"]",
"=",
"... | Sets the object size in correct position of the data array.
@param data control point data packet
@param value Object size in bytes. | [
"Sets",
"the",
"object",
"size",
"in",
"correct",
"position",
"of",
"the",
"data",
"array",
"."
] | train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L737-L742 |
validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.fatal | private void fatal(String message, char textFound, String textExpected)
throws SAXException {
fatal(message, Character.valueOf(textFound).toString(), textExpected);
} | java | private void fatal(String message, char textFound, String textExpected)
throws SAXException {
fatal(message, Character.valueOf(textFound).toString(), textExpected);
} | [
"private",
"void",
"fatal",
"(",
"String",
"message",
",",
"char",
"textFound",
",",
"String",
"textExpected",
")",
"throws",
"SAXException",
"{",
"fatal",
"(",
"message",
",",
"Character",
".",
"valueOf",
"(",
"textFound",
")",
".",
"toString",
"(",
")",
... | Report a serious error.
@param message
The error message.
@param textFound
The text that caused the error (or null). | [
"Report",
"a",
"serious",
"error",
"."
] | train | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L578-L581 |
prestodb/presto | presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java | SemiTransactionalHiveMetastore.deleteRecursivelyIfExists | private static boolean deleteRecursivelyIfExists(HdfsContext context, HdfsEnvironment hdfsEnvironment, Path path)
{
FileSystem fileSystem;
try {
fileSystem = hdfsEnvironment.getFileSystem(context, path);
}
catch (IOException ignored) {
return false;
}
return deleteIfExists(fileSystem, path, true);
} | java | private static boolean deleteRecursivelyIfExists(HdfsContext context, HdfsEnvironment hdfsEnvironment, Path path)
{
FileSystem fileSystem;
try {
fileSystem = hdfsEnvironment.getFileSystem(context, path);
}
catch (IOException ignored) {
return false;
}
return deleteIfExists(fileSystem, path, true);
} | [
"private",
"static",
"boolean",
"deleteRecursivelyIfExists",
"(",
"HdfsContext",
"context",
",",
"HdfsEnvironment",
"hdfsEnvironment",
",",
"Path",
"path",
")",
"{",
"FileSystem",
"fileSystem",
";",
"try",
"{",
"fileSystem",
"=",
"hdfsEnvironment",
".",
"getFileSystem... | Attempts to remove the file or empty directory.
@return true if the location no longer exists | [
"Attempts",
"to",
"remove",
"the",
"file",
"or",
"empty",
"directory",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java#L1863-L1874 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java | ClassWriterImpl.getClassLinks | private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) {
Object[] typeList = list.toArray();
Content dd = new HtmlTree(HtmlTag.DD);
boolean isFirst = true;
for (Object item : typeList) {
if (!isFirst) {
Content separator = new StringContent(", ");
dd.addContent(separator);
} else {
isFirst = false;
}
if (item instanceof ClassDoc) {
Content link = getLink(new LinkInfoImpl(configuration, context, (ClassDoc)item));
dd.addContent(link);
} else {
Content link = getLink(new LinkInfoImpl(configuration, context, (Type)item));
dd.addContent(link);
}
}
return dd;
} | java | private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) {
Object[] typeList = list.toArray();
Content dd = new HtmlTree(HtmlTag.DD);
boolean isFirst = true;
for (Object item : typeList) {
if (!isFirst) {
Content separator = new StringContent(", ");
dd.addContent(separator);
} else {
isFirst = false;
}
if (item instanceof ClassDoc) {
Content link = getLink(new LinkInfoImpl(configuration, context, (ClassDoc)item));
dd.addContent(link);
} else {
Content link = getLink(new LinkInfoImpl(configuration, context, (Type)item));
dd.addContent(link);
}
}
return dd;
} | [
"private",
"Content",
"getClassLinks",
"(",
"LinkInfoImpl",
".",
"Kind",
"context",
",",
"Collection",
"<",
"?",
">",
"list",
")",
"{",
"Object",
"[",
"]",
"typeList",
"=",
"list",
".",
"toArray",
"(",
")",
";",
"Content",
"dd",
"=",
"new",
"HtmlTree",
... | Get links to the given classes.
@param context the id of the context where the link will be printed
@param list the list of classes
@return a content tree for the class list | [
"Get",
"links",
"to",
"the",
"given",
"classes",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java#L590-L611 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy2nd | public static <T1, T2, T3> TriPredicate<T1, T2, T3> spy2nd(TriPredicate<T1, T2, T3> predicate, Box<T2> param2) {
return spy(predicate, Box.<Boolean>empty(), Box.<T1>empty(), param2, Box.<T3>empty());
} | java | public static <T1, T2, T3> TriPredicate<T1, T2, T3> spy2nd(TriPredicate<T1, T2, T3> predicate, Box<T2> param2) {
return spy(predicate, Box.<Boolean>empty(), Box.<T1>empty(), param2, Box.<T3>empty());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"TriPredicate",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"spy2nd",
"(",
"TriPredicate",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"predicate",
",",
"Box",
"<",
"T2",
">",
"param2",
")",
"{",
"r... | Proxies a ternary predicate spying for second parameter.
@param <T1> the predicate first parameter type
@param <T2> the predicate second parameter type
@param <T3> the predicate third parameter type
@param predicate the predicate that will be spied
@param param2 a box that will be containing the second spied parameter
@return the proxied predicate | [
"Proxies",
"a",
"ternary",
"predicate",
"spying",
"for",
"second",
"parameter",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L429-L431 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImagesFromUrls | public ImageCreateSummary createImagesFromUrls(UUID projectId, ImageUrlCreateBatch batch) {
return createImagesFromUrlsWithServiceResponseAsync(projectId, batch).toBlocking().single().body();
} | java | public ImageCreateSummary createImagesFromUrls(UUID projectId, ImageUrlCreateBatch batch) {
return createImagesFromUrlsWithServiceResponseAsync(projectId, batch).toBlocking().single().body();
} | [
"public",
"ImageCreateSummary",
"createImagesFromUrls",
"(",
"UUID",
"projectId",
",",
"ImageUrlCreateBatch",
"batch",
")",
"{",
"return",
"createImagesFromUrlsWithServiceResponseAsync",
"(",
"projectId",
",",
"batch",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Add the provided images urls to the set of training images.
This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags.
@param projectId The project id
@param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch
@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 ImageCreateSummary object if successful. | [
"Add",
"the",
"provided",
"images",
"urls",
"to",
"the",
"set",
"of",
"training",
"images",
".",
"This",
"API",
"accepts",
"a",
"batch",
"of",
"urls",
"and",
"optionally",
"tags",
"to",
"create",
"images",
".",
"There",
"is",
"a",
"limit",
"of",
"64",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3840-L3842 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java | RingPlacer.getNativeRingRadius | public double getNativeRingRadius(IRing ring, double bondLength) {
int size = ring.getAtomCount();
double radius = bondLength / (2 * Math.sin((Math.PI) / size));
return radius;
} | java | public double getNativeRingRadius(IRing ring, double bondLength) {
int size = ring.getAtomCount();
double radius = bondLength / (2 * Math.sin((Math.PI) / size));
return radius;
} | [
"public",
"double",
"getNativeRingRadius",
"(",
"IRing",
"ring",
",",
"double",
"bondLength",
")",
"{",
"int",
"size",
"=",
"ring",
".",
"getAtomCount",
"(",
")",
";",
"double",
"radius",
"=",
"bondLength",
"/",
"(",
"2",
"*",
"Math",
".",
"sin",
"(",
... | Returns the ring radius of a perfect polygons of size ring.getAtomCount()
The ring radius is the distance of each atom to the ringcenter.
@param ring The ring for which the radius is to calculated
@param bondLength The bond length for each bond in the ring
@return The radius of the ring. | [
"Returns",
"the",
"ring",
"radius",
"of",
"a",
"perfect",
"polygons",
"of",
"size",
"ring",
".",
"getAtomCount",
"()",
"The",
"ring",
"radius",
"is",
"the",
"distance",
"of",
"each",
"atom",
"to",
"the",
"ringcenter",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java#L686-L690 |
teatrove/teatrove | teaapps/src/main/java/org/teatrove/teaapps/contexts/HttpContext.java | HttpContext.doSecureGet | public String doSecureGet(String host, String path,
int port, Map<String, String> headers,
int timeout)
throws UnknownHostException, ConnectException, IOException {
return doHttpCall(host, path, null, port, headers, timeout, true);
} | java | public String doSecureGet(String host, String path,
int port, Map<String, String> headers,
int timeout)
throws UnknownHostException, ConnectException, IOException {
return doHttpCall(host, path, null, port, headers, timeout, true);
} | [
"public",
"String",
"doSecureGet",
"(",
"String",
"host",
",",
"String",
"path",
",",
"int",
"port",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"int",
"timeout",
")",
"throws",
"UnknownHostException",
",",
"ConnectException",
",",
"IOExce... | Perform a secure HTTPS GET at the given path returning the results of the
response.
@param host The hostname of the request
@param path The path of the request
@param port The port of the request
@param headers The headers to pass in the request
@param timeout The timeout of the request in milliseconds
@return The data of the resposne
@throws UnknownHostException if the host cannot be found
@throws ConnectException if the HTTP server does not respond
@throws IOException if an I/O error occurs processing the request | [
"Perform",
"a",
"secure",
"HTTPS",
"GET",
"at",
"the",
"given",
"path",
"returning",
"the",
"results",
"of",
"the",
"response",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/HttpContext.java#L83-L89 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.collectOne | public Object collectOne(String json, String... paths) {
return collectOne(json, compile(paths));
} | java | public Object collectOne(String json, String... paths) {
return collectOne(json, compile(paths));
} | [
"public",
"Object",
"collectOne",
"(",
"String",
"json",
",",
"String",
"...",
"paths",
")",
"{",
"return",
"collectOne",
"(",
"json",
",",
"compile",
"(",
"paths",
")",
")",
";",
"}"
] | Collect the first matched value and stop parsing immediately
@param json json
@param paths JsonPath
@return value | [
"Collect",
"the",
"first",
"matched",
"value",
"and",
"stop",
"parsing",
"immediately"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L388-L390 |
facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyRaid.java | BlockPlacementPolicyRaid.getSourceFile | NameWithINode getSourceFile(String parity, String prefix) throws IOException {
if (isHarFile(parity)) {
return null;
}
// remove the prefix
String src = parity.substring(prefix.length());
byte[][] components = INodeDirectory.getPathComponents(src);
INode inode = namesystem.dir.getINode(components);
return new NameWithINode(src, inode);
} | java | NameWithINode getSourceFile(String parity, String prefix) throws IOException {
if (isHarFile(parity)) {
return null;
}
// remove the prefix
String src = parity.substring(prefix.length());
byte[][] components = INodeDirectory.getPathComponents(src);
INode inode = namesystem.dir.getINode(components);
return new NameWithINode(src, inode);
} | [
"NameWithINode",
"getSourceFile",
"(",
"String",
"parity",
",",
"String",
"prefix",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isHarFile",
"(",
"parity",
")",
")",
"{",
"return",
"null",
";",
"}",
"// remove the prefix",
"String",
"src",
"=",
"parity",
"... | Get path for the corresponding source file for a valid parity
file. Returns null if it does not exists
@param parity the toUri path of the parity file
@return the toUri path of the source file | [
"Get",
"path",
"for",
"the",
"corresponding",
"source",
"file",
"for",
"a",
"valid",
"parity",
"file",
".",
"Returns",
"null",
"if",
"it",
"does",
"not",
"exists"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/hdfs/server/namenode/BlockPlacementPolicyRaid.java#L774-L783 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | TypeUtils.getType | public String getType(TypeElement element, TypeMirror type) {
if (type == null) {
return null;
}
return type.accept(this.typeExtractor, createTypeDescriptor(element));
} | java | public String getType(TypeElement element, TypeMirror type) {
if (type == null) {
return null;
}
return type.accept(this.typeExtractor, createTypeDescriptor(element));
} | [
"public",
"String",
"getType",
"(",
"TypeElement",
"element",
",",
"TypeMirror",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"type",
".",
"accept",
"(",
"this",
".",
"typeExtractor",
",",
"createType... | Return the type of the specified {@link TypeMirror} including all its generic
information.
@param element the {@link TypeElement} in which this {@code type} is declared
@param type the type to handle
@return a representation of the type including all its generic information | [
"Return",
"the",
"type",
"of",
"the",
"specified",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java#L138-L143 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_secondaryDnsDomains_domain_PUT | public void serviceName_secondaryDnsDomains_domain_PUT(String serviceName, String domain, OvhSecondaryDNS body) throws IOException {
String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains/{domain}";
StringBuilder sb = path(qPath, serviceName, domain);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_secondaryDnsDomains_domain_PUT(String serviceName, String domain, OvhSecondaryDNS body) throws IOException {
String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains/{domain}";
StringBuilder sb = path(qPath, serviceName, domain);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_secondaryDnsDomains_domain_PUT",
"(",
"String",
"serviceName",
",",
"String",
"domain",
",",
"OvhSecondaryDNS",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/secondaryDnsDomains/{domain}\"",
... | Alter this object properties
REST: PUT /dedicated/server/{serviceName}/secondaryDnsDomains/{domain}
@param body [required] New object properties
@param serviceName [required] The internal name of your dedicated server
@param domain [required] domain on slave server | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1963-L1967 |
infinispan/infinispan | core/src/main/java/org/infinispan/persistence/support/SingletonCacheWriter.java | SingletonCacheWriter.pushState | protected void pushState(final Cache<?, ?> cache) throws Exception {
DataContainer<?, ?> dc = cache.getAdvancedCache().getDataContainer();
dc.forEach(entry -> {
MarshallableEntry me = ctx.getMarshallableEntryFactory().create(entry.getKey(), entry.getValue(), entry.getMetadata(),
entry.getExpiryTime(), entry.getLastUsed());
write(me);
});
} | java | protected void pushState(final Cache<?, ?> cache) throws Exception {
DataContainer<?, ?> dc = cache.getAdvancedCache().getDataContainer();
dc.forEach(entry -> {
MarshallableEntry me = ctx.getMarshallableEntryFactory().create(entry.getKey(), entry.getValue(), entry.getMetadata(),
entry.getExpiryTime(), entry.getLastUsed());
write(me);
});
} | [
"protected",
"void",
"pushState",
"(",
"final",
"Cache",
"<",
"?",
",",
"?",
">",
"cache",
")",
"throws",
"Exception",
"{",
"DataContainer",
"<",
"?",
",",
"?",
">",
"dc",
"=",
"cache",
".",
"getAdvancedCache",
"(",
")",
".",
"getDataContainer",
"(",
"... | Pushes the state of a specific cache by reading the cache's data and putting in the cache store. | [
"Pushes",
"the",
"state",
"of",
"a",
"specific",
"cache",
"by",
"reading",
"the",
"cache",
"s",
"data",
"and",
"putting",
"in",
"the",
"cache",
"store",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/persistence/support/SingletonCacheWriter.java#L141-L148 |
cryptomator/siv-mode | src/main/java/org/cryptomator/siv/SivMode.java | SivMode.s2v | byte[] s2v(byte[] macKey, byte[] plaintext, byte[]... associatedData) {
// Maximum permitted AD length is the block size in bits - 2
if (associatedData.length > 126) {
// SIV mode cannot be used safely with this many AD fields
throw new IllegalArgumentException("too many Associated Data fields");
}
final CipherParameters params = new KeyParameter(macKey);
final CMac mac = new CMac(threadLocalCipher.get());
mac.init(params);
byte[] d = mac(mac, BYTES_ZERO);
for (byte[] s : associatedData) {
d = xor(dbl(d), mac(mac, s));
}
final byte[] t;
if (plaintext.length >= 16) {
t = xorend(plaintext, d);
} else {
t = xor(dbl(d), pad(plaintext));
}
return mac(mac, t);
} | java | byte[] s2v(byte[] macKey, byte[] plaintext, byte[]... associatedData) {
// Maximum permitted AD length is the block size in bits - 2
if (associatedData.length > 126) {
// SIV mode cannot be used safely with this many AD fields
throw new IllegalArgumentException("too many Associated Data fields");
}
final CipherParameters params = new KeyParameter(macKey);
final CMac mac = new CMac(threadLocalCipher.get());
mac.init(params);
byte[] d = mac(mac, BYTES_ZERO);
for (byte[] s : associatedData) {
d = xor(dbl(d), mac(mac, s));
}
final byte[] t;
if (plaintext.length >= 16) {
t = xorend(plaintext, d);
} else {
t = xor(dbl(d), pad(plaintext));
}
return mac(mac, t);
} | [
"byte",
"[",
"]",
"s2v",
"(",
"byte",
"[",
"]",
"macKey",
",",
"byte",
"[",
"]",
"plaintext",
",",
"byte",
"[",
"]",
"...",
"associatedData",
")",
"{",
"// Maximum permitted AD length is the block size in bits - 2",
"if",
"(",
"associatedData",
".",
"length",
... | Visible for testing, throws IllegalArgumentException if key is not accepted by CMac#init(CipherParameters) | [
"Visible",
"for",
"testing",
"throws",
"IllegalArgumentException",
"if",
"key",
"is",
"not",
"accepted",
"by",
"CMac#init",
"(",
"CipherParameters",
")"
] | train | https://github.com/cryptomator/siv-mode/blob/aa21286cc5a840c42ec3bf6d4c945ab6acaad568/src/main/java/org/cryptomator/siv/SivMode.java#L224-L249 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/StringUtils.java | StringUtils.restoreSet | public static Set<String> restoreSet(final String s, final String delim) {
final Set<String> copytoSet = new HashSet<>();
if (StringUtils.isEmptyString(s)) {
return copytoSet;
}
final StringTokenizer st = new StringTokenizer(s, delim);
while (st.hasMoreTokens()) {
final String entry = st.nextToken();
if (!StringUtils.isEmptyString(entry)) {
copytoSet.add(entry);
}
}
return copytoSet;
} | java | public static Set<String> restoreSet(final String s, final String delim) {
final Set<String> copytoSet = new HashSet<>();
if (StringUtils.isEmptyString(s)) {
return copytoSet;
}
final StringTokenizer st = new StringTokenizer(s, delim);
while (st.hasMoreTokens()) {
final String entry = st.nextToken();
if (!StringUtils.isEmptyString(entry)) {
copytoSet.add(entry);
}
}
return copytoSet;
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"restoreSet",
"(",
"final",
"String",
"s",
",",
"final",
"String",
"delim",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"copytoSet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"StringUtils",
... | Break down a string separated by <code>delim</code> into a string set.
@param s String to be splitted
@param delim Delimiter to be used.
@return string set | [
"Break",
"down",
"a",
"string",
"separated",
"by",
"<code",
">",
"delim<",
"/",
"code",
">",
"into",
"a",
"string",
"set",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/StringUtils.java#L144-L160 |
jenkinsci/jenkins | core/src/main/java/jenkins/security/UserDetailsCache.java | UserDetailsCache.loadUserByUsername | @Nonnull
public UserDetails loadUserByUsername(String idOrFullName) throws UsernameNotFoundException, DataAccessException, ExecutionException {
Boolean exists = existenceCache.getIfPresent(idOrFullName);
if(exists != null && !exists) {
throw new UsernameNotFoundException(String.format("\"%s\" does not exist", idOrFullName));
} else {
try {
return detailsCache.get(idOrFullName, new Retriever(idOrFullName));
} catch (ExecutionException | UncheckedExecutionException e) {
if (e.getCause() instanceof UsernameNotFoundException) {
throw ((UsernameNotFoundException)e.getCause());
} else if (e.getCause() instanceof DataAccessException) {
throw ((DataAccessException)e.getCause());
} else {
throw e;
}
}
}
} | java | @Nonnull
public UserDetails loadUserByUsername(String idOrFullName) throws UsernameNotFoundException, DataAccessException, ExecutionException {
Boolean exists = existenceCache.getIfPresent(idOrFullName);
if(exists != null && !exists) {
throw new UsernameNotFoundException(String.format("\"%s\" does not exist", idOrFullName));
} else {
try {
return detailsCache.get(idOrFullName, new Retriever(idOrFullName));
} catch (ExecutionException | UncheckedExecutionException e) {
if (e.getCause() instanceof UsernameNotFoundException) {
throw ((UsernameNotFoundException)e.getCause());
} else if (e.getCause() instanceof DataAccessException) {
throw ((DataAccessException)e.getCause());
} else {
throw e;
}
}
}
} | [
"@",
"Nonnull",
"public",
"UserDetails",
"loadUserByUsername",
"(",
"String",
"idOrFullName",
")",
"throws",
"UsernameNotFoundException",
",",
"DataAccessException",
",",
"ExecutionException",
"{",
"Boolean",
"exists",
"=",
"existenceCache",
".",
"getIfPresent",
"(",
"i... | Locates the user based on the username, by first looking in the cache and then delegate to
{@link hudson.security.SecurityRealm#loadUserByUsername(String)}.
@param idOrFullName the username
@return the details
@throws UsernameNotFoundException (normally a {@link hudson.security.UserMayOrMayNotExistException})
if the user could not be found or the user has no GrantedAuthority
@throws DataAccessException if user could not be found for a repository-specific reason
@throws ExecutionException if anything else went wrong in the cache lookup/retrieval | [
"Locates",
"the",
"user",
"based",
"on",
"the",
"username",
"by",
"first",
"looking",
"in",
"the",
"cache",
"and",
"then",
"delegate",
"to",
"{",
"@link",
"hudson",
".",
"security",
".",
"SecurityRealm#loadUserByUsername",
"(",
"String",
")",
"}",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/UserDetailsCache.java#L120-L138 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/DateUtil.java | DateUtil.parseIso8601Date | public static Instant parseIso8601Date(String dateString) {
// For EC2 Spot Fleet.
if (dateString.endsWith("+0000")) {
dateString = dateString
.substring(0, dateString.length() - 5)
.concat("Z");
}
try {
return parseInstant(dateString, ISO_INSTANT);
} catch (DateTimeParseException e) {
return parseInstant(dateString, ALTERNATE_ISO_8601_DATE_FORMAT);
}
} | java | public static Instant parseIso8601Date(String dateString) {
// For EC2 Spot Fleet.
if (dateString.endsWith("+0000")) {
dateString = dateString
.substring(0, dateString.length() - 5)
.concat("Z");
}
try {
return parseInstant(dateString, ISO_INSTANT);
} catch (DateTimeParseException e) {
return parseInstant(dateString, ALTERNATE_ISO_8601_DATE_FORMAT);
}
} | [
"public",
"static",
"Instant",
"parseIso8601Date",
"(",
"String",
"dateString",
")",
"{",
"// For EC2 Spot Fleet.",
"if",
"(",
"dateString",
".",
"endsWith",
"(",
"\"+0000\"",
")",
")",
"{",
"dateString",
"=",
"dateString",
".",
"substring",
"(",
"0",
",",
"da... | Parses the specified date string as an ISO 8601 date (yyyy-MM-dd'T'HH:mm:ss.SSSZZ)
and returns the {@link Instant} object.
@param dateString
The date string to parse.
@return The parsed Instant object. | [
"Parses",
"the",
"specified",
"date",
"string",
"as",
"an",
"ISO",
"8601",
"date",
"(",
"yyyy",
"-",
"MM",
"-",
"dd",
"T",
"HH",
":",
"mm",
":",
"ss",
".",
"SSSZZ",
")",
"and",
"returns",
"the",
"{",
"@link",
"Instant",
"}",
"object",
"."
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/DateUtil.java#L56-L69 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonTo.java | GeoJsonTo.mergeInto | private static void mergeInto(double[] first, double[] second) {
for (int j = 0; j < first.length / 2; j++) {
first[j] = Math.min(first[j], second[j]);
first[j + first.length / 2] = Math.max(first[j + first.length / 2], second[j + first.length / 2]);
}
} | java | private static void mergeInto(double[] first, double[] second) {
for (int j = 0; j < first.length / 2; j++) {
first[j] = Math.min(first[j], second[j]);
first[j + first.length / 2] = Math.max(first[j + first.length / 2], second[j + first.length / 2]);
}
} | [
"private",
"static",
"void",
"mergeInto",
"(",
"double",
"[",
"]",
"first",
",",
"double",
"[",
"]",
"second",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"first",
".",
"length",
"/",
"2",
";",
"j",
"++",
")",
"{",
"first",
"[",
... | Merges the second boundingbox into the first. Basically, this extends the first boundingbox to also
encapsulate the second
@param first the first boundingbox
@param second the second boundingbox | [
"Merges",
"the",
"second",
"boundingbox",
"into",
"the",
"first",
".",
"Basically",
"this",
"extends",
"the",
"first",
"boundingbox",
"to",
"also",
"encapsulate",
"the",
"second"
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonTo.java#L242-L247 |
w3c/epubcheck | src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java | VocabUtil.parsePrefixDeclaration | public static Map<String, Vocab> parsePrefixDeclaration(String value,
Map<String, ? extends Vocab> predefined, Map<String, ? extends Vocab> known,
Set<String> forbidden, Report report, EPUBLocation location)
{
Map<String, Vocab> vocabs = Maps.newHashMap(predefined);
Map<String, String> mappings = PrefixDeclarationParser.parsePrefixMappings(value, report,
location);
for (Entry<String, String> mapping : mappings.entrySet())
{
String prefix = mapping.getKey();
String uri = mapping.getValue();
if ("_".equals(prefix))
{
// must not define the '_' prefix
report.message(MessageId.OPF_007a, location);
}
else if (forbidden.contains(uri))
{
// must not declare a default vocab
report.message(MessageId.OPF_007b, location, prefix);
}
else
{
if (predefined.containsKey(prefix)
&& !Strings.nullToEmpty(predefined.get(prefix).getURI()).equals(uri))
{
// re-declaration of reserved prefix
report.message(MessageId.OPF_007, location, prefix);
}
Vocab vocab = known.get(uri);
vocabs.put(mapping.getKey(), (vocab == null) ? new UncheckedVocab(uri, prefix) : vocab);
}
}
return ImmutableMap.copyOf(vocabs);
} | java | public static Map<String, Vocab> parsePrefixDeclaration(String value,
Map<String, ? extends Vocab> predefined, Map<String, ? extends Vocab> known,
Set<String> forbidden, Report report, EPUBLocation location)
{
Map<String, Vocab> vocabs = Maps.newHashMap(predefined);
Map<String, String> mappings = PrefixDeclarationParser.parsePrefixMappings(value, report,
location);
for (Entry<String, String> mapping : mappings.entrySet())
{
String prefix = mapping.getKey();
String uri = mapping.getValue();
if ("_".equals(prefix))
{
// must not define the '_' prefix
report.message(MessageId.OPF_007a, location);
}
else if (forbidden.contains(uri))
{
// must not declare a default vocab
report.message(MessageId.OPF_007b, location, prefix);
}
else
{
if (predefined.containsKey(prefix)
&& !Strings.nullToEmpty(predefined.get(prefix).getURI()).equals(uri))
{
// re-declaration of reserved prefix
report.message(MessageId.OPF_007, location, prefix);
}
Vocab vocab = known.get(uri);
vocabs.put(mapping.getKey(), (vocab == null) ? new UncheckedVocab(uri, prefix) : vocab);
}
}
return ImmutableMap.copyOf(vocabs);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Vocab",
">",
"parsePrefixDeclaration",
"(",
"String",
"value",
",",
"Map",
"<",
"String",
",",
"?",
"extends",
"Vocab",
">",
"predefined",
",",
"Map",
"<",
"String",
",",
"?",
"extends",
"Vocab",
">",
"know... | Parses a prefix attribute value and returns a map of prefixes to
vocabularies, given a pre-existing set of reserved prefixes, known
vocabularies, and default vocabularies that cannot be re-declared.
@param value
the prefix declaration to parse.
@param predefined
a map of reserved prefixes to associated vocabularies.
@param known
a map of known URIs to known vocabularies.
@param forbidden
a set of URIs of default vocabularies that cannot be re-declared.
@param report
to report errors on the fly.
@param location
the location of the attribute in the source file.
@return | [
"Parses",
"a",
"prefix",
"attribute",
"value",
"and",
"returns",
"a",
"map",
"of",
"prefixes",
"to",
"vocabularies",
"given",
"a",
"pre",
"-",
"existing",
"set",
"of",
"reserved",
"prefixes",
"known",
"vocabularies",
"and",
"default",
"vocabularies",
"that",
"... | train | https://github.com/w3c/epubcheck/blob/4d5a24d9f2878a2a5497eb11c036cc18fe2c0a78/src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java#L174-L208 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/JodaBeanSer.java | JodaBeanSer.withShortTypes | public JodaBeanSer withShortTypes(boolean shortTypes) {
return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived);
} | java | public JodaBeanSer withShortTypes(boolean shortTypes) {
return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived);
} | [
"public",
"JodaBeanSer",
"withShortTypes",
"(",
"boolean",
"shortTypes",
")",
"{",
"return",
"new",
"JodaBeanSer",
"(",
"indent",
",",
"newLine",
",",
"converter",
",",
"iteratorFactory",
",",
"shortTypes",
",",
"deserializers",
",",
"includeDerived",
")",
";",
... | Returns a copy of this serializer with the short types flag set.
@param shortTypes whether to use short types, not null
@return a copy of this object with the short types flag changed, not null | [
"Returns",
"a",
"copy",
"of",
"this",
"serializer",
"with",
"the",
"short",
"types",
"flag",
"set",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/JodaBeanSer.java#L201-L203 |
OpenTSDB/opentsdb | src/tsd/GraphHandler.java | GraphHandler.runGnuplot | static int runGnuplot(final HttpQuery query,
final String basepath,
final Plot plot) throws IOException {
final int nplotted = plot.dumpToFiles(basepath);
final long start_time = System.nanoTime();
final Process gnuplot = new ProcessBuilder(GNUPLOT,
basepath + ".out", basepath + ".err", basepath + ".gnuplot").start();
final int rv;
try {
rv = gnuplot.waitFor(); // Couldn't find how to do this asynchronously.
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // Restore the interrupted status.
throw new IOException("interrupted", e); // I hate checked exceptions.
} finally {
// We need to always destroy() the Process, otherwise we "leak" file
// descriptors and pipes. Unless I'm blind, this isn't actually
// documented in the Javadoc of the !@#$%^ JDK, and in Java 6 there's no
// way to ask the stupid-ass ProcessBuilder to not create fucking pipes.
// I think when the GC kicks in the JVM may run some kind of a finalizer
// that closes the pipes, because I've never seen this issue on long
// running TSDs, except where ulimit -n was low (the default, 1024).
gnuplot.destroy();
}
gnuplotlatency.add((int) ((System.nanoTime() - start_time) / 1000000));
if (rv != 0) {
final byte[] stderr = readFile(query, new File(basepath + ".err"),
4096);
// Sometimes Gnuplot will error out but still create the file.
new File(basepath + ".png").delete();
if (stderr == null) {
throw new GnuplotException(rv);
}
throw new GnuplotException(new String(stderr));
}
// Remove the files for stderr/stdout if they're empty.
deleteFileIfEmpty(basepath + ".out");
deleteFileIfEmpty(basepath + ".err");
return nplotted;
} | java | static int runGnuplot(final HttpQuery query,
final String basepath,
final Plot plot) throws IOException {
final int nplotted = plot.dumpToFiles(basepath);
final long start_time = System.nanoTime();
final Process gnuplot = new ProcessBuilder(GNUPLOT,
basepath + ".out", basepath + ".err", basepath + ".gnuplot").start();
final int rv;
try {
rv = gnuplot.waitFor(); // Couldn't find how to do this asynchronously.
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // Restore the interrupted status.
throw new IOException("interrupted", e); // I hate checked exceptions.
} finally {
// We need to always destroy() the Process, otherwise we "leak" file
// descriptors and pipes. Unless I'm blind, this isn't actually
// documented in the Javadoc of the !@#$%^ JDK, and in Java 6 there's no
// way to ask the stupid-ass ProcessBuilder to not create fucking pipes.
// I think when the GC kicks in the JVM may run some kind of a finalizer
// that closes the pipes, because I've never seen this issue on long
// running TSDs, except where ulimit -n was low (the default, 1024).
gnuplot.destroy();
}
gnuplotlatency.add((int) ((System.nanoTime() - start_time) / 1000000));
if (rv != 0) {
final byte[] stderr = readFile(query, new File(basepath + ".err"),
4096);
// Sometimes Gnuplot will error out but still create the file.
new File(basepath + ".png").delete();
if (stderr == null) {
throw new GnuplotException(rv);
}
throw new GnuplotException(new String(stderr));
}
// Remove the files for stderr/stdout if they're empty.
deleteFileIfEmpty(basepath + ".out");
deleteFileIfEmpty(basepath + ".err");
return nplotted;
} | [
"static",
"int",
"runGnuplot",
"(",
"final",
"HttpQuery",
"query",
",",
"final",
"String",
"basepath",
",",
"final",
"Plot",
"plot",
")",
"throws",
"IOException",
"{",
"final",
"int",
"nplotted",
"=",
"plot",
".",
"dumpToFiles",
"(",
"basepath",
")",
";",
... | Runs Gnuplot in a subprocess to generate the graph.
<strong>This function will block</strong> while Gnuplot is running.
@param query The query being handled (for logging purposes).
@param basepath The base path used for the Gnuplot files.
@param plot The plot object to generate Gnuplot's input files.
@return The number of points plotted by Gnuplot (0 or more).
@throws IOException if the Gnuplot files can't be written, or
the Gnuplot subprocess fails to start, or we can't read the
graph from the file it produces, or if we have been interrupted.
@throws GnuplotException if Gnuplot returns non-zero. | [
"Runs",
"Gnuplot",
"in",
"a",
"subprocess",
"to",
"generate",
"the",
"graph",
".",
"<strong",
">",
"This",
"function",
"will",
"block<",
"/",
"strong",
">",
"while",
"Gnuplot",
"is",
"running",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/GraphHandler.java#L780-L818 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java | EnglishEnums.valueOf | public static <T extends Enum<T>> T valueOf(final Class<T> enumType, final String name, final T defaultValue) {
return name == null ? defaultValue : Enum.valueOf(enumType, name.toUpperCase(Locale.ENGLISH));
} | java | public static <T extends Enum<T>> T valueOf(final Class<T> enumType, final String name, final T defaultValue) {
return name == null ? defaultValue : Enum.valueOf(enumType, name.toUpperCase(Locale.ENGLISH));
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"valueOf",
"(",
"final",
"Class",
"<",
"T",
">",
"enumType",
",",
"final",
"String",
"name",
",",
"final",
"T",
"defaultValue",
")",
"{",
"return",
"name",
"==",
"null",
"?",
... | Returns an enum value for the given string.
<p>
The {@code name} is converted internally to upper case with the {@linkplain Locale#ENGLISH ENGLISH} locale to
avoid problems on the Turkish locale. Do not use with Turkish enum values.
</p>
@param name The enum name, case-insensitive. If null, returns {@code defaultValue}.
@param enumType The Class of the enum.
@param defaultValue the enum value to return if {@code name} is null.
@param <T> The type of the enum.
@return an enum value or {@code defaultValue} if {@code name} is null. | [
"Returns",
"an",
"enum",
"value",
"for",
"the",
"given",
"string",
".",
"<p",
">",
"The",
"{",
"@code",
"name",
"}",
"is",
"converted",
"internally",
"to",
"upper",
"case",
"with",
"the",
"{",
"@linkplain",
"Locale#ENGLISH",
"ENGLISH",
"}",
"locale",
"to",... | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java#L66-L68 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/discovery/AbstractDiscoveryStrategy.java | AbstractDiscoveryStrategy.getOrNull | protected <T extends Comparable> T getOrNull(String prefix, PropertyDefinition property) {
return getOrDefault(prefix, property, null);
} | java | protected <T extends Comparable> T getOrNull(String prefix, PropertyDefinition property) {
return getOrDefault(prefix, property, null);
} | [
"protected",
"<",
"T",
"extends",
"Comparable",
">",
"T",
"getOrNull",
"(",
"String",
"prefix",
",",
"PropertyDefinition",
"property",
")",
"{",
"return",
"getOrDefault",
"(",
"prefix",
",",
"property",
",",
"null",
")",
";",
"}"
] | Returns the value of the requested {@link PropertyDefinition} if available in the
declarative or programmatic configuration (XML or Config API), can be found in the
system's environment, or passed as a JVM property. Otherwise it will return <tt>null</tt>.
<p/>
This overload will resolve the requested property in the following order, whereas the
higher priority is from top to bottom:
<ul>
<li>{@link System#getProperty(String)}: JVM properties</li>
<li>{@link System#getenv(String)}: System environment</li>
<li>Configuration properties of this {@link DiscoveryStrategy}</li>
</ul>
To resolve JVM properties or the system environment the property's key is prefixed with
given <tt>prefix</tt>, therefore a prefix of <i>com.hazelcast.discovery</i> and a property
key of <i>hostname</i> will result in a property lookup of <i>com.hazelcast.discovery.hostname</i>
in the system environment and JVM properties.
@param prefix the property key prefix for environment and JVM properties lookup
@param property the PropertyDefinition to lookup
@param <T> the type of the property, must be compatible with the conversion
result of {@link PropertyDefinition#typeConverter()}
@return the value of the given property if available in the configuration, system environment
or JVM properties, otherwise null | [
"Returns",
"the",
"value",
"of",
"the",
"requested",
"{",
"@link",
"PropertyDefinition",
"}",
"if",
"available",
"in",
"the",
"declarative",
"or",
"programmatic",
"configuration",
"(",
"XML",
"or",
"Config",
"API",
")",
"can",
"be",
"found",
"in",
"the",
"sy... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/discovery/AbstractDiscoveryStrategy.java#L124-L126 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java | FlowController.addActionErrorExpression | protected void addActionErrorExpression( String propertyName, String expression, Object[] messageArgs )
{
PageFlowUtils.addActionErrorExpression( getRequest(), propertyName, expression, messageArgs );
} | java | protected void addActionErrorExpression( String propertyName, String expression, Object[] messageArgs )
{
PageFlowUtils.addActionErrorExpression( getRequest(), propertyName, expression, messageArgs );
} | [
"protected",
"void",
"addActionErrorExpression",
"(",
"String",
"propertyName",
",",
"String",
"expression",
",",
"Object",
"[",
"]",
"messageArgs",
")",
"{",
"PageFlowUtils",
".",
"addActionErrorExpression",
"(",
"getRequest",
"(",
")",
",",
"propertyName",
",",
... | Add a property-related message as an expression that will be evaluated and shown with the Errors and Error tags.
@param propertyName the name of the property with which to associate this error.
@param expression the expression that will be evaluated to generate the error message.
@param messageArgs zero or more arguments to the message; may be expressions. | [
"Add",
"a",
"property",
"-",
"related",
"message",
"as",
"an",
"expression",
"that",
"will",
"be",
"evaluated",
"and",
"shown",
"with",
"the",
"Errors",
"and",
"Error",
"tags",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1483-L1486 |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatXFileOutput.java | DssatXFileOutput.translateTo2BitCrid | private String translateTo2BitCrid(Map cuData, String id, String defVal) {
String crid = getValueOr(cuData, id, "");
if (!crid.equals("")) {
return DssatCRIDHelper.get2BitCrid(crid);
} else {
return defVal;
}
} | java | private String translateTo2BitCrid(Map cuData, String id, String defVal) {
String crid = getValueOr(cuData, id, "");
if (!crid.equals("")) {
return DssatCRIDHelper.get2BitCrid(crid);
} else {
return defVal;
}
} | [
"private",
"String",
"translateTo2BitCrid",
"(",
"Map",
"cuData",
",",
"String",
"id",
",",
"String",
"defVal",
")",
"{",
"String",
"crid",
"=",
"getValueOr",
"(",
"cuData",
",",
"id",
",",
"\"\"",
")",
";",
"if",
"(",
"!",
"crid",
".",
"equals",
"(",
... | Try to translate 3-bit CRID to 2-bit version stored in the map
@param cuData the cultivar data record
@param id the field id for contain crop id info
@param defVal the default value when id is not available
@return 2-bit crop ID | [
"Try",
"to",
"translate",
"3",
"-",
"bit",
"CRID",
"to",
"2",
"-",
"bit",
"version",
"stored",
"in",
"the",
"map"
] | train | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatXFileOutput.java#L1565-L1572 |
google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.isPrivate | public static Matcher isPrivate() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSDocInfo jsDoc = NodeUtil.getBestJSDocInfo(node);
if (jsDoc != null) {
return jsDoc.getVisibility() == Visibility.PRIVATE;
}
return false;
}
};
} | java | public static Matcher isPrivate() {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
JSDocInfo jsDoc = NodeUtil.getBestJSDocInfo(node);
if (jsDoc != null) {
return jsDoc.getVisibility() == Visibility.PRIVATE;
}
return false;
}
};
} | [
"public",
"static",
"Matcher",
"isPrivate",
"(",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"JSDocInfo",
"jsDoc",
"=",
"NodeUtil",
".... | Returns a Matcher that matches against nodes that are declared {@code @private}. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"against",
"nodes",
"that",
"are",
"declared",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L392-L402 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java | AlertResources.deleteTriggersById | @DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/{alertId}/triggers/{triggerId}")
@Description("Deletes a trigger having the given ID and removes any associations with the alert or notifications.")
public Response deleteTriggersById(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId,
@PathParam("triggerId") BigInteger triggerId) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (triggerId == null || triggerId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Trigger Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
List<Trigger> listTrigger = new ArrayList<Trigger>(alert.getTriggers());
Iterator<Trigger> itTrigger = listTrigger.iterator();
while (itTrigger.hasNext()) {
Trigger trigger = itTrigger.next();
if (triggerId.equals(trigger.getId())) {
itTrigger.remove();
alert.setTriggers(listTrigger);
alertService.updateAlert(alert);
return Response.status(Status.OK).build();
}
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | java | @DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/{alertId}/triggers/{triggerId}")
@Description("Deletes a trigger having the given ID and removes any associations with the alert or notifications.")
public Response deleteTriggersById(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId,
@PathParam("triggerId") BigInteger triggerId) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (triggerId == null || triggerId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Trigger Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
List<Trigger> listTrigger = new ArrayList<Trigger>(alert.getTriggers());
Iterator<Trigger> itTrigger = listTrigger.iterator();
while (itTrigger.hasNext()) {
Trigger trigger = itTrigger.next();
if (triggerId.equals(trigger.getId())) {
itTrigger.remove();
alert.setTriggers(listTrigger);
alertService.updateAlert(alert);
return Response.status(Status.OK).build();
}
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | [
"@",
"DELETE",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/{alertId}/triggers/{triggerId}\"",
")",
"@",
"Description",
"(",
"\"Deletes a trigger having the given ID and removes any associations with the alert or notifications.\"",
")",
... | Deletes a trigger from alert.
@param req The HttpServlet request object. Cannot be null.
@param alertId The alert Id. Cannot be null.
@param triggerId The trigger Id. Cannot be null.
@return Updated alert object.
@throws WebApplicationException The exception with 404 status will be thrown if an alert or trigger do not exist. | [
"Deletes",
"a",
"trigger",
"from",
"alert",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java#L1251-L1286 |
leonchen83/redis-replicator | src/main/java/com/moilioncircle/redis/replicator/rdb/BaseRdbParser.java | BaseRdbParser.rdbLoadLen | public Len rdbLoadLen() throws IOException {
boolean isencoded = false;
int rawByte = in.read();
int type = (rawByte & 0xC0) >> 6;
long value;
if (type == RDB_ENCVAL) {
isencoded = true;
value = rawByte & 0x3F;
} else if (type == RDB_6BITLEN) {
value = rawByte & 0x3F;
} else if (type == RDB_14BITLEN) {
value = ((rawByte & 0x3F) << 8) | in.read();
} else if (rawByte == RDB_32BITLEN) {
value = in.readInt(4, false);
} else if (rawByte == RDB_64BITLEN) {
value = in.readLong(8, false);
} else {
throw new AssertionError("unexpected len-type:" + type);
}
return new Len(value, isencoded);
} | java | public Len rdbLoadLen() throws IOException {
boolean isencoded = false;
int rawByte = in.read();
int type = (rawByte & 0xC0) >> 6;
long value;
if (type == RDB_ENCVAL) {
isencoded = true;
value = rawByte & 0x3F;
} else if (type == RDB_6BITLEN) {
value = rawByte & 0x3F;
} else if (type == RDB_14BITLEN) {
value = ((rawByte & 0x3F) << 8) | in.read();
} else if (rawByte == RDB_32BITLEN) {
value = in.readInt(4, false);
} else if (rawByte == RDB_64BITLEN) {
value = in.readLong(8, false);
} else {
throw new AssertionError("unexpected len-type:" + type);
}
return new Len(value, isencoded);
} | [
"public",
"Len",
"rdbLoadLen",
"(",
")",
"throws",
"IOException",
"{",
"boolean",
"isencoded",
"=",
"false",
";",
"int",
"rawByte",
"=",
"in",
".",
"read",
"(",
")",
";",
"int",
"type",
"=",
"(",
"rawByte",
"&",
"0xC0",
")",
">>",
"6",
";",
"long",
... | read bytes 1 or 2 or 5
<p>
1. |00xxxxxx| remaining 6 bits represent the length
<p>
2. |01xxxxxx|xxxxxxxx| the combined 14 bits represent the length
<p>
3. |10xxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx|xxxxxxxx| the remaining 6 bits are discarded.Additional 4 bytes represent the length(big endian in version6)
<p>
4. |11xxxxxx| the remaining 6 bits are read.and then the next object is encoded in a special format.so we set encoded = true
<p>
@return tuple(len, encoded)
@throws IOException when read timeout
@see #rdbLoadIntegerObject
@see #rdbLoadLzfStringObject | [
"read",
"bytes",
"1",
"or",
"2",
"or",
"5",
"<p",
">",
"1",
".",
"|00xxxxxx|",
"remaining",
"6",
"bits",
"represent",
"the",
"length",
"<p",
">",
"2",
".",
"|01xxxxxx|xxxxxxxx|",
"the",
"combined",
"14",
"bits",
"represent",
"the",
"length",
"<p",
">",
... | train | https://github.com/leonchen83/redis-replicator/blob/645aac2de1452e26c0f8f9d01d60edb45bba38c9/src/main/java/com/moilioncircle/redis/replicator/rdb/BaseRdbParser.java#L92-L112 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.getAndTouch | @Override
public CASValue<Object> getAndTouch(String key, int exp) {
return getAndTouch(key, exp, transcoder);
} | java | @Override
public CASValue<Object> getAndTouch(String key, int exp) {
return getAndTouch(key, exp, transcoder);
} | [
"@",
"Override",
"public",
"CASValue",
"<",
"Object",
">",
"getAndTouch",
"(",
"String",
"key",
",",
"int",
"exp",
")",
"{",
"return",
"getAndTouch",
"(",
"key",
",",
"exp",
",",
"transcoder",
")",
";",
"}"
] | Get a single key and reset its expiration using the default transcoder.
@param key the key to get
@param exp the new expiration for the key
@return the result from the cache and CAS id (null if there is none)
@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",
"a",
"single",
"key",
"and",
"reset",
"its",
"expiration",
"using",
"the",
"default",
"transcoder",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1193-L1196 |
skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.nextMinor | public Version nextMinor(String newPrelease) {
require(newPrelease != null, "newPreRelease is null");
final String[] preReleaseParts = parsePreRelease(newPrelease);
return new Version(this.major, this.minor + 1, 0, preReleaseParts, EMPTY_ARRAY);
} | java | public Version nextMinor(String newPrelease) {
require(newPrelease != null, "newPreRelease is null");
final String[] preReleaseParts = parsePreRelease(newPrelease);
return new Version(this.major, this.minor + 1, 0, preReleaseParts, EMPTY_ARRAY);
} | [
"public",
"Version",
"nextMinor",
"(",
"String",
"newPrelease",
")",
"{",
"require",
"(",
"newPrelease",
"!=",
"null",
",",
"\"newPreRelease is null\"",
")",
";",
"final",
"String",
"[",
"]",
"preReleaseParts",
"=",
"parsePreRelease",
"(",
"newPrelease",
")",
";... | Given this version, returns the next minor version. That is, the major part remains
the same and the minor version is incremented. The pre-release part will be set to
the given identifier and the build-meta-data is dropped.
@param newPrelease The pre-release part for the resulting Version.
@return The incremented version.
@throws VersionFormatException If the given String is not a valid pre-release
identifier.
@throws IllegalArgumentException If newPreRelease is null.
@see #nextMinor()
@see #nextMinor(String[])
@since 1.2.0 | [
"Given",
"this",
"version",
"returns",
"the",
"next",
"minor",
"version",
".",
"That",
"is",
"the",
"major",
"part",
"remains",
"the",
"same",
"and",
"the",
"minor",
"version",
"is",
"incremented",
".",
"The",
"pre",
"-",
"release",
"part",
"will",
"be",
... | train | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L770-L774 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/OidcClientUtil.java | OidcClientUtil.createCookie | public static Cookie createCookie(String cookieName, @Sensitive String cookieValue, HttpServletRequest req) {
return createCookie(cookieName, cookieValue, -1, req);
} | java | public static Cookie createCookie(String cookieName, @Sensitive String cookieValue, HttpServletRequest req) {
return createCookie(cookieName, cookieValue, -1, req);
} | [
"public",
"static",
"Cookie",
"createCookie",
"(",
"String",
"cookieName",
",",
"@",
"Sensitive",
"String",
"cookieValue",
",",
"HttpServletRequest",
"req",
")",
"{",
"return",
"createCookie",
"(",
"cookieName",
",",
"cookieValue",
",",
"-",
"1",
",",
"req",
"... | /*
In case, the ReferrerURLCookieHandler is dynamic in every request, then we will need to make this into
OidcClientRequest. And do not do static. | [
"/",
"*",
"In",
"case",
"the",
"ReferrerURLCookieHandler",
"is",
"dynamic",
"in",
"every",
"request",
"then",
"we",
"will",
"need",
"to",
"make",
"this",
"into",
"OidcClientRequest",
".",
"And",
"do",
"not",
"do",
"static",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.openidconnect.clients.common/src/com/ibm/ws/security/openidconnect/clients/common/OidcClientUtil.java#L286-L288 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/ParameterUtil.java | ParameterUtil.requireIntParameter | public static int requireIntParameter (HttpServletRequest req, String name, int low, int high,
String invalidDataMessage)
throws DataValidationException
{
return requireIntParameter(
req, name, invalidDataMessage, new IntRangeValidator(low, high, invalidDataMessage));
} | java | public static int requireIntParameter (HttpServletRequest req, String name, int low, int high,
String invalidDataMessage)
throws DataValidationException
{
return requireIntParameter(
req, name, invalidDataMessage, new IntRangeValidator(low, high, invalidDataMessage));
} | [
"public",
"static",
"int",
"requireIntParameter",
"(",
"HttpServletRequest",
"req",
",",
"String",
"name",
",",
"int",
"low",
",",
"int",
"high",
",",
"String",
"invalidDataMessage",
")",
"throws",
"DataValidationException",
"{",
"return",
"requireIntParameter",
"("... | Fetches the supplied parameter from the request and converts it to an integer. If the
parameter does not exist or is not a well-formed integer, a data validation exception is
thrown with the supplied message. | [
"Fetches",
"the",
"supplied",
"parameter",
"from",
"the",
"request",
"and",
"converts",
"it",
"to",
"an",
"integer",
".",
"If",
"the",
"parameter",
"does",
"not",
"exist",
"or",
"is",
"not",
"a",
"well",
"-",
"formed",
"integer",
"a",
"data",
"validation",... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ParameterUtil.java#L112-L118 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/reflect/MethodInvocation.java | MethodInvocation.newMethodInvocation | public static MethodInvocation newMethodInvocation(Object target, Method method, Object... args) {
return new MethodInvocation(target, method, args);
} | java | public static MethodInvocation newMethodInvocation(Object target, Method method, Object... args) {
return new MethodInvocation(target, method, args);
} | [
"public",
"static",
"MethodInvocation",
"newMethodInvocation",
"(",
"Object",
"target",
",",
"Method",
"method",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"MethodInvocation",
"(",
"target",
",",
"method",
",",
"args",
")",
";",
"}"
] | Factory method used to construct a new instance of {@link MethodInvocation} initialized with
the given target {@link Object}, instance {@link Method} and array of {@link Object arguments}
passed to the {@link Method} during invocation.
The {@link Method} represents a {@link java.lang.reflect.Modifier#STATIC non-static} instance {@link Method}
that will be invoked on the given target {@link Object}.
@param target {@link Object} on which the instance {@link Method} will be invoked.
@param method {@link Method} to invoke.
@param args array of {@link Object arguments} to pass to the {@link Method} during invocation.
@return an instance of {@link MethodInvocation} encapsulating all the necessary details
to invoke the {@link Method} on the given {@link Object target}.
@see #MethodInvocation(Object, Method, Object...)
@see java.lang.reflect.Method
@see java.lang.Object | [
"Factory",
"method",
"used",
"to",
"construct",
"a",
"new",
"instance",
"of",
"{",
"@link",
"MethodInvocation",
"}",
"initialized",
"with",
"the",
"given",
"target",
"{",
"@link",
"Object",
"}",
"instance",
"{",
"@link",
"Method",
"}",
"and",
"array",
"of",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/MethodInvocation.java#L78-L80 |
bwkimmel/java-util | src/main/java/ca/eandb/util/io/FileUtil.java | FileUtil.setFileContents | public static void setFileContents(File file, ByteBuffer contents) throws IOException {
setFileContents(file, contents, false);
} | java | public static void setFileContents(File file, ByteBuffer contents) throws IOException {
setFileContents(file, contents, false);
} | [
"public",
"static",
"void",
"setFileContents",
"(",
"File",
"file",
",",
"ByteBuffer",
"contents",
")",
"throws",
"IOException",
"{",
"setFileContents",
"(",
"file",
",",
"contents",
",",
"false",
")",
";",
"}"
] | Writes the specified byte array to a file.
@param file The <code>File</code> to write.
@param contents The byte array to write to the file.
@throws IOException If the file could not be written. | [
"Writes",
"the",
"specified",
"byte",
"array",
"to",
"a",
"file",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L129-L131 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java | AbstractAnnotationValueVisitor6.visitUnknown | @Override
public R visitUnknown(AnnotationValue av, P p) {
throw new UnknownAnnotationValueException(av, p);
} | java | @Override
public R visitUnknown(AnnotationValue av, P p) {
throw new UnknownAnnotationValueException(av, p);
} | [
"@",
"Override",
"public",
"R",
"visitUnknown",
"(",
"AnnotationValue",
"av",
",",
"P",
"p",
")",
"{",
"throw",
"new",
"UnknownAnnotationValueException",
"(",
"av",
",",
"p",
")",
";",
"}"
] | {@inheritDoc}
@implSpec The default implementation of this method in {@code
AbstractAnnotationValueVisitor6} will always throw {@code
new UnknownAnnotationValueException(av, p)}. This behavior is not
required of a subclass.
@param av {@inheritDoc}
@param p {@inheritDoc} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java#L115-L118 |
alkacon/opencms-core | src/org/opencms/workplace/tools/CmsToolManager.java | CmsToolManager.generateNavBar | public String generateNavBar(String toolPath, CmsWorkplace wp) {
if (toolPath.equals(getBaseToolPath(wp))) {
return "<div class='pathbar'> </div>\n";
}
CmsTool adminTool = resolveAdminTool(getCurrentRoot(wp).getKey(), toolPath);
String html = A_CmsHtmlIconButton.defaultButtonHtml(
CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT,
"nav" + adminTool.getId(),
adminTool.getHandler().getName(),
null,
false,
null,
null,
null);
String parent = toolPath;
while (!parent.equals(getBaseToolPath(wp))) {
parent = getParent(wp, parent);
adminTool = resolveAdminTool(getCurrentRoot(wp).getKey(), parent);
if (adminTool == null) {
break;
}
String id = "nav" + adminTool.getId();
String link = linkForToolPath(wp.getJsp(), parent, adminTool.getHandler().getParameters(wp));
String onClic = "openPage('" + link + "');";
String buttonHtml = A_CmsHtmlIconButton.defaultButtonHtml(
CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT,
id,
adminTool.getHandler().getName(),
adminTool.getHandler().getHelpText(),
true,
null,
null,
onClic);
html = "<span>" + buttonHtml + NAVBAR_SEPARATOR + "</span>" + html;
}
html = CmsToolMacroResolver.resolveMacros(html, wp);
html = CmsEncoder.decode(html);
html = CmsToolMacroResolver.resolveMacros(html, wp);
html = "<div class='pathbar'>\n" + html + "</div>\n";
return html;
} | java | public String generateNavBar(String toolPath, CmsWorkplace wp) {
if (toolPath.equals(getBaseToolPath(wp))) {
return "<div class='pathbar'> </div>\n";
}
CmsTool adminTool = resolveAdminTool(getCurrentRoot(wp).getKey(), toolPath);
String html = A_CmsHtmlIconButton.defaultButtonHtml(
CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT,
"nav" + adminTool.getId(),
adminTool.getHandler().getName(),
null,
false,
null,
null,
null);
String parent = toolPath;
while (!parent.equals(getBaseToolPath(wp))) {
parent = getParent(wp, parent);
adminTool = resolveAdminTool(getCurrentRoot(wp).getKey(), parent);
if (adminTool == null) {
break;
}
String id = "nav" + adminTool.getId();
String link = linkForToolPath(wp.getJsp(), parent, adminTool.getHandler().getParameters(wp));
String onClic = "openPage('" + link + "');";
String buttonHtml = A_CmsHtmlIconButton.defaultButtonHtml(
CmsHtmlIconButtonStyleEnum.SMALL_ICON_TEXT,
id,
adminTool.getHandler().getName(),
adminTool.getHandler().getHelpText(),
true,
null,
null,
onClic);
html = "<span>" + buttonHtml + NAVBAR_SEPARATOR + "</span>" + html;
}
html = CmsToolMacroResolver.resolveMacros(html, wp);
html = CmsEncoder.decode(html);
html = CmsToolMacroResolver.resolveMacros(html, wp);
html = "<div class='pathbar'>\n" + html + "</div>\n";
return html;
} | [
"public",
"String",
"generateNavBar",
"(",
"String",
"toolPath",
",",
"CmsWorkplace",
"wp",
")",
"{",
"if",
"(",
"toolPath",
".",
"equals",
"(",
"getBaseToolPath",
"(",
"wp",
")",
")",
")",
"{",
"return",
"\"<div class='pathbar'> </div>\\n\"",
";",
"}",
"... | Returns the navigation bar html code for the given tool path.<p>
@param toolPath the path
@param wp the jsp page
@return the html code | [
"Returns",
"the",
"navigation",
"bar",
"html",
"code",
"for",
"the",
"given",
"tool",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L218-L259 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseHashMap.java | DatabaseHashMap.setMaxInactToZero | int setMaxInactToZero(String sessId, String appName) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "for " + sessId + " and app " + appName);
}
int rc = 0;
PreparedStatement psRemoteInval = null;
Connection con = getConnection(false);
if (con == null) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "DatabaseHashMap.nullConnection");
return 0;
}
try {
psRemoteInval = con.prepareStatement(remoteInvalAll);
psRemoteInval.setString(1, sessId);
psRemoteInval.setString(2, sessId);
psRemoteInval.setString(3, appName);
rc = psRemoteInval.executeUpdate();
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.session.store.db.DatabaseHashMap.setMaxInactToZero", "2417", this);
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "CommonMessage.exception", t);
} finally {
if (psRemoteInval != null)
closeStatement(psRemoteInval);
closeConnection(con);
}
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "for " + sessId + " returning " + rc);
}
return rc;
} | java | int setMaxInactToZero(String sessId, String appName) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "for " + sessId + " and app " + appName);
}
int rc = 0;
PreparedStatement psRemoteInval = null;
Connection con = getConnection(false);
if (con == null) {
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "DatabaseHashMap.nullConnection");
return 0;
}
try {
psRemoteInval = con.prepareStatement(remoteInvalAll);
psRemoteInval.setString(1, sessId);
psRemoteInval.setString(2, sessId);
psRemoteInval.setString(3, appName);
rc = psRemoteInval.executeUpdate();
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.session.store.db.DatabaseHashMap.setMaxInactToZero", "2417", this);
LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "CommonMessage.exception", t);
} finally {
if (psRemoteInval != null)
closeStatement(psRemoteInval);
closeConnection(con);
}
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SET_MAX_INACT_TO_ZERO], "for " + sessId + " returning " + rc);
}
return rc;
} | [
"int",
"setMaxInactToZero",
"(",
"String",
"sessId",
",",
"String",
"appName",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"websphere",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_LOGGER_WAS",
... | /*
setMaxInactToZero - called to set the max inactive time to zero for remote invalidateAll.
This will result in the session being invalidated by the next run of the background
invalidator. | [
"/",
"*",
"setMaxInactToZero",
"-",
"called",
"to",
"set",
"the",
"max",
"inactive",
"time",
"to",
"zero",
"for",
"remote",
"invalidateAll",
".",
"This",
"will",
"result",
"in",
"the",
"session",
"being",
"invalidated",
"by",
"the",
"next",
"run",
"of",
"t... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.db/src/com/ibm/ws/session/store/db/DatabaseHashMap.java#L2787-L2816 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/PropertiesFromJSON.java | PropertiesFromJSON.getProperties | public static Properties getProperties(JSONObject json, String rootObjectPath,
String customObjectPath) throws JSONException, InvalidJSONPathException {
if (customObjectPath != null && !customObjectPath.equals("")) {
try {
return getPropertiesFromTraversal(json, customObjectPath);
} catch (InvalidJSONPathException e) {
// fall through to using rootObjectPath
}
}
return getPropertiesFromTraversal(json, rootObjectPath);
} | java | public static Properties getProperties(JSONObject json, String rootObjectPath,
String customObjectPath) throws JSONException, InvalidJSONPathException {
if (customObjectPath != null && !customObjectPath.equals("")) {
try {
return getPropertiesFromTraversal(json, customObjectPath);
} catch (InvalidJSONPathException e) {
// fall through to using rootObjectPath
}
}
return getPropertiesFromTraversal(json, rootObjectPath);
} | [
"public",
"static",
"Properties",
"getProperties",
"(",
"JSONObject",
"json",
",",
"String",
"rootObjectPath",
",",
"String",
"customObjectPath",
")",
"throws",
"JSONException",
",",
"InvalidJSONPathException",
"{",
"if",
"(",
"customObjectPath",
"!=",
"null",
"&&",
... | Uses an object path to traverse the json object and return a Properties
object
from the JSONObject (map<string, string>) object at the end of the path. If
customObjectPath
is null or isn't a valid path for the json object then rootObjectPath is
used as the path.
@param json
@param rootObjectPath
@param customObjectPath
@return
@throws JSONException
@throws InvalidJSONPathException | [
"Uses",
"an",
"object",
"path",
"to",
"traverse",
"the",
"json",
"object",
"and",
"return",
"a",
"Properties",
"object",
"from",
"the",
"JSONObject",
"(",
"map<string",
"string",
">",
")",
"object",
"at",
"the",
"end",
"of",
"the",
"path",
".",
"If",
"cu... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/PropertiesFromJSON.java#L90-L100 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.forCapacity | public ImageDescriptor forCapacity(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.CAPACITY, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | java | public ImageDescriptor forCapacity(JvmVisibility visibility, int flags) {
return getDecorated(getTypeImageDescriptor(
SarlElementType.CAPACITY, false, false, toFlags(visibility), USE_LIGHT_ICONS), flags);
} | [
"public",
"ImageDescriptor",
"forCapacity",
"(",
"JvmVisibility",
"visibility",
",",
"int",
"flags",
")",
"{",
"return",
"getDecorated",
"(",
"getTypeImageDescriptor",
"(",
"SarlElementType",
".",
"CAPACITY",
",",
"false",
",",
"false",
",",
"toFlags",
"(",
"visib... | Replies the image descriptor for the "capacities".
@param visibility the visibility of the capacity.
@param flags the mark flags. See {@link JavaElementImageDescriptor#setAdornments(int)} for
a description of the available flags.
@return the image descriptor for the capacities. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"capacities",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L151-L154 |
kmi/iserve | iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java | UriUtil.getUniqueId | public static String getUniqueId(URI resourceUri, URI basePath) {
String result = null;
URI relativeUri = basePath.relativize(resourceUri);
// If it is relative the first part of the path is the Unique ID
if (!relativeUri.isAbsolute()) {
result = relativeUri.toASCIIString();
int slashIndex = result.indexOf('/');
int hashIndex = result.indexOf('#');
if (slashIndex > -1) {
result = result.substring(0, slashIndex);
} else if (hashIndex > -1) {
result = result.substring(0, hashIndex);
}
}
return result;
} | java | public static String getUniqueId(URI resourceUri, URI basePath) {
String result = null;
URI relativeUri = basePath.relativize(resourceUri);
// If it is relative the first part of the path is the Unique ID
if (!relativeUri.isAbsolute()) {
result = relativeUri.toASCIIString();
int slashIndex = result.indexOf('/');
int hashIndex = result.indexOf('#');
if (slashIndex > -1) {
result = result.substring(0, slashIndex);
} else if (hashIndex > -1) {
result = result.substring(0, hashIndex);
}
}
return result;
} | [
"public",
"static",
"String",
"getUniqueId",
"(",
"URI",
"resourceUri",
",",
"URI",
"basePath",
")",
"{",
"String",
"result",
"=",
"null",
";",
"URI",
"relativeUri",
"=",
"basePath",
".",
"relativize",
"(",
"resourceUri",
")",
";",
"// If it is relative the firs... | Given the URI of a resource it returns the Unique ID.
In reality this obtains the first path element after the basePath.
Checks for those that are local to the server only. Developed both for hash and slash URIs.
Works in iServe on the basis of the following assumption behind resource URIs:
http://host:port/...some...path.../{uniqueResourceId}#fragment
or
http://host:port/...some...path.../{uniqueResourceId}/subPart
The result should be {uniqueResourceId}
@param resourceUri the actual resource URI
@param basePath the base path of the URI
@return the uniqueId if it is a local URI to the server or null. | [
"Given",
"the",
"URI",
"of",
"a",
"resource",
"it",
"returns",
"the",
"Unique",
"ID",
".",
"In",
"reality",
"this",
"obtains",
"the",
"first",
"path",
"element",
"after",
"the",
"basePath",
".",
"Checks",
"for",
"those",
"that",
"are",
"local",
"to",
"th... | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java#L46-L61 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java | StoreCallback.sessionMaxInactiveTimeSet | public void sessionMaxInactiveTimeSet(ISession session, int old, int newval) {
_sessionStateEventDispatcher.sessionMaxInactiveTimeSet(session, old, newval);
} | java | public void sessionMaxInactiveTimeSet(ISession session, int old, int newval) {
_sessionStateEventDispatcher.sessionMaxInactiveTimeSet(session, old, newval);
} | [
"public",
"void",
"sessionMaxInactiveTimeSet",
"(",
"ISession",
"session",
",",
"int",
"old",
",",
"int",
"newval",
")",
"{",
"_sessionStateEventDispatcher",
".",
"sessionMaxInactiveTimeSet",
"(",
"session",
",",
"old",
",",
"newval",
")",
";",
"}"
] | Method sessionMaxInactiveTimeSet
<p>
@param session
@param old
@param newval
@see com.ibm.wsspi.session.IStoreCallback#sessionMaxInactiveTimeSet(com.ibm.wsspi.session.ISession, int, int) | [
"Method",
"sessionMaxInactiveTimeSet",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java#L238-L241 |
belaban/JGroups | src/org/jgroups/blocks/UnicastRequest.java | UnicastRequest.receiveResponse | public void receiveResponse(Object response_value, Address sender, boolean is_exception) {
if(isDone())
return;
if(is_exception && response_value instanceof Throwable)
completeExceptionally((Throwable)response_value);
else
complete((T)response_value);
corrDone();
} | java | public void receiveResponse(Object response_value, Address sender, boolean is_exception) {
if(isDone())
return;
if(is_exception && response_value instanceof Throwable)
completeExceptionally((Throwable)response_value);
else
complete((T)response_value);
corrDone();
} | [
"public",
"void",
"receiveResponse",
"(",
"Object",
"response_value",
",",
"Address",
"sender",
",",
"boolean",
"is_exception",
")",
"{",
"if",
"(",
"isDone",
"(",
")",
")",
"return",
";",
"if",
"(",
"is_exception",
"&&",
"response_value",
"instanceof",
"Throw... | <b>Callback</b> (called by RequestCorrelator or Transport).
Adds a response to the response table. When all responses have been received, {@code execute()} returns. | [
"<b",
">",
"Callback<",
"/",
"b",
">",
"(",
"called",
"by",
"RequestCorrelator",
"or",
"Transport",
")",
".",
"Adds",
"a",
"response",
"to",
"the",
"response",
"table",
".",
"When",
"all",
"responses",
"have",
"been",
"received",
"{"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/UnicastRequest.java#L50-L58 |
lucee/Lucee | core/src/main/java/lucee/runtime/crypt/BinConverter.java | BinConverter.longToIntArray | public static void longToIntArray(long lValue, int[] buffer, int nStartIndex) {
buffer[nStartIndex] = (int) (lValue >>> 32);
buffer[nStartIndex + 1] = (int) lValue;
} | java | public static void longToIntArray(long lValue, int[] buffer, int nStartIndex) {
buffer[nStartIndex] = (int) (lValue >>> 32);
buffer[nStartIndex + 1] = (int) lValue;
} | [
"public",
"static",
"void",
"longToIntArray",
"(",
"long",
"lValue",
",",
"int",
"[",
"]",
"buffer",
",",
"int",
"nStartIndex",
")",
"{",
"buffer",
"[",
"nStartIndex",
"]",
"=",
"(",
"int",
")",
"(",
"lValue",
">>>",
"32",
")",
";",
"buffer",
"[",
"n... | converts a long to integers which are put into a given array
@param lValue the 64bit integer to convert
@param buffer the target buffer
@param nStartIndex where to place the bytes in the buffer | [
"converts",
"a",
"long",
"to",
"integers",
"which",
"are",
"put",
"into",
"a",
"given",
"array"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/BinConverter.java#L74-L77 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.apportalRegister | public static ApportalRegisterResult apportalRegister(String accessToken, ApportalRegister apportalRegister) {
return apportalRegister(accessToken, JsonUtil.toJSONString(apportalRegister));
} | java | public static ApportalRegisterResult apportalRegister(String accessToken, ApportalRegister apportalRegister) {
return apportalRegister(accessToken, JsonUtil.toJSONString(apportalRegister));
} | [
"public",
"static",
"ApportalRegisterResult",
"apportalRegister",
"(",
"String",
"accessToken",
",",
"ApportalRegister",
"apportalRegister",
")",
"{",
"return",
"apportalRegister",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"apportalRegister",
")",
"... | Wi-Fi设备管理-添加portal型设备
@param accessToken accessToken
@param apportalRegister apportalRegister
@return ApportalRegisterResult | [
"Wi",
"-",
"Fi设备管理",
"-",
"添加portal型设备"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L347-L349 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java | CompareHelper.gt | public static <T> boolean gt(Comparable<T> a, T b)
{
return gt(a.compareTo(b));
} | java | public static <T> boolean gt(Comparable<T> a, T b)
{
return gt(a.compareTo(b));
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"gt",
"(",
"Comparable",
"<",
"T",
">",
"a",
",",
"T",
"b",
")",
"{",
"return",
"gt",
"(",
"a",
".",
"compareTo",
"(",
"b",
")",
")",
";",
"}"
] | <code>a > b</code>
@param <T>
@param a
@param b
@return true if a > b | [
"<code",
">",
"a",
">",
"b<",
"/",
"code",
">"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java#L113-L116 |
jqm4gwt/jqm4gwt | library/src/main/java/com/sksamuel/jqm4gwt/JQMContext.java | JQMContext.changePage | public static void changePage(JQMContainer container, TransitionIntf<?> transition, boolean reverse) {
changePage(container, false/*dialog*/, transition, reverse);
} | java | public static void changePage(JQMContainer container, TransitionIntf<?> transition, boolean reverse) {
changePage(container, false/*dialog*/, transition, reverse);
} | [
"public",
"static",
"void",
"changePage",
"(",
"JQMContainer",
"container",
",",
"TransitionIntf",
"<",
"?",
">",
"transition",
",",
"boolean",
"reverse",
")",
"{",
"changePage",
"(",
"container",
",",
"false",
"/*dialog*/",
",",
"transition",
",",
"reverse",
... | Change the displayed page to the given {@link JQMPage} instance using
the supplied transition and reverse setting. | [
"Change",
"the",
"displayed",
"page",
"to",
"the",
"given",
"{"
] | train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/JQMContext.java#L111-L113 |
dkmfbk/knowledgestore | ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java | SelectQuery.from | public static SelectQuery from(final TupleExpr expression, @Nullable final Dataset dataset)
throws ParseException {
Preconditions.checkNotNull(expression);
try {
// Sesame rendering facilities are definitely broken, so we use our own
final String string = new SPARQLRenderer(null, true).render(expression, dataset);
SelectQuery query = CACHE.getIfPresent(string);
if (query == null) {
query = new SelectQuery(string, expression, dataset);
CACHE.put(string, query);
}
return query;
} catch (final Exception ex) {
throw new ParseException(expression.toString(),
"The supplied algebraic expression does not denote a valid SPARQL query", ex);
}
} | java | public static SelectQuery from(final TupleExpr expression, @Nullable final Dataset dataset)
throws ParseException {
Preconditions.checkNotNull(expression);
try {
// Sesame rendering facilities are definitely broken, so we use our own
final String string = new SPARQLRenderer(null, true).render(expression, dataset);
SelectQuery query = CACHE.getIfPresent(string);
if (query == null) {
query = new SelectQuery(string, expression, dataset);
CACHE.put(string, query);
}
return query;
} catch (final Exception ex) {
throw new ParseException(expression.toString(),
"The supplied algebraic expression does not denote a valid SPARQL query", ex);
}
} | [
"public",
"static",
"SelectQuery",
"from",
"(",
"final",
"TupleExpr",
"expression",
",",
"@",
"Nullable",
"final",
"Dataset",
"dataset",
")",
"throws",
"ParseException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"expression",
")",
";",
"try",
"{",
"// Sesa... | Returns an <tt>SelectQuery</tt> for the algebraic expression and optional dataset
specified.
@param expression
the algebraic expression for the query
@param dataset
the dataset optionally associated to the query
@return the corresponding <tt>SelectQuery</tt> object
@throws ParseException
in case the supplied algebraic expression does not denote a valid SPARQL SELECT
query | [
"Returns",
"an",
"<tt",
">",
"SelectQuery<",
"/",
"tt",
">",
"for",
"the",
"algebraic",
"expression",
"and",
"optional",
"dataset",
"specified",
"."
] | train | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java#L118-L137 |
stanfy/goro | goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java | GoroService.foregroundTaskIntent | public static <T extends Callable<?> & Parcelable> Intent foregroundTaskIntent(final Context context,
final String queueName,
final T task,
final int notificationId,
final Notification notification) {
// It may produce ClassNotFoundException when using custom Parcelable (for example via an AlarmManager).
// As a workaround pack a Parcelable into an additional Bundle, then put that Bundle into Intent.
// XXX http://code.google.com/p/android/issues/detail?id=6822
Bundle taskBundle = new Bundle();
taskBundle.putParcelable(EXTRA_TASK, task);
Bundle notificationBundle = new Bundle();
notificationBundle.putParcelable(EXTRA_NOTIFICATION, notification);
return new Intent(context, GoroService.class)
.putExtra(EXTRA_TASK_BUNDLE, taskBundle)
.putExtra(EXTRA_NOTIFICATION_BUNDLE, notificationBundle)
.putExtra(EXTRA_QUEUE_NAME, queueName)
.putExtra(EXTRA_NOTIFICATION_ID, notificationId);
} | java | public static <T extends Callable<?> & Parcelable> Intent foregroundTaskIntent(final Context context,
final String queueName,
final T task,
final int notificationId,
final Notification notification) {
// It may produce ClassNotFoundException when using custom Parcelable (for example via an AlarmManager).
// As a workaround pack a Parcelable into an additional Bundle, then put that Bundle into Intent.
// XXX http://code.google.com/p/android/issues/detail?id=6822
Bundle taskBundle = new Bundle();
taskBundle.putParcelable(EXTRA_TASK, task);
Bundle notificationBundle = new Bundle();
notificationBundle.putParcelable(EXTRA_NOTIFICATION, notification);
return new Intent(context, GoroService.class)
.putExtra(EXTRA_TASK_BUNDLE, taskBundle)
.putExtra(EXTRA_NOTIFICATION_BUNDLE, notificationBundle)
.putExtra(EXTRA_QUEUE_NAME, queueName)
.putExtra(EXTRA_NOTIFICATION_ID, notificationId);
} | [
"public",
"static",
"<",
"T",
"extends",
"Callable",
"<",
"?",
">",
"&",
"Parcelable",
">",
"Intent",
"foregroundTaskIntent",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"queueName",
",",
"final",
"T",
"task",
",",
"final",
"int",
"notificati... | Create an intent that contains a task that should be scheduled
on a defined queue. The Service will run in the foreground and display notification.
Intent can be used as an argument for
{@link android.content.Context#startService(android.content.Intent)}
or {@link android.content.Context#startForegroundService(Intent)}
@param context context instance
@param task task instance
@param queueName queue name
@param <T> task type
@param notificationId id of notification for foreground Service, must not be 0
@param notification notification for foreground Service,
should be not null to start service in the foreground | [
"Create",
"an",
"intent",
"that",
"contains",
"a",
"task",
"that",
"should",
"be",
"scheduled",
"on",
"a",
"defined",
"queue",
".",
"The",
"Service",
"will",
"run",
"in",
"the",
"foreground",
"and",
"display",
"notification",
".",
"Intent",
"can",
"be",
"u... | train | https://github.com/stanfy/goro/blob/6618e63a926833d61f492ec611ee77668d756820/goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java#L127-L144 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java | ActionUtil.addAction | public static ActionListener addAction(BaseComponent component, String action) {
return addAction(component, createAction(action));
} | java | public static ActionListener addAction(BaseComponent component, String action) {
return addAction(component, createAction(action));
} | [
"public",
"static",
"ActionListener",
"addAction",
"(",
"BaseComponent",
"component",
",",
"String",
"action",
")",
"{",
"return",
"addAction",
"(",
"component",
",",
"createAction",
"(",
"action",
")",
")",
";",
"}"
] | Adds/removes an action listener to/from a component using the default click trigger event.
@param component Component to be associated with the action.
@param action Action to invoke when listener event is triggered. This may be either the
action script or a registered action name. If empty or null, dissociates the event
listener from the component.
@return The newly created action listener. | [
"Adds",
"/",
"removes",
"an",
"action",
"listener",
"to",
"/",
"from",
"a",
"component",
"using",
"the",
"default",
"click",
"trigger",
"event",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionUtil.java#L72-L74 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java | DateTimesHelper.toDateTime | public T toDateTime(String dateTime, String timeZoneId) {
return toDateTime(ISODateTimeFormat.dateHourMinuteSecond().parseDateTime(dateTime)
.withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId))));
} | java | public T toDateTime(String dateTime, String timeZoneId) {
return toDateTime(ISODateTimeFormat.dateHourMinuteSecond().parseDateTime(dateTime)
.withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId))));
} | [
"public",
"T",
"toDateTime",
"(",
"String",
"dateTime",
",",
"String",
"timeZoneId",
")",
"{",
"return",
"toDateTime",
"(",
"ISODateTimeFormat",
".",
"dateHourMinuteSecond",
"(",
")",
".",
"parseDateTime",
"(",
"dateTime",
")",
".",
"withZoneRetainFields",
"(",
... | Converts a string in the form of {@code yyyy-MM-dd'T'HH:mm:ss} to an API
date time in the time zone supplied. | [
"Converts",
"a",
"string",
"in",
"the",
"form",
"of",
"{"
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java#L109-L112 |
square/otto | otto/src/main/java/com/squareup/otto/Bus.java | Bus.throwRuntimeException | private static void throwRuntimeException(String msg, InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause != null) {
throw new RuntimeException(msg + ": " + cause.getMessage(), cause);
} else {
throw new RuntimeException(msg + ": " + e.getMessage(), e);
}
} | java | private static void throwRuntimeException(String msg, InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause != null) {
throw new RuntimeException(msg + ": " + cause.getMessage(), cause);
} else {
throw new RuntimeException(msg + ": " + e.getMessage(), e);
}
} | [
"private",
"static",
"void",
"throwRuntimeException",
"(",
"String",
"msg",
",",
"InvocationTargetException",
"e",
")",
"{",
"Throwable",
"cause",
"=",
"e",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"!=",
"null",
")",
"{",
"throw",
"new",
"Runtim... | Throw a {@link RuntimeException} with given message and cause lifted from an {@link
InvocationTargetException}. If the specified {@link InvocationTargetException} does not have a
cause, neither will the {@link RuntimeException}. | [
"Throw",
"a",
"{"
] | train | https://github.com/square/otto/blob/2a67589abd91879cf23a8c96542b59349485ec3d/otto/src/main/java/com/squareup/otto/Bus.java#L457-L464 |
geomajas/geomajas-project-hammer-gwt | hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerTime.java | HammerTime.setOption | @Api
public <T> void setOption(GestureOption<T> option, T value) {
if (value == null) {
throw new IllegalArgumentException("Null value passed.");
}
if (value instanceof Boolean) {
setOption(this, (Boolean) value, option.getName());
} else if (value instanceof Integer) {
setOption(this, (Integer) value, option.getName());
} else if (value instanceof Double) {
setOption(this, (Double) value, option.getName());
} else if (value instanceof String) {
setOption(this, String.valueOf(value), option.getName());
}
} | java | @Api
public <T> void setOption(GestureOption<T> option, T value) {
if (value == null) {
throw new IllegalArgumentException("Null value passed.");
}
if (value instanceof Boolean) {
setOption(this, (Boolean) value, option.getName());
} else if (value instanceof Integer) {
setOption(this, (Integer) value, option.getName());
} else if (value instanceof Double) {
setOption(this, (Double) value, option.getName());
} else if (value instanceof String) {
setOption(this, String.valueOf(value), option.getName());
}
} | [
"@",
"Api",
"public",
"<",
"T",
">",
"void",
"setOption",
"(",
"GestureOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null value passed.\"",
"... | Change the initial settings of hammer Gwt.
@param option {@link org.geomajas.hammergwt.client.option.GestureOption}
@param value T look at {@link org.geomajas.hammergwt.client.option.GestureOptions}
interface for all possible types
@param <T>
@since 1.0.0 | [
"Change",
"the",
"initial",
"settings",
"of",
"hammer",
"Gwt",
"."
] | train | https://github.com/geomajas/geomajas-project-hammer-gwt/blob/bc764171bed55e5a9eced72f0078ec22b8105b62/hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerTime.java#L56-L73 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/KeyArea.java | KeyArea.lastModified | public int lastModified(int iAreaDesc, boolean bForceUniqueKey)
{ // Set up the end key
int iLastKeyField = this.getKeyFields(bForceUniqueKey, false) - 1;
for (int iKeyFieldSeq = iLastKeyField; iKeyFieldSeq >= DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq--)
{
KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey);
if (keyField.getField(iAreaDesc).isModified())
return iKeyFieldSeq;
}
return -1;
} | java | public int lastModified(int iAreaDesc, boolean bForceUniqueKey)
{ // Set up the end key
int iLastKeyField = this.getKeyFields(bForceUniqueKey, false) - 1;
for (int iKeyFieldSeq = iLastKeyField; iKeyFieldSeq >= DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq--)
{
KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey);
if (keyField.getField(iAreaDesc).isModified())
return iKeyFieldSeq;
}
return -1;
} | [
"public",
"int",
"lastModified",
"(",
"int",
"iAreaDesc",
",",
"boolean",
"bForceUniqueKey",
")",
"{",
"// Set up the end key",
"int",
"iLastKeyField",
"=",
"this",
".",
"getKeyFields",
"(",
"bForceUniqueKey",
",",
"false",
")",
"-",
"1",
";",
"for",
"(",
"int... | Any of these key fields modified?
@param iAreaDesc The key field area to get the values from.
@param iStartKeyFieldSeq The starting key field to check (from here on).
@return true if any have been modified. | [
"Any",
"of",
"these",
"key",
"fields",
"modified?"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L391-L401 |
primefaces/primefaces | src/main/java/org/primefaces/model/timeline/TimelineModel.java | TimelineModel.deleteAll | public void deleteAll(Collection<TimelineEvent> events, TimelineUpdater timelineUpdater) {
if (events != null && !events.isEmpty()) {
for (TimelineEvent event : events) {
delete(event, timelineUpdater);
}
}
} | java | public void deleteAll(Collection<TimelineEvent> events, TimelineUpdater timelineUpdater) {
if (events != null && !events.isEmpty()) {
for (TimelineEvent event : events) {
delete(event, timelineUpdater);
}
}
} | [
"public",
"void",
"deleteAll",
"(",
"Collection",
"<",
"TimelineEvent",
">",
"events",
",",
"TimelineUpdater",
"timelineUpdater",
")",
"{",
"if",
"(",
"events",
"!=",
"null",
"&&",
"!",
"events",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"TimelineEve... | Deletes all given events in the model with UI update.
@param events collection of events to be deleted
@param timelineUpdater TimelineUpdater instance to delete the events in UI | [
"Deletes",
"all",
"given",
"events",
"in",
"the",
"model",
"with",
"UI",
"update",
"."
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/model/timeline/TimelineModel.java#L233-L239 |
forge/furnace | se/src/main/java/org/jboss/forge/furnace/se/FurnaceFactory.java | FurnaceFactory.getInstance | public static Furnace getInstance(final ClassLoader clientLoader)
{
final BootstrapClassLoader loader = new BootstrapClassLoader("bootpath");
return getInstance(clientLoader, loader);
} | java | public static Furnace getInstance(final ClassLoader clientLoader)
{
final BootstrapClassLoader loader = new BootstrapClassLoader("bootpath");
return getInstance(clientLoader, loader);
} | [
"public",
"static",
"Furnace",
"getInstance",
"(",
"final",
"ClassLoader",
"clientLoader",
")",
"{",
"final",
"BootstrapClassLoader",
"loader",
"=",
"new",
"BootstrapClassLoader",
"(",
"\"bootpath\"",
")",
";",
"return",
"getInstance",
"(",
"clientLoader",
",",
"loa... | Produce a {@link Furnace} instance using the given {@link ClassLoader} to act as the client for which
{@link Class} instances should be translated across {@link ClassLoader} boundaries, and using the default
bootstrap {@link ClassLoader} to load core furnace implementation JARs from `<code>src/main/java/bootpath/*</code>
` | [
"Produce",
"a",
"{"
] | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/se/src/main/java/org/jboss/forge/furnace/se/FurnaceFactory.java#L47-L51 |
alkacon/opencms-core | src/org/opencms/db/CmsImportFolder.java | CmsImportFolder.importResources | private void importResources(File folder, String importPath) throws Exception {
String[] diskFiles = folder.list();
File currentFile;
for (int i = 0; i < diskFiles.length; i++) {
currentFile = new File(folder, diskFiles[i]);
if (currentFile.isDirectory()) {
// create directory in cms
m_importedResources.add(
m_cms.createResource(importPath + currentFile.getName(), CmsResourceTypeFolder.RESOURCE_TYPE_ID));
importResources(currentFile, importPath + currentFile.getName() + "/");
} else {
// import file into cms
int type = OpenCms.getResourceManager().getDefaultTypeForName(currentFile.getName()).getTypeId();
byte[] content = CmsFileUtil.readFile(currentFile);
// create the file
try {
m_importedResources.add(
m_cms.createResource(importPath + currentFile.getName(), type, content, null));
} catch (CmsSecurityException e) {
// in case of not enough permissions, try to create a plain text file
int plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId();
m_importedResources.add(
m_cms.createResource(importPath + currentFile.getName(), plainId, content, null));
}
content = null;
}
}
} | java | private void importResources(File folder, String importPath) throws Exception {
String[] diskFiles = folder.list();
File currentFile;
for (int i = 0; i < diskFiles.length; i++) {
currentFile = new File(folder, diskFiles[i]);
if (currentFile.isDirectory()) {
// create directory in cms
m_importedResources.add(
m_cms.createResource(importPath + currentFile.getName(), CmsResourceTypeFolder.RESOURCE_TYPE_ID));
importResources(currentFile, importPath + currentFile.getName() + "/");
} else {
// import file into cms
int type = OpenCms.getResourceManager().getDefaultTypeForName(currentFile.getName()).getTypeId();
byte[] content = CmsFileUtil.readFile(currentFile);
// create the file
try {
m_importedResources.add(
m_cms.createResource(importPath + currentFile.getName(), type, content, null));
} catch (CmsSecurityException e) {
// in case of not enough permissions, try to create a plain text file
int plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId();
m_importedResources.add(
m_cms.createResource(importPath + currentFile.getName(), plainId, content, null));
}
content = null;
}
}
} | [
"private",
"void",
"importResources",
"(",
"File",
"folder",
",",
"String",
"importPath",
")",
"throws",
"Exception",
"{",
"String",
"[",
"]",
"diskFiles",
"=",
"folder",
".",
"list",
"(",
")",
";",
"File",
"currentFile",
";",
"for",
"(",
"int",
"i",
"="... | Imports the resources from the folder in the real file system to the OpenCms VFS.<p>
@param folder the folder to import from
@param importPath the OpenCms VFS import path to import to
@throws Exception if something goes wrong during file IO | [
"Imports",
"the",
"resources",
"from",
"the",
"folder",
"in",
"the",
"real",
"file",
"system",
"to",
"the",
"OpenCms",
"VFS",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsImportFolder.java#L231-L262 |
Netflix/spectator | spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java | AsciiSet.fromPattern | public static AsciiSet fromPattern(String pattern) {
final boolean[] members = new boolean[128];
final int n = pattern.length();
for (int i = 0; i < n; ++i) {
final char c = pattern.charAt(i);
if (c >= members.length) {
throw new IllegalArgumentException("invalid pattern, '" + c + "' is not ascii");
}
final boolean isStartOrEnd = i == 0 || i == n - 1;
if (isStartOrEnd || c != '-') {
members[c] = true;
} else {
final char s = pattern.charAt(i - 1);
final char e = pattern.charAt(i + 1);
for (char v = s; v <= e; ++v) {
members[v] = true;
}
}
}
return new AsciiSet(members);
} | java | public static AsciiSet fromPattern(String pattern) {
final boolean[] members = new boolean[128];
final int n = pattern.length();
for (int i = 0; i < n; ++i) {
final char c = pattern.charAt(i);
if (c >= members.length) {
throw new IllegalArgumentException("invalid pattern, '" + c + "' is not ascii");
}
final boolean isStartOrEnd = i == 0 || i == n - 1;
if (isStartOrEnd || c != '-') {
members[c] = true;
} else {
final char s = pattern.charAt(i - 1);
final char e = pattern.charAt(i + 1);
for (char v = s; v <= e; ++v) {
members[v] = true;
}
}
}
return new AsciiSet(members);
} | [
"public",
"static",
"AsciiSet",
"fromPattern",
"(",
"String",
"pattern",
")",
"{",
"final",
"boolean",
"[",
"]",
"members",
"=",
"new",
"boolean",
"[",
"128",
"]",
";",
"final",
"int",
"n",
"=",
"pattern",
".",
"length",
"(",
")",
";",
"for",
"(",
"i... | Create a set containing ascii characters using a simple pattern. The pattern is similar
to a character set in regex. For example, {@code ABC} would contain the characters
{@code A}, {@code B}, and {@code C}. Ranges are supported so all uppercase letters could
be specified as {@code A-Z}. The dash, {@code -}, will be included as part of the set if
it is at the start or end of the pattern.
@param pattern
String specification of the character set.
@return
Set containing the characters specified in {@code pattern}. | [
"Create",
"a",
"set",
"containing",
"ascii",
"characters",
"using",
"a",
"simple",
"pattern",
".",
"The",
"pattern",
"is",
"similar",
"to",
"a",
"character",
"set",
"in",
"regex",
".",
"For",
"example",
"{",
"@code",
"ABC",
"}",
"would",
"contain",
"the",
... | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/impl/AsciiSet.java#L91-L112 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Table.java | Table.addCell | public void addCell(Cell aCell, int row, int column) throws BadElementException {
addCell(aCell, new Point(row,column));
} | java | public void addCell(Cell aCell, int row, int column) throws BadElementException {
addCell(aCell, new Point(row,column));
} | [
"public",
"void",
"addCell",
"(",
"Cell",
"aCell",
",",
"int",
"row",
",",
"int",
"column",
")",
"throws",
"BadElementException",
"{",
"addCell",
"(",
"aCell",
",",
"new",
"Point",
"(",
"row",
",",
"column",
")",
")",
";",
"}"
] | Adds a <CODE>Cell</CODE> to the <CODE>Table</CODE> at a certain row and column.
@param aCell The <CODE>Cell</CODE> to add
@param row The row where the <CODE>Cell</CODE> will be added
@param column The column where the <CODE>Cell</CODE> will be added
@throws BadElementException | [
"Adds",
"a",
"<CODE",
">",
"Cell<",
"/",
"CODE",
">",
"to",
"the",
"<CODE",
">",
"Table<",
"/",
"CODE",
">",
"at",
"a",
"certain",
"row",
"and",
"column",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Table.java#L685-L687 |
phax/ph-commons | ph-datetime/src/main/java/com/helger/datetime/util/PDTXMLConverter.java | PDTXMLConverter.getXMLCalendarTime | @Nonnull
public static XMLGregorianCalendar getXMLCalendarTime (final int nHour,
final int nMinute,
final int nSecond,
final int nMilliSecond)
{
return getXMLCalendarTime (nHour, nMinute, nSecond, nMilliSecond, DatatypeConstants.FIELD_UNDEFINED);
} | java | @Nonnull
public static XMLGregorianCalendar getXMLCalendarTime (final int nHour,
final int nMinute,
final int nSecond,
final int nMilliSecond)
{
return getXMLCalendarTime (nHour, nMinute, nSecond, nMilliSecond, DatatypeConstants.FIELD_UNDEFINED);
} | [
"@",
"Nonnull",
"public",
"static",
"XMLGregorianCalendar",
"getXMLCalendarTime",
"(",
"final",
"int",
"nHour",
",",
"final",
"int",
"nMinute",
",",
"final",
"int",
"nSecond",
",",
"final",
"int",
"nMilliSecond",
")",
"{",
"return",
"getXMLCalendarTime",
"(",
"n... | <p>
Create a Java representation of XML Schema builtin datatype
<code>date</code> or <code>g*</code>.
</p>
<p>
For example, an instance of <code>gYear</code> can be created invoking this
factory with <code>month</code> and <code>day</code> parameters set to
{@link DatatypeConstants#FIELD_UNDEFINED}.
</p>
<p>
A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is
not set.
</p>
@param nHour
Hour to be created.
@param nMinute
Minute to be created.
@param nSecond
Second to be created.
@param nMilliSecond
Milli second to be created.
@return <code>XMLGregorianCalendar</code> created from parameter values.
@see DatatypeConstants#FIELD_UNDEFINED
@throws IllegalArgumentException
If any individual parameter's value is outside the maximum value
constraint for the field as determined by the Date/Time Data
Mapping table in {@link XMLGregorianCalendar} or if the composite
values constitute an invalid <code>XMLGregorianCalendar</code>
instance as determined by {@link XMLGregorianCalendar#isValid()}. | [
"<p",
">",
"Create",
"a",
"Java",
"representation",
"of",
"XML",
"Schema",
"builtin",
"datatype",
"<code",
">",
"date<",
"/",
"code",
">",
"or",
"<code",
">",
"g",
"*",
"<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"For",
"example",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTXMLConverter.java#L450-L457 |
samskivert/pythagoras | src/main/java/pythagoras/f/Quaternion.java | Quaternion.fromAngleAxis | public Quaternion fromAngleAxis (float angle, float x, float y, float z) {
float sina = FloatMath.sin(angle / 2f);
return set(x*sina, y*sina, z*sina, FloatMath.cos(angle / 2f));
} | java | public Quaternion fromAngleAxis (float angle, float x, float y, float z) {
float sina = FloatMath.sin(angle / 2f);
return set(x*sina, y*sina, z*sina, FloatMath.cos(angle / 2f));
} | [
"public",
"Quaternion",
"fromAngleAxis",
"(",
"float",
"angle",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"float",
"sina",
"=",
"FloatMath",
".",
"sin",
"(",
"angle",
"/",
"2f",
")",
";",
"return",
"set",
"(",
"x",
"*",
"si... | Sets this quaternion to the rotation described by the given angle and normalized
axis.
@return a reference to this quaternion, for chaining. | [
"Sets",
"this",
"quaternion",
"to",
"the",
"rotation",
"described",
"by",
"the",
"given",
"angle",
"and",
"normalized",
"axis",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L165-L168 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.beginUpdate | public VirtualMachineScaleSetInner beginUpdate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).toBlocking().single().body();
} | java | public VirtualMachineScaleSetInner beginUpdate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).toBlocking().single().body();
} | [
"public",
"VirtualMachineScaleSetInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"VirtualMachineScaleSetUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetN... | Update a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set to create or update.
@param parameters The scale set object.
@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 VirtualMachineScaleSetInner object if successful. | [
"Update",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L454-L456 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/JMFileAppender.java | JMFileAppender.appendLinesAndClose | public static Path appendLinesAndClose(String filePath, String... lines) {
return appendLinesAndClose(filePath, UTF_8, lines);
} | java | public static Path appendLinesAndClose(String filePath, String... lines) {
return appendLinesAndClose(filePath, UTF_8, lines);
} | [
"public",
"static",
"Path",
"appendLinesAndClose",
"(",
"String",
"filePath",
",",
"String",
"...",
"lines",
")",
"{",
"return",
"appendLinesAndClose",
"(",
"filePath",
",",
"UTF_8",
",",
"lines",
")",
";",
"}"
] | Append lines and close path.
@param filePath the file path
@param lines the lines
@return the path | [
"Append",
"lines",
"and",
"close",
"path",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMFileAppender.java#L122-L124 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.computeLineLineIntersectionFactor | @Pure
public static double computeLineLineIntersectionFactor(
double x1, double y1, double z1, double x2, double y2, double z2,
double x3, double y3, double z3, double x4, double y4, double z4) {
//We compute the 4 vectors P1P2, P3P4, P1P3 and P2P4
Vector3f a = new Vector3f(x2 - x1, y2 - y1, z2 - z1);
Vector3f b = new Vector3f(x4 - x3, y4 - y3, z4 - z3);
Vector3f c = new Vector3f(x3 - x1, y3 - y1, z3 - z1);
Vector3D v = a.cross(b);
//If the cross product is zero then the two segments are parallels
if (MathUtil.isEpsilonZero(v.lengthSquared())) {
return Double.NaN;
}
//If the determinant det(c,a,b)=c.(a x b)!=0 then the two segment are not colinears
if (!MathUtil.isEpsilonZero(c.dot(v))) {
return Double.NaN;
}
return FunctionalVector3D.determinant(
c.getX(), c.getY(), c.getZ(),
b.getX(), b.getY(), b.getZ(),
v.getX(), v.getY(), v.getZ()) / v.lengthSquared();
} | java | @Pure
public static double computeLineLineIntersectionFactor(
double x1, double y1, double z1, double x2, double y2, double z2,
double x3, double y3, double z3, double x4, double y4, double z4) {
//We compute the 4 vectors P1P2, P3P4, P1P3 and P2P4
Vector3f a = new Vector3f(x2 - x1, y2 - y1, z2 - z1);
Vector3f b = new Vector3f(x4 - x3, y4 - y3, z4 - z3);
Vector3f c = new Vector3f(x3 - x1, y3 - y1, z3 - z1);
Vector3D v = a.cross(b);
//If the cross product is zero then the two segments are parallels
if (MathUtil.isEpsilonZero(v.lengthSquared())) {
return Double.NaN;
}
//If the determinant det(c,a,b)=c.(a x b)!=0 then the two segment are not colinears
if (!MathUtil.isEpsilonZero(c.dot(v))) {
return Double.NaN;
}
return FunctionalVector3D.determinant(
c.getX(), c.getY(), c.getZ(),
b.getX(), b.getY(), b.getZ(),
v.getX(), v.getY(), v.getZ()) / v.lengthSquared();
} | [
"@",
"Pure",
"public",
"static",
"double",
"computeLineLineIntersectionFactor",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"z1",
",",
"double",
"x2",
",",
"double",
"y2",
",",
"double",
"z2",
",",
"double",
"x3",
",",
"double",
"y3",
",",
"... | Replies one position factor for the intersection point between two lines.
<p>
Let line equations for L1 and L2:<br>
<code>L1: P1 + factor1 * (P2-P1)</code><br>
<code>L2: P3 + factor2 * (P4-P3)</code><br>
If lines are intersecting, then<br>
<code>P1 + factor1 * (P2-P1) = P3 + factor2 * (P4-P3)</code>
<p>
This function computes and replies <code>factor1</code>.
@param x1 is the first point of the first line.
@param y1 is the first point of the first line.
@param z1 is the first point of the first line.
@param x2 is the second point of the first line.
@param y2 is the second point of the first line.
@param z2 is the second point of the first line.
@param x3 is the first point of the second line.
@param y3 is the first point of the second line.
@param z3 is the first point of the second line.
@param x4 is the second point of the second line.
@param y4 is the second point of the second line.
@param z4 is the second point of the second line.
@return <code>factor1</code> or {@link Double#NaN} if no intersection. | [
"Replies",
"one",
"position",
"factor",
"for",
"the",
"intersection",
"point",
"between",
"two",
"lines",
".",
"<p",
">",
"Let",
"line",
"equations",
"for",
"L1",
"and",
"L2",
":",
"<br",
">",
"<code",
">",
"L1",
":",
"P1",
"+",
"factor1",
"*",
"(",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L327-L353 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/type/TypeAnalysis.java | TypeAnalysis.computeBlockExceptionSet | private CachedExceptionSet computeBlockExceptionSet(BasicBlock basicBlock, TypeFrame result) throws DataflowAnalysisException {
ExceptionSet exceptionSet = computeThrownExceptionTypes(basicBlock);
TypeFrame copyOfResult = createFact();
copy(result, copyOfResult);
CachedExceptionSet cachedExceptionSet = new CachedExceptionSet(copyOfResult, exceptionSet);
thrownExceptionSetMap.put(basicBlock, cachedExceptionSet);
return cachedExceptionSet;
} | java | private CachedExceptionSet computeBlockExceptionSet(BasicBlock basicBlock, TypeFrame result) throws DataflowAnalysisException {
ExceptionSet exceptionSet = computeThrownExceptionTypes(basicBlock);
TypeFrame copyOfResult = createFact();
copy(result, copyOfResult);
CachedExceptionSet cachedExceptionSet = new CachedExceptionSet(copyOfResult, exceptionSet);
thrownExceptionSetMap.put(basicBlock, cachedExceptionSet);
return cachedExceptionSet;
} | [
"private",
"CachedExceptionSet",
"computeBlockExceptionSet",
"(",
"BasicBlock",
"basicBlock",
",",
"TypeFrame",
"result",
")",
"throws",
"DataflowAnalysisException",
"{",
"ExceptionSet",
"exceptionSet",
"=",
"computeThrownExceptionTypes",
"(",
"basicBlock",
")",
";",
"TypeF... | Compute the set of exceptions that can be thrown from the given basic
block. This should only be called if the existing cached exception set is
out of date.
@param basicBlock
the basic block
@param result
the result fact for the block; this is used to determine
whether or not the cached exception set is up to date
@return the cached exception set for the block | [
"Compute",
"the",
"set",
"of",
"exceptions",
"that",
"can",
"be",
"thrown",
"from",
"the",
"given",
"basic",
"block",
".",
"This",
"should",
"only",
"be",
"called",
"if",
"the",
"existing",
"cached",
"exception",
"set",
"is",
"out",
"of",
"date",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/type/TypeAnalysis.java#L729-L741 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.