repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java | ReplyFactory.addAirlineFlightUpdateTemplate | public static AirlineFlightUpdateTemplateBuilder addAirlineFlightUpdateTemplate(
String introMessage, String locale, String pnrNumber,
UpdateType updateType) {
return new AirlineFlightUpdateTemplateBuilder(introMessage, locale,
pnrNumber, updateType);
} | java | public static AirlineFlightUpdateTemplateBuilder addAirlineFlightUpdateTemplate(
String introMessage, String locale, String pnrNumber,
UpdateType updateType) {
return new AirlineFlightUpdateTemplateBuilder(introMessage, locale,
pnrNumber, updateType);
} | [
"public",
"static",
"AirlineFlightUpdateTemplateBuilder",
"addAirlineFlightUpdateTemplate",
"(",
"String",
"introMessage",
",",
"String",
"locale",
",",
"String",
"pnrNumber",
",",
"UpdateType",
"updateType",
")",
"{",
"return",
"new",
"AirlineFlightUpdateTemplateBuilder",
... | Adds an Airline Flight Update Template to the response.
@param introMessage
the message to send before the template. It can't be empty.
@param locale
the current locale. It can't be empty and must be in format
[a-z]{2}_[A-Z]{2}. Locale must be in format [a-z]{2}_[A-Z]{2}.
For more information see<a href=
"https://developers.facebook.com/docs/internationalization#locales"
> Facebook's locale support</a>.
@param pnrNumber
the Passenger Name Record number (Booking Number). It can't be
empty.
@param updateType
an {@link UpdateType} object that represents the kind of
status update of the flight. It can't be null.
@return a builder for the response.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/airline-update-template"
> Facebook's Messenger Platform Airline Flight Update Template
Documentation</a> | [
"Adds",
"an",
"Airline",
"Flight",
"Update",
"Template",
"to",
"the",
"response",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L375-L380 |
tvesalainen/util | util/src/main/java/org/vesalainen/lang/Primitives.java | Primitives.parseShort | public static final short parseShort(CharSequence cs)
{
if (CharSequences.startsWith(cs, "0b"))
{
return parseShort(cs, 2, 2, cs.length());
}
if (CharSequences.startsWith(cs, "0x"))
{
return parseShort(cs, 16, 2, cs.length());
}
return parseShort(cs, 10);
} | java | public static final short parseShort(CharSequence cs)
{
if (CharSequences.startsWith(cs, "0b"))
{
return parseShort(cs, 2, 2, cs.length());
}
if (CharSequences.startsWith(cs, "0x"))
{
return parseShort(cs, 16, 2, cs.length());
}
return parseShort(cs, 10);
} | [
"public",
"static",
"final",
"short",
"parseShort",
"(",
"CharSequence",
"cs",
")",
"{",
"if",
"(",
"CharSequences",
".",
"startsWith",
"(",
"cs",
",",
"\"0b\"",
")",
")",
"{",
"return",
"parseShort",
"(",
"cs",
",",
"2",
",",
"2",
",",
"cs",
".",
"l... | Equal to calling parseShort(cs, 10).
@param cs
@return
@throws java.lang.NumberFormatException if input cannot be parsed to proper
short.
@see java.lang.Short#parseShort(java.lang.String, int)
@see java.lang.Character#digit(int, int) | [
"Equal",
"to",
"calling",
"parseShort",
"(",
"cs",
"10",
")",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L1169-L1180 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.failedStage | @Trivial
public static <U> CompletionStage<U> failedStage(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedStage"));
} | java | @Trivial
public static <U> CompletionStage<U> failedStage(Throwable x) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.failedStage"));
} | [
"@",
"Trivial",
"public",
"static",
"<",
"U",
">",
"CompletionStage",
"<",
"U",
">",
"failedStage",
"(",
"Throwable",
"x",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWWKC1156.not.supported\"",
... | Because CompletableFuture.failedStage is static, this is not a true override.
It will be difficult for the user to invoke this method because they would need to get the class
of the CompletableFuture implementation and locate the static failedStage method on that.
@throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. | [
"Because",
"CompletableFuture",
".",
"failedStage",
"is",
"static",
"this",
"is",
"not",
"a",
"true",
"override",
".",
"It",
"will",
"be",
"difficult",
"for",
"the",
"user",
"to",
"invoke",
"this",
"method",
"because",
"they",
"would",
"need",
"to",
"get",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L387-L390 |
litsec/eidas-opensaml | opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java | RequestedAttributeTemplates.GENDER | public static RequestedAttribute GENDER(Boolean isRequired, boolean includeFriendlyName) {
return create(AttributeConstants.EIDAS_GENDER_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_GENDER_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | java | public static RequestedAttribute GENDER(Boolean isRequired, boolean includeFriendlyName) {
return create(AttributeConstants.EIDAS_GENDER_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_GENDER_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | [
"public",
"static",
"RequestedAttribute",
"GENDER",
"(",
"Boolean",
"isRequired",
",",
"boolean",
"includeFriendlyName",
")",
"{",
"return",
"create",
"(",
"AttributeConstants",
".",
"EIDAS_GENDER_ATTRIBUTE_NAME",
",",
"includeFriendlyName",
"?",
"AttributeConstants",
"."... | Creates a {@code RequestedAttribute} object for the Gender attribute.
@param isRequired
flag to tell whether the attribute is required
@param includeFriendlyName
flag that tells whether the friendly name should be included
@return a {@code RequestedAttribute} object representing the Gender attribute | [
"Creates",
"a",
"{",
"@code",
"RequestedAttribute",
"}",
"object",
"for",
"the",
"Gender",
"attribute",
"."
] | train | https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java#L101-L105 |
jmurty/java-xmlbuilder | src/main/java/com/jamesmurty/utils/NamespaceContextImpl.java | NamespaceContextImpl.addNamespace | public void addNamespace(String prefix, String namespaceURI) {
this.prefixToNsUriMap.put(prefix, namespaceURI);
if (this.nsUriToPrefixesMap.get(namespaceURI) == null) {
this.nsUriToPrefixesMap.put(namespaceURI, new HashSet<String>());
}
this.nsUriToPrefixesMap.get(namespaceURI).add(prefix);
} | java | public void addNamespace(String prefix, String namespaceURI) {
this.prefixToNsUriMap.put(prefix, namespaceURI);
if (this.nsUriToPrefixesMap.get(namespaceURI) == null) {
this.nsUriToPrefixesMap.put(namespaceURI, new HashSet<String>());
}
this.nsUriToPrefixesMap.get(namespaceURI).add(prefix);
} | [
"public",
"void",
"addNamespace",
"(",
"String",
"prefix",
",",
"String",
"namespaceURI",
")",
"{",
"this",
".",
"prefixToNsUriMap",
".",
"put",
"(",
"prefix",
",",
"namespaceURI",
")",
";",
"if",
"(",
"this",
".",
"nsUriToPrefixesMap",
".",
"get",
"(",
"n... | Add a custom mapping from prefix to a namespace. This mapping will
override any mappings present in this class's XML Element (if provided).
@param prefix
the namespace's prefix. Use an empty string for the
default prefix.
@param namespaceURI
the namespace URI to map. | [
"Add",
"a",
"custom",
"mapping",
"from",
"prefix",
"to",
"a",
"namespace",
".",
"This",
"mapping",
"will",
"override",
"any",
"mappings",
"present",
"in",
"this",
"class",
"s",
"XML",
"Element",
"(",
"if",
"provided",
")",
"."
] | train | https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/NamespaceContextImpl.java#L52-L58 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPoseMapper.java | GVRPoseMapper.animate | public void animate(GVRHybridObject target, float time)
{
if ((mSourceSkeleton == null) || !mSourceSkeleton.isEnabled())
{
return;
}
mapLocalToTarget();
mDestSkeleton.poseToBones();
mDestSkeleton.updateBonePose();
mDestSkeleton.updateSkinPose();
} | java | public void animate(GVRHybridObject target, float time)
{
if ((mSourceSkeleton == null) || !mSourceSkeleton.isEnabled())
{
return;
}
mapLocalToTarget();
mDestSkeleton.poseToBones();
mDestSkeleton.updateBonePose();
mDestSkeleton.updateSkinPose();
} | [
"public",
"void",
"animate",
"(",
"GVRHybridObject",
"target",
",",
"float",
"time",
")",
"{",
"if",
"(",
"(",
"mSourceSkeleton",
"==",
"null",
")",
"||",
"!",
"mSourceSkeleton",
".",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"mapLocalToTarget",... | /*
Updates the color and depth map textures from the Kinect cameras.
If a Skeleton is our target or a child, we update the joint angles
for the user associated with it. | [
"/",
"*",
"Updates",
"the",
"color",
"and",
"depth",
"map",
"textures",
"from",
"the",
"Kinect",
"cameras",
".",
"If",
"a",
"Skeleton",
"is",
"our",
"target",
"or",
"a",
"child",
"we",
"update",
"the",
"joint",
"angles",
"for",
"the",
"user",
"associated... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPoseMapper.java#L219-L229 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Rectangle.java | Rectangle.updateBorderBasedOnWidth | private void updateBorderBasedOnWidth(float width, int side) {
useVariableBorders = true;
if (width > 0)
enableBorderSide(side);
else
disableBorderSide(side);
} | java | private void updateBorderBasedOnWidth(float width, int side) {
useVariableBorders = true;
if (width > 0)
enableBorderSide(side);
else
disableBorderSide(side);
} | [
"private",
"void",
"updateBorderBasedOnWidth",
"(",
"float",
"width",
",",
"int",
"side",
")",
"{",
"useVariableBorders",
"=",
"true",
";",
"if",
"(",
"width",
">",
"0",
")",
"enableBorderSide",
"(",
"side",
")",
";",
"else",
"disableBorderSide",
"(",
"side"... | Helper function updating the border flag for a side
based on the specified width.
A width of 0 will disable the border on that side.
Any other width enables it.
@param width width of border
@param side border side constant | [
"Helper",
"function",
"updating",
"the",
"border",
"flag",
"for",
"a",
"side",
"based",
"on",
"the",
"specified",
"width",
".",
"A",
"width",
"of",
"0",
"will",
"disable",
"the",
"border",
"on",
"that",
"side",
".",
"Any",
"other",
"width",
"enables",
"i... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Rectangle.java#L595-L601 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/TypedCollections.java | TypedCollections.dynamicallyCastSet | @SuppressWarnings("unchecked")
static <E> Set<E> dynamicallyCastSet(Set<?> set,
Class<E> type) {
return dynamicallyCastCollection(set, type, Set.class);
} | java | @SuppressWarnings("unchecked")
static <E> Set<E> dynamicallyCastSet(Set<?> set,
Class<E> type) {
return dynamicallyCastCollection(set, type, Set.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"E",
">",
"Set",
"<",
"E",
">",
"dynamicallyCastSet",
"(",
"Set",
"<",
"?",
">",
"set",
",",
"Class",
"<",
"E",
">",
"type",
")",
"{",
"return",
"dynamicallyCastCollection",
"(",
"set",
... | Dynamically check that the members of the set are all instances of
the given type (or null).
@param <E>
the set's element type
@param set
the set to cast
@param type
the class of the set's element type.
@return the dynamically-type checked set.
@throws java.lang.ClassCastException | [
"Dynamically",
"check",
"that",
"the",
"members",
"of",
"the",
"set",
"are",
"all",
"instances",
"of",
"the",
"given",
"type",
"(",
"or",
"null",
")",
"."
] | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/TypedCollections.java#L122-L126 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/proxy/StatementProxyLogic.java | StatementProxyLogic.invoke | public Object invoke(Method method, Object[] args) throws Throwable {
return MethodExecutionListenerUtils.invoke(new MethodExecutionListenerUtils.MethodExecutionCallback() {
@Override
public Object execute(Object proxyTarget, Method method, Object[] args) throws Throwable {
return performQueryExecutionListener(method, args);
}
}, this.proxyConfig, this.statement, this.connectionInfo, method, args);
} | java | public Object invoke(Method method, Object[] args) throws Throwable {
return MethodExecutionListenerUtils.invoke(new MethodExecutionListenerUtils.MethodExecutionCallback() {
@Override
public Object execute(Object proxyTarget, Method method, Object[] args) throws Throwable {
return performQueryExecutionListener(method, args);
}
}, this.proxyConfig, this.statement, this.connectionInfo, method, args);
} | [
"public",
"Object",
"invoke",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"return",
"MethodExecutionListenerUtils",
".",
"invoke",
"(",
"new",
"MethodExecutionListenerUtils",
".",
"MethodExecutionCallback",
"(",
")",
... | set true if auto-generate keys is enabled at "Connection#prepareStatement()" | [
"set",
"true",
"if",
"auto",
"-",
"generate",
"keys",
"is",
"enabled",
"at",
"Connection#prepareStatement",
"()"
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/proxy/StatementProxyLogic.java#L118-L127 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/LookupManagerImpl.java | LookupManagerImpl.removeNotificationHandler | @Override
public void removeNotificationHandler(String serviceName, NotificationHandler handler) throws ServiceException {
if(! isStarted){
ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED);
throw new ServiceException(error);
}
if(handler == null || serviceName == null || serviceName.isEmpty()){
throw new IllegalArgumentException();
}
getLookupService().removeNotificationHandler(serviceName, handler);
} | java | @Override
public void removeNotificationHandler(String serviceName, NotificationHandler handler) throws ServiceException {
if(! isStarted){
ServiceDirectoryError error = new ServiceDirectoryError(ErrorCode.SERVICE_DIRECTORY_MANAGER_FACTORY_CLOSED);
throw new ServiceException(error);
}
if(handler == null || serviceName == null || serviceName.isEmpty()){
throw new IllegalArgumentException();
}
getLookupService().removeNotificationHandler(serviceName, handler);
} | [
"@",
"Override",
"public",
"void",
"removeNotificationHandler",
"(",
"String",
"serviceName",
",",
"NotificationHandler",
"handler",
")",
"throws",
"ServiceException",
"{",
"if",
"(",
"!",
"isStarted",
")",
"{",
"ServiceDirectoryError",
"error",
"=",
"new",
"Service... | Remove the NotificationHandler from the Service.
@param serviceName
the service name.
@param handler
the NotificationHandler for the service. | [
"Remove",
"the",
"NotificationHandler",
"from",
"the",
"Service",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/LookupManagerImpl.java#L447-L460 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/TcasesJson.java | TcasesJson.writeInputModel | public static void writeInputModel( SystemInputDef inputDef, OutputStream outputStream)
{
try( SystemInputJsonWriter writer = new SystemInputJsonWriter( outputStream))
{
writer.write( inputDef);
}
catch( Exception e)
{
throw new RuntimeException( "Can't write input definition", e);
}
} | java | public static void writeInputModel( SystemInputDef inputDef, OutputStream outputStream)
{
try( SystemInputJsonWriter writer = new SystemInputJsonWriter( outputStream))
{
writer.write( inputDef);
}
catch( Exception e)
{
throw new RuntimeException( "Can't write input definition", e);
}
} | [
"public",
"static",
"void",
"writeInputModel",
"(",
"SystemInputDef",
"inputDef",
",",
"OutputStream",
"outputStream",
")",
"{",
"try",
"(",
"SystemInputJsonWriter",
"writer",
"=",
"new",
"SystemInputJsonWriter",
"(",
"outputStream",
")",
")",
"{",
"writer",
".",
... | Writes a {@link SystemInputJsonWriter JSON document} describing the given system input definition to the given output stream. | [
"Writes",
"a",
"{"
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/TcasesJson.java#L48-L58 |
restfb/restfb | src/main/java/com/restfb/util/ReflectionUtils.java | ReflectionUtils.findFieldsWithAnnotation | public static <T extends Annotation> List<FieldWithAnnotation<T>> findFieldsWithAnnotation(Class<?> type,
Class<T> annotationType) {
ClassAnnotationCacheKey cacheKey = new ClassAnnotationCacheKey(type, annotationType);
@SuppressWarnings("unchecked")
List<FieldWithAnnotation<T>> cachedResults =
(List<FieldWithAnnotation<T>>) FIELDS_WITH_ANNOTATION_CACHE.get(cacheKey);
if (cachedResults != null) {
return cachedResults;
}
List<FieldWithAnnotation<T>> fieldsWithAnnotation = new ArrayList<>();
// Walk all superclasses looking for annotated fields until we hit Object
while (!Object.class.equals(type) && type != null) {
for (Field field : type.getDeclaredFields()) {
T annotation = field.getAnnotation(annotationType);
if (annotation != null) {
fieldsWithAnnotation.add(new FieldWithAnnotation<>(field, annotation));
}
}
type = type.getSuperclass();
}
fieldsWithAnnotation = unmodifiableList(fieldsWithAnnotation);
FIELDS_WITH_ANNOTATION_CACHE.put(cacheKey, fieldsWithAnnotation);
return fieldsWithAnnotation;
} | java | public static <T extends Annotation> List<FieldWithAnnotation<T>> findFieldsWithAnnotation(Class<?> type,
Class<T> annotationType) {
ClassAnnotationCacheKey cacheKey = new ClassAnnotationCacheKey(type, annotationType);
@SuppressWarnings("unchecked")
List<FieldWithAnnotation<T>> cachedResults =
(List<FieldWithAnnotation<T>>) FIELDS_WITH_ANNOTATION_CACHE.get(cacheKey);
if (cachedResults != null) {
return cachedResults;
}
List<FieldWithAnnotation<T>> fieldsWithAnnotation = new ArrayList<>();
// Walk all superclasses looking for annotated fields until we hit Object
while (!Object.class.equals(type) && type != null) {
for (Field field : type.getDeclaredFields()) {
T annotation = field.getAnnotation(annotationType);
if (annotation != null) {
fieldsWithAnnotation.add(new FieldWithAnnotation<>(field, annotation));
}
}
type = type.getSuperclass();
}
fieldsWithAnnotation = unmodifiableList(fieldsWithAnnotation);
FIELDS_WITH_ANNOTATION_CACHE.put(cacheKey, fieldsWithAnnotation);
return fieldsWithAnnotation;
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"List",
"<",
"FieldWithAnnotation",
"<",
"T",
">",
">",
"findFieldsWithAnnotation",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"T",
">",
"annotationType",
")",
"{",
"ClassAnnotationCach... | Finds fields on the given {@code type} and all of its superclasses annotated with annotations of type
{@code annotationType}.
@param <T>
The annotation type.
@param type
The target type token.
@param annotationType
The annotation type token.
@return A list of field/annotation pairs. | [
"Finds",
"fields",
"on",
"the",
"given",
"{",
"@code",
"type",
"}",
"and",
"all",
"of",
"its",
"superclasses",
"annotated",
"with",
"annotations",
"of",
"type",
"{",
"@code",
"annotationType",
"}",
"."
] | train | https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/ReflectionUtils.java#L96-L126 |
aws/aws-sdk-java | aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/util/SignerUtils.java | SignerUtils.makeBytesUrlSafe | public static String makeBytesUrlSafe(byte[] bytes) {
byte[] encoded = Base64.encode(bytes);
for (int i=0; i < encoded.length; i++) {
switch(encoded[i]) {
case '+':
encoded[i] = '-'; continue;
case '=':
encoded[i] = '_'; continue;
case '/':
encoded[i] = '~'; continue;
default:
continue;
}
}
return new String(encoded, UTF8);
} | java | public static String makeBytesUrlSafe(byte[] bytes) {
byte[] encoded = Base64.encode(bytes);
for (int i=0; i < encoded.length; i++) {
switch(encoded[i]) {
case '+':
encoded[i] = '-'; continue;
case '=':
encoded[i] = '_'; continue;
case '/':
encoded[i] = '~'; continue;
default:
continue;
}
}
return new String(encoded, UTF8);
} | [
"public",
"static",
"String",
"makeBytesUrlSafe",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"byte",
"[",
"]",
"encoded",
"=",
"Base64",
".",
"encode",
"(",
"bytes",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"encoded",
".",
"length"... | Converts the given data to be safe for use in signed URLs for a private
distribution by using specialized Base64 encoding. | [
"Converts",
"the",
"given",
"data",
"to",
"be",
"safe",
"for",
"use",
"in",
"signed",
"URLs",
"for",
"a",
"private",
"distribution",
"by",
"using",
"specialized",
"Base64",
"encoding",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/util/SignerUtils.java#L97-L113 |
hawkular/hawkular-apm | api/src/main/java/org/hawkular/apm/api/services/AbstractAnalyticsService.java | AbstractAnalyticsService.createRegex | protected static String createRegex(String endpoint, boolean meta) {
StringBuilder regex = new StringBuilder();
regex.append('^');
for (int i=0; i < endpoint.length(); i++) {
char ch=endpoint.charAt(i);
if ("*".indexOf(ch) != -1) {
regex.append('.');
} else if ("\\.^$|?+[]{}()".indexOf(ch) != -1) {
regex.append('\\');
}
regex.append(ch);
}
regex.append('$');
return regex.toString();
} | java | protected static String createRegex(String endpoint, boolean meta) {
StringBuilder regex = new StringBuilder();
regex.append('^');
for (int i=0; i < endpoint.length(); i++) {
char ch=endpoint.charAt(i);
if ("*".indexOf(ch) != -1) {
regex.append('.');
} else if ("\\.^$|?+[]{}()".indexOf(ch) != -1) {
regex.append('\\');
}
regex.append(ch);
}
regex.append('$');
return regex.toString();
} | [
"protected",
"static",
"String",
"createRegex",
"(",
"String",
"endpoint",
",",
"boolean",
"meta",
")",
"{",
"StringBuilder",
"regex",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"regex",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",
... | This method derives the regular expression from the supplied
URI.
@param endpoint The endpoint
@param meta Whether this is a meta endpoint
@return The regular expression | [
"This",
"method",
"derives",
"the",
"regular",
"expression",
"from",
"the",
"supplied",
"URI",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/services/AbstractAnalyticsService.java#L506-L524 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.getRawSnippetContent | public String getRawSnippetContent(Object projectIdOrPath, Integer snippetId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "raw");
return (response.readEntity(String.class));
} | java | public String getRawSnippetContent(Object projectIdOrPath, Integer snippetId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId, "raw");
return (response.readEntity(String.class));
} | [
"public",
"String",
"getRawSnippetContent",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"snippetId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"null",
",",
"\"projects\"",
... | Get the raw project snippet as plain text.
<pre><code>GET /projects/:id/snippets/:snippet_id/raw</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param snippetId the ID of the project's snippet
@return the raw project snippet plain text as an Optional instance
@throws GitLabApiException if any exception occurs | [
"Get",
"the",
"raw",
"project",
"snippet",
"as",
"plain",
"text",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2049-L2052 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/callables/CreateIndexCallable.java | CreateIndexCallable.createVirtualTableStatementForIndex | private String createVirtualTableStatementForIndex(String indexName,
List<String> columns,
List<String> indexSettings) {
String tableName = String.format(Locale.ENGLISH, "\"%s\"", QueryImpl
.tableNameForIndex(indexName));
String cols = Misc.join(",", columns);
String settings = Misc.join(",", indexSettings);
return String.format("CREATE VIRTUAL TABLE %s USING FTS4 ( %s, %s )", tableName,
cols,
settings);
} | java | private String createVirtualTableStatementForIndex(String indexName,
List<String> columns,
List<String> indexSettings) {
String tableName = String.format(Locale.ENGLISH, "\"%s\"", QueryImpl
.tableNameForIndex(indexName));
String cols = Misc.join(",", columns);
String settings = Misc.join(",", indexSettings);
return String.format("CREATE VIRTUAL TABLE %s USING FTS4 ( %s, %s )", tableName,
cols,
settings);
} | [
"private",
"String",
"createVirtualTableStatementForIndex",
"(",
"String",
"indexName",
",",
"List",
"<",
"String",
">",
"columns",
",",
"List",
"<",
"String",
">",
"indexSettings",
")",
"{",
"String",
"tableName",
"=",
"String",
".",
"format",
"(",
"Locale",
... | This method generates the virtual table create SQL for the specified index.
Note: Any column that contains an '=' will cause the statement to fail
because it triggers SQLite to expect that a parameter/value is being passed in.
@param indexName the index name to be used when creating the SQLite virtual table
@param columns the columns in the table
@param indexSettings the special settings to apply to the virtual table -
(only 'tokenize' is current supported)
@return the SQL to create the SQLite virtual table | [
"This",
"method",
"generates",
"the",
"virtual",
"table",
"create",
"SQL",
"for",
"the",
"specified",
"index",
".",
"Note",
":",
"Any",
"column",
"that",
"contains",
"an",
"=",
"will",
"cause",
"the",
"statement",
"to",
"fail",
"because",
"it",
"triggers",
... | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/callables/CreateIndexCallable.java#L113-L124 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java | JCusolverSp.cusolverSpXcsrsymrcmHost | public static int cusolverSpXcsrsymrcmHost(
cusolverSpHandle handle,
int n,
int nnzA,
cusparseMatDescr descrA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer p)
{
return checkResult(cusolverSpXcsrsymrcmHostNative(handle, n, nnzA, descrA, csrRowPtrA, csrColIndA, p));
} | java | public static int cusolverSpXcsrsymrcmHost(
cusolverSpHandle handle,
int n,
int nnzA,
cusparseMatDescr descrA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer p)
{
return checkResult(cusolverSpXcsrsymrcmHostNative(handle, n, nnzA, descrA, csrRowPtrA, csrColIndA, p));
} | [
"public",
"static",
"int",
"cusolverSpXcsrsymrcmHost",
"(",
"cusolverSpHandle",
"handle",
",",
"int",
"n",
",",
"int",
"nnzA",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrRowPtrA",
",",
"Pointer",
"csrColIndA",
",",
"Pointer",
"p",
")",
"{",
"return",... | <pre>
--------- CPU symrcm
Symmetric reverse Cuthill McKee permutation
</pre> | [
"<pre",
">",
"---------",
"CPU",
"symrcm",
"Symmetric",
"reverse",
"Cuthill",
"McKee",
"permutation"
] | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L1354-L1364 |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java | MatFileReader.zeroEndByteArrayToString | private String zeroEndByteArrayToString(byte[] bytes) throws IOException
{
int i = 0;
for ( i = 0; i < bytes.length && bytes[i] != 0; i++ );
return new String( bytes, 0, i );
} | java | private String zeroEndByteArrayToString(byte[] bytes) throws IOException
{
int i = 0;
for ( i = 0; i < bytes.length && bytes[i] != 0; i++ );
return new String( bytes, 0, i );
} | [
"private",
"String",
"zeroEndByteArrayToString",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
"&&",
"bytes",
"[",
"i",
"]",
"!=",
"0"... | Converts byte array to <code>String</code>.
It assumes that String ends with \0 value.
@param bytes byte array containing the string.
@return String retrieved from byte array.
@throws IOException if reading error occurred. | [
"Converts",
"byte",
"array",
"to",
"<code",
">",
"String<",
"/",
"code",
">",
"."
] | train | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/MatFileReader.java#L1301-L1309 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Bits | public JBBPDslBuilder Bits(final String name, final JBBPBitNumber bits) {
final Item item = new Item(BinType.BIT, name, this.byteOrder);
item.bitNumber = bits;
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Bits(final String name, final JBBPBitNumber bits) {
final Item item = new Item(BinType.BIT, name, this.byteOrder);
item.bitNumber = bits;
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Bits",
"(",
"final",
"String",
"name",
",",
"final",
"JBBPBitNumber",
"bits",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BIT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
... | Add named fixed length bit field.
@param name name of the field, if null then anonymous one
@param bits number of bits as length of the field, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"length",
"bit",
"field",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L636-L641 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/audiencesegmentservice/GetFirstPartyAudienceSegments.java | GetFirstPartyAudienceSegments.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
AudienceSegmentServiceInterface audienceSegmentService =
adManagerServices.get(session, AudienceSegmentServiceInterface.class);
// Create a statement to select audience segments.
StatementBuilder statementBuilder = new StatementBuilder()
.where("type = :type")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("type", AudienceSegmentType.FIRST_PARTY.toString());
// Retrieve a small amount of audience segments at a time, paging through
// until all audience segments have been retrieved.
int totalResultSetSize = 0;
do {
AudienceSegmentPage page =
audienceSegmentService.getAudienceSegmentsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each audience segment.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (AudienceSegment audienceSegment : page.getResults()) {
System.out.printf(
"%d) Audience segment with ID %d, name '%s', and size %d was found.%n",
i++,
audienceSegment.getId(),
audienceSegment.getName(),
audienceSegment.getSize()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
AudienceSegmentServiceInterface audienceSegmentService =
adManagerServices.get(session, AudienceSegmentServiceInterface.class);
// Create a statement to select audience segments.
StatementBuilder statementBuilder = new StatementBuilder()
.where("type = :type")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("type", AudienceSegmentType.FIRST_PARTY.toString());
// Retrieve a small amount of audience segments at a time, paging through
// until all audience segments have been retrieved.
int totalResultSetSize = 0;
do {
AudienceSegmentPage page =
audienceSegmentService.getAudienceSegmentsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each audience segment.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (AudienceSegment audienceSegment : page.getResults()) {
System.out.printf(
"%d) Audience segment with ID %d, name '%s', and size %d was found.%n",
i++,
audienceSegment.getId(),
audienceSegment.getName(),
audienceSegment.getSize()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"AudienceSegmentServiceInterface",
"audienceSegmentService",
"=",
"adManagerServices",
".",
"get",
"(",
"sessi... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/audiencesegmentservice/GetFirstPartyAudienceSegments.java#L52-L90 |
denisneuling/apitrary.jar | apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java | ClassUtil.getClassAnnotationValue | @SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> T getClassAnnotationValue(Class source, Class annotation, String attributeName, Class<T> expected) {
Annotation instance = source.getAnnotation(annotation);
T value = null;
if (instance != null) {
try {
value = (T) instance.annotationType().getMethod(attributeName).invoke(instance);
} catch (Exception ex) {
log.warning(ex.getClass().getSimpleName() + ": " + ex.getMessage());
}
}
return value;
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public static <T> T getClassAnnotationValue(Class source, Class annotation, String attributeName, Class<T> expected) {
Annotation instance = source.getAnnotation(annotation);
T value = null;
if (instance != null) {
try {
value = (T) instance.annotationType().getMethod(attributeName).invoke(instance);
} catch (Exception ex) {
log.warning(ex.getClass().getSimpleName() + ": " + ex.getMessage());
}
}
return value;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getClassAnnotationValue",
"(",
"Class",
"source",
",",
"Class",
"annotation",
",",
"String",
"attributeName",
",",
"Class",
"<",
"T",
... | <p>
getClassAnnotationValue.
</p>
@param source
a {@link java.lang.Class} object.
@param annotation
a {@link java.lang.Class} object.
@param attributeName
a {@link java.lang.String} object.
@param expected
a {@link java.lang.Class} object.
@param <T>
a T object.
@return a T object. | [
"<p",
">",
"getClassAnnotationValue",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L55-L67 |
op4j/op4j | src/main/java/org/op4j/functions/FnNumber.java | FnNumber.roundFloat | public static final Function<Float,Float> roundFloat(final int scale, final RoundingMode roundingMode) {
return new RoundFloat(scale, roundingMode);
} | java | public static final Function<Float,Float> roundFloat(final int scale, final RoundingMode roundingMode) {
return new RoundFloat(scale, roundingMode);
} | [
"public",
"static",
"final",
"Function",
"<",
"Float",
",",
"Float",
">",
"roundFloat",
"(",
"final",
"int",
"scale",
",",
"final",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"new",
"RoundFloat",
"(",
"scale",
",",
"roundingMode",
")",
";",
"}"
] | <p>
It rounds the target with the specified scale and rounding mode
</p>
@param scale the scale to be used
@param roundingMode the {@link RoundingMode} to round the input with
@return the {@link Float} | [
"<p",
">",
"It",
"rounds",
"the",
"target",
"with",
"the",
"specified",
"scale",
"and",
"rounding",
"mode",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnNumber.java#L292-L294 |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.apiPost | public JsonResponse apiPost(ApiParams data, ApiFileParams fileParams) throws IOException {
return httpRequestJson(HttpRequestMethod.POST, data, fileParams);
} | java | public JsonResponse apiPost(ApiParams data, ApiFileParams fileParams) throws IOException {
return httpRequestJson(HttpRequestMethod.POST, data, fileParams);
} | [
"public",
"JsonResponse",
"apiPost",
"(",
"ApiParams",
"data",
",",
"ApiFileParams",
"fileParams",
")",
"throws",
"IOException",
"{",
"return",
"httpRequestJson",
"(",
"HttpRequestMethod",
".",
"POST",
",",
"data",
",",
"fileParams",
")",
";",
"}"
] | HTTP POST Request with Interface implementation of ApiParams and ApiFileParams
@param data
@param fileParams
@throws IOException | [
"HTTP",
"POST",
"Request",
"with",
"Interface",
"implementation",
"of",
"ApiParams",
"and",
"ApiFileParams"
] | train | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L291-L293 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.deleteCertificateIssuer | public IssuerBundle deleteCertificateIssuer(String vaultBaseUrl, String issuerName) {
return deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body();
} | java | public IssuerBundle deleteCertificateIssuer(String vaultBaseUrl, String issuerName) {
return deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body();
} | [
"public",
"IssuerBundle",
"deleteCertificateIssuer",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
")",
"{",
"return",
"deleteCertificateIssuerWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"issuerName",
")",
".",
"toBlocking",
"(",
")",
".",
"single... | Deletes the specified certificate issuer.
The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This operation requires the certificates/manageissuers/deleteissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the IssuerBundle object if successful. | [
"Deletes",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"DeleteCertificateIssuer",
"operation",
"permanently",
"removes",
"the",
"specified",
"certificate",
"issuer",
"from",
"the",
"vault",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6400-L6402 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/TypeInfo.java | TypeInfo.innerClass | public final TypeInfo innerClass(String simpleName) {
checkArgument(
simpleName.indexOf('$') == -1, "Simple names shouldn't contain '$': %s", simpleName);
String className = className() + '$' + simpleName;
String internalName = internalName() + '$' + simpleName;
Type type = Type.getObjectType(internalName);
return new AutoValue_TypeInfo(className, simpleName, internalName, type);
} | java | public final TypeInfo innerClass(String simpleName) {
checkArgument(
simpleName.indexOf('$') == -1, "Simple names shouldn't contain '$': %s", simpleName);
String className = className() + '$' + simpleName;
String internalName = internalName() + '$' + simpleName;
Type type = Type.getObjectType(internalName);
return new AutoValue_TypeInfo(className, simpleName, internalName, type);
} | [
"public",
"final",
"TypeInfo",
"innerClass",
"(",
"String",
"simpleName",
")",
"{",
"checkArgument",
"(",
"simpleName",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
",",
"\"Simple names shouldn't contain '$': %s\"",
",",
"simpleName",
")",
";",
"String",
... | Returns a new {@link TypeInfo} for an inner class of this class. | [
"Returns",
"a",
"new",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/TypeInfo.java#L57-L64 |
Azure/azure-sdk-for-java | policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java | PolicySetDefinitionsInner.createOrUpdate | public PolicySetDefinitionInner createOrUpdate(String policySetDefinitionName, PolicySetDefinitionInner parameters) {
return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).toBlocking().single().body();
} | java | public PolicySetDefinitionInner createOrUpdate(String policySetDefinitionName, PolicySetDefinitionInner parameters) {
return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).toBlocking().single().body();
} | [
"public",
"PolicySetDefinitionInner",
"createOrUpdate",
"(",
"String",
"policySetDefinitionName",
",",
"PolicySetDefinitionInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"policySetDefinitionName",
",",
"parameters",
")",
".",
"toBlockin... | Creates or updates a policy set definition.
This operation creates or updates a policy set definition in the given subscription with the given name.
@param policySetDefinitionName The name of the policy set definition to create.
@param parameters The policy set definition properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicySetDefinitionInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"policy",
"set",
"definition",
".",
"This",
"operation",
"creates",
"or",
"updates",
"a",
"policy",
"set",
"definition",
"in",
"the",
"given",
"subscription",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java#L129-L131 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java | NotificationHandlerNodeSubregistry.findHandlers | void findHandlers(ListIterator<PathElement> iterator, String value, Notification notification, Collection<NotificationHandler> handlers) {
NotificationHandlerNodeRegistry registry = childRegistries.get(value);
if (registry != null) {
registry.findEntries(iterator, handlers, notification);
}
// if a child registry exists for the wildcard, we traverse it too
NotificationHandlerNodeRegistry wildCardRegistry = childRegistries.get(WILDCARD_VALUE);
if (wildCardRegistry != null) {
wildCardRegistry.findEntries(iterator, handlers, notification);
}
} | java | void findHandlers(ListIterator<PathElement> iterator, String value, Notification notification, Collection<NotificationHandler> handlers) {
NotificationHandlerNodeRegistry registry = childRegistries.get(value);
if (registry != null) {
registry.findEntries(iterator, handlers, notification);
}
// if a child registry exists for the wildcard, we traverse it too
NotificationHandlerNodeRegistry wildCardRegistry = childRegistries.get(WILDCARD_VALUE);
if (wildCardRegistry != null) {
wildCardRegistry.findEntries(iterator, handlers, notification);
}
} | [
"void",
"findHandlers",
"(",
"ListIterator",
"<",
"PathElement",
">",
"iterator",
",",
"String",
"value",
",",
"Notification",
"notification",
",",
"Collection",
"<",
"NotificationHandler",
">",
"handlers",
")",
"{",
"NotificationHandlerNodeRegistry",
"registry",
"=",... | Get the registry child for the given {@code elementValue} and traverse it to collect the handlers that match the notifications.
If the subregistry has a children for the {@link org.jboss.as.controller.PathElement#WILDCARD_VALUE}, it is also traversed. | [
"Get",
"the",
"registry",
"child",
"for",
"the",
"given",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java#L94-L104 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.forEntireMethod | public static SourceLineAnnotation forEntireMethod(@DottedClassName String className, String sourceFile, LineNumberTable lineNumberTable,
int codeSize) {
LineNumber[] table = lineNumberTable.getLineNumberTable();
if (table != null && table.length > 0) {
LineNumber first = table[0];
LineNumber last = table[table.length - 1];
return new SourceLineAnnotation(className, sourceFile, first.getLineNumber(), last.getLineNumber(), 0, codeSize - 1);
} else {
return createUnknown(className, sourceFile, 0, codeSize - 1);
}
} | java | public static SourceLineAnnotation forEntireMethod(@DottedClassName String className, String sourceFile, LineNumberTable lineNumberTable,
int codeSize) {
LineNumber[] table = lineNumberTable.getLineNumberTable();
if (table != null && table.length > 0) {
LineNumber first = table[0];
LineNumber last = table[table.length - 1];
return new SourceLineAnnotation(className, sourceFile, first.getLineNumber(), last.getLineNumber(), 0, codeSize - 1);
} else {
return createUnknown(className, sourceFile, 0, codeSize - 1);
}
} | [
"public",
"static",
"SourceLineAnnotation",
"forEntireMethod",
"(",
"@",
"DottedClassName",
"String",
"className",
",",
"String",
"sourceFile",
",",
"LineNumberTable",
"lineNumberTable",
",",
"int",
"codeSize",
")",
"{",
"LineNumber",
"[",
"]",
"table",
"=",
"lineNu... | Create a SourceLineAnnotation covering an entire method.
@param className
name of the class the method is in
@param sourceFile
source file containing the method
@param lineNumberTable
the method's LineNumberTable
@param codeSize
size in bytes of the method's code
@return a SourceLineAnnotation covering the entire method | [
"Create",
"a",
"SourceLineAnnotation",
"covering",
"an",
"entire",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L260-L270 |
Backendless/Android-SDK | src/com/backendless/Media.java | Media.startStream | private void startStream( RtspClient rtspClient, String streamName, String params ) throws BackendlessException
{
if( rtspClient.isStreaming() )
{
throw new BackendlessException( "Rtsp client is working on other stream" );
}
rtspClient.setServerAddress( WOWZA_SERVER_IP, WOWZA_SERVER_PORT );
rtspClient.setStreamPath( "/" + WOWZA_SERVER_LIVE_APP_NAME + "/" + streamName + params );
rtspClient.startStream();
} | java | private void startStream( RtspClient rtspClient, String streamName, String params ) throws BackendlessException
{
if( rtspClient.isStreaming() )
{
throw new BackendlessException( "Rtsp client is working on other stream" );
}
rtspClient.setServerAddress( WOWZA_SERVER_IP, WOWZA_SERVER_PORT );
rtspClient.setStreamPath( "/" + WOWZA_SERVER_LIVE_APP_NAME + "/" + streamName + params );
rtspClient.startStream();
} | [
"private",
"void",
"startStream",
"(",
"RtspClient",
"rtspClient",
",",
"String",
"streamName",
",",
"String",
"params",
")",
"throws",
"BackendlessException",
"{",
"if",
"(",
"rtspClient",
".",
"isStreaming",
"(",
")",
")",
"{",
"throw",
"new",
"BackendlessExce... | Connects/disconnects to the RTSP server and starts/stops the stream | [
"Connects",
"/",
"disconnects",
"to",
"the",
"RTSP",
"server",
"and",
"starts",
"/",
"stops",
"the",
"stream"
] | train | https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/Media.java#L395-L404 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java | DefaultSwidProcessor.setTagCreator | public DefaultSwidProcessor setTagCreator(final String tagCreatorName, final String tagCreatorRegId) {
swidTag.setTagCreator(
new EntityComplexType(
new Token(tagCreatorName, idGenerator.nextId()),
new RegistrationId(tagCreatorRegId, idGenerator.nextId()),
idGenerator.nextId()));
return this;
} | java | public DefaultSwidProcessor setTagCreator(final String tagCreatorName, final String tagCreatorRegId) {
swidTag.setTagCreator(
new EntityComplexType(
new Token(tagCreatorName, idGenerator.nextId()),
new RegistrationId(tagCreatorRegId, idGenerator.nextId()),
idGenerator.nextId()));
return this;
} | [
"public",
"DefaultSwidProcessor",
"setTagCreator",
"(",
"final",
"String",
"tagCreatorName",
",",
"final",
"String",
"tagCreatorRegId",
")",
"{",
"swidTag",
".",
"setTagCreator",
"(",
"new",
"EntityComplexType",
"(",
"new",
"Token",
"(",
"tagCreatorName",
",",
"idGe... | <p>
Identifies the tag creator (tag: tag_creator).
</p>
<p>
Example data format: <i>“regid.2010-04.com.labs64,NLIC”</i> where:
<ul>
<li>regid = registered id</li>
<li>2010-04 = the year and first month the domain was registered (yyyy-mm)</li>
<li>com = the upper level domain</li>
<li>labs64 = the domain name</li>
<li>NLIC = the name of the business unit (BU) that created the SWID tag</li>
</ul>
<p>
Note that everything after the comma ‘,’ is optional and only required if a software title is specific
</p>
@param tagCreatorName
tag creator name
@param tagCreatorRegId
tag creator registration ID
@return a reference to this object. | [
"<p",
">",
"Identifies",
"the",
"tag",
"creator",
"(",
"tag",
":",
"tag_creator",
")",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Example",
"data",
"format",
":",
"<i",
">",
"“regid",
".",
"2010",
"-",
"04",
".",
"com",
".",
"labs64",
"NLIC”<",
"/",
"i... | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L206-L213 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.sendSticker | @ObjectiveCName("sendStickerWithPeer:withSticker:")
public void sendSticker(Peer peer, Sticker sticker) {
modules.getMessagesModule().sendSticker(peer, sticker);
} | java | @ObjectiveCName("sendStickerWithPeer:withSticker:")
public void sendSticker(Peer peer, Sticker sticker) {
modules.getMessagesModule().sendSticker(peer, sticker);
} | [
"@",
"ObjectiveCName",
"(",
"\"sendStickerWithPeer:withSticker:\"",
")",
"public",
"void",
"sendSticker",
"(",
"Peer",
"peer",
",",
"Sticker",
"sticker",
")",
"{",
"modules",
".",
"getMessagesModule",
"(",
")",
".",
"sendSticker",
"(",
"peer",
",",
"sticker",
")... | Send document without preview
@param peer destination peer
@param sticker sticker to send | [
"Send",
"document",
"without",
"preview"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L1004-L1007 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/dtd/DTDNotationAttr.java | DTDNotationAttr.validateDefault | @Override
public void validateDefault(InputProblemReporter rep, boolean normalize)
throws XMLStreamException
{
// First, basic checks that it's a valid non-empty name:
String def = validateDefaultName(rep, normalize);
// And then that it's one of listed values:
String shared = mEnumValues.find(def);
if (shared == null) {
reportValidationProblem(rep, "Invalid default value '"+def+"': has to be one of ("
+mEnumValues+")");
}
// Ok, cool it's ok...
if (normalize) {
mDefValue.setValue(shared);
}
} | java | @Override
public void validateDefault(InputProblemReporter rep, boolean normalize)
throws XMLStreamException
{
// First, basic checks that it's a valid non-empty name:
String def = validateDefaultName(rep, normalize);
// And then that it's one of listed values:
String shared = mEnumValues.find(def);
if (shared == null) {
reportValidationProblem(rep, "Invalid default value '"+def+"': has to be one of ("
+mEnumValues+")");
}
// Ok, cool it's ok...
if (normalize) {
mDefValue.setValue(shared);
}
} | [
"@",
"Override",
"public",
"void",
"validateDefault",
"(",
"InputProblemReporter",
"rep",
",",
"boolean",
"normalize",
")",
"throws",
"XMLStreamException",
"{",
"// First, basic checks that it's a valid non-empty name:",
"String",
"def",
"=",
"validateDefaultName",
"(",
"re... | Method called by the validator
to ask attribute to verify that the default it has (if any) is
valid for such type. | [
"Method",
"called",
"by",
"the",
"validator",
"to",
"ask",
"attribute",
"to",
"verify",
"that",
"the",
"default",
"it",
"has",
"(",
"if",
"any",
")",
"is",
"valid",
"for",
"such",
"type",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDNotationAttr.java#L86-L104 |
andrewoma/dexx | collection/src/main/java/com/github/andrewoma/dexx/collection/Vector.java | VectorPointer.gotoFreshPosWritable1 | public void gotoFreshPosWritable1(int oldIndex, int newIndex, int xor) {
stabilize(oldIndex);
gotoFreshPosWritable0(oldIndex, newIndex, xor);
} | java | public void gotoFreshPosWritable1(int oldIndex, int newIndex, int xor) {
stabilize(oldIndex);
gotoFreshPosWritable0(oldIndex, newIndex, xor);
} | [
"public",
"void",
"gotoFreshPosWritable1",
"(",
"int",
"oldIndex",
",",
"int",
"newIndex",
",",
"int",
"xor",
")",
"{",
"stabilize",
"(",
"oldIndex",
")",
";",
"gotoFreshPosWritable0",
"(",
"oldIndex",
",",
"newIndex",
",",
"xor",
")",
";",
"}"
] | ensures structure is dirty and at pos newIndex and writable at level 0 | [
"ensures",
"structure",
"is",
"dirty",
"and",
"at",
"pos",
"newIndex",
"and",
"writable",
"at",
"level",
"0"
] | train | https://github.com/andrewoma/dexx/blob/96755b325e90c84ffa006365dde9ddf89c83c6ca/collection/src/main/java/com/github/andrewoma/dexx/collection/Vector.java#L1071-L1074 |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java | Scheduler.schedule | public Scheduler schedule(Setting cronSetting) {
if (CollectionUtil.isNotEmpty(cronSetting)) {
String group;
for (Entry<String, LinkedHashMap<String, String>> groupedEntry : cronSetting.getGroupedMap().entrySet()) {
group = groupedEntry.getKey();
for (Entry<String, String> entry : groupedEntry.getValue().entrySet()) {
String jobClass = entry.getKey();
if (StrUtil.isNotBlank(group)) {
jobClass = group + CharUtil.DOT + jobClass;
}
final String pattern = entry.getValue();
StaticLog.debug("Load job: {} {}", pattern, jobClass);
try {
schedule(pattern, new InvokeTask(jobClass));
} catch (Exception e) {
throw new CronException(e, "Schedule [{}] [{}] error!", pattern, jobClass);
}
}
}
}
return this;
} | java | public Scheduler schedule(Setting cronSetting) {
if (CollectionUtil.isNotEmpty(cronSetting)) {
String group;
for (Entry<String, LinkedHashMap<String, String>> groupedEntry : cronSetting.getGroupedMap().entrySet()) {
group = groupedEntry.getKey();
for (Entry<String, String> entry : groupedEntry.getValue().entrySet()) {
String jobClass = entry.getKey();
if (StrUtil.isNotBlank(group)) {
jobClass = group + CharUtil.DOT + jobClass;
}
final String pattern = entry.getValue();
StaticLog.debug("Load job: {} {}", pattern, jobClass);
try {
schedule(pattern, new InvokeTask(jobClass));
} catch (Exception e) {
throw new CronException(e, "Schedule [{}] [{}] error!", pattern, jobClass);
}
}
}
}
return this;
} | [
"public",
"Scheduler",
"schedule",
"(",
"Setting",
"cronSetting",
")",
"{",
"if",
"(",
"CollectionUtil",
".",
"isNotEmpty",
"(",
"cronSetting",
")",
")",
"{",
"String",
"group",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"LinkedHashMap",
"<",
"String",
... | 批量加入配置文件中的定时任务<br>
配置文件格式为: xxx.xxx.xxx.Class.method = * * * * *
@param cronSetting 定时任务设置文件
@return this | [
"批量加入配置文件中的定时任务<br",
">",
"配置文件格式为:",
"xxx",
".",
"xxx",
".",
"xxx",
".",
"Class",
".",
"method",
"=",
"*",
"*",
"*",
"*",
"*"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L176-L197 |
upwork/java-upwork | src/com/Upwork/api/Routers/Activities/Team.java | Team.updateBatch | public JSONObject updateBatch(String company, HashMap<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/tasks/batch", params);
} | java | public JSONObject updateBatch(String company, HashMap<String, String> params) throws JSONException {
return oClient.put("/otask/v1/tasks/companies/" + company + "/tasks/batch", params);
} | [
"public",
"JSONObject",
"updateBatch",
"(",
"String",
"company",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"put",
"(",
"\"/otask/v1/tasks/companies/\"",
"+",
"company",
"+",
"\"/ta... | Update a group of oTask/Activity records
@param company Company ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Update",
"a",
"group",
"of",
"oTask",
"/",
"Activity",
"records"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Activities/Team.java#L149-L151 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_migration_GET | public ArrayList<OvhMigration> project_serviceName_migration_GET(String serviceName) throws IOException {
String qPath = "/cloud/project/{serviceName}/migration";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t10);
} | java | public ArrayList<OvhMigration> project_serviceName_migration_GET(String serviceName) throws IOException {
String qPath = "/cloud/project/{serviceName}/migration";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t10);
} | [
"public",
"ArrayList",
"<",
"OvhMigration",
">",
"project_serviceName_migration_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/migration\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qP... | Get planned migrations
REST: GET /cloud/project/{serviceName}/migration
@param serviceName [required] Service name
API beta | [
"Get",
"planned",
"migrations"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1074-L1079 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readParentFolder | public CmsResource readParentFolder(CmsRequestContext context, CmsUUID structureId) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsResource result = null;
try {
result = m_driverManager.readParentFolder(dbc, structureId);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_READ_PARENT_FOLDER_2,
dbc.currentProject().getName(),
structureId),
e);
} finally {
dbc.clear();
}
return result;
} | java | public CmsResource readParentFolder(CmsRequestContext context, CmsUUID structureId) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsResource result = null;
try {
result = m_driverManager.readParentFolder(dbc, structureId);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(
Messages.ERR_READ_PARENT_FOLDER_2,
dbc.currentProject().getName(),
structureId),
e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsResource",
"readParentFolder",
"(",
"CmsRequestContext",
"context",
",",
"CmsUUID",
"structureId",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"CmsResource",
"result... | Returns the parent folder to the given structure id.<p>
@param context the current request context
@param structureId the child structure id
@return the parent folder <code>{@link CmsResource}</code>
@throws CmsException if something goes wrong | [
"Returns",
"the",
"parent",
"folder",
"to",
"the",
"given",
"structure",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4629-L4647 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/BeanELResolver.java | BeanELResolver.getValue | @Override
public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
Object result = null;
if (isResolvable(base)) {
Method method = toBeanProperty(base, property).getReadMethod();
if (method == null) {
throw new PropertyNotFoundException("Cannot read property " + property);
}
try {
result = method.invoke(base);
} catch (InvocationTargetException e) {
throw new ELException(e.getCause());
} catch (Exception e) {
throw new ELException(e);
}
context.setPropertyResolved(true);
}
return result;
} | java | @Override
public Object getValue(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
Object result = null;
if (isResolvable(base)) {
Method method = toBeanProperty(base, property).getReadMethod();
if (method == null) {
throw new PropertyNotFoundException("Cannot read property " + property);
}
try {
result = method.invoke(base);
} catch (InvocationTargetException e) {
throw new ELException(e.getCause());
} catch (Exception e) {
throw new ELException(e);
}
context.setPropertyResolved(true);
}
return result;
} | [
"@",
"Override",
"public",
"Object",
"getValue",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"Object",
... | If the base object is not null, returns the current value of the given property on this bean.
If the base is not null, the propertyResolved property of the ELContext object must be set to
true by this resolver, before returning. If this property is not true after this method is
called, the caller should ignore the return value. The provided property name will first be
coerced to a String. If the property is a readable property of the base object, as per the
JavaBeans specification, then return the result of the getter call. If the getter throws an
exception, it is propagated to the caller. If the property is not found or is not readable, a
PropertyNotFoundException is thrown.
@param context
The context of this evaluation.
@param base
The bean to analyze.
@param property
The name of the property to analyze. Will be coerced to a String.
@return If the propertyResolved property of ELContext was set to true, then the value of the
given property. Otherwise, undefined.
@throws NullPointerException
if context is null
@throws PropertyNotFoundException
if base is not null and the specified property does not exist or is not readable.
@throws ELException
if an exception was thrown while performing the property or variable resolution.
The thrown exception must be included as the cause property of this exception, if
available. | [
"If",
"the",
"base",
"object",
"is",
"not",
"null",
"returns",
"the",
"current",
"value",
"of",
"the",
"given",
"property",
"on",
"this",
"bean",
".",
"If",
"the",
"base",
"is",
"not",
"null",
"the",
"propertyResolved",
"property",
"of",
"the",
"ELContext"... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/BeanELResolver.java#L291-L312 |
indeedeng/proctor | proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnPersisterCoreImpl.java | SvnPersisterCoreImpl.getMostRecentLogEntry | private SVNLogEntry getMostRecentLogEntry(final SVNClientManager clientManager, final String path, final SVNRevision startRevision) throws SVNException {
final String[] targetPaths = {path};
final SVNLogClient logClient = clientManager.getLogClient();
final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler();
final int limit = 1;
// In order to get history is "descending" order, the startRevision should be the one closer to HEAD
// The path@head could be deleted - must use 'pegRevision' to get history at a deleted path
logClient.doLog(svnUrl, targetPaths,
/* pegRevision */ startRevision,
/* startRevision */ startRevision,
/* endRevision */ SVNRevision.create(1),
/* stopOnCopy */ false,
/* discoverChangedPaths */ false,
/* includeMergedRevisions */ false,
limit,
new String[]{SVNRevisionProperty.AUTHOR}, handler);
if (handler.getLogEntries().isEmpty()) {
return null;
} else {
return handler.getLogEntries().get(0);
}
} | java | private SVNLogEntry getMostRecentLogEntry(final SVNClientManager clientManager, final String path, final SVNRevision startRevision) throws SVNException {
final String[] targetPaths = {path};
final SVNLogClient logClient = clientManager.getLogClient();
final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler();
final int limit = 1;
// In order to get history is "descending" order, the startRevision should be the one closer to HEAD
// The path@head could be deleted - must use 'pegRevision' to get history at a deleted path
logClient.doLog(svnUrl, targetPaths,
/* pegRevision */ startRevision,
/* startRevision */ startRevision,
/* endRevision */ SVNRevision.create(1),
/* stopOnCopy */ false,
/* discoverChangedPaths */ false,
/* includeMergedRevisions */ false,
limit,
new String[]{SVNRevisionProperty.AUTHOR}, handler);
if (handler.getLogEntries().isEmpty()) {
return null;
} else {
return handler.getLogEntries().get(0);
}
} | [
"private",
"SVNLogEntry",
"getMostRecentLogEntry",
"(",
"final",
"SVNClientManager",
"clientManager",
",",
"final",
"String",
"path",
",",
"final",
"SVNRevision",
"startRevision",
")",
"throws",
"SVNException",
"{",
"final",
"String",
"[",
"]",
"targetPaths",
"=",
"... | Returns the most recent log entry startRevision.
startRevision should not be HEAD because the path @HEAD could be deleted.
@param path
@param startRevision
@return
@throws SVNException | [
"Returns",
"the",
"most",
"recent",
"log",
"entry",
"startRevision",
".",
"startRevision",
"should",
"not",
"be",
"HEAD",
"because",
"the",
"path",
"@HEAD",
"could",
"be",
"deleted",
"."
] | train | https://github.com/indeedeng/proctor/blob/b7795acfc26a30d013655d0e0fa1d3f8d0576571/proctor-store-svn/src/main/java/com/indeed/proctor/store/SvnPersisterCoreImpl.java#L215-L238 |
dickschoeller/gedbrowser | geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/GeoServiceBounds.java | GeoServiceBounds.createBounds | public static Feature createBounds(final String id,
final LngLatAlt southwest,
final LngLatAlt northeast) {
final Feature feature = new Feature();
feature.setId(id);
if (northeast == null || southwest == null) {
throw new IllegalArgumentException(
"Must have a proper bounding box");
}
final double[] bbox = {
southwest.getLongitude(),
southwest.getLatitude(),
northeast.getLongitude(),
northeast.getLatitude()
};
final Polygon polygon = new Polygon();
feature.setGeometry(polygon);
polygon.setBbox(bbox);
final List<LngLatAlt> elements = new ArrayList<>(5);
elements.add(new LngLatAlt(bbox[SW_LNG], bbox[SW_LAT]));
elements.add(new LngLatAlt(bbox[NE_LNG], bbox[SW_LAT]));
elements.add(new LngLatAlt(bbox[NE_LNG], bbox[NE_LAT]));
elements.add(new LngLatAlt(bbox[SW_LNG], bbox[NE_LAT]));
elements.add(new LngLatAlt(bbox[SW_LNG], bbox[SW_LAT]));
polygon.add(elements);
feature.setBbox(bbox);
return feature;
} | java | public static Feature createBounds(final String id,
final LngLatAlt southwest,
final LngLatAlt northeast) {
final Feature feature = new Feature();
feature.setId(id);
if (northeast == null || southwest == null) {
throw new IllegalArgumentException(
"Must have a proper bounding box");
}
final double[] bbox = {
southwest.getLongitude(),
southwest.getLatitude(),
northeast.getLongitude(),
northeast.getLatitude()
};
final Polygon polygon = new Polygon();
feature.setGeometry(polygon);
polygon.setBbox(bbox);
final List<LngLatAlt> elements = new ArrayList<>(5);
elements.add(new LngLatAlt(bbox[SW_LNG], bbox[SW_LAT]));
elements.add(new LngLatAlt(bbox[NE_LNG], bbox[SW_LAT]));
elements.add(new LngLatAlt(bbox[NE_LNG], bbox[NE_LAT]));
elements.add(new LngLatAlt(bbox[SW_LNG], bbox[NE_LAT]));
elements.add(new LngLatAlt(bbox[SW_LNG], bbox[SW_LAT]));
polygon.add(elements);
feature.setBbox(bbox);
return feature;
} | [
"public",
"static",
"Feature",
"createBounds",
"(",
"final",
"String",
"id",
",",
"final",
"LngLatAlt",
"southwest",
",",
"final",
"LngLatAlt",
"northeast",
")",
"{",
"final",
"Feature",
"feature",
"=",
"new",
"Feature",
"(",
")",
";",
"feature",
".",
"setId... | Build a bounding box feature.
@param id the ID string
@param southwest the southwest corner of the bounding box
@param northeast the northeast corner of the bounding box
@return the Feature for the new bounds | [
"Build",
"a",
"bounding",
"box",
"feature",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/geoservice-persistence/src/main/java/org/schoellerfamily/geoservice/model/GeoServiceBounds.java#L54-L81 |
vanniktech/Emoji | emoji/src/main/java/com/vanniktech/emoji/EmojiUtils.java | EmojiUtils.emojiInformation | @NonNull public static EmojiInformation emojiInformation(@Nullable final String text) {
final List<EmojiRange> emojis = EmojiManager.getInstance().findAllEmojis(text);
final boolean isOnlyEmojis = isOnlyEmojis(text);
return new EmojiInformation(isOnlyEmojis, emojis);
} | java | @NonNull public static EmojiInformation emojiInformation(@Nullable final String text) {
final List<EmojiRange> emojis = EmojiManager.getInstance().findAllEmojis(text);
final boolean isOnlyEmojis = isOnlyEmojis(text);
return new EmojiInformation(isOnlyEmojis, emojis);
} | [
"@",
"NonNull",
"public",
"static",
"EmojiInformation",
"emojiInformation",
"(",
"@",
"Nullable",
"final",
"String",
"text",
")",
"{",
"final",
"List",
"<",
"EmojiRange",
">",
"emojis",
"=",
"EmojiManager",
".",
"getInstance",
"(",
")",
".",
"findAllEmojis",
"... | returns a class that contains all of the emoji information that was found in the given text | [
"returns",
"a",
"class",
"that",
"contains",
"all",
"of",
"the",
"emoji",
"information",
"that",
"was",
"found",
"in",
"the",
"given",
"text"
] | train | https://github.com/vanniktech/Emoji/blob/6d53773c1e018a4d19065b9dc1092de4308dd6f3/emoji/src/main/java/com/vanniktech/emoji/EmojiUtils.java#L39-L43 |
aragozin/jvm-tools | mxdump/src/main/java/org/gridkit/jvmtool/jackson/WriterBasedGenerator.java | WriterBasedGenerator._writePPFieldName | protected final void _writePPFieldName(String name, boolean commaBefore)
throws IOException, JsonGenerationException
{
if (commaBefore) {
_cfgPrettyPrinter.writeObjectEntrySeparator(this);
} else {
_cfgPrettyPrinter.beforeObjectEntries(this);
}
if (isEnabled(Feature.QUOTE_FIELD_NAMES)) { // standard
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
_writeString(name);
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
} else { // non-standard, omit quotes
_writeString(name);
}
} | java | protected final void _writePPFieldName(String name, boolean commaBefore)
throws IOException, JsonGenerationException
{
if (commaBefore) {
_cfgPrettyPrinter.writeObjectEntrySeparator(this);
} else {
_cfgPrettyPrinter.beforeObjectEntries(this);
}
if (isEnabled(Feature.QUOTE_FIELD_NAMES)) { // standard
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
_writeString(name);
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
} else { // non-standard, omit quotes
_writeString(name);
}
} | [
"protected",
"final",
"void",
"_writePPFieldName",
"(",
"String",
"name",
",",
"boolean",
"commaBefore",
")",
"throws",
"IOException",
",",
"JsonGenerationException",
"{",
"if",
"(",
"commaBefore",
")",
"{",
"_cfgPrettyPrinter",
".",
"writeObjectEntrySeparator",
"(",
... | Specialized version of <code>_writeFieldName</code>, off-lined
to keep the "fast path" as simple (and hopefully fast) as possible. | [
"Specialized",
"version",
"of",
"<code",
">",
"_writeFieldName<",
"/",
"code",
">",
"off",
"-",
"lined",
"to",
"keep",
"the",
"fast",
"path",
"as",
"simple",
"(",
"and",
"hopefully",
"fast",
")",
"as",
"possible",
"."
] | train | https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/mxdump/src/main/java/org/gridkit/jvmtool/jackson/WriterBasedGenerator.java#L300-L322 |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatXFileOutput.java | DssatXFileOutput.setSecDataArr | private int setSecDataArr(ArrayList inArr, ArrayList outArr) {
if (!inArr.isEmpty()) {
for (int j = 0; j < outArr.size(); j++) {
if (outArr.get(j).equals(inArr)) {
return j + 1;
}
}
outArr.add(inArr);
return outArr.size();
} else {
return 0;
}
} | java | private int setSecDataArr(ArrayList inArr, ArrayList outArr) {
if (!inArr.isEmpty()) {
for (int j = 0; j < outArr.size(); j++) {
if (outArr.get(j).equals(inArr)) {
return j + 1;
}
}
outArr.add(inArr);
return outArr.size();
} else {
return 0;
}
} | [
"private",
"int",
"setSecDataArr",
"(",
"ArrayList",
"inArr",
",",
"ArrayList",
"outArr",
")",
"{",
"if",
"(",
"!",
"inArr",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"outArr",
".",
"size",
"(",
")",
";"... | Get index value of the record and set new id value in the array
@param inArr sub array of data
@param outArr array of sub data
@return current index value of the sub data | [
"Get",
"index",
"value",
"of",
"the",
"record",
"and",
"set",
"new",
"id",
"value",
"in",
"the",
"array"
] | train | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatXFileOutput.java#L1496-L1509 |
ehcache/ehcache3 | 107/src/main/java/org/ehcache/jsr107/EhcacheCachingProvider.java | EhcacheCachingProvider.getCacheManager | public CacheManager getCacheManager(URI uri, Configuration config) {
return getCacheManager(new ConfigSupplier(uri, config), new Properties());
} | java | public CacheManager getCacheManager(URI uri, Configuration config) {
return getCacheManager(new ConfigSupplier(uri, config), new Properties());
} | [
"public",
"CacheManager",
"getCacheManager",
"(",
"URI",
"uri",
",",
"Configuration",
"config",
")",
"{",
"return",
"getCacheManager",
"(",
"new",
"ConfigSupplier",
"(",
"uri",
",",
"config",
")",
",",
"new",
"Properties",
"(",
")",
")",
";",
"}"
] | Enables to create a JSR-107 {@link CacheManager} based on the provided Ehcache {@link Configuration}.
@param uri the URI identifying this cache manager
@param config the Ehcache configuration to use
@return a cache manager | [
"Enables",
"to",
"create",
"a",
"JSR",
"-",
"107",
"{",
"@link",
"CacheManager",
"}",
"based",
"on",
"the",
"provided",
"Ehcache",
"{",
"@link",
"Configuration",
"}",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/107/src/main/java/org/ehcache/jsr107/EhcacheCachingProvider.java#L96-L98 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigFactory.java | XMLConfigFactory.createConfigFile | static void createConfigFile(String xmlName, Resource configFile) throws IOException {
configFile.createFile(true);
createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
} | java | static void createConfigFile(String xmlName, Resource configFile) throws IOException {
configFile.createFile(true);
createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
} | [
"static",
"void",
"createConfigFile",
"(",
"String",
"xmlName",
",",
"Resource",
"configFile",
")",
"throws",
"IOException",
"{",
"configFile",
".",
"createFile",
"(",
"true",
")",
";",
"createFileFromResource",
"(",
"\"/resource/config/\"",
"+",
"xmlName",
"+",
"... | creates the Config File, if File not exist
@param xmlName
@param configFile
@throws IOException | [
"creates",
"the",
"Config",
"File",
"if",
"File",
"not",
"exist"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigFactory.java#L185-L188 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.divideAndRound | private static BigDecimal divideAndRound(BigInteger bdividend,
long ldivisor, int scale, int roundingMode, int preferredScale) {
boolean isRemainderZero; // record remainder is zero or not
int qsign; // quotient sign
long r = 0; // store quotient & remainder in long
MutableBigInteger mq = null; // store quotient
// Descend into mutables for faster remainder checks
MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
mq = new MutableBigInteger();
r = mdividend.divide(ldivisor, mq);
isRemainderZero = (r == 0);
qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
if (!isRemainderZero) {
if(needIncrement(ldivisor, roundingMode, qsign, mq, r)) {
mq.add(MutableBigInteger.ONE);
}
return mq.toBigDecimal(qsign, scale);
} else {
if (preferredScale != scale) {
long compactVal = mq.toCompactValue(qsign);
if(compactVal!=INFLATED) {
return createAndStripZerosToMatchScale(compactVal, scale, preferredScale);
}
BigInteger intVal = mq.toBigInteger(qsign);
return createAndStripZerosToMatchScale(intVal,scale, preferredScale);
} else {
return mq.toBigDecimal(qsign, scale);
}
}
} | java | private static BigDecimal divideAndRound(BigInteger bdividend,
long ldivisor, int scale, int roundingMode, int preferredScale) {
boolean isRemainderZero; // record remainder is zero or not
int qsign; // quotient sign
long r = 0; // store quotient & remainder in long
MutableBigInteger mq = null; // store quotient
// Descend into mutables for faster remainder checks
MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
mq = new MutableBigInteger();
r = mdividend.divide(ldivisor, mq);
isRemainderZero = (r == 0);
qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
if (!isRemainderZero) {
if(needIncrement(ldivisor, roundingMode, qsign, mq, r)) {
mq.add(MutableBigInteger.ONE);
}
return mq.toBigDecimal(qsign, scale);
} else {
if (preferredScale != scale) {
long compactVal = mq.toCompactValue(qsign);
if(compactVal!=INFLATED) {
return createAndStripZerosToMatchScale(compactVal, scale, preferredScale);
}
BigInteger intVal = mq.toBigInteger(qsign);
return createAndStripZerosToMatchScale(intVal,scale, preferredScale);
} else {
return mq.toBigDecimal(qsign, scale);
}
}
} | [
"private",
"static",
"BigDecimal",
"divideAndRound",
"(",
"BigInteger",
"bdividend",
",",
"long",
"ldivisor",
",",
"int",
"scale",
",",
"int",
"roundingMode",
",",
"int",
"preferredScale",
")",
"{",
"boolean",
"isRemainderZero",
";",
"// record remainder is zero or no... | Internally used for division operation for division {@code BigInteger}
by {@code long}.
The returned {@code BigDecimal} object is the quotient whose scale is set
to the passed in scale. If the remainder is not zero, it will be rounded
based on the passed in roundingMode. Also, if the remainder is zero and
the last parameter, i.e. preferredScale is NOT equal to scale, the
trailing zeros of the result is stripped to match the preferredScale. | [
"Internally",
"used",
"for",
"division",
"operation",
"for",
"division",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4241-L4270 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsUserQueryBuilder.java | CmsUserQueryBuilder.createFlagCondition | protected I_CmsQueryFragment createFlagCondition(TableAlias users, int flags) {
return new CmsSimpleQueryFragment(
users.column(colFlags()) + " & ? = ? ",
new Integer(flags),
new Integer(flags));
} | java | protected I_CmsQueryFragment createFlagCondition(TableAlias users, int flags) {
return new CmsSimpleQueryFragment(
users.column(colFlags()) + " & ? = ? ",
new Integer(flags),
new Integer(flags));
} | [
"protected",
"I_CmsQueryFragment",
"createFlagCondition",
"(",
"TableAlias",
"users",
",",
"int",
"flags",
")",
"{",
"return",
"new",
"CmsSimpleQueryFragment",
"(",
"users",
".",
"column",
"(",
"colFlags",
"(",
")",
")",
"+",
"\" & ? = ? \"",
",",
"new",
"Intege... | Creates an SQL flag check condition.<p>
@param users the user table alias
@param flags the flags to check
@return the resulting SQL expression | [
"Creates",
"an",
"SQL",
"flag",
"check",
"condition",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserQueryBuilder.java#L517-L523 |
WiQuery/wiquery | wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java | Options.putInteger | public Options putInteger(String key, IModel<Integer> value)
{
putOption(key, new IntegerOption(value));
return this;
} | java | public Options putInteger(String key, IModel<Integer> value)
{
putOption(key, new IntegerOption(value));
return this;
} | [
"public",
"Options",
"putInteger",
"(",
"String",
"key",
",",
"IModel",
"<",
"Integer",
">",
"value",
")",
"{",
"putOption",
"(",
"key",
",",
"new",
"IntegerOption",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Puts an int value for the given option name.
</p>
@param key
the option name.
@param value
the int value. | [
"<p",
">",
"Puts",
"an",
"int",
"value",
"for",
"the",
"given",
"option",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java#L484-L488 |
lucee/Lucee | core/src/main/java/lucee/runtime/schedule/StorageUtil.java | StorageUtil.toTime | public Time toTime(Element el, String attributeName, Time defaultValue) {
return new TimeImpl(toDateTime(el, attributeName, defaultValue));
} | java | public Time toTime(Element el, String attributeName, Time defaultValue) {
return new TimeImpl(toDateTime(el, attributeName, defaultValue));
} | [
"public",
"Time",
"toTime",
"(",
"Element",
"el",
",",
"String",
"attributeName",
",",
"Time",
"defaultValue",
")",
"{",
"return",
"new",
"TimeImpl",
"(",
"toDateTime",
"(",
"el",
",",
"attributeName",
",",
"defaultValue",
")",
")",
";",
"}"
] | reads a XML Element Attribute ans cast it to a Date
@param el XML Element to read Attribute from it
@param attributeName Name of the Attribute to read
@param defaultValue if attribute doesn't exist return default value
@return Attribute Value | [
"reads",
"a",
"XML",
"Element",
"Attribute",
"ans",
"cast",
"it",
"to",
"a",
"Date"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L313-L315 |
greatman/GreatmancodeTools | src/main/java/com/greatmancode/tools/utils/Vector.java | Vector.getMidpoint | public Vector getMidpoint(Vector other) {
double x = (this.x + other.x) / 2;
double y = (this.y + other.y) / 2;
double z = (this.z + other.z) / 2;
return new Vector(x, y, z);
} | java | public Vector getMidpoint(Vector other) {
double x = (this.x + other.x) / 2;
double y = (this.y + other.y) / 2;
double z = (this.z + other.z) / 2;
return new Vector(x, y, z);
} | [
"public",
"Vector",
"getMidpoint",
"(",
"Vector",
"other",
")",
"{",
"double",
"x",
"=",
"(",
"this",
".",
"x",
"+",
"other",
".",
"x",
")",
"/",
"2",
";",
"double",
"y",
"=",
"(",
"this",
".",
"y",
"+",
"other",
".",
"y",
")",
"/",
"2",
";",... | Gets a new midpoint vector between this vector and another.
@param other The other vector
@return a new midpoint vector | [
"Gets",
"a",
"new",
"midpoint",
"vector",
"between",
"this",
"vector",
"and",
"another",
"."
] | train | https://github.com/greatman/GreatmancodeTools/blob/4c9d2656c5c8298ff9e1f235c9be8b148e43c9f1/src/main/java/com/greatmancode/tools/utils/Vector.java#L237-L242 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurealert.java | br_configurealert.configurealert | public static br_configurealert configurealert(nitro_service client, br_configurealert resource) throws Exception
{
return ((br_configurealert[]) resource.perform_operation(client, "configurealert"))[0];
} | java | public static br_configurealert configurealert(nitro_service client, br_configurealert resource) throws Exception
{
return ((br_configurealert[]) resource.perform_operation(client, "configurealert"))[0];
} | [
"public",
"static",
"br_configurealert",
"configurealert",
"(",
"nitro_service",
"client",
",",
"br_configurealert",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_configurealert",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"clie... | <pre>
Use this operation to configure alerts on Repeater Instances.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"configure",
"alerts",
"on",
"Repeater",
"Instances",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurealert.java#L126-L129 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java | IOManagerAsync.createBulkBlockChannelReader | @Override
public BulkBlockChannelReader createBulkBlockChannelReader(FileIOChannel.ID channelID,
List<MemorySegment> targetSegments, int numBlocks) throws IOException
{
checkState(!isShutdown.get(), "I/O-Manager is shut down.");
return new AsynchronousBulkBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks);
} | java | @Override
public BulkBlockChannelReader createBulkBlockChannelReader(FileIOChannel.ID channelID,
List<MemorySegment> targetSegments, int numBlocks) throws IOException
{
checkState(!isShutdown.get(), "I/O-Manager is shut down.");
return new AsynchronousBulkBlockReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks);
} | [
"@",
"Override",
"public",
"BulkBlockChannelReader",
"createBulkBlockChannelReader",
"(",
"FileIOChannel",
".",
"ID",
"channelID",
",",
"List",
"<",
"MemorySegment",
">",
"targetSegments",
",",
"int",
"numBlocks",
")",
"throws",
"IOException",
"{",
"checkState",
"(",
... | Creates a block channel reader that reads all blocks from the given channel directly in one bulk.
The reader draws segments to read the blocks into from a supplied list, which must contain as many
segments as the channel has blocks. After the reader is done, the list with the full segments can be
obtained from the reader.
<p>
If a channel is not to be read in one bulk, but in multiple smaller batches, a
{@link BlockChannelReader} should be used.
@param channelID The descriptor for the channel to write to.
@param targetSegments The list to take the segments from into which to read the data.
@param numBlocks The number of blocks in the channel to read.
@return A block channel reader that reads from the given channel.
@throws IOException Thrown, if the channel for the reader could not be opened. | [
"Creates",
"a",
"block",
"channel",
"reader",
"that",
"reads",
"all",
"blocks",
"from",
"the",
"given",
"channel",
"directly",
"in",
"one",
"bulk",
".",
"The",
"reader",
"draws",
"segments",
"to",
"read",
"the",
"blocks",
"into",
"from",
"a",
"supplied",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L264-L270 |
samskivert/samskivert | src/main/java/com/samskivert/util/Config.java | Config.getValue | public int getValue (String name, int defval)
{
String val = _props.getProperty(name);
if (val != null) {
try {
return Integer.decode(val).intValue(); // handles base 10, hex values, etc.
} catch (NumberFormatException nfe) {
log.warning("Malformed integer property", "name", name, "value", val);
}
}
return defval;
} | java | public int getValue (String name, int defval)
{
String val = _props.getProperty(name);
if (val != null) {
try {
return Integer.decode(val).intValue(); // handles base 10, hex values, etc.
} catch (NumberFormatException nfe) {
log.warning("Malformed integer property", "name", name, "value", val);
}
}
return defval;
} | [
"public",
"int",
"getValue",
"(",
"String",
"name",
",",
"int",
"defval",
")",
"{",
"String",
"val",
"=",
"_props",
".",
"getProperty",
"(",
"name",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"decode",
... | Fetches and returns the value for the specified configuration property. If the value is not
specified in the associated properties file, the supplied default value is returned instead.
If the property specified in the file is poorly formatted (not and integer, not in proper
array specification), a warning message will be logged and the default value will be
returned.
@param name name of the property.
@param defval the value to return if the property is not specified in the config file.
@return the value of the requested property. | [
"Fetches",
"and",
"returns",
"the",
"value",
"for",
"the",
"specified",
"configuration",
"property",
".",
"If",
"the",
"value",
"is",
"not",
"specified",
"in",
"the",
"associated",
"properties",
"file",
"the",
"supplied",
"default",
"value",
"is",
"returned",
... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L110-L121 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryResult.java | QueryResult.withLastEvaluatedKey | public QueryResult withLastEvaluatedKey(java.util.Map<String, AttributeValue> lastEvaluatedKey) {
setLastEvaluatedKey(lastEvaluatedKey);
return this;
} | java | public QueryResult withLastEvaluatedKey(java.util.Map<String, AttributeValue> lastEvaluatedKey) {
setLastEvaluatedKey(lastEvaluatedKey);
return this;
} | [
"public",
"QueryResult",
"withLastEvaluatedKey",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"lastEvaluatedKey",
")",
"{",
"setLastEvaluatedKey",
"(",
"lastEvaluatedKey",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to
start a new operation, excluding this value in the new request.
</p>
<p>
If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no
more data to be retrieved.
</p>
<p>
If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result
set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code>
is empty.
</p>
@param lastEvaluatedKey
The primary key of the item where the operation stopped, inclusive of the previous result set. Use this
value to start a new operation, excluding this value in the new request.</p>
<p>
If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is
no more data to be retrieved.
</p>
<p>
If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the
result set. The only way to know when you have reached the end of the result set is when
<code>LastEvaluatedKey</code> is empty.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"primary",
"key",
"of",
"the",
"item",
"where",
"the",
"operation",
"stopped",
"inclusive",
"of",
"the",
"previous",
"result",
"set",
".",
"Use",
"this",
"value",
"to",
"start",
"a",
"new",
"operation",
"excluding",
"this",
"value",
"in",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryResult.java#L431-L434 |
aws/aws-sdk-java | aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/S3Location.java | S3Location.withTagging | public S3Location withTagging(java.util.Map<String, String> tagging) {
setTagging(tagging);
return this;
} | java | public S3Location withTagging(java.util.Map<String, String> tagging) {
setTagging(tagging);
return this;
} | [
"public",
"S3Location",
"withTagging",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tagging",
")",
"{",
"setTagging",
"(",
"tagging",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tag-set that is applied to the job results.
</p>
@param tagging
The tag-set that is applied to the job results.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tag",
"-",
"set",
"that",
"is",
"applied",
"to",
"the",
"job",
"results",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/S3Location.java#L361-L364 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java | JawrApplicationConfigManager.getStringValue | public String getStringValue(String property) {
final List<JawrConfigManagerMBean> mBeans = getInitializedConfigurationManagers();
try {
if (mBeans.size() == 3) {
if (areEquals(getProperty(jsMBean, property), getProperty(cssMBean, property),
getProperty(binaryMBean, property))) {
return getProperty(jsMBean, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
if (mBeans.size() == 2) {
JawrConfigManagerMBean mBean1 = mBeans.get(0);
JawrConfigManagerMBean mBean2 = mBeans.get(1);
if (areEquals(getProperty(mBean1, property), getProperty(mBean2, property))) {
return getProperty(mBean1, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
JawrConfigManagerMBean mBean1 = mBeans.get(0);
return getProperty(mBean1, property);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
return ERROR_VALUE;
}
} | java | public String getStringValue(String property) {
final List<JawrConfigManagerMBean> mBeans = getInitializedConfigurationManagers();
try {
if (mBeans.size() == 3) {
if (areEquals(getProperty(jsMBean, property), getProperty(cssMBean, property),
getProperty(binaryMBean, property))) {
return getProperty(jsMBean, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
if (mBeans.size() == 2) {
JawrConfigManagerMBean mBean1 = mBeans.get(0);
JawrConfigManagerMBean mBean2 = mBeans.get(1);
if (areEquals(getProperty(mBean1, property), getProperty(mBean2, property))) {
return getProperty(mBean1, property);
} else {
return NOT_IDENTICAL_VALUES;
}
}
JawrConfigManagerMBean mBean1 = mBeans.get(0);
return getProperty(mBean1, property);
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
return ERROR_VALUE;
}
} | [
"public",
"String",
"getStringValue",
"(",
"String",
"property",
")",
"{",
"final",
"List",
"<",
"JawrConfigManagerMBean",
">",
"mBeans",
"=",
"getInitializedConfigurationManagers",
"(",
")",
";",
"try",
"{",
"if",
"(",
"mBeans",
".",
"size",
"(",
")",
"==",
... | Returns the string value of the configuration managers
@param property
the property to retrieve
@return the string value of the configuration managers | [
"Returns",
"the",
"string",
"value",
"of",
"the",
"configuration",
"managers"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java#L512-L547 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java | DOM2DTM.getNodeData | protected static void getNodeData(Node node, FastStringBuffer buf)
{
switch (node.getNodeType())
{
case Node.DOCUMENT_FRAGMENT_NODE :
case Node.DOCUMENT_NODE :
case Node.ELEMENT_NODE :
{
for (Node child = node.getFirstChild(); null != child;
child = child.getNextSibling())
{
getNodeData(child, buf);
}
}
break;
case Node.TEXT_NODE :
case Node.CDATA_SECTION_NODE :
case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node
buf.append(node.getNodeValue());
break;
case Node.PROCESSING_INSTRUCTION_NODE :
// warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
break;
default :
// ignore
break;
}
} | java | protected static void getNodeData(Node node, FastStringBuffer buf)
{
switch (node.getNodeType())
{
case Node.DOCUMENT_FRAGMENT_NODE :
case Node.DOCUMENT_NODE :
case Node.ELEMENT_NODE :
{
for (Node child = node.getFirstChild(); null != child;
child = child.getNextSibling())
{
getNodeData(child, buf);
}
}
break;
case Node.TEXT_NODE :
case Node.CDATA_SECTION_NODE :
case Node.ATTRIBUTE_NODE : // Never a child but might be our starting node
buf.append(node.getNodeValue());
break;
case Node.PROCESSING_INSTRUCTION_NODE :
// warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);
break;
default :
// ignore
break;
}
} | [
"protected",
"static",
"void",
"getNodeData",
"(",
"Node",
"node",
",",
"FastStringBuffer",
"buf",
")",
"{",
"switch",
"(",
"node",
".",
"getNodeType",
"(",
")",
")",
"{",
"case",
"Node",
".",
"DOCUMENT_FRAGMENT_NODE",
":",
"case",
"Node",
".",
"DOCUMENT_NOD... | Retrieve the text content of a DOM subtree, appending it into a
user-supplied FastStringBuffer object. Note that attributes are
not considered part of the content of an element.
<p>
There are open questions regarding whitespace stripping.
Currently we make no special effort in that regard, since the standard
DOM doesn't yet provide DTD-based information to distinguish
whitespace-in-element-context from genuine #PCDATA. Note that we
should probably also consider xml:space if/when we address this.
DOM Level 3 may solve the problem for us.
<p>
%REVIEW% Actually, since this method operates on the DOM side of the
fence rather than the DTM side, it SHOULDN'T do
any special handling. The DOM does what the DOM does; if you want
DTM-level abstractions, use DTM-level methods.
@param node Node whose subtree is to be walked, gathering the
contents of all Text or CDATASection nodes.
@param buf FastStringBuffer into which the contents of the text
nodes are to be concatenated. | [
"Retrieve",
"the",
"text",
"content",
"of",
"a",
"DOM",
"subtree",
"appending",
"it",
"into",
"a",
"user",
"-",
"supplied",
"FastStringBuffer",
"object",
".",
"Note",
"that",
"attributes",
"are",
"not",
"considered",
"part",
"of",
"the",
"content",
"of",
"an... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/dom2dtm/DOM2DTM.java#L916-L944 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/Resource.java | Resource.newResource | public static Resource newResource(URL url)
throws IOException
{
if (url==null)
return null;
String urls=url.toExternalForm();
if( urls.startsWith( "file:"))
{
try
{
FileResource fileResource= new FileResource(url);
return fileResource;
}
catch(Exception e)
{
log.debug(LogSupport.EXCEPTION,e);
return new BadResource(url,e.toString());
}
}
else if( urls.startsWith( "jar:file:"))
{
return new JarFileResource(url);
}
else if( urls.startsWith( "jar:"))
{
return new JarResource(url);
}
return new URLResource(url,null);
} | java | public static Resource newResource(URL url)
throws IOException
{
if (url==null)
return null;
String urls=url.toExternalForm();
if( urls.startsWith( "file:"))
{
try
{
FileResource fileResource= new FileResource(url);
return fileResource;
}
catch(Exception e)
{
log.debug(LogSupport.EXCEPTION,e);
return new BadResource(url,e.toString());
}
}
else if( urls.startsWith( "jar:file:"))
{
return new JarFileResource(url);
}
else if( urls.startsWith( "jar:"))
{
return new JarResource(url);
}
return new URLResource(url,null);
} | [
"public",
"static",
"Resource",
"newResource",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"return",
"null",
";",
"String",
"urls",
"=",
"url",
".",
"toExternalForm",
"(",
")",
";",
"if",
"(",
"urls",
".",... | Construct a resource from a url.
@param url A URL.
@return A Resource object. | [
"Construct",
"a",
"resource",
"from",
"a",
"url",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/Resource.java#L47-L77 |
weld/core | impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java | ProxyFactory.createInterceptorBody | protected void createInterceptorBody(ClassMethod classMethod, MethodInformation method, ClassMethod staticConstructor) {
invokeMethodHandler(classMethod, method, true, DEFAULT_METHOD_RESOLVER, staticConstructor);
} | java | protected void createInterceptorBody(ClassMethod classMethod, MethodInformation method, ClassMethod staticConstructor) {
invokeMethodHandler(classMethod, method, true, DEFAULT_METHOD_RESOLVER, staticConstructor);
} | [
"protected",
"void",
"createInterceptorBody",
"(",
"ClassMethod",
"classMethod",
",",
"MethodInformation",
"method",
",",
"ClassMethod",
"staticConstructor",
")",
"{",
"invokeMethodHandler",
"(",
"classMethod",
",",
"method",
",",
"true",
",",
"DEFAULT_METHOD_RESOLVER",
... | Creates the given method on the proxy class where the implementation
forwards the call directly to the method handler.
<p/>
the generated bytecode is equivalent to:
<p/>
return (RetType) methodHandler.invoke(this,param1,param2);
@param classMethod the class method
@param method any JLR method
@return the method byte code | [
"Creates",
"the",
"given",
"method",
"on",
"the",
"proxy",
"class",
"where",
"the",
"implementation",
"forwards",
"the",
"call",
"directly",
"to",
"the",
"method",
"handler",
".",
"<p",
"/",
">",
"the",
"generated",
"bytecode",
"is",
"equivalent",
"to",
":",... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L732-L734 |
js-lib-com/commons | src/main/java/js/converter/LocaleConverter.java | LocaleConverter.asObject | @Override
public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException {
// at this point value type is guaranteed to be a Locale
int dashIndex = string.indexOf('-');
if (dashIndex == -1) {
throw new IllegalArgumentException(String.format("Cannot convert |%s| to locale instance.", string));
}
return (T) new Locale(string.substring(0, dashIndex), string.substring(dashIndex + 1));
} | java | @Override
public <T> T asObject(String string, Class<T> valueType) throws IllegalArgumentException {
// at this point value type is guaranteed to be a Locale
int dashIndex = string.indexOf('-');
if (dashIndex == -1) {
throw new IllegalArgumentException(String.format("Cannot convert |%s| to locale instance.", string));
}
return (T) new Locale(string.substring(0, dashIndex), string.substring(dashIndex + 1));
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"asObject",
"(",
"String",
"string",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"throws",
"IllegalArgumentException",
"{",
"// at this point value type is guaranteed to be a Locale\r",
"int",
"dashIndex",
"=",
"stri... | Create locale instance from ISO-639 language and ISO-3166 country code, for example en-US.
@throws IllegalArgumentException if given string argument is not well formatted. | [
"Create",
"locale",
"instance",
"from",
"ISO",
"-",
"639",
"language",
"and",
"ISO",
"-",
"3166",
"country",
"code",
"for",
"example",
"en",
"-",
"US",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/LocaleConverter.java#L24-L32 |
motown-io/motown | operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java | ChargingStationEventListener.updateChargingStationAvailability | private void updateChargingStationAvailability(ChargingStationId chargingStationId, Availability availability) {
ChargingStation chargingStation = repository.findOne(chargingStationId.getId());
if (chargingStation != null) {
chargingStation.setAvailability(availability);
repository.createOrUpdate(chargingStation);
}
} | java | private void updateChargingStationAvailability(ChargingStationId chargingStationId, Availability availability) {
ChargingStation chargingStation = repository.findOne(chargingStationId.getId());
if (chargingStation != null) {
chargingStation.setAvailability(availability);
repository.createOrUpdate(chargingStation);
}
} | [
"private",
"void",
"updateChargingStationAvailability",
"(",
"ChargingStationId",
"chargingStationId",
",",
"Availability",
"availability",
")",
"{",
"ChargingStation",
"chargingStation",
"=",
"repository",
".",
"findOne",
"(",
"chargingStationId",
".",
"getId",
"(",
")",... | Updates the charging station's availability.
@param chargingStationId the charging station's id.
@param availability the charging station's new availability. | [
"Updates",
"the",
"charging",
"station",
"s",
"availability",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/ChargingStationEventListener.java#L366-L373 |
alkacon/opencms-core | src/org/opencms/importexport/CmsImportVersion7.java | CmsImportVersion7.addContentFile | public void addContentFile(String source, String resourceId) {
if ((source != null) && (resourceId != null)) {
try {
m_helper.getFileBytes(source);
m_contentFiles.add(new CmsUUID(resourceId));
} catch (CmsImportExportException e) {
LOG.info("File not found in import: " + source);
}
}
} | java | public void addContentFile(String source, String resourceId) {
if ((source != null) && (resourceId != null)) {
try {
m_helper.getFileBytes(source);
m_contentFiles.add(new CmsUUID(resourceId));
} catch (CmsImportExportException e) {
LOG.info("File not found in import: " + source);
}
}
} | [
"public",
"void",
"addContentFile",
"(",
"String",
"source",
",",
"String",
"resourceId",
")",
"{",
"if",
"(",
"(",
"source",
"!=",
"null",
")",
"&&",
"(",
"resourceId",
"!=",
"null",
")",
")",
"{",
"try",
"{",
"m_helper",
".",
"getFileBytes",
"(",
"so... | Registers a file whose contents are contained in the zip file.<p>
@param source the path in the zip file
@param resourceId | [
"Registers",
"a",
"file",
"whose",
"contents",
"are",
"contained",
"in",
"the",
"zip",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion7.java#L533-L543 |
square/otto | otto/src/main/java/com/squareup/otto/Bus.java | Bus.enqueueEvent | protected void enqueueEvent(Object event, EventHandler handler) {
eventsToDispatch.get().offer(new EventWithHandler(event, handler));
} | java | protected void enqueueEvent(Object event, EventHandler handler) {
eventsToDispatch.get().offer(new EventWithHandler(event, handler));
} | [
"protected",
"void",
"enqueueEvent",
"(",
"Object",
"event",
",",
"EventHandler",
"handler",
")",
"{",
"eventsToDispatch",
".",
"get",
"(",
")",
".",
"offer",
"(",
"new",
"EventWithHandler",
"(",
"event",
",",
"handler",
")",
")",
";",
"}"
] | Queue the {@code event} for dispatch during {@link #dispatchQueuedEvents()}. Events are queued in-order of
occurrence so they can be dispatched in the same order. | [
"Queue",
"the",
"{"
] | train | https://github.com/square/otto/blob/2a67589abd91879cf23a8c96542b59349485ec3d/otto/src/main/java/com/squareup/otto/Bus.java#L344-L346 |
wanglinsong/th-lipermi | src/main/java/net/sf/lipermi/handler/CallProxy.java | CallProxy.buildProxy | public static Object buildProxy(RemoteInstance remoteInstance, ConnectionHandler connectionHandler)
throws ClassNotFoundException {
Class<?> clazz = Class.forName(remoteInstance.getClassName());
return Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, new CallProxy(connectionHandler));
} | java | public static Object buildProxy(RemoteInstance remoteInstance, ConnectionHandler connectionHandler)
throws ClassNotFoundException {
Class<?> clazz = Class.forName(remoteInstance.getClassName());
return Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, new CallProxy(connectionHandler));
} | [
"public",
"static",
"Object",
"buildProxy",
"(",
"RemoteInstance",
"remoteInstance",
",",
"ConnectionHandler",
"connectionHandler",
")",
"throws",
"ClassNotFoundException",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"remoteInstance",
".... | Build a proxy to a {
@see net.sf.lipermi.call.RemoteInstance RemoteInstance}
specifing how it could be reached (i.e., through a ConnectionHandler)
@param remoteInstance remote instance
@param connectionHandler handler
@return dymamic proxy for RemoteInstance
@throws ClassNotFoundException class not found | [
"Build",
"a",
"proxy",
"to",
"a",
"{"
] | train | https://github.com/wanglinsong/th-lipermi/blob/5fa9ab1d7085b5133dc37ce3ba201d44a7bf25f0/src/main/java/net/sf/lipermi/handler/CallProxy.java#L76-L80 |
linkedin/dexmaker | dexmaker-mockito-inline/src/main/java/com/android/dx/mockito/inline/InvocationHandlerAdapter.java | InvocationHandlerAdapter.invoke | @Override
public Object invoke(final Object proxy, final Method method, final Object[] rawArgs) throws
Throwable {
// args can be null if the method invoked has no arguments, but Mockito expects a non-null
Object[] args = rawArgs;
if (rawArgs == null) {
args = new Object[0];
}
if (isEqualsMethod(method)) {
return proxy == args[0];
} else if (isHashCodeMethod(method)) {
return System.identityHashCode(proxy);
}
return handler.handle(Mockito.framework().getInvocationFactory().createInvocation(proxy,
withSettings().build(proxy.getClass().getSuperclass()), method,
new RealMethodBehavior() {
@Override
public Object call() throws Throwable {
return ProxyBuilder.callSuper(proxy, method, rawArgs);
}
}, args));
} | java | @Override
public Object invoke(final Object proxy, final Method method, final Object[] rawArgs) throws
Throwable {
// args can be null if the method invoked has no arguments, but Mockito expects a non-null
Object[] args = rawArgs;
if (rawArgs == null) {
args = new Object[0];
}
if (isEqualsMethod(method)) {
return proxy == args[0];
} else if (isHashCodeMethod(method)) {
return System.identityHashCode(proxy);
}
return handler.handle(Mockito.framework().getInvocationFactory().createInvocation(proxy,
withSettings().build(proxy.getClass().getSuperclass()), method,
new RealMethodBehavior() {
@Override
public Object call() throws Throwable {
return ProxyBuilder.callSuper(proxy, method, rawArgs);
}
}, args));
} | [
"@",
"Override",
"public",
"Object",
"invoke",
"(",
"final",
"Object",
"proxy",
",",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"rawArgs",
")",
"throws",
"Throwable",
"{",
"// args can be null if the method invoked has no arguments, but Mockito expec... | Intercept a method call. Called <u>before</u> a method is called by the proxied method.
<p>This does the same as {@link #interceptEntryHook(Object, Method, Object[], SuperMethod)}
but this handles proxied methods. We only proxy abstract methods.
@param proxy proxies object
@param method method that was called
@param rawArgs arguments to the method
@return mocked result
@throws Throwable An exception if thrown | [
"Intercept",
"a",
"method",
"call",
".",
"Called",
"<u",
">",
"before<",
"/",
"u",
">",
"a",
"method",
"is",
"called",
"by",
"the",
"proxied",
"method",
"."
] | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker-mockito-inline/src/main/java/com/android/dx/mockito/inline/InvocationHandlerAdapter.java#L97-L120 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java | CPRuleUserSegmentRelPersistenceImpl.findAll | @Override
public List<CPRuleUserSegmentRel> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CPRuleUserSegmentRel> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPRuleUserSegmentRel",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp rule user segment rels.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPRuleUserSegmentRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp rule user segment rels
@param end the upper bound of the range of cp rule user segment rels (not inclusive)
@return the range of cp rule user segment rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"rule",
"user",
"segment",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java#L1681-L1684 |
czyzby/gdx-lml | mvc/src/main/java/com/github/czyzby/autumn/mvc/component/ui/InterfaceService.java | InterfaceService.addPreferencesToParser | public void addPreferencesToParser(final String preferencesKey, final String preferencesPath) {
parser.getData().addPreferences(preferencesKey, ApplicationPreferences.getPreferences(preferencesPath));
} | java | public void addPreferencesToParser(final String preferencesKey, final String preferencesPath) {
parser.getData().addPreferences(preferencesKey, ApplicationPreferences.getPreferences(preferencesPath));
} | [
"public",
"void",
"addPreferencesToParser",
"(",
"final",
"String",
"preferencesKey",
",",
"final",
"String",
"preferencesPath",
")",
"{",
"parser",
".",
"getData",
"(",
")",
".",
"addPreferences",
"(",
"preferencesKey",
",",
"ApplicationPreferences",
".",
"getPrefe... | Registers {@link com.badlogic.gdx.Preferences} object to the LML parser.
@param preferencesKey key of the preferences as it appears in LML views.
@param preferencesPath path to the preferences. | [
"Registers",
"{",
"@link",
"com",
".",
"badlogic",
".",
"gdx",
".",
"Preferences",
"}",
"object",
"to",
"the",
"LML",
"parser",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/ui/InterfaceService.java#L126-L128 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java | DomainsInner.listSharedAccessKeysAsync | public Observable<DomainSharedAccessKeysInner> listSharedAccessKeysAsync(String resourceGroupName, String domainName) {
return listSharedAccessKeysWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<DomainSharedAccessKeysInner>, DomainSharedAccessKeysInner>() {
@Override
public DomainSharedAccessKeysInner call(ServiceResponse<DomainSharedAccessKeysInner> response) {
return response.body();
}
});
} | java | public Observable<DomainSharedAccessKeysInner> listSharedAccessKeysAsync(String resourceGroupName, String domainName) {
return listSharedAccessKeysWithServiceResponseAsync(resourceGroupName, domainName).map(new Func1<ServiceResponse<DomainSharedAccessKeysInner>, DomainSharedAccessKeysInner>() {
@Override
public DomainSharedAccessKeysInner call(ServiceResponse<DomainSharedAccessKeysInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DomainSharedAccessKeysInner",
">",
"listSharedAccessKeysAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
")",
"{",
"return",
"listSharedAccessKeysWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"domainName",
")",... | List keys for a domain.
List the two keys used to publish to a domain.
@param resourceGroupName The name of the resource group within the user's subscription.
@param domainName Name of the domain
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DomainSharedAccessKeysInner object | [
"List",
"keys",
"for",
"a",
"domain",
".",
"List",
"the",
"two",
"keys",
"used",
"to",
"publish",
"to",
"a",
"domain",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L1099-L1106 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java | GenericConversionService.getDefaultConverter | protected GenericConverter getDefaultConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
return (sourceType.isAssignableTo(targetType) ? NO_OP_CONVERTER : null);
} | java | protected GenericConverter getDefaultConverter(TypeDescriptor sourceType, TypeDescriptor targetType) {
return (sourceType.isAssignableTo(targetType) ? NO_OP_CONVERTER : null);
} | [
"protected",
"GenericConverter",
"getDefaultConverter",
"(",
"TypeDescriptor",
"sourceType",
",",
"TypeDescriptor",
"targetType",
")",
"{",
"return",
"(",
"sourceType",
".",
"isAssignableTo",
"(",
"targetType",
")",
"?",
"NO_OP_CONVERTER",
":",
"null",
")",
";",
"}"... | Return the default converter if no converter is found for the given sourceType/targetType pair.
Returns a NO_OP Converter if the sourceType is assignable to the targetType.
Returns {@code null} otherwise, indicating no suitable converter could be found.
Subclasses may override.
@param sourceType the source type to convert from
@param targetType the target type to convert to
@return the default generic converter that will perform the conversion | [
"Return",
"the",
"default",
"converter",
"if",
"no",
"converter",
"is",
"found",
"for",
"the",
"given",
"sourceType",
"/",
"targetType",
"pair",
".",
"Returns",
"a",
"NO_OP",
"Converter",
"if",
"the",
"sourceType",
"is",
"assignable",
"to",
"the",
"targetType"... | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java#L252-L254 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java | TypeEnter.handleDeprecatedAnnotations | private void handleDeprecatedAnnotations(List<JCAnnotation> annotations, Symbol sym) {
for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
JCAnnotation a = al.head;
if (a.annotationType.type == syms.deprecatedType) {
sym.flags_field |= (Flags.DEPRECATED | Flags.DEPRECATED_ANNOTATION);
a.args.stream()
.filter(e -> e.hasTag(ASSIGN))
.map(e -> (JCAssign) e)
.filter(assign -> TreeInfo.name(assign.lhs) == names.forRemoval)
.findFirst()
.ifPresent(assign -> {
JCExpression rhs = TreeInfo.skipParens(assign.rhs);
if (rhs.hasTag(LITERAL)
&& Boolean.TRUE.equals(((JCLiteral) rhs).getValue())) {
sym.flags_field |= DEPRECATED_REMOVAL;
}
});
}
}
} | java | private void handleDeprecatedAnnotations(List<JCAnnotation> annotations, Symbol sym) {
for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
JCAnnotation a = al.head;
if (a.annotationType.type == syms.deprecatedType) {
sym.flags_field |= (Flags.DEPRECATED | Flags.DEPRECATED_ANNOTATION);
a.args.stream()
.filter(e -> e.hasTag(ASSIGN))
.map(e -> (JCAssign) e)
.filter(assign -> TreeInfo.name(assign.lhs) == names.forRemoval)
.findFirst()
.ifPresent(assign -> {
JCExpression rhs = TreeInfo.skipParens(assign.rhs);
if (rhs.hasTag(LITERAL)
&& Boolean.TRUE.equals(((JCLiteral) rhs).getValue())) {
sym.flags_field |= DEPRECATED_REMOVAL;
}
});
}
}
} | [
"private",
"void",
"handleDeprecatedAnnotations",
"(",
"List",
"<",
"JCAnnotation",
">",
"annotations",
",",
"Symbol",
"sym",
")",
"{",
"for",
"(",
"List",
"<",
"JCAnnotation",
">",
"al",
"=",
"annotations",
";",
"!",
"al",
".",
"isEmpty",
"(",
")",
";",
... | If a list of annotations contains a reference to java.lang.Deprecated,
set the DEPRECATED flag.
If the annotation is marked forRemoval=true, also set DEPRECATED_REMOVAL. | [
"If",
"a",
"list",
"of",
"annotations",
"contains",
"a",
"reference",
"to",
"java",
".",
"lang",
".",
"Deprecated",
"set",
"the",
"DEPRECATED",
"flag",
".",
"If",
"the",
"annotation",
"is",
"marked",
"forRemoval",
"=",
"true",
"also",
"set",
"DEPRECATED_REMO... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java#L1134-L1153 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java | ResourceManager.closeJobManagerConnection | protected void closeJobManagerConnection(JobID jobId, Exception cause) {
JobManagerRegistration jobManagerRegistration = jobManagerRegistrations.remove(jobId);
if (jobManagerRegistration != null) {
final ResourceID jobManagerResourceId = jobManagerRegistration.getJobManagerResourceID();
final JobMasterGateway jobMasterGateway = jobManagerRegistration.getJobManagerGateway();
final JobMasterId jobMasterId = jobManagerRegistration.getJobMasterId();
log.info("Disconnect job manager {}@{} for job {} from the resource manager.",
jobMasterId,
jobMasterGateway.getAddress(),
jobId);
jobManagerHeartbeatManager.unmonitorTarget(jobManagerResourceId);
jmResourceIdRegistrations.remove(jobManagerResourceId);
// tell the job manager about the disconnect
jobMasterGateway.disconnectResourceManager(getFencingToken(), cause);
} else {
log.debug("There was no registered job manager for job {}.", jobId);
}
} | java | protected void closeJobManagerConnection(JobID jobId, Exception cause) {
JobManagerRegistration jobManagerRegistration = jobManagerRegistrations.remove(jobId);
if (jobManagerRegistration != null) {
final ResourceID jobManagerResourceId = jobManagerRegistration.getJobManagerResourceID();
final JobMasterGateway jobMasterGateway = jobManagerRegistration.getJobManagerGateway();
final JobMasterId jobMasterId = jobManagerRegistration.getJobMasterId();
log.info("Disconnect job manager {}@{} for job {} from the resource manager.",
jobMasterId,
jobMasterGateway.getAddress(),
jobId);
jobManagerHeartbeatManager.unmonitorTarget(jobManagerResourceId);
jmResourceIdRegistrations.remove(jobManagerResourceId);
// tell the job manager about the disconnect
jobMasterGateway.disconnectResourceManager(getFencingToken(), cause);
} else {
log.debug("There was no registered job manager for job {}.", jobId);
}
} | [
"protected",
"void",
"closeJobManagerConnection",
"(",
"JobID",
"jobId",
",",
"Exception",
"cause",
")",
"{",
"JobManagerRegistration",
"jobManagerRegistration",
"=",
"jobManagerRegistrations",
".",
"remove",
"(",
"jobId",
")",
";",
"if",
"(",
"jobManagerRegistration",
... | This method should be called by the framework once it detects that a currently registered
job manager has failed.
@param jobId identifying the job whose leader shall be disconnected.
@param cause The exception which cause the JobManager failed. | [
"This",
"method",
"should",
"be",
"called",
"by",
"the",
"framework",
"once",
"it",
"detects",
"that",
"a",
"currently",
"registered",
"job",
"manager",
"has",
"failed",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java#L763-L785 |
ontop/ontop | core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/UnifierUtilities.java | UnifierUtilities.getMGU | public Substitution getMGU(Function first, Function second) {
SubstitutionImpl mgu = new SubstitutionImpl(termFactory);
if (mgu.composeFunctions(first, second))
return mgu;
return null;
} | java | public Substitution getMGU(Function first, Function second) {
SubstitutionImpl mgu = new SubstitutionImpl(termFactory);
if (mgu.composeFunctions(first, second))
return mgu;
return null;
} | [
"public",
"Substitution",
"getMGU",
"(",
"Function",
"first",
",",
"Function",
"second",
")",
"{",
"SubstitutionImpl",
"mgu",
"=",
"new",
"SubstitutionImpl",
"(",
"termFactory",
")",
";",
"if",
"(",
"mgu",
".",
"composeFunctions",
"(",
"first",
",",
"second",
... | Computes the Most General Unifier (MGU) for two n-ary atoms.
<p/>
IMPORTANT: Function terms are supported as long as they are not nested.
<p/>
IMPORTANT: handling of AnonymousVariables is questionable --
much is left to UnifierUtilities.apply (and only one version handles them)
@param first
@param second
@return the substitution corresponding to this unification. | [
"Computes",
"the",
"Most",
"General",
"Unifier",
"(",
"MGU",
")",
"for",
"two",
"n",
"-",
"ary",
"atoms",
".",
"<p",
"/",
">",
"IMPORTANT",
":",
"Function",
"terms",
"are",
"supported",
"as",
"long",
"as",
"they",
"are",
"not",
"nested",
".",
"<p",
"... | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/core/model/src/main/java/it/unibz/inf/ontop/substitution/impl/UnifierUtilities.java#L72-L77 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java | AbstractOracleQuery.connectByNocyclePrior | @WithBridgeMethods(value = OracleQuery.class, castRequired = true)
public C connectByNocyclePrior(Predicate cond) {
return addFlag(Position.BEFORE_ORDER, CONNECT_BY_NOCYCLE_PRIOR, cond);
} | java | @WithBridgeMethods(value = OracleQuery.class, castRequired = true)
public C connectByNocyclePrior(Predicate cond) {
return addFlag(Position.BEFORE_ORDER, CONNECT_BY_NOCYCLE_PRIOR, cond);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"OracleQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"C",
"connectByNocyclePrior",
"(",
"Predicate",
"cond",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"BEFORE_ORDER",
",",
"CONNEC... | CONNECT BY specifies the relationship between parent rows and child rows of the hierarchy.
@param cond condition
@return the current object | [
"CONNECT",
"BY",
"specifies",
"the",
"relationship",
"between",
"parent",
"rows",
"and",
"child",
"rows",
"of",
"the",
"hierarchy",
"."
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java#L83-L86 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.getPackageResource | public static String getPackageResource(Class<?> type, String resourceName)
{
StringBuilder builder = new StringBuilder();
builder.append(type.getPackage().getName().replace('.', '/'));
if(resourceName.charAt(0) != '/') {
builder.append('/');
}
builder.append(resourceName);
return builder.toString();
} | java | public static String getPackageResource(Class<?> type, String resourceName)
{
StringBuilder builder = new StringBuilder();
builder.append(type.getPackage().getName().replace('.', '/'));
if(resourceName.charAt(0) != '/') {
builder.append('/');
}
builder.append(resourceName);
return builder.toString();
} | [
"public",
"static",
"String",
"getPackageResource",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"resourceName",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"type",
".",
"getPackage"... | Get resource name qualified with the package of a given class. Given a resource with simple name
<code>pdf-view-fop.xconf</code> and class <code>js.fop.PdfView</code> this method returns
<code>js/fop/pdf-view-fop.xconf</code>.
@param type class to infer package on which resource reside,
@param resourceName simple resource name.
@return qualified resource name. | [
"Get",
"resource",
"name",
"qualified",
"with",
"the",
"package",
"of",
"a",
"given",
"class",
".",
"Given",
"a",
"resource",
"with",
"simple",
"name",
"<code",
">",
"pdf",
"-",
"view",
"-",
"fop",
".",
"xconf<",
"/",
"code",
">",
"and",
"class",
"<cod... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L949-L958 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/distancemetrics/TrainableDistanceMetric.java | TrainableDistanceMetric.trainIfNeeded | public static void trainIfNeeded(DistanceMetric dm, DataSet dataset, ExecutorService threadpool)
{
//TODO I WILL DELETE, JUST STUBBING FOR NOW TO MAKE LIFE EASY AS I DO ONE CODE SECTION AT A TIME
trainIfNeeded(dm, dataset);
} | java | public static void trainIfNeeded(DistanceMetric dm, DataSet dataset, ExecutorService threadpool)
{
//TODO I WILL DELETE, JUST STUBBING FOR NOW TO MAKE LIFE EASY AS I DO ONE CODE SECTION AT A TIME
trainIfNeeded(dm, dataset);
} | [
"public",
"static",
"void",
"trainIfNeeded",
"(",
"DistanceMetric",
"dm",
",",
"DataSet",
"dataset",
",",
"ExecutorService",
"threadpool",
")",
"{",
"//TODO I WILL DELETE, JUST STUBBING FOR NOW TO MAKE LIFE EASY AS I DO ONE CODE SECTION AT A TIME",
"trainIfNeeded",
"(",
"dm",
"... | Static helper method for training a distance metric only if it is needed.
This method can be safely called for any Distance Metric.
@param dm the distance metric to train
@param dataset the data set to train from
@param threadpool the source of threads for parallel training. May be
<tt>null</tt>, in which case {@link #trainIfNeeded(jsat.linear.distancemetrics.DistanceMetric, jsat.DataSet) }
is used instead.
@deprecated I WILL DELETE THIS METHOD SOON | [
"Static",
"helper",
"method",
"for",
"training",
"a",
"distance",
"metric",
"only",
"if",
"it",
"is",
"needed",
".",
"This",
"method",
"can",
"be",
"safely",
"called",
"for",
"any",
"Distance",
"Metric",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/distancemetrics/TrainableDistanceMetric.java#L186-L190 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/OldConvolution.java | OldConvolution.col2im | public static INDArray col2im(INDArray col, int sy, int sx, int ph, int pw, int h, int w) {
//number of images
long n = col.size(0);
//number of columns
long c = col.size(1);
//kernel height
long kh = col.size(2);
//kernel width
long kw = col.size(3);
//out height
long outH = col.size(4);
//out width
long outW = col.size(5);
INDArray img = Nd4j.create(n, c, h + 2 * ph + sy - 1, w + 2 * pw + sx - 1);
for (int i = 0; i < kh; i++) {
//iterate over the kernel rows
long iLim = i + sy * outH;
for (int j = 0; j < kw; j++) {
//iterate over the kernel columns
long jLim = j + sx * outW;
INDArrayIndex[] indices = new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
NDArrayIndex.interval(i, sy, iLim), NDArrayIndex.interval(j, sx, jLim)};
INDArray get = img.get(indices);
INDArray colAdd = col.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.point(i),
NDArrayIndex.point(j), NDArrayIndex.all(), NDArrayIndex.all());
get.addi(colAdd);
img.put(indices, get);
}
}
//return the subset of the padded image relative to the height/width of the image and the padding width/height
return img.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.interval(ph, ph + h),
NDArrayIndex.interval(pw, pw + w));
} | java | public static INDArray col2im(INDArray col, int sy, int sx, int ph, int pw, int h, int w) {
//number of images
long n = col.size(0);
//number of columns
long c = col.size(1);
//kernel height
long kh = col.size(2);
//kernel width
long kw = col.size(3);
//out height
long outH = col.size(4);
//out width
long outW = col.size(5);
INDArray img = Nd4j.create(n, c, h + 2 * ph + sy - 1, w + 2 * pw + sx - 1);
for (int i = 0; i < kh; i++) {
//iterate over the kernel rows
long iLim = i + sy * outH;
for (int j = 0; j < kw; j++) {
//iterate over the kernel columns
long jLim = j + sx * outW;
INDArrayIndex[] indices = new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
NDArrayIndex.interval(i, sy, iLim), NDArrayIndex.interval(j, sx, jLim)};
INDArray get = img.get(indices);
INDArray colAdd = col.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.point(i),
NDArrayIndex.point(j), NDArrayIndex.all(), NDArrayIndex.all());
get.addi(colAdd);
img.put(indices, get);
}
}
//return the subset of the padded image relative to the height/width of the image and the padding width/height
return img.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.interval(ph, ph + h),
NDArrayIndex.interval(pw, pw + w));
} | [
"public",
"static",
"INDArray",
"col2im",
"(",
"INDArray",
"col",
",",
"int",
"sy",
",",
"int",
"sx",
",",
"int",
"ph",
",",
"int",
"pw",
",",
"int",
"h",
",",
"int",
"w",
")",
"{",
"//number of images",
"long",
"n",
"=",
"col",
".",
"size",
"(",
... | Rearrange matrix
columns into blocks
@param col the column
transposed image to convert
@param sy stride y
@param sx stride x
@param ph padding height
@param pw padding width
@param h height
@param w width
@return | [
"Rearrange",
"matrix",
"columns",
"into",
"blocks"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/OldConvolution.java#L55-L92 |
agentgt/jirm | jirm-core/src/main/java/co/jirm/core/util/ResourceUtils.java | ResourceUtils.resolveName | private static String resolveName(Class<?> c, String name) {
if (name == null) {
return name;
}
if (!name.startsWith("/")) {
while (c.isArray()) {
c = c.getComponentType();
}
String baseName = c.getName();
int index = baseName.lastIndexOf('.');
if (index != -1) {
name = baseName.substring(0, index).replace('.', '/')
+"/"+name;
}
} else {
name = name.substring(1);
}
return name;
} | java | private static String resolveName(Class<?> c, String name) {
if (name == null) {
return name;
}
if (!name.startsWith("/")) {
while (c.isArray()) {
c = c.getComponentType();
}
String baseName = c.getName();
int index = baseName.lastIndexOf('.');
if (index != -1) {
name = baseName.substring(0, index).replace('.', '/')
+"/"+name;
}
} else {
name = name.substring(1);
}
return name;
} | [
"private",
"static",
"String",
"resolveName",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"name",
";",
"}",
"if",
"(",
"!",
"name",
".",
"startsWith",
"(",
"\"/\"",
")",
... | /*
Add a package name prefix if the name is not absolute Remove leading "/"
if name is absolute | [
"/",
"*",
"Add",
"a",
"package",
"name",
"prefix",
"if",
"the",
"name",
"is",
"not",
"absolute",
"Remove",
"leading",
"/",
"if",
"name",
"is",
"absolute"
] | train | https://github.com/agentgt/jirm/blob/95a2fcdef4121c439053524407af3d4ce8035722/jirm-core/src/main/java/co/jirm/core/util/ResourceUtils.java#L102-L120 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImagesInner.java | VirtualMachineImagesInner.listOffersAsync | public Observable<List<VirtualMachineImageResourceInner>> listOffersAsync(String location, String publisherName) {
return listOffersWithServiceResponseAsync(location, publisherName).map(new Func1<ServiceResponse<List<VirtualMachineImageResourceInner>>, List<VirtualMachineImageResourceInner>>() {
@Override
public List<VirtualMachineImageResourceInner> call(ServiceResponse<List<VirtualMachineImageResourceInner>> response) {
return response.body();
}
});
} | java | public Observable<List<VirtualMachineImageResourceInner>> listOffersAsync(String location, String publisherName) {
return listOffersWithServiceResponseAsync(location, publisherName).map(new Func1<ServiceResponse<List<VirtualMachineImageResourceInner>>, List<VirtualMachineImageResourceInner>>() {
@Override
public List<VirtualMachineImageResourceInner> call(ServiceResponse<List<VirtualMachineImageResourceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"VirtualMachineImageResourceInner",
">",
">",
"listOffersAsync",
"(",
"String",
"location",
",",
"String",
"publisherName",
")",
"{",
"return",
"listOffersWithServiceResponseAsync",
"(",
"location",
",",
"publisherName",
")",
... | Gets a list of virtual machine image offers for the specified location and publisher.
@param location The name of a supported Azure region.
@param publisherName A valid image publisher.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<VirtualMachineImageResourceInner> object | [
"Gets",
"a",
"list",
"of",
"virtual",
"machine",
"image",
"offers",
"for",
"the",
"specified",
"location",
"and",
"publisher",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImagesInner.java#L427-L434 |
exoplatform/jcr | applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java | BackupConsole.getRepoWS | private static String getRepoWS(String[] args, int curArg)
{
if (curArg == args.length)
{
System.out.println(INCORRECT_PARAM + "There is no path to workspace parameter."); //NOSONAR
return null;
}
// make correct path
String repWS = args[curArg];
repWS = repWS.replaceAll("\\\\", "/");
if ( !repWS.matches("[/][^/]+") && !repWS.matches("[/][^/]+[/][^/]+"))
{
System.out.println(INCORRECT_PARAM + "There is incorrect path to workspace parameter: " + repWS); //NOSONAR
return null;
}
else
{
return repWS;
}
} | java | private static String getRepoWS(String[] args, int curArg)
{
if (curArg == args.length)
{
System.out.println(INCORRECT_PARAM + "There is no path to workspace parameter."); //NOSONAR
return null;
}
// make correct path
String repWS = args[curArg];
repWS = repWS.replaceAll("\\\\", "/");
if ( !repWS.matches("[/][^/]+") && !repWS.matches("[/][^/]+[/][^/]+"))
{
System.out.println(INCORRECT_PARAM + "There is incorrect path to workspace parameter: " + repWS); //NOSONAR
return null;
}
else
{
return repWS;
}
} | [
"private",
"static",
"String",
"getRepoWS",
"(",
"String",
"[",
"]",
"args",
",",
"int",
"curArg",
")",
"{",
"if",
"(",
"curArg",
"==",
"args",
".",
"length",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"INCORRECT_PARAM",
"+",
"\"There is no pat... | Get parameter from argument list, check it and return as valid path to repository and
workspace.
@param args
list of arguments.
@param curArg
argument index.
@return String valid path. | [
"Get",
"parameter",
"from",
"argument",
"list",
"check",
"it",
"and",
"return",
"as",
"valid",
"path",
"to",
"repository",
"and",
"workspace",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java#L688-L708 |
windup/windup | config/api/src/main/java/org/jboss/windup/config/metadata/MetadataBuilder.java | MetadataBuilder.forProvider | public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType)
{
String id = implementationType.getSimpleName();
RuleMetadata metadata = Annotations.getAnnotation(implementationType, RuleMetadata.class);
if (metadata != null && !metadata.id().isEmpty())
id = metadata.id();
return forProvider(implementationType, id);
} | java | public static MetadataBuilder forProvider(Class<? extends RuleProvider> implementationType)
{
String id = implementationType.getSimpleName();
RuleMetadata metadata = Annotations.getAnnotation(implementationType, RuleMetadata.class);
if (metadata != null && !metadata.id().isEmpty())
id = metadata.id();
return forProvider(implementationType, id);
} | [
"public",
"static",
"MetadataBuilder",
"forProvider",
"(",
"Class",
"<",
"?",
"extends",
"RuleProvider",
">",
"implementationType",
")",
"{",
"String",
"id",
"=",
"implementationType",
".",
"getSimpleName",
"(",
")",
";",
"RuleMetadata",
"metadata",
"=",
"Annotati... | Create a new {@link RuleProviderMetadata} builder instance for the given {@link RuleProvider} type, using the provided parameters and
{@link RulesetMetadata} to seed sensible defaults. | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/metadata/MetadataBuilder.java#L70-L79 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/sortable/SortableBehavior.java | SortableBehavior.setGrid | public SortableBehavior setGrid(int x, int y)
{
ArrayItemOptions<IntegerItemOptions> grids = new ArrayItemOptions<IntegerItemOptions>();
grids.add(new IntegerItemOptions(x));
grids.add(new IntegerItemOptions(y));
this.options.put("grid", grids);
return this;
} | java | public SortableBehavior setGrid(int x, int y)
{
ArrayItemOptions<IntegerItemOptions> grids = new ArrayItemOptions<IntegerItemOptions>();
grids.add(new IntegerItemOptions(x));
grids.add(new IntegerItemOptions(y));
this.options.put("grid", grids);
return this;
} | [
"public",
"SortableBehavior",
"setGrid",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"ArrayItemOptions",
"<",
"IntegerItemOptions",
">",
"grids",
"=",
"new",
"ArrayItemOptions",
"<",
"IntegerItemOptions",
">",
"(",
")",
";",
"grids",
".",
"add",
"(",
"new",
... | Snaps the sorting element or helper to a grid, every x and y pixels. Array values:
[x, y]
@param x
@param y
@return instance of the current behavior | [
"Snaps",
"the",
"sorting",
"element",
"or",
"helper",
"to",
"a",
"grid",
"every",
"x",
"and",
"y",
"pixels",
".",
"Array",
"values",
":",
"[",
"x",
"y",
"]"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/sortable/SortableBehavior.java#L825-L832 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_Reverse3DLine.java | ST_Reverse3DLine.reverse3D | public static MultiLineString reverse3D(MultiLineString multiLineString, String order) {
int num = multiLineString.getNumGeometries();
LineString[] lineStrings = new LineString[num];
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
lineStrings[i] = reverse3D((LineString) multiLineString.getGeometryN(i), order);
}
return FACTORY.createMultiLineString(lineStrings);
} | java | public static MultiLineString reverse3D(MultiLineString multiLineString, String order) {
int num = multiLineString.getNumGeometries();
LineString[] lineStrings = new LineString[num];
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
lineStrings[i] = reverse3D((LineString) multiLineString.getGeometryN(i), order);
}
return FACTORY.createMultiLineString(lineStrings);
} | [
"public",
"static",
"MultiLineString",
"reverse3D",
"(",
"MultiLineString",
"multiLineString",
",",
"String",
"order",
")",
"{",
"int",
"num",
"=",
"multiLineString",
".",
"getNumGeometries",
"(",
")",
";",
"LineString",
"[",
"]",
"lineStrings",
"=",
"new",
"Lin... | Reverses a multilinestring according to z value. If asc : the z first
point must be lower than the z end point if desc : the z first point must
be greater than the z end point
@param multiLineString
@return | [
"Reverses",
"a",
"multilinestring",
"according",
"to",
"z",
"value",
".",
"If",
"asc",
":",
"the",
"z",
"first",
"point",
"must",
"be",
"lower",
"than",
"the",
"z",
"end",
"point",
"if",
"desc",
":",
"the",
"z",
"first",
"point",
"must",
"be",
"greater... | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_Reverse3DLine.java#L116-L124 |
jenkinsci/jenkins | core/src/main/java/hudson/model/queue/Timeline.java | Timeline.insert | int insert(long start, long end, int n) {
splitAt(start);
splitAt(end);
int peak = 0;
for (Map.Entry<Long, int[]> e : data.tailMap(start).headMap(end).entrySet()) {
peak = max(peak, e.getValue()[0] += n);
}
return peak;
} | java | int insert(long start, long end, int n) {
splitAt(start);
splitAt(end);
int peak = 0;
for (Map.Entry<Long, int[]> e : data.tailMap(start).headMap(end).entrySet()) {
peak = max(peak, e.getValue()[0] += n);
}
return peak;
} | [
"int",
"insert",
"(",
"long",
"start",
",",
"long",
"end",
",",
"int",
"n",
")",
"{",
"splitAt",
"(",
"start",
")",
";",
"splitAt",
"(",
"end",
")",
";",
"int",
"peak",
"=",
"0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Long",
",",
"int",
... | increases q(t) by n for t in [start,end).
@return peak value of q(t) in this range as a result of addition. | [
"increases",
"q",
"(",
"t",
")",
"by",
"n",
"for",
"t",
"in",
"[",
"start",
"end",
")",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/queue/Timeline.java#L79-L88 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java | DatatypeConverter.printExtendedAttribute | public static final String printExtendedAttribute(MSPDIWriter writer, Object value, DataType type)
{
String result;
if (type == DataType.DATE)
{
result = printExtendedAttributeDate((Date) value);
}
else
{
if (value instanceof Boolean)
{
result = printExtendedAttributeBoolean((Boolean) value);
}
else
{
if (value instanceof Duration)
{
result = printDuration(writer, (Duration) value);
}
else
{
if (type == DataType.CURRENCY)
{
result = printExtendedAttributeCurrency((Number) value);
}
else
{
if (value instanceof Number)
{
result = printExtendedAttributeNumber((Number) value);
}
else
{
result = value.toString();
}
}
}
}
}
return (result);
} | java | public static final String printExtendedAttribute(MSPDIWriter writer, Object value, DataType type)
{
String result;
if (type == DataType.DATE)
{
result = printExtendedAttributeDate((Date) value);
}
else
{
if (value instanceof Boolean)
{
result = printExtendedAttributeBoolean((Boolean) value);
}
else
{
if (value instanceof Duration)
{
result = printDuration(writer, (Duration) value);
}
else
{
if (type == DataType.CURRENCY)
{
result = printExtendedAttributeCurrency((Number) value);
}
else
{
if (value instanceof Number)
{
result = printExtendedAttributeNumber((Number) value);
}
else
{
result = value.toString();
}
}
}
}
}
return (result);
} | [
"public",
"static",
"final",
"String",
"printExtendedAttribute",
"(",
"MSPDIWriter",
"writer",
",",
"Object",
"value",
",",
"DataType",
"type",
")",
"{",
"String",
"result",
";",
"if",
"(",
"type",
"==",
"DataType",
".",
"DATE",
")",
"{",
"result",
"=",
"p... | Print an extended attribute value.
@param writer parent MSPDIWriter instance
@param value attribute value
@param type type of the value being passed
@return string representation | [
"Print",
"an",
"extended",
"attribute",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/DatatypeConverter.java#L186-L228 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getWriter | public static BufferedWriter getWriter(File file, String charsetName, boolean isAppend) throws IORuntimeException {
return getWriter(file, Charset.forName(charsetName), isAppend);
} | java | public static BufferedWriter getWriter(File file, String charsetName, boolean isAppend) throws IORuntimeException {
return getWriter(file, Charset.forName(charsetName), isAppend);
} | [
"public",
"static",
"BufferedWriter",
"getWriter",
"(",
"File",
"file",
",",
"String",
"charsetName",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"getWriter",
"(",
"file",
",",
"Charset",
".",
"forName",
"(",
"charsetName",
")... | 获得一个带缓存的写入对象
@param file 输出文件
@param charsetName 字符集
@param isAppend 是否追加
@return BufferedReader对象
@throws IORuntimeException IO异常 | [
"获得一个带缓存的写入对象"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2611-L2613 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/Directory.java | Directory.setObject | @java.lang.SuppressWarnings( { "ConstantConditions", "UnnecessaryBoxing" })
public void setObject(int tagType, @NotNull Object value)
{
if (value == null)
throw new NullPointerException("cannot set a null object");
if (!_tagMap.containsKey(Integer.valueOf(tagType))) {
_definedTagList.add(new Tag(tagType, this));
}
// else {
// final Object oldValue = _tagMap.get(tagType);
// if (!oldValue.equals(value))
// addError(String.format("Overwritten tag 0x%s (%s). Old=%s, New=%s", Integer.toHexString(tagType), getTagName(tagType), oldValue, value));
// }
_tagMap.put(tagType, value);
} | java | @java.lang.SuppressWarnings( { "ConstantConditions", "UnnecessaryBoxing" })
public void setObject(int tagType, @NotNull Object value)
{
if (value == null)
throw new NullPointerException("cannot set a null object");
if (!_tagMap.containsKey(Integer.valueOf(tagType))) {
_definedTagList.add(new Tag(tagType, this));
}
// else {
// final Object oldValue = _tagMap.get(tagType);
// if (!oldValue.equals(value))
// addError(String.format("Overwritten tag 0x%s (%s). Old=%s, New=%s", Integer.toHexString(tagType), getTagName(tagType), oldValue, value));
// }
_tagMap.put(tagType, value);
} | [
"@",
"java",
".",
"lang",
".",
"SuppressWarnings",
"(",
"{",
"\"ConstantConditions\"",
",",
"\"UnnecessaryBoxing\"",
"}",
")",
"public",
"void",
"setObject",
"(",
"int",
"tagType",
",",
"@",
"NotNull",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
... | Sets a <code>Object</code> for the specified tag.
@param tagType the tag's value as an int
@param value the value for the specified tag
@throws NullPointerException if value is <code>null</code> | [
"Sets",
"a",
"<code",
">",
"Object<",
"/",
"code",
">",
"for",
"the",
"specified",
"tag",
"."
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/Directory.java#L386-L401 |
jbossws/jbossws-cxf | modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java | SoapAddressRewriteHelper.rewriteSoapAddress | private static String rewriteSoapAddress(SOAPAddressRewriteMetadata sarm, String origAddress, String newAddress, String uriScheme)
{
try
{
URL url = new URL(newAddress);
String path = url.getPath();
String host = sarm.getWebServiceHost();
String port = getDotPortNumber(uriScheme, sarm);
StringBuilder sb = new StringBuilder(uriScheme);
sb.append("://");
sb.append(host);
sb.append(port);
if (isPathRewriteRequired(sarm)) {
sb.append(SEDProcessor.newInstance(sarm.getWebServicePathRewriteRule()).processLine(path));
}
else
{
sb.append(path);
}
final String urlStr = sb.toString();
ADDRESS_REWRITE_LOGGER.addressRewritten(origAddress, urlStr);
return urlStr;
}
catch (MalformedURLException e)
{
ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(newAddress, origAddress);
return origAddress;
}
} | java | private static String rewriteSoapAddress(SOAPAddressRewriteMetadata sarm, String origAddress, String newAddress, String uriScheme)
{
try
{
URL url = new URL(newAddress);
String path = url.getPath();
String host = sarm.getWebServiceHost();
String port = getDotPortNumber(uriScheme, sarm);
StringBuilder sb = new StringBuilder(uriScheme);
sb.append("://");
sb.append(host);
sb.append(port);
if (isPathRewriteRequired(sarm)) {
sb.append(SEDProcessor.newInstance(sarm.getWebServicePathRewriteRule()).processLine(path));
}
else
{
sb.append(path);
}
final String urlStr = sb.toString();
ADDRESS_REWRITE_LOGGER.addressRewritten(origAddress, urlStr);
return urlStr;
}
catch (MalformedURLException e)
{
ADDRESS_REWRITE_LOGGER.invalidAddressProvidedUseItWithoutRewriting(newAddress, origAddress);
return origAddress;
}
} | [
"private",
"static",
"String",
"rewriteSoapAddress",
"(",
"SOAPAddressRewriteMetadata",
"sarm",
",",
"String",
"origAddress",
",",
"String",
"newAddress",
",",
"String",
"uriScheme",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"newAddress",
")",
... | Rewrite the provided address according to the current server
configuration and always using the specified uriScheme.
@param sarm The deployment SOAPAddressRewriteMetadata
@param origAddress The source address
@param newAddress The new (candidate) address
@param uriScheme The uriScheme to use for rewrite
@return The obtained address | [
"Rewrite",
"the",
"provided",
"address",
"according",
"to",
"the",
"current",
"server",
"configuration",
"and",
"always",
"using",
"the",
"specified",
"uriScheme",
"."
] | train | https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SoapAddressRewriteHelper.java#L173-L204 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchIndex.java | CmsSearchIndex.hasReadPermission | protected boolean hasReadPermission(CmsObject cms, I_CmsSearchDocument doc) {
// If no permission check is needed: the document can be read
// Else try to read the resource if this is not possible the user does not have enough permissions
return !needsPermissionCheck(doc) ? true : (null != getResource(cms, doc));
} | java | protected boolean hasReadPermission(CmsObject cms, I_CmsSearchDocument doc) {
// If no permission check is needed: the document can be read
// Else try to read the resource if this is not possible the user does not have enough permissions
return !needsPermissionCheck(doc) ? true : (null != getResource(cms, doc));
} | [
"protected",
"boolean",
"hasReadPermission",
"(",
"CmsObject",
"cms",
",",
"I_CmsSearchDocument",
"doc",
")",
"{",
"// If no permission check is needed: the document can be read",
"// Else try to read the resource if this is not possible the user does not have enough permissions",
"return"... | Checks if the OpenCms resource referenced by the result document can be read
be the user of the given OpenCms context.<p>
@param cms the OpenCms user context to use for permission testing
@param doc the search result document to check
@return <code>true</code> if the user has read permissions to the resource | [
"Checks",
"if",
"the",
"OpenCms",
"resource",
"referenced",
"by",
"the",
"result",
"document",
"can",
"be",
"read",
"be",
"the",
"user",
"of",
"the",
"given",
"OpenCms",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1758-L1763 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java | ImageModerationsImpl.evaluateUrlInput | public Evaluate evaluateUrlInput(String contentType, BodyModelModel imageUrl, EvaluateUrlInputOptionalParameter evaluateUrlInputOptionalParameter) {
return evaluateUrlInputWithServiceResponseAsync(contentType, imageUrl, evaluateUrlInputOptionalParameter).toBlocking().single().body();
} | java | public Evaluate evaluateUrlInput(String contentType, BodyModelModel imageUrl, EvaluateUrlInputOptionalParameter evaluateUrlInputOptionalParameter) {
return evaluateUrlInputWithServiceResponseAsync(contentType, imageUrl, evaluateUrlInputOptionalParameter).toBlocking().single().body();
} | [
"public",
"Evaluate",
"evaluateUrlInput",
"(",
"String",
"contentType",
",",
"BodyModelModel",
"imageUrl",
",",
"EvaluateUrlInputOptionalParameter",
"evaluateUrlInputOptionalParameter",
")",
"{",
"return",
"evaluateUrlInputWithServiceResponseAsync",
"(",
"contentType",
",",
"im... | Returns probabilities of the image containing racy or adult content.
@param contentType The content type.
@param imageUrl The image url.
@param evaluateUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Evaluate object if successful. | [
"Returns",
"probabilities",
"of",
"the",
"image",
"containing",
"racy",
"or",
"adult",
"content",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1579-L1581 |
3pillarlabs/spring-data-simpledb | spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java | ReflectionUtils.hasDeclaredGetterAndSetter | public static <T> boolean hasDeclaredGetterAndSetter(final Field field, Class<T> entityClazz) {
boolean hasDeclaredAccessorsMutators = true;
Method getter = retrieveGetterFrom(entityClazz, field.getName());
Method setter = retrieveSetterFrom(entityClazz, field.getName());
if(getter == null || setter == null) {
hasDeclaredAccessorsMutators = false;
}
return hasDeclaredAccessorsMutators;
} | java | public static <T> boolean hasDeclaredGetterAndSetter(final Field field, Class<T> entityClazz) {
boolean hasDeclaredAccessorsMutators = true;
Method getter = retrieveGetterFrom(entityClazz, field.getName());
Method setter = retrieveSetterFrom(entityClazz, field.getName());
if(getter == null || setter == null) {
hasDeclaredAccessorsMutators = false;
}
return hasDeclaredAccessorsMutators;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"hasDeclaredGetterAndSetter",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"T",
">",
"entityClazz",
")",
"{",
"boolean",
"hasDeclaredAccessorsMutators",
"=",
"true",
";",
"Method",
"getter",
"=",
"retrieveGette... | This method checks if the declared Field is accessible through getters and setters methods Fields which have only
setters OR getters and NOT both are discarded from serialization process | [
"This",
"method",
"checks",
"if",
"the",
"declared",
"Field",
"is",
"accessible",
"through",
"getters",
"and",
"setters",
"methods",
"Fields",
"which",
"have",
"only",
"setters",
"OR",
"getters",
"and",
"NOT",
"both",
"are",
"discarded",
"from",
"serialization",... | train | https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java#L107-L118 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/model/Recur.java | Recur.getDates | public final DateList getDates(final Date seed, final Period period,
final Value value) {
return getDates(seed, period.getStart(), period.getEnd(), value, -1);
} | java | public final DateList getDates(final Date seed, final Period period,
final Value value) {
return getDates(seed, period.getStart(), period.getEnd(), value, -1);
} | [
"public",
"final",
"DateList",
"getDates",
"(",
"final",
"Date",
"seed",
",",
"final",
"Period",
"period",
",",
"final",
"Value",
"value",
")",
"{",
"return",
"getDates",
"(",
"seed",
",",
"period",
".",
"getStart",
"(",
")",
",",
"period",
".",
"getEnd"... | Convenience method for retrieving recurrences in a specified period.
@param seed a seed date for generating recurrence instances
@param period the period of returned recurrence dates
@param value type of dates to generate
@return a list of dates | [
"Convenience",
"method",
"for",
"retrieving",
"recurrences",
"in",
"a",
"specified",
"period",
"."
] | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/Recur.java#L640-L643 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java | JDBC4PreparedStatement.setObject | @Override
public void setObject(int parameterIndex, Object x) throws SQLException
{
checkParameterBounds(parameterIndex);
this.parameters[parameterIndex-1] = x;
} | java | @Override
public void setObject(int parameterIndex, Object x) throws SQLException
{
checkParameterBounds(parameterIndex);
this.parameters[parameterIndex-1] = x;
} | [
"@",
"Override",
"public",
"void",
"setObject",
"(",
"int",
"parameterIndex",
",",
"Object",
"x",
")",
"throws",
"SQLException",
"{",
"checkParameterBounds",
"(",
"parameterIndex",
")",
";",
"this",
".",
"parameters",
"[",
"parameterIndex",
"-",
"1",
"]",
"=",... | Sets the value of the designated parameter using the given object. | [
"Sets",
"the",
"value",
"of",
"the",
"designated",
"parameter",
"using",
"the",
"given",
"object",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L461-L466 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.existsResource | public boolean existsResource(CmsUUID structureId, CmsResourceFilter filter) {
return m_securityManager.existsResource(m_context, structureId, filter);
} | java | public boolean existsResource(CmsUUID structureId, CmsResourceFilter filter) {
return m_securityManager.existsResource(m_context, structureId, filter);
} | [
"public",
"boolean",
"existsResource",
"(",
"CmsUUID",
"structureId",
",",
"CmsResourceFilter",
"filter",
")",
"{",
"return",
"m_securityManager",
".",
"existsResource",
"(",
"m_context",
",",
"structureId",
",",
"filter",
")",
";",
"}"
] | Checks the availability of a resource in the VFS,
using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
A resource may be of type <code>{@link CmsFile}</code> or
<code>{@link CmsFolder}</code>.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
This method also takes into account the user permissions, so if
the given resource exists, but the current user has not the required
permissions, then this method will return <code>false</code>.<p>
@param structureId the structure id of the resource to check
@param filter the resource filter to use while checking
@return <code>true</code> if the resource is available
@see #readResource(CmsUUID)
@see #readResource(CmsUUID, CmsResourceFilter) | [
"Checks",
"the",
"availability",
"of",
"a",
"resource",
"in",
"the",
"VFS",
"using",
"the",
"<code",
">",
"{",
"@link",
"CmsResourceFilter#DEFAULT",
"}",
"<",
"/",
"code",
">",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1176-L1179 |
avarabyeu/restendpoint | src/main/java/com/github/avarabyeu/restendpoint/http/DefaultErrorHandler.java | DefaultErrorHandler.handleError | protected void handleError(URI requestUri, HttpMethod requestMethod, int statusCode, String statusMessage,
ByteSource errorBody) throws RestEndpointIOException {
throw new RestEndpointException(requestUri, requestMethod, statusCode, statusMessage, errorBody);
} | java | protected void handleError(URI requestUri, HttpMethod requestMethod, int statusCode, String statusMessage,
ByteSource errorBody) throws RestEndpointIOException {
throw new RestEndpointException(requestUri, requestMethod, statusCode, statusMessage, errorBody);
} | [
"protected",
"void",
"handleError",
"(",
"URI",
"requestUri",
",",
"HttpMethod",
"requestMethod",
",",
"int",
"statusCode",
",",
"String",
"statusMessage",
",",
"ByteSource",
"errorBody",
")",
"throws",
"RestEndpointIOException",
"{",
"throw",
"new",
"RestEndpointExce... | Handler methods for HTTP client errors
@param requestUri - Request URI
@param requestMethod - Request HTTP Method
@param statusCode - HTTP status code
@param statusMessage - HTTP status message
@param errorBody - HTTP response body | [
"Handler",
"methods",
"for",
"HTTP",
"client",
"errors"
] | train | https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/http/DefaultErrorHandler.java#L69-L72 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java | NonplanarBonds.findBond | private IBond findBond(IAtom beg1, IAtom beg2, IAtom end) {
IBond bond = container.getBond(beg1, end);
if (bond != null)
return bond;
return container.getBond(beg2, end);
} | java | private IBond findBond(IAtom beg1, IAtom beg2, IAtom end) {
IBond bond = container.getBond(beg1, end);
if (bond != null)
return bond;
return container.getBond(beg2, end);
} | [
"private",
"IBond",
"findBond",
"(",
"IAtom",
"beg1",
",",
"IAtom",
"beg2",
",",
"IAtom",
"end",
")",
"{",
"IBond",
"bond",
"=",
"container",
".",
"getBond",
"(",
"beg1",
",",
"end",
")",
";",
"if",
"(",
"bond",
"!=",
"null",
")",
"return",
"bond",
... | Find a bond between two possible atoms. For example beg1 - end or
beg2 - end.
@param beg1 begin 1
@param beg2 begin 2
@param end end
@return the bond (or null if none) | [
"Find",
"a",
"bond",
"between",
"two",
"possible",
"atoms",
".",
"For",
"example",
"beg1",
"-",
"end",
"or",
"beg2",
"-",
"end",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java#L401-L406 |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.processPageMetadata | private void processPageMetadata(int bitOffset, List<SubheaderPointer> subheaderPointers)
throws IOException {
subheaderPointers.clear();
for (int subheaderPointerIndex = 0; subheaderPointerIndex < currentPageSubheadersCount;
subheaderPointerIndex++) {
SubheaderPointer currentSubheaderPointer = processSubheaderPointers((long) bitOffset
+ SUBHEADER_POINTERS_OFFSET, subheaderPointerIndex);
subheaderPointers.add(currentSubheaderPointer);
if (currentSubheaderPointer.compression != TRUNCATED_SUBHEADER_ID) {
long subheaderSignature = readSubheaderSignature(currentSubheaderPointer.offset);
SubheaderIndexes subheaderIndex = chooseSubheaderClass(subheaderSignature,
currentSubheaderPointer.compression, currentSubheaderPointer.type);
if (subheaderIndex != null) {
if (subheaderIndex != SubheaderIndexes.DATA_SUBHEADER_INDEX) {
LOGGER.debug(SUBHEADER_PROCESS_FUNCTION_NAME, subheaderIndex);
subheaderIndexToClass.get(subheaderIndex).processSubheader(
subheaderPointers.get(subheaderPointerIndex).offset,
subheaderPointers.get(subheaderPointerIndex).length);
} else {
currentPageDataSubheaderPointers.add(subheaderPointers.get(subheaderPointerIndex));
}
} else {
LOGGER.debug(UNKNOWN_SUBHEADER_SIGNATURE);
}
}
}
} | java | private void processPageMetadata(int bitOffset, List<SubheaderPointer> subheaderPointers)
throws IOException {
subheaderPointers.clear();
for (int subheaderPointerIndex = 0; subheaderPointerIndex < currentPageSubheadersCount;
subheaderPointerIndex++) {
SubheaderPointer currentSubheaderPointer = processSubheaderPointers((long) bitOffset
+ SUBHEADER_POINTERS_OFFSET, subheaderPointerIndex);
subheaderPointers.add(currentSubheaderPointer);
if (currentSubheaderPointer.compression != TRUNCATED_SUBHEADER_ID) {
long subheaderSignature = readSubheaderSignature(currentSubheaderPointer.offset);
SubheaderIndexes subheaderIndex = chooseSubheaderClass(subheaderSignature,
currentSubheaderPointer.compression, currentSubheaderPointer.type);
if (subheaderIndex != null) {
if (subheaderIndex != SubheaderIndexes.DATA_SUBHEADER_INDEX) {
LOGGER.debug(SUBHEADER_PROCESS_FUNCTION_NAME, subheaderIndex);
subheaderIndexToClass.get(subheaderIndex).processSubheader(
subheaderPointers.get(subheaderPointerIndex).offset,
subheaderPointers.get(subheaderPointerIndex).length);
} else {
currentPageDataSubheaderPointers.add(subheaderPointers.get(subheaderPointerIndex));
}
} else {
LOGGER.debug(UNKNOWN_SUBHEADER_SIGNATURE);
}
}
}
} | [
"private",
"void",
"processPageMetadata",
"(",
"int",
"bitOffset",
",",
"List",
"<",
"SubheaderPointer",
">",
"subheaderPointers",
")",
"throws",
"IOException",
"{",
"subheaderPointers",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"subheaderPointerIndex",
"=",... | The method to parse and read metadata of a page, used for pages of the {@link SasFileConstants#PAGE_META_TYPE_1}
{@link SasFileConstants#PAGE_META_TYPE_1}, and {@link SasFileConstants#PAGE_MIX_TYPE} types. The method goes
through subheaders, one by one, and calls the processing functions depending on their signatures.
@param bitOffset the offset from the beginning of the page at which the page stores its metadata.
@param subheaderPointers the number of subheaders on the page.
@throws IOException if reading from the {@link SasFileParser#sasFileStream} string is impossible. | [
"The",
"method",
"to",
"parse",
"and",
"read",
"metadata",
"of",
"a",
"page",
"used",
"for",
"pages",
"of",
"the",
"{",
"@link",
"SasFileConstants#PAGE_META_TYPE_1",
"}",
"{",
"@link",
"SasFileConstants#PAGE_META_TYPE_1",
"}",
"and",
"{",
"@link",
"SasFileConstant... | train | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L383-L409 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java | TransformerIdentityImpl.elementDecl | public void elementDecl (String name, String model)
throws SAXException
{
if (null != m_resultDeclHandler)
m_resultDeclHandler.elementDecl(name, model);
} | java | public void elementDecl (String name, String model)
throws SAXException
{
if (null != m_resultDeclHandler)
m_resultDeclHandler.elementDecl(name, model);
} | [
"public",
"void",
"elementDecl",
"(",
"String",
"name",
",",
"String",
"model",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"null",
"!=",
"m_resultDeclHandler",
")",
"m_resultDeclHandler",
".",
"elementDecl",
"(",
"name",
",",
"model",
")",
";",
"}"
] | Report an element type declaration.
<p>The content model will consist of the string "EMPTY", the
string "ANY", or a parenthesised group, optionally followed
by an occurrence indicator. The model will be normalized so
that all whitespace is removed,and will include the enclosing
parentheses.</p>
@param name The element type name.
@param model The content model as a normalized string.
@exception SAXException The application may raise an exception. | [
"Report",
"an",
"element",
"type",
"declaration",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L1342-L1347 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java | ClientEventHandler.checkUserAgent | private Object checkUserAgent(RequestResponseClass clazz, ApiUser userAgent) {
if(clazz.getUserClass().isAssignableFrom(userAgent.getClass()))
return userAgent;
return UserAgentUtil.getGameUser(userAgent, clazz.getUserClass());
} | java | private Object checkUserAgent(RequestResponseClass clazz, ApiUser userAgent) {
if(clazz.getUserClass().isAssignableFrom(userAgent.getClass()))
return userAgent;
return UserAgentUtil.getGameUser(userAgent, clazz.getUserClass());
} | [
"private",
"Object",
"checkUserAgent",
"(",
"RequestResponseClass",
"clazz",
",",
"ApiUser",
"userAgent",
")",
"{",
"if",
"(",
"clazz",
".",
"getUserClass",
"(",
")",
".",
"isAssignableFrom",
"(",
"userAgent",
".",
"getClass",
"(",
")",
")",
")",
"return",
"... | For each listener, we may use a class of user agent, so we need check it
@param clazz structure of listener class
@param userAgent user agent object
@return instance of user agent | [
"For",
"each",
"listener",
"we",
"may",
"use",
"a",
"class",
"of",
"user",
"agent",
"so",
"we",
"need",
"check",
"it"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java#L133-L137 |
webjars/webjars-locator | src/main/java/org/webjars/RequireJS.java | RequireJS.requireJsConfigErrorMessage | private static String requireJsConfigErrorMessage(Map.Entry<String, String> webJar) {
return "Could not read WebJar RequireJS config for: " + webJar.getKey() + " " + webJar.getValue() + "\n" +
"Please file a bug at: http://github.com/webjars/" + webJar.getKey() + "/issues/new";
} | java | private static String requireJsConfigErrorMessage(Map.Entry<String, String> webJar) {
return "Could not read WebJar RequireJS config for: " + webJar.getKey() + " " + webJar.getValue() + "\n" +
"Please file a bug at: http://github.com/webjars/" + webJar.getKey() + "/issues/new";
} | [
"private",
"static",
"String",
"requireJsConfigErrorMessage",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"webJar",
")",
"{",
"return",
"\"Could not read WebJar RequireJS config for: \"",
"+",
"webJar",
".",
"getKey",
"(",
")",
"+",
"\" \"",
"+",
... | A generic error message for when the RequireJS config could not be parsed out of the WebJar's pom.xml meta-data.
@param webJar A tuple (artifactId -> version) representing the WebJar.
@return The error message. | [
"A",
"generic",
"error",
"message",
"for",
"when",
"the",
"RequireJS",
"config",
"could",
"not",
"be",
"parsed",
"out",
"of",
"the",
"WebJar",
"s",
"pom",
".",
"xml",
"meta",
"-",
"data",
"."
] | train | https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L551-L554 |
craftercms/core | src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/MetaDataMergeStrategyResolver.java | MetaDataMergeStrategyResolver.getStrategy | public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) throws XmlException {
if (descriptorDom != null) {
Node element = descriptorDom.selectSingleNode(mergeStrategyElementXPathQuery);
if (element != null) {
DescriptorMergeStrategy strategy = elementValueToStrategyMappings.get(element.getText());
if (strategy != null) {
return strategy;
} else {
throw new XmlException("Element value \"" + element.getText() + "\" doesn't refer to an " +
"registered strategy");
}
} else {
return null;
}
} else {
return null;
}
} | java | public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) throws XmlException {
if (descriptorDom != null) {
Node element = descriptorDom.selectSingleNode(mergeStrategyElementXPathQuery);
if (element != null) {
DescriptorMergeStrategy strategy = elementValueToStrategyMappings.get(element.getText());
if (strategy != null) {
return strategy;
} else {
throw new XmlException("Element value \"" + element.getText() + "\" doesn't refer to an " +
"registered strategy");
}
} else {
return null;
}
} else {
return null;
}
} | [
"public",
"DescriptorMergeStrategy",
"getStrategy",
"(",
"String",
"descriptorUrl",
",",
"Document",
"descriptorDom",
")",
"throws",
"XmlException",
"{",
"if",
"(",
"descriptorDom",
"!=",
"null",
")",
"{",
"Node",
"element",
"=",
"descriptorDom",
".",
"selectSingleN... | Returns a {@link DescriptorMergeStrategy} for a given descriptor. The strategy chosen is the one defined
in the descriptor document.
@param descriptorUrl the URL that identifies the descriptor
@param descriptorDom the XML DOM of the descriptor
@return the {@link DescriptorMergeStrategy} for the descriptor, or null if the DOM is null or if there's no
element in the DOM that defines the merge strategy to use.
@throws XmlException if the element value doesn't refer to an existing strategy | [
"Returns",
"a",
"{",
"@link",
"DescriptorMergeStrategy",
"}",
"for",
"a",
"given",
"descriptor",
".",
"The",
"strategy",
"chosen",
"is",
"the",
"one",
"defined",
"in",
"the",
"descriptor",
"document",
"."
] | train | https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/MetaDataMergeStrategyResolver.java#L60-L77 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.