repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java | AbstractBuilder.newTypeRef | public JvmParameterizedTypeReference newTypeRef(Notifier context, String typeName) {
JvmTypeReference typeReference;
try {
typeReference = findType(context, typeName);
getImportManager().addImportFor(typeReference.getType());
return (JvmParameterizedTypeReference) typeReference;
} catch (TypeNotPresentException exception) {
}
final JvmParameterizedTypeReference pref = ExpressionBuilderImpl.parseType(context, typeName, this);
final JvmTypeReference baseType = findType(context, pref.getType().getIdentifier());
final int len = pref.getArguments().size();
final JvmTypeReference[] args = new JvmTypeReference[len];
for (int i = 0; i < len; ++i) {
final JvmTypeReference original = pref.getArguments().get(i);
if (original instanceof JvmAnyTypeReference) {
args[i] = EcoreUtil.copy(original);
} else if (original instanceof JvmWildcardTypeReference) {
final JvmWildcardTypeReference wc = EcoreUtil.copy((JvmWildcardTypeReference) original);
for (final JvmTypeConstraint c : wc.getConstraints()) {
c.setTypeReference(newTypeRef(context, c.getTypeReference().getIdentifier()));
}
args[i] = wc;
} else {
args[i] = newTypeRef(context, original.getIdentifier());
}
}
final TypeReferences typeRefs = getTypeReferences();
return typeRefs.createTypeRef(baseType.getType(), args);
} | java | public JvmParameterizedTypeReference newTypeRef(Notifier context, String typeName) {
JvmTypeReference typeReference;
try {
typeReference = findType(context, typeName);
getImportManager().addImportFor(typeReference.getType());
return (JvmParameterizedTypeReference) typeReference;
} catch (TypeNotPresentException exception) {
}
final JvmParameterizedTypeReference pref = ExpressionBuilderImpl.parseType(context, typeName, this);
final JvmTypeReference baseType = findType(context, pref.getType().getIdentifier());
final int len = pref.getArguments().size();
final JvmTypeReference[] args = new JvmTypeReference[len];
for (int i = 0; i < len; ++i) {
final JvmTypeReference original = pref.getArguments().get(i);
if (original instanceof JvmAnyTypeReference) {
args[i] = EcoreUtil.copy(original);
} else if (original instanceof JvmWildcardTypeReference) {
final JvmWildcardTypeReference wc = EcoreUtil.copy((JvmWildcardTypeReference) original);
for (final JvmTypeConstraint c : wc.getConstraints()) {
c.setTypeReference(newTypeRef(context, c.getTypeReference().getIdentifier()));
}
args[i] = wc;
} else {
args[i] = newTypeRef(context, original.getIdentifier());
}
}
final TypeReferences typeRefs = getTypeReferences();
return typeRefs.createTypeRef(baseType.getType(), args);
} | [
"public",
"JvmParameterizedTypeReference",
"newTypeRef",
"(",
"Notifier",
"context",
",",
"String",
"typeName",
")",
"{",
"JvmTypeReference",
"typeReference",
";",
"try",
"{",
"typeReference",
"=",
"findType",
"(",
"context",
",",
"typeName",
")",
";",
"getImportMan... | Replies the type reference for the given name in the given context. | [
"Replies",
"the",
"type",
"reference",
"for",
"the",
"given",
"name",
"in",
"the",
"given",
"context",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java#L189-L217 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java | MurmurHashUtil.hashUnsafeBytes | public static int hashUnsafeBytes(Object base, long offset, int lengthInBytes) {
return hashUnsafeBytes(base, offset, lengthInBytes, DEFAULT_SEED);
} | java | public static int hashUnsafeBytes(Object base, long offset, int lengthInBytes) {
return hashUnsafeBytes(base, offset, lengthInBytes, DEFAULT_SEED);
} | [
"public",
"static",
"int",
"hashUnsafeBytes",
"(",
"Object",
"base",
",",
"long",
"offset",
",",
"int",
"lengthInBytes",
")",
"{",
"return",
"hashUnsafeBytes",
"(",
"base",
",",
"offset",
",",
"lengthInBytes",
",",
"DEFAULT_SEED",
")",
";",
"}"
] | Hash unsafe bytes.
@param base base unsafe object
@param offset offset for unsafe object
@param lengthInBytes length in bytes
@return hash code | [
"Hash",
"unsafe",
"bytes",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java#L51-L53 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.dslTemplate | @Deprecated
public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, String template, ImmutableList<?> args) {
return dslTemplate(cl, createTemplate(template), args);
} | java | @Deprecated
public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, String template, ImmutableList<?> args) {
return dslTemplate(cl, createTemplate(template), args);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"DslTemplate",
"<",
"T",
">",
"dslTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"ImmutableList",
"<",
"?",
">",
"args",
")",
"{",
"return",
"dslTempla... | Create a new Template expression
@deprecated Use {@link #dslTemplate(Class, String, List)} instead.
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L334-L337 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/SupportProgressDialogFragment.java | SupportProgressDialogFragment.newInstance | public static final SupportProgressDialogFragment newInstance(Context context, int title, int message, boolean indeterminate) {
return newInstance(context.getString(title), context.getString(message), indeterminate);
} | java | public static final SupportProgressDialogFragment newInstance(Context context, int title, int message, boolean indeterminate) {
return newInstance(context.getString(title), context.getString(message), indeterminate);
} | [
"public",
"static",
"final",
"SupportProgressDialogFragment",
"newInstance",
"(",
"Context",
"context",
",",
"int",
"title",
",",
"int",
"message",
",",
"boolean",
"indeterminate",
")",
"{",
"return",
"newInstance",
"(",
"context",
".",
"getString",
"(",
"title",
... | Create a new instance of the {@link com.amalgam.app.SupportProgressDialogFragment}.
@param context the context.
@param title the title text resource.
@param message the message text resource.
@param indeterminate indeterminate progress or not.
@return the instance of the {@link com.amalgam.app.SupportProgressDialogFragment}. | [
"Create",
"a",
"new",
"instance",
"of",
"the",
"{",
"@link",
"com",
".",
"amalgam",
".",
"app",
".",
"SupportProgressDialogFragment",
"}",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/SupportProgressDialogFragment.java#L51-L53 |
openbase/jul | exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java | ExceptionPrinter.printVerboseMessage | public static void printVerboseMessage(final String message, final Logger logger) {
try {
if (JPService.getProperty(JPVerbose.class).getValue()) {
logger.info(message);
} else {
logger.debug(message);
}
} catch (final JPServiceException ex) {
logger.info(message);
ExceptionPrinter.printHistory("Could not access verbose java property!", ex, logger);
}
} | java | public static void printVerboseMessage(final String message, final Logger logger) {
try {
if (JPService.getProperty(JPVerbose.class).getValue()) {
logger.info(message);
} else {
logger.debug(message);
}
} catch (final JPServiceException ex) {
logger.info(message);
ExceptionPrinter.printHistory("Could not access verbose java property!", ex, logger);
}
} | [
"public",
"static",
"void",
"printVerboseMessage",
"(",
"final",
"String",
"message",
",",
"final",
"Logger",
"logger",
")",
"{",
"try",
"{",
"if",
"(",
"JPService",
".",
"getProperty",
"(",
"JPVerbose",
".",
"class",
")",
".",
"getValue",
"(",
")",
")",
... | Method prints the given message only in verbose mode on the INFO channel, otherwise the DEBUG channel is used for printing.
@param message the message to print
@param logger the logger which is used for the message logging. | [
"Method",
"prints",
"the",
"given",
"message",
"only",
"in",
"verbose",
"mode",
"on",
"the",
"INFO",
"channel",
"otherwise",
"the",
"DEBUG",
"channel",
"is",
"used",
"for",
"printing",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java#L438-L449 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.registerClass | public static void registerClass(String ID, Class<? extends Transliterator> transClass, String displayName) {
registry.put(ID, transClass, true);
if (displayName != null) {
displayNameCache.put(new CaseInsensitiveString(ID), displayName);
}
} | java | public static void registerClass(String ID, Class<? extends Transliterator> transClass, String displayName) {
registry.put(ID, transClass, true);
if (displayName != null) {
displayNameCache.put(new CaseInsensitiveString(ID), displayName);
}
} | [
"public",
"static",
"void",
"registerClass",
"(",
"String",
"ID",
",",
"Class",
"<",
"?",
"extends",
"Transliterator",
">",
"transClass",
",",
"String",
"displayName",
")",
"{",
"registry",
".",
"put",
"(",
"ID",
",",
"transClass",
",",
"true",
")",
";",
... | Registers a subclass of <code>Transliterator</code> with the
system. This subclass must have a public constructor taking no
arguments. When that constructor is called, the resulting
object must return the <code>ID</code> passed to this method if
its <code>getID()</code> method is called.
@param ID the result of <code>getID()</code> for this
transliterator
@param transClass a subclass of <code>Transliterator</code>
@see #unregister | [
"Registers",
"a",
"subclass",
"of",
"<code",
">",
"Transliterator<",
"/",
"code",
">",
"with",
"the",
"system",
".",
"This",
"subclass",
"must",
"have",
"a",
"public",
"constructor",
"taking",
"no",
"arguments",
".",
"When",
"that",
"constructor",
"is",
"cal... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1671-L1676 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/packageservice/GetInProgressPackages.java | GetInProgressPackages.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
PackageServiceInterface packageService =
adManagerServices.get(session, PackageServiceInterface.class);
// Create a statement to select packages.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", PackageStatus.IN_PROGRESS.toString());
// Retrieve a small amount of packages at a time, paging through
// until all packages have been retrieved.
int totalResultSetSize = 0;
do {
PackagePage page =
packageService.getPackagesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each package.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Package pkg : page.getResults()) {
System.out.printf(
"%d) Package with ID %d, name '%s', and proposal ID %d was found.%n",
i++,
pkg.getId(),
pkg.getName(),
pkg.getProposalId()
);
}
}
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 {
PackageServiceInterface packageService =
adManagerServices.get(session, PackageServiceInterface.class);
// Create a statement to select packages.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", PackageStatus.IN_PROGRESS.toString());
// Retrieve a small amount of packages at a time, paging through
// until all packages have been retrieved.
int totalResultSetSize = 0;
do {
PackagePage page =
packageService.getPackagesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each package.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Package pkg : page.getResults()) {
System.out.printf(
"%d) Package with ID %d, name '%s', and proposal ID %d was found.%n",
i++,
pkg.getId(),
pkg.getName(),
pkg.getProposalId()
);
}
}
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",
"{",
"PackageServiceInterface",
"packageService",
"=",
"adManagerServices",
".",
"get",
"(",
"session",
",",
"P... | 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/packageservice/GetInProgressPackages.java#L52-L90 |
reactor/reactor-netty | src/main/java/reactor/netty/tcp/TcpClient.java | TcpClient.doOnConnect | public final TcpClient doOnConnect(Consumer<? super Bootstrap> doOnConnect) {
Objects.requireNonNull(doOnConnect, "doOnConnect");
return new TcpClientDoOn(this, doOnConnect, null, null);
} | java | public final TcpClient doOnConnect(Consumer<? super Bootstrap> doOnConnect) {
Objects.requireNonNull(doOnConnect, "doOnConnect");
return new TcpClientDoOn(this, doOnConnect, null, null);
} | [
"public",
"final",
"TcpClient",
"doOnConnect",
"(",
"Consumer",
"<",
"?",
"super",
"Bootstrap",
">",
"doOnConnect",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"doOnConnect",
",",
"\"doOnConnect\"",
")",
";",
"return",
"new",
"TcpClientDoOn",
"(",
"this",
... | Setup a callback called when {@link Channel} is about to connect.
@param doOnConnect a runnable observing connected events
@return a new {@link TcpClient} | [
"Setup",
"a",
"callback",
"called",
"when",
"{",
"@link",
"Channel",
"}",
"is",
"about",
"to",
"connect",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/TcpClient.java#L238-L241 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java | NotificationHubsInner.listAuthorizationRulesAsync | public Observable<Page<SharedAccessAuthorizationRuleResourceInner>> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String notificationHubName) {
return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName)
.map(new Func1<ServiceResponse<Page<SharedAccessAuthorizationRuleResourceInner>>, Page<SharedAccessAuthorizationRuleResourceInner>>() {
@Override
public Page<SharedAccessAuthorizationRuleResourceInner> call(ServiceResponse<Page<SharedAccessAuthorizationRuleResourceInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SharedAccessAuthorizationRuleResourceInner>> listAuthorizationRulesAsync(final String resourceGroupName, final String namespaceName, final String notificationHubName) {
return listAuthorizationRulesWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName)
.map(new Func1<ServiceResponse<Page<SharedAccessAuthorizationRuleResourceInner>>, Page<SharedAccessAuthorizationRuleResourceInner>>() {
@Override
public Page<SharedAccessAuthorizationRuleResourceInner> call(ServiceResponse<Page<SharedAccessAuthorizationRuleResourceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SharedAccessAuthorizationRuleResourceInner",
">",
">",
"listAuthorizationRulesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"namespaceName",
",",
"final",
"String",
"notificationHubName",
")",
"{",
... | Gets the authorization rules for a NotificationHub.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name
@param notificationHubName The notification hub name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SharedAccessAuthorizationRuleResourceInner> object | [
"Gets",
"the",
"authorization",
"rules",
"for",
"a",
"NotificationHub",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L1373-L1381 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getNearestBusHub | @Pure
public final BusHub getNearestBusHub(Point2D<?, ?> point) {
return getNearestBusHub(point.getX(), point.getY());
} | java | @Pure
public final BusHub getNearestBusHub(Point2D<?, ?> point) {
return getNearestBusHub(point.getX(), point.getY());
} | [
"@",
"Pure",
"public",
"final",
"BusHub",
"getNearestBusHub",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
")",
"{",
"return",
"getNearestBusHub",
"(",
"point",
".",
"getX",
"(",
")",
",",
"point",
".",
"getY",
"(",
")",
")",
";",
"}"
] | Replies the nearest bus hub to the given point.
@param point the point
@return the nearest bus hub or <code>null</code> if none was found. | [
"Replies",
"the",
"nearest",
"bus",
"hub",
"to",
"the",
"given",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1348-L1351 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java | CmsPreviewUtil.setImageLink | public static void setImageLink(String path, Map<String, String> attributes, String linkPath, String target) {
CmsJSONMap attributesJS = CmsJSONMap.createJSONMap();
for (Entry<String, String> entry : attributes.entrySet()) {
attributesJS.put(entry.getKey(), entry.getValue());
}
nativeSetImageLink(path, attributesJS, linkPath, target);
} | java | public static void setImageLink(String path, Map<String, String> attributes, String linkPath, String target) {
CmsJSONMap attributesJS = CmsJSONMap.createJSONMap();
for (Entry<String, String> entry : attributes.entrySet()) {
attributesJS.put(entry.getKey(), entry.getValue());
}
nativeSetImageLink(path, attributesJS, linkPath, target);
} | [
"public",
"static",
"void",
"setImageLink",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
",",
"String",
"linkPath",
",",
"String",
"target",
")",
"{",
"CmsJSONMap",
"attributesJS",
"=",
"CmsJSONMap",
".",
"createJSONMap",... | Sets the image link within the rich text editor (FCKEditor, CKEditor, ...).<p>
@param path the image path
@param attributes the image tag attributes
@param linkPath the link path
@param target the link target attribute | [
"Sets",
"the",
"image",
"link",
"within",
"the",
"rich",
"text",
"editor",
"(",
"FCKEditor",
"CKEditor",
"...",
")",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsPreviewUtil.java#L239-L246 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java | AbstractGpxParserRte.startElement | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (localName.equalsIgnoreCase(GPXTags.RTEPT)) {
point = true;
GPXPoint routePoint = new GPXPoint(GpxMetadata.RTEPTFIELDCOUNT);
try {
Coordinate coordinate = GPXCoordinate.createCoordinate(attributes);
Point geom = getGeometryFactory().createPoint(coordinate);
geom.setSRID(4326);
routePoint.setValue(GpxMetadata.THE_GEOM, geom);
routePoint.setValue(GpxMetadata.PTLAT, coordinate.y);
routePoint.setValue(GpxMetadata.PTLON, coordinate.x);
routePoint.setValue(GpxMetadata.PTELE, coordinate.z);
routePoint.setValue(GpxMetadata.PTID, idRtPt++);
routePoint.setValue(GpxMetadata.RTEPT_RTEID, getCurrentLine().getValues()[GpxMetadata.LINEID]);
rteList.add(coordinate);
} catch (NumberFormatException ex) {
throw new SAXException(ex);
}
setCurrentPoint(routePoint);
}
// Clear content buffer
getContentBuffer().delete(0, getContentBuffer().length());
// Store name of current element in stack
getElementNames().push(qName);
} | java | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (localName.equalsIgnoreCase(GPXTags.RTEPT)) {
point = true;
GPXPoint routePoint = new GPXPoint(GpxMetadata.RTEPTFIELDCOUNT);
try {
Coordinate coordinate = GPXCoordinate.createCoordinate(attributes);
Point geom = getGeometryFactory().createPoint(coordinate);
geom.setSRID(4326);
routePoint.setValue(GpxMetadata.THE_GEOM, geom);
routePoint.setValue(GpxMetadata.PTLAT, coordinate.y);
routePoint.setValue(GpxMetadata.PTLON, coordinate.x);
routePoint.setValue(GpxMetadata.PTELE, coordinate.z);
routePoint.setValue(GpxMetadata.PTID, idRtPt++);
routePoint.setValue(GpxMetadata.RTEPT_RTEID, getCurrentLine().getValues()[GpxMetadata.LINEID]);
rteList.add(coordinate);
} catch (NumberFormatException ex) {
throw new SAXException(ex);
}
setCurrentPoint(routePoint);
}
// Clear content buffer
getContentBuffer().delete(0, getContentBuffer().length());
// Store name of current element in stack
getElementNames().push(qName);
} | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attributes",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"localName",
".",
"equalsIgnoreCase",
"(",
"GPXTags",
"... | Fires whenever an XML start markup is encountered. It creates a new
routePoint when a <rtept> markup is encountered.
@param uri URI of the local element
@param localName Name of the local element (without prefix)
@param qName qName of the local element (with prefix)
@param attributes Attributes of the local element (contained in the
markup)
@throws SAXException Any SAX exception, possibly wrapping another
exception | [
"Fires",
"whenever",
"an",
"XML",
"start",
"markup",
"is",
"encountered",
".",
"It",
"creates",
"a",
"new",
"routePoint",
"when",
"a",
"<rtept",
">",
"markup",
"is",
"encountered",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java#L81-L108 |
Multifarious/MacroManager | src/main/java/com/fasterxml/mama/util/ZKUtils.java | ZKUtils.deleteAtomic | public static boolean deleteAtomic(ZooKeeperClient zk, String path, String expectedValue)
{
final Stat stat = new Stat();
String value = getWithStat(zk, path, stat);
if (!expectedValue.equals(value)) {
return false;
}
try {
zk.get().delete(path, stat.getVersion());
return true;
} catch (Exception e) {
LOG.error("Failed to delete path "+path+" with expected value '"+expectedValue+"'", e);
}
return false;
} | java | public static boolean deleteAtomic(ZooKeeperClient zk, String path, String expectedValue)
{
final Stat stat = new Stat();
String value = getWithStat(zk, path, stat);
if (!expectedValue.equals(value)) {
return false;
}
try {
zk.get().delete(path, stat.getVersion());
return true;
} catch (Exception e) {
LOG.error("Failed to delete path "+path+" with expected value '"+expectedValue+"'", e);
}
return false;
} | [
"public",
"static",
"boolean",
"deleteAtomic",
"(",
"ZooKeeperClient",
"zk",
",",
"String",
"path",
",",
"String",
"expectedValue",
")",
"{",
"final",
"Stat",
"stat",
"=",
"new",
"Stat",
"(",
")",
";",
"String",
"value",
"=",
"getWithStat",
"(",
"zk",
",",... | Attempts to atomically delete the ZNode with the specified path and value. Should be preferred over calling
delete() if the value is known.
@param zk ZooKeeper client.
@param path Path to be deleted.
@param expectedValue The expected value of the ZNode at the specified path.
@return True if the path was deleted, false otherwise. | [
"Attempts",
"to",
"atomically",
"delete",
"the",
"ZNode",
"with",
"the",
"specified",
"path",
"and",
"value",
".",
"Should",
"be",
"preferred",
"over",
"calling",
"delete",
"()",
"if",
"the",
"value",
"is",
"known",
"."
] | train | https://github.com/Multifarious/MacroManager/blob/559785839981f460aaeba3c3fddff7fb667d9581/src/main/java/com/fasterxml/mama/util/ZKUtils.java#L97-L111 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java | ParameterFormatter.countArgumentPlaceholders2 | static int countArgumentPlaceholders2(final String messagePattern, final int[] indices) {
if (messagePattern == null) {
return 0;
}
final int length = messagePattern.length();
int result = 0;
boolean isEscaped = false;
for (int i = 0; i < length - 1; i++) {
final char curChar = messagePattern.charAt(i);
if (curChar == ESCAPE_CHAR) {
isEscaped = !isEscaped;
indices[0] = -1; // escaping means fast path is not available...
result++;
} else if (curChar == DELIM_START) {
if (!isEscaped && messagePattern.charAt(i + 1) == DELIM_STOP) {
indices[result] = i;
result++;
i++;
}
isEscaped = false;
} else {
isEscaped = false;
}
}
return result;
} | java | static int countArgumentPlaceholders2(final String messagePattern, final int[] indices) {
if (messagePattern == null) {
return 0;
}
final int length = messagePattern.length();
int result = 0;
boolean isEscaped = false;
for (int i = 0; i < length - 1; i++) {
final char curChar = messagePattern.charAt(i);
if (curChar == ESCAPE_CHAR) {
isEscaped = !isEscaped;
indices[0] = -1; // escaping means fast path is not available...
result++;
} else if (curChar == DELIM_START) {
if (!isEscaped && messagePattern.charAt(i + 1) == DELIM_STOP) {
indices[result] = i;
result++;
i++;
}
isEscaped = false;
} else {
isEscaped = false;
}
}
return result;
} | [
"static",
"int",
"countArgumentPlaceholders2",
"(",
"final",
"String",
"messagePattern",
",",
"final",
"int",
"[",
"]",
"indices",
")",
"{",
"if",
"(",
"messagePattern",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"final",
"int",
"length",
"=",
"messa... | Counts the number of unescaped placeholders in the given messagePattern.
@param messagePattern the message pattern to be analyzed.
@return the number of unescaped placeholders. | [
"Counts",
"the",
"number",
"of",
"unescaped",
"placeholders",
"in",
"the",
"given",
"messagePattern",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java#L104-L129 |
apache/flink | flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java | AbstractYarnClusterDescriptor.failSessionDuringDeployment | private void failSessionDuringDeployment(YarnClient yarnClient, YarnClientApplication yarnApplication) {
LOG.info("Killing YARN application");
try {
yarnClient.killApplication(yarnApplication.getNewApplicationResponse().getApplicationId());
} catch (Exception e) {
// we only log a debug message here because the "killApplication" call is a best-effort
// call (we don't know if the application has been deployed when the error occured).
LOG.debug("Error while killing YARN application", e);
}
yarnClient.stop();
} | java | private void failSessionDuringDeployment(YarnClient yarnClient, YarnClientApplication yarnApplication) {
LOG.info("Killing YARN application");
try {
yarnClient.killApplication(yarnApplication.getNewApplicationResponse().getApplicationId());
} catch (Exception e) {
// we only log a debug message here because the "killApplication" call is a best-effort
// call (we don't know if the application has been deployed when the error occured).
LOG.debug("Error while killing YARN application", e);
}
yarnClient.stop();
} | [
"private",
"void",
"failSessionDuringDeployment",
"(",
"YarnClient",
"yarnClient",
",",
"YarnClientApplication",
"yarnApplication",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Killing YARN application\"",
")",
";",
"try",
"{",
"yarnClient",
".",
"killApplication",
"(",
"yar... | Kills YARN application and stops YARN client.
<p>Use this method to kill the App before it has been properly deployed | [
"Kills",
"YARN",
"application",
"and",
"stops",
"YARN",
"client",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java#L1196-L1207 |
kite-sdk/kite | kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveAbstractMetadataProvider.java | HiveAbstractMetadataProvider.resolveNamespace | protected String resolveNamespace(String namespace, String name) {
return resolveNamespace(namespace, name, null);
} | java | protected String resolveNamespace(String namespace, String name) {
return resolveNamespace(namespace, name, null);
} | [
"protected",
"String",
"resolveNamespace",
"(",
"String",
"namespace",
",",
"String",
"name",
")",
"{",
"return",
"resolveNamespace",
"(",
"namespace",
",",
"name",
",",
"null",
")",
";",
"}"
] | Checks whether the Hive table {@code namespace.name} exists or if
{@code default.name} exists and should be used.
@param namespace the requested namespace
@param name the table name
@return if namespace.name exists, namespace. if not and default.name
exists, then default. {@code null} otherwise. | [
"Checks",
"whether",
"the",
"Hive",
"table",
"{",
"@code",
"namespace",
".",
"name",
"}",
"exists",
"or",
"if",
"{",
"@code",
"default",
".",
"name",
"}",
"exists",
"and",
"should",
"be",
"used",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hive/src/main/java/org/kitesdk/data/spi/hive/HiveAbstractMetadataProvider.java#L259-L261 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgEndblk.java | DwgEndblk.readDwgEndblkV15 | public void readDwgEndblkV15(int[] data, int offset) throws Exception {
int bitPos = offset;
bitPos = readObjectHeaderV15(data, bitPos);
bitPos = readObjectTailV15(data, bitPos);
} | java | public void readDwgEndblkV15(int[] data, int offset) throws Exception {
int bitPos = offset;
bitPos = readObjectHeaderV15(data, bitPos);
bitPos = readObjectTailV15(data, bitPos);
} | [
"public",
"void",
"readDwgEndblkV15",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"throws",
"Exception",
"{",
"int",
"bitPos",
"=",
"offset",
";",
"bitPos",
"=",
"readObjectHeaderV15",
"(",
"data",
",",
"bitPos",
")",
";",
"bitPos",
"=",
"re... | Read a Endblk in the DWG format Version 15
@param data Array of unsigned bytes obtained from the DWG binary file
@param offset The current bit offset where the value begins
@throws Exception If an unexpected bit value is found in the DWG file. Occurs
when we are looking for LwPolylines. | [
"Read",
"a",
"Endblk",
"in",
"the",
"DWG",
"format",
"Version",
"15"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgEndblk.java#L38-L42 |
Coolerfall/Android-HttpDownloadManager | library/src/main/java/com/coolerfall/download/DownloadDelivery.java | DownloadDelivery.postProgress | void postProgress(final DownloadRequest request, final long bytesWritten, final long totalBytes) {
downloadPoster.execute(new Runnable() {
@Override public void run() {
request.downloadCallback().onProgress(request.downloadId(), bytesWritten, totalBytes);
}
});
} | java | void postProgress(final DownloadRequest request, final long bytesWritten, final long totalBytes) {
downloadPoster.execute(new Runnable() {
@Override public void run() {
request.downloadCallback().onProgress(request.downloadId(), bytesWritten, totalBytes);
}
});
} | [
"void",
"postProgress",
"(",
"final",
"DownloadRequest",
"request",
",",
"final",
"long",
"bytesWritten",
",",
"final",
"long",
"totalBytes",
")",
"{",
"downloadPoster",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
... | Post download progress event.
@param request download request
@param bytesWritten the bytes have written to file
@param totalBytes the total bytes of currnet file in downloading | [
"Post",
"download",
"progress",
"event",
"."
] | train | https://github.com/Coolerfall/Android-HttpDownloadManager/blob/2b32451c1799c77708c12bf8155e43c7dc25bc57/library/src/main/java/com/coolerfall/download/DownloadDelivery.java#L57-L63 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.findByC_S | @Override
public List<CPDefinition> findByC_S(long CProductId, int status, int start,
int end, OrderByComparator<CPDefinition> orderByComparator) {
return findByC_S(CProductId, status, start, end, orderByComparator, true);
} | java | @Override
public List<CPDefinition> findByC_S(long CProductId, int status, int start,
int end, OrderByComparator<CPDefinition> orderByComparator) {
return findByC_S(CProductId, status, start, end, orderByComparator, true);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinition",
">",
"findByC_S",
"(",
"long",
"CProductId",
",",
"int",
"status",
",",
"int",
"start",
",",
"int",
"end",
",",
"OrderByComparator",
"<",
"CPDefinition",
">",
"orderByComparator",
")",
"{",
"return",
"f... | Returns an ordered range of all the cp definitions where CProductId = ? and status = ?.
<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 CPDefinitionModelImpl}. 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 CProductId the c product ID
@param status the status
@param start the lower bound of the range of cp definitions
@param end the upper bound of the range of cp definitions (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching cp definitions | [
"Returns",
"an",
"ordered",
"range",
"of",
"all",
"the",
"cp",
"definitions",
"where",
"CProductId",
"=",
"?",
";",
"and",
"status",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L4139-L4143 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cql3/ErrorCollector.java | ErrorCollector.insertChar | private static String insertChar(String s, int index, char c)
{
return new StringBuilder().append(s.substring(0, index))
.append(c)
.append(s.substring(index))
.toString();
} | java | private static String insertChar(String s, int index, char c)
{
return new StringBuilder().append(s.substring(0, index))
.append(c)
.append(s.substring(index))
.toString();
} | [
"private",
"static",
"String",
"insertChar",
"(",
"String",
"s",
",",
"int",
"index",
",",
"char",
"c",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"s",
".",
"substring",
"(",
"0",
",",
"index",
")",
")",
".",
"append",
... | Inserts a character at a given position within a <code>String</code>.
@param s the <code>String</code> in which the character must be inserted
@param index the position where the character must be inserted
@param c the character to insert
@return the modified <code>String</code> | [
"Inserts",
"a",
"character",
"at",
"a",
"given",
"position",
"within",
"a",
"<code",
">",
"String<",
"/",
"code",
">",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cql3/ErrorCollector.java#L246-L252 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java | ClasspathUrlFinder.findClassBase | public static URL findClassBase(Class clazz)
{
String resource = clazz.getName().replace('.', '/') + ".class";
return findResourceBase(resource, clazz.getClassLoader());
} | java | public static URL findClassBase(Class clazz)
{
String resource = clazz.getName().replace('.', '/') + ".class";
return findResourceBase(resource, clazz.getClassLoader());
} | [
"public",
"static",
"URL",
"findClassBase",
"(",
"Class",
"clazz",
")",
"{",
"String",
"resource",
"=",
"clazz",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
";",
"return",
"findResourceBase",
"(",
"re... | Find the classpath for the particular class
@param clazz
@return | [
"Find",
"the",
"classpath",
"for",
"the",
"particular",
"class"
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java#L115-L119 |
NessComputing/components-ness-event | core/src/main/java/com/nesscomputing/event/NessEvent.java | NessEvent.createEvent | public static NessEvent createEvent(@Nullable final UUID user,
@Nullable final DateTime timestamp,
@Nonnull final NessEventType type,
@Nullable final Map<String, ? extends Object> payload)
{
return new NessEvent(user, timestamp, type, payload, UUID.randomUUID());
} | java | public static NessEvent createEvent(@Nullable final UUID user,
@Nullable final DateTime timestamp,
@Nonnull final NessEventType type,
@Nullable final Map<String, ? extends Object> payload)
{
return new NessEvent(user, timestamp, type, payload, UUID.randomUUID());
} | [
"public",
"static",
"NessEvent",
"createEvent",
"(",
"@",
"Nullable",
"final",
"UUID",
"user",
",",
"@",
"Nullable",
"final",
"DateTime",
"timestamp",
",",
"@",
"Nonnull",
"final",
"NessEventType",
"type",
",",
"@",
"Nullable",
"final",
"Map",
"<",
"String",
... | Create a new event.
@param user User that the event happened for. Can be null for a system level event.
@param timestamp The time when this event entered the system
@param type The Event type.
@param payload Arbitrary data describing the event. | [
"Create",
"a",
"new",
"event",
"."
] | train | https://github.com/NessComputing/components-ness-event/blob/6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33/core/src/main/java/com/nesscomputing/event/NessEvent.java#L81-L87 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java | DockerAgentUtils.registerImage | private static void registerImage(String imageId, String imageTag, String targetRepo,
ArrayListMultimap<String, String> artifactsProps, int buildInfoId) throws IOException {
DockerImage image = new DockerImage(imageId, imageTag, targetRepo, buildInfoId, artifactsProps);
images.add(image);
} | java | private static void registerImage(String imageId, String imageTag, String targetRepo,
ArrayListMultimap<String, String> artifactsProps, int buildInfoId) throws IOException {
DockerImage image = new DockerImage(imageId, imageTag, targetRepo, buildInfoId, artifactsProps);
images.add(image);
} | [
"private",
"static",
"void",
"registerImage",
"(",
"String",
"imageId",
",",
"String",
"imageTag",
",",
"String",
"targetRepo",
",",
"ArrayListMultimap",
"<",
"String",
",",
"String",
">",
"artifactsProps",
",",
"int",
"buildInfoId",
")",
"throws",
"IOException",
... | Registers an image to the images cache, so that it can be captured by the build-info proxy.
@param imageId
@param imageTag
@param targetRepo
@param buildInfoId
@throws IOException | [
"Registers",
"an",
"image",
"to",
"the",
"images",
"cache",
"so",
"that",
"it",
"can",
"be",
"captured",
"by",
"the",
"build",
"-",
"info",
"proxy",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java#L74-L78 |
aoindustries/ao-encoding | src/main/java/com/aoindustries/encoding/ChainWriter.java | ChainWriter.printTimeJS | @Deprecated
public ChainWriter printTimeJS(long date, Sequence sequence, Appendable scriptOut) throws IOException {
return writeTimeJavaScript(date==-1 ? null : new Date(date), sequence, scriptOut);
} | java | @Deprecated
public ChainWriter printTimeJS(long date, Sequence sequence, Appendable scriptOut) throws IOException {
return writeTimeJavaScript(date==-1 ? null : new Date(date), sequence, scriptOut);
} | [
"@",
"Deprecated",
"public",
"ChainWriter",
"printTimeJS",
"(",
"long",
"date",
",",
"Sequence",
"sequence",
",",
"Appendable",
"scriptOut",
")",
"throws",
"IOException",
"{",
"return",
"writeTimeJavaScript",
"(",
"date",
"==",
"-",
"1",
"?",
"null",
":",
"new... | Writes a JavaScript script tag that a time in the user's locale. Prints <code>&#160;</code>
if the date is <code>-1</code>.
Writes to the internal <code>PrintWriter</code>.
@deprecated
@see #writeTimeJavaScript(long) | [
"Writes",
"a",
"JavaScript",
"script",
"tag",
"that",
"a",
"time",
"in",
"the",
"user",
"s",
"locale",
".",
"Prints",
"<code",
">",
"&",
";",
"#160",
";",
"<",
"/",
"code",
">",
"if",
"the",
"date",
"is",
"<code",
">",
"-",
"1<",
"/",
"code",
... | train | https://github.com/aoindustries/ao-encoding/blob/54eeb8ff58ab7b44bb02549bbe2572625b449e4e/src/main/java/com/aoindustries/encoding/ChainWriter.java#L961-L964 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java | ImageScaling.scaleFill | public static Bitmap scaleFill(Bitmap src, int w, int h) {
Bitmap res = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
scaleFill(src, res);
return res;
} | java | public static Bitmap scaleFill(Bitmap src, int w, int h) {
Bitmap res = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
scaleFill(src, res);
return res;
} | [
"public",
"static",
"Bitmap",
"scaleFill",
"(",
"Bitmap",
"src",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"Bitmap",
"res",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"w",
",",
"h",
",",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
";",
"scaleFill... | Scaling bitmap to fill rect with centering. Method keep aspect ratio.
@param src source bitmap
@param w width of result
@param h height of result
@return scaled bitmap | [
"Scaling",
"bitmap",
"to",
"fill",
"rect",
"with",
"centering",
".",
"Method",
"keep",
"aspect",
"ratio",
"."
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java#L23-L27 |
amzn/ion-java | src/com/amazon/ion/impl/IonUTF8.java | IonUTF8.getScalarFromBytes | public final static int getScalarFromBytes(byte[] bytes, int offset, int maxLength)
{
int src = offset;
int end = offset + maxLength;
if (src >= end) throw new ArrayIndexOutOfBoundsException();
int c = bytes[src++] & 0xff;
int utf8length = getUTF8LengthFromFirstByte(c);
if (src + utf8length > end) throw new ArrayIndexOutOfBoundsException();
switch (utf8length) {
case 1:
break;
case 2:
c = (c & UNICODE_TWO_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
break;
case 3:
c = (c & UNICODE_THREE_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
break;
case 4:
c = (c & UNICODE_FOUR_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
break;
default:
throw new InvalidUnicodeCodePoint("code point is invalid: "+utf8length);
}
return c;
} | java | public final static int getScalarFromBytes(byte[] bytes, int offset, int maxLength)
{
int src = offset;
int end = offset + maxLength;
if (src >= end) throw new ArrayIndexOutOfBoundsException();
int c = bytes[src++] & 0xff;
int utf8length = getUTF8LengthFromFirstByte(c);
if (src + utf8length > end) throw new ArrayIndexOutOfBoundsException();
switch (utf8length) {
case 1:
break;
case 2:
c = (c & UNICODE_TWO_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
break;
case 3:
c = (c & UNICODE_THREE_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
break;
case 4:
c = (c & UNICODE_FOUR_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
c |= ((bytes[src++] & 0xff) & UNICODE_CONTINUATION_BYTE_MASK);
break;
default:
throw new InvalidUnicodeCodePoint("code point is invalid: "+utf8length);
}
return c;
} | [
"public",
"final",
"static",
"int",
"getScalarFromBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"maxLength",
")",
"{",
"int",
"src",
"=",
"offset",
";",
"int",
"end",
"=",
"offset",
"+",
"maxLength",
";",
"if",
"(",
"src",
... | this helper converts the bytes starting at offset from UTF8 to a
Unicode scalar. This does not check for valid Unicode scalar ranges
but simply handle the UTF8 decoding. getScalarReadLengthFromBytes
can be used to determine how many bytes would be converted (consumed) in
this process if the same parameters are passed in. This will throw
ArrayIndexOutOfBoundsException if the array has too few bytes to
fully decode the scalar. It will throw InvalidUnicodeCodePoint if
the first byte isn't a valid UTF8 initial byte with a length of
4 or less.
@param bytes UTF8 bytes in an array
@param offset initial array element to decode from
@param maxLength maximum number of bytes to consume from the array
@return Unicode scalar | [
"this",
"helper",
"converts",
"the",
"bytes",
"starting",
"at",
"offset",
"from",
"UTF8",
"to",
"a",
"Unicode",
"scalar",
".",
"This",
"does",
"not",
"check",
"for",
"valid",
"Unicode",
"scalar",
"ranges",
"but",
"simply",
"handle",
"the",
"UTF8",
"decoding"... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonUTF8.java#L346-L378 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/AbstractUpdateOperation.java | AbstractUpdateOperation.retrieveRemoteVersion | @Nullable
private static String retrieveRemoteVersion(@Nonnull final URL url, @Nonnull final Charset charset) throws IOException {
final InputStream stream = url.openStream();
final InputStreamReader reader = new InputStreamReader(stream, charset);
final LineNumberReader lnr = new LineNumberReader(reader);
final String line = lnr.readLine();
lnr.close();
reader.close();
stream.close();
return line;
} | java | @Nullable
private static String retrieveRemoteVersion(@Nonnull final URL url, @Nonnull final Charset charset) throws IOException {
final InputStream stream = url.openStream();
final InputStreamReader reader = new InputStreamReader(stream, charset);
final LineNumberReader lnr = new LineNumberReader(reader);
final String line = lnr.readLine();
lnr.close();
reader.close();
stream.close();
return line;
} | [
"@",
"Nullable",
"private",
"static",
"String",
"retrieveRemoteVersion",
"(",
"@",
"Nonnull",
"final",
"URL",
"url",
",",
"@",
"Nonnull",
"final",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"final",
"InputStream",
"stream",
"=",
"url",
".",
"open... | Reads the current User-Agent data version from <a
href="http://data.udger.com">http://data.udger.com</a>.
@param url
a URL which the version information can be loaded
@return a version string or {@code null}
@throws IOException
if an I/O exception occurs | [
"Reads",
"the",
"current",
"User",
"-",
"Agent",
"data",
"version",
"from",
"<a",
"href",
"=",
"http",
":",
"//",
"data",
".",
"udger",
".",
"com",
">",
"http",
":",
"//",
"data",
".",
"udger",
".",
"com<",
"/",
"a",
">",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/AbstractUpdateOperation.java#L117-L127 |
google/auto | common/src/main/java/com/google/auto/common/MoreTypes.java | MoreTypes.isTypeOf | public static boolean isTypeOf(final Class<?> clazz, TypeMirror type) {
checkNotNull(clazz);
return type.accept(new IsTypeOf(clazz), null);
} | java | public static boolean isTypeOf(final Class<?> clazz, TypeMirror type) {
checkNotNull(clazz);
return type.accept(new IsTypeOf(clazz), null);
} | [
"public",
"static",
"boolean",
"isTypeOf",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"TypeMirror",
"type",
")",
"{",
"checkNotNull",
"(",
"clazz",
")",
";",
"return",
"type",
".",
"accept",
"(",
"new",
"IsTypeOf",
"(",
"clazz",
")",
",",
"nul... | Returns true if the raw type underlying the given {@link TypeMirror} represents the same raw
type as the given {@link Class} and throws an IllegalArgumentException if the {@link
TypeMirror} does not represent a type that can be referenced by a {@link Class} | [
"Returns",
"true",
"if",
"the",
"raw",
"type",
"underlying",
"the",
"given",
"{"
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/MoreTypes.java#L811-L814 |
real-logic/agrona | agrona/src/main/java/org/agrona/concurrent/MappedResizeableBuffer.java | MappedResizeableBuffer.wrap | public void wrap(final long offset, final long length)
{
if (offset == addressOffset && length == capacity)
{
return;
}
wrap(fileChannel, offset, length);
} | java | public void wrap(final long offset, final long length)
{
if (offset == addressOffset && length == capacity)
{
return;
}
wrap(fileChannel, offset, length);
} | [
"public",
"void",
"wrap",
"(",
"final",
"long",
"offset",
",",
"final",
"long",
"length",
")",
"{",
"if",
"(",
"offset",
"==",
"addressOffset",
"&&",
"length",
"==",
"capacity",
")",
"{",
"return",
";",
"}",
"wrap",
"(",
"fileChannel",
",",
"offset",
"... | Remap the buffer using the existing file based on a new offset and length
@param offset the offset of the file to start the mapping
@param length of the buffer from the given address | [
"Remap",
"the",
"buffer",
"using",
"the",
"existing",
"file",
"based",
"on",
"a",
"new",
"offset",
"and",
"length"
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/MappedResizeableBuffer.java#L100-L108 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java | LayoutRefiner.restoreCoords | private void restoreCoords(IntStack stack, Point2d[] src) {
for (int i = 0; i < stack.len; i++) {
int v = stack.xs[i];
atoms[v].getPoint2d().x = src[v].x;
atoms[v].getPoint2d().y = src[v].y;
}
} | java | private void restoreCoords(IntStack stack, Point2d[] src) {
for (int i = 0; i < stack.len; i++) {
int v = stack.xs[i];
atoms[v].getPoint2d().x = src[v].x;
atoms[v].getPoint2d().y = src[v].y;
}
} | [
"private",
"void",
"restoreCoords",
"(",
"IntStack",
"stack",
",",
"Point2d",
"[",
"]",
"src",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"stack",
".",
"len",
";",
"i",
"++",
")",
"{",
"int",
"v",
"=",
"stack",
".",
"xs",
"[",
... | Restore the coordinates of atoms (idxs) in the stack to the provided
source.
@param stack atom indexes to backup
@param src source of coordinates | [
"Restore",
"the",
"coordinates",
"of",
"atoms",
"(",
"idxs",
")",
"in",
"the",
"stack",
"to",
"the",
"provided",
"source",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L850-L856 |
liferay/com-liferay-commerce | commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java | CPDefinitionGroupedEntryPersistenceImpl.removeByUUID_G | @Override
public CPDefinitionGroupedEntry removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionGroupedEntryException {
CPDefinitionGroupedEntry cpDefinitionGroupedEntry = findByUUID_G(uuid,
groupId);
return remove(cpDefinitionGroupedEntry);
} | java | @Override
public CPDefinitionGroupedEntry removeByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionGroupedEntryException {
CPDefinitionGroupedEntry cpDefinitionGroupedEntry = findByUUID_G(uuid,
groupId);
return remove(cpDefinitionGroupedEntry);
} | [
"@",
"Override",
"public",
"CPDefinitionGroupedEntry",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPDefinitionGroupedEntryException",
"{",
"CPDefinitionGroupedEntry",
"cpDefinitionGroupedEntry",
"=",
"findByUUID_G",
"(",
"uuid",
"... | Removes the cp definition grouped entry where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp definition grouped entry that was removed | [
"Removes",
"the",
"cp",
"definition",
"grouped",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L817-L824 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_sound_soundId_GET | public OvhOvhPabxSound billingAccount_easyHunting_serviceName_sound_soundId_GET(String billingAccount, String serviceName, Long soundId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/sound/{soundId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, soundId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxSound.class);
} | java | public OvhOvhPabxSound billingAccount_easyHunting_serviceName_sound_soundId_GET(String billingAccount, String serviceName, Long soundId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/sound/{soundId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, soundId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxSound.class);
} | [
"public",
"OvhOvhPabxSound",
"billingAccount_easyHunting_serviceName_sound_soundId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"soundId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/easyHunting/... | Get this object properties
REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/sound/{soundId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param soundId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2213-L2218 |
mijecu25/dsa | src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java | BinarySearch.searchDescending | public static int searchDescending(int[] intArray, int value) {
int start = 0;
int end = intArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value == intArray[middle]) {
return middle;
}
if(value > intArray[middle]) {
end = middle - 1 ;
}
else {
start = middle + 1;
}
}
return -1;
} | java | public static int searchDescending(int[] intArray, int value) {
int start = 0;
int end = intArray.length - 1;
int middle = 0;
while(start <= end) {
middle = (start + end) >> 1;
if(value == intArray[middle]) {
return middle;
}
if(value > intArray[middle]) {
end = middle - 1 ;
}
else {
start = middle + 1;
}
}
return -1;
} | [
"public",
"static",
"int",
"searchDescending",
"(",
"int",
"[",
"]",
"intArray",
",",
"int",
"value",
")",
"{",
"int",
"start",
"=",
"0",
";",
"int",
"end",
"=",
"intArray",
".",
"length",
"-",
"1",
";",
"int",
"middle",
"=",
"0",
";",
"while",
"("... | Search for the value in the reverse sorted int array and return the index.
@param intArray array that we are searching in.
@param value value that is being searched in the array.
@return the index where the value is found in the array, else -1. | [
"Search",
"for",
"the",
"value",
"in",
"the",
"reverse",
"sorted",
"int",
"array",
"and",
"return",
"the",
"index",
"."
] | train | https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L409-L431 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/impl/getters/AbstractJsonGetter.java | AbstractJsonGetter.findAttribute | private boolean findAttribute(JsonParser parser, JsonPathCursor pathCursor) throws IOException {
JsonToken token = parser.getCurrentToken();
if (token != JsonToken.START_OBJECT) {
return false;
}
while (true) {
token = parser.nextToken();
if (token == JsonToken.END_OBJECT) {
return false;
}
if (pathCursor.getCurrent().equals(parser.getCurrentName())) {
parser.nextToken();
return true;
} else {
parser.nextToken();
parser.skipChildren();
}
}
} | java | private boolean findAttribute(JsonParser parser, JsonPathCursor pathCursor) throws IOException {
JsonToken token = parser.getCurrentToken();
if (token != JsonToken.START_OBJECT) {
return false;
}
while (true) {
token = parser.nextToken();
if (token == JsonToken.END_OBJECT) {
return false;
}
if (pathCursor.getCurrent().equals(parser.getCurrentName())) {
parser.nextToken();
return true;
} else {
parser.nextToken();
parser.skipChildren();
}
}
} | [
"private",
"boolean",
"findAttribute",
"(",
"JsonParser",
"parser",
",",
"JsonPathCursor",
"pathCursor",
")",
"throws",
"IOException",
"{",
"JsonToken",
"token",
"=",
"parser",
".",
"getCurrentToken",
"(",
")",
";",
"if",
"(",
"token",
"!=",
"JsonToken",
".",
... | Looks for the attribute with the given name only in current
object. If found, parser points to the value of the given
attribute when this method returns. If given path does not exist
in the current level, then parser points to matching
{@code JsonToken.END_OBJECT} of the current object.
Assumes the parser points to a {@code JsonToken.START_OBJECT}
@param parser
@param pathCursor
@return {@code true} if given attribute name exists in the current object
@throws IOException | [
"Looks",
"for",
"the",
"attribute",
"with",
"the",
"given",
"name",
"only",
"in",
"current",
"object",
".",
"If",
"found",
"parser",
"points",
"to",
"the",
"value",
"of",
"the",
"given",
"attribute",
"when",
"this",
"method",
"returns",
".",
"If",
"given",... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/getters/AbstractJsonGetter.java#L211-L229 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.sumOfMeanDifferences | public static double sumOfMeanDifferences(double[] vector, double[] vector2) {
double mean = sum(vector) / vector.length;
double mean2 = sum(vector2) / vector2.length;
double ret = 0;
for (int i = 0; i < vector.length; i++) {
double vec1Diff = vector[i] - mean;
double vec2Diff = vector2[i] - mean2;
ret += vec1Diff * vec2Diff;
}
return ret;
} | java | public static double sumOfMeanDifferences(double[] vector, double[] vector2) {
double mean = sum(vector) / vector.length;
double mean2 = sum(vector2) / vector2.length;
double ret = 0;
for (int i = 0; i < vector.length; i++) {
double vec1Diff = vector[i] - mean;
double vec2Diff = vector2[i] - mean2;
ret += vec1Diff * vec2Diff;
}
return ret;
} | [
"public",
"static",
"double",
"sumOfMeanDifferences",
"(",
"double",
"[",
"]",
"vector",
",",
"double",
"[",
"]",
"vector2",
")",
"{",
"double",
"mean",
"=",
"sum",
"(",
"vector",
")",
"/",
"vector",
".",
"length",
";",
"double",
"mean2",
"=",
"sum",
"... | Used for calculating top part of simple regression for
beta 1
@param vector the x coordinates
@param vector2 the y coordinates
@return the sum of mean differences for the input vectors | [
"Used",
"for",
"calculating",
"top",
"part",
"of",
"simple",
"regression",
"for",
"beta",
"1"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L474-L484 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java | MmffAtomTypeMatcher.assignPreliminaryTypes | private void assignPreliminaryTypes(IAtomContainer container, String[] symbs) {
// shallow copy
IAtomContainer cpy = container.getBuilder().newInstance(IAtomContainer.class, container);
Cycles.markRingAtomsAndBonds(cpy);
for (AtomTypePattern matcher : patterns) {
for (final int idx : matcher.matches(cpy)) {
if (symbs[idx] == null) {
symbs[idx] = matcher.symb;
}
}
}
} | java | private void assignPreliminaryTypes(IAtomContainer container, String[] symbs) {
// shallow copy
IAtomContainer cpy = container.getBuilder().newInstance(IAtomContainer.class, container);
Cycles.markRingAtomsAndBonds(cpy);
for (AtomTypePattern matcher : patterns) {
for (final int idx : matcher.matches(cpy)) {
if (symbs[idx] == null) {
symbs[idx] = matcher.symb;
}
}
}
} | [
"private",
"void",
"assignPreliminaryTypes",
"(",
"IAtomContainer",
"container",
",",
"String",
"[",
"]",
"symbs",
")",
"{",
"// shallow copy",
"IAtomContainer",
"cpy",
"=",
"container",
".",
"getBuilder",
"(",
")",
".",
"newInstance",
"(",
"IAtomContainer",
".",
... | Preliminary atom types are assigned using SMARTS definitions.
@param container input structure representation
@param symbs symbolic atom types | [
"Preliminary",
"atom",
"types",
"are",
"assigned",
"using",
"SMARTS",
"definitions",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java#L202-L213 |
jboss/jboss-common-beans | src/main/java/org/jboss/common/beans/property/DateEditor.java | DateEditor.initialize | public static void initialize() {
PrivilegedAction action = new PrivilegedAction() {
public Object run() {
String defaultFormat = System.getProperty("org.jboss.common.beans.property.DateEditor.format", "MMM d, yyyy");
String defaultLocale = System.getProperty("org.jboss.common.beans.property.DateEditor.locale");
DateFormat defaultDateFormat;
if (defaultLocale == null || defaultLocale.length() == 0) {
defaultDateFormat = new SimpleDateFormat(defaultFormat);
} else {
LocaleEditor localeEditor = new LocaleEditor();
localeEditor.setAsText(defaultLocale);
Locale locale = (Locale) localeEditor.getValue();
defaultDateFormat = new SimpleDateFormat(defaultFormat, locale);
}
formats = new DateFormat[] { defaultDateFormat,
// Tue Jan 04 00:00:00 PST 2005
new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy"),
// Wed, 4 Jul 2001 12:08:56 -0700
new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z") };
return null;
}
};
AccessController.doPrivileged(action);
} | java | public static void initialize() {
PrivilegedAction action = new PrivilegedAction() {
public Object run() {
String defaultFormat = System.getProperty("org.jboss.common.beans.property.DateEditor.format", "MMM d, yyyy");
String defaultLocale = System.getProperty("org.jboss.common.beans.property.DateEditor.locale");
DateFormat defaultDateFormat;
if (defaultLocale == null || defaultLocale.length() == 0) {
defaultDateFormat = new SimpleDateFormat(defaultFormat);
} else {
LocaleEditor localeEditor = new LocaleEditor();
localeEditor.setAsText(defaultLocale);
Locale locale = (Locale) localeEditor.getValue();
defaultDateFormat = new SimpleDateFormat(defaultFormat, locale);
}
formats = new DateFormat[] { defaultDateFormat,
// Tue Jan 04 00:00:00 PST 2005
new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy"),
// Wed, 4 Jul 2001 12:08:56 -0700
new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z") };
return null;
}
};
AccessController.doPrivileged(action);
} | [
"public",
"static",
"void",
"initialize",
"(",
")",
"{",
"PrivilegedAction",
"action",
"=",
"new",
"PrivilegedAction",
"(",
")",
"{",
"public",
"Object",
"run",
"(",
")",
"{",
"String",
"defaultFormat",
"=",
"System",
".",
"getProperty",
"(",
"\"org.jboss.comm... | Setup the parsing formats. Offered as a separate static method to allow testing of locale changes, since SimpleDateFormat
will use the default locale upon construction. Should not be normally used! | [
"Setup",
"the",
"parsing",
"formats",
".",
"Offered",
"as",
"a",
"separate",
"static",
"method",
"to",
"allow",
"testing",
"of",
"locale",
"changes",
"since",
"SimpleDateFormat",
"will",
"use",
"the",
"default",
"locale",
"upon",
"construction",
".",
"Should",
... | train | https://github.com/jboss/jboss-common-beans/blob/ffb48b1719762534bf92d762eadf91d1815f6748/src/main/java/org/jboss/common/beans/property/DateEditor.java#L60-L84 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withKeyCopier | public CacheConfigurationBuilder<K, V> withKeyCopier(Class<? extends Copier<K>> keyCopierClass) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(keyCopierClass, "Null key copier class"), DefaultCopierConfiguration.Type.KEY));
} | java | public CacheConfigurationBuilder<K, V> withKeyCopier(Class<? extends Copier<K>> keyCopierClass) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(keyCopierClass, "Null key copier class"), DefaultCopierConfiguration.Type.KEY));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withKeyCopier",
"(",
"Class",
"<",
"?",
"extends",
"Copier",
"<",
"K",
">",
">",
"keyCopierClass",
")",
"{",
"return",
"withCopier",
"(",
"new",
"DefaultCopierConfiguration",
"<>",
"(",
"requireN... | Adds by-value semantic using the provided {@link Copier} class for the key on heap.
<p>
{@link Copier}s are what enable control of by-reference / by-value semantics for on-heap tier.
@param keyCopierClass the key copier class to use
@return a new builder with the added key copier | [
"Adds",
"by",
"-",
"value",
"semantic",
"using",
"the",
"provided",
"{",
"@link",
"Copier",
"}",
"class",
"for",
"the",
"key",
"on",
"heap",
".",
"<p",
">",
"{",
"@link",
"Copier",
"}",
"s",
"are",
"what",
"enable",
"control",
"of",
"by",
"-",
"refer... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L420-L422 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java | SparkExport.exportStringLocal | public static void exportStringLocal(File outputFile, JavaRDD<String> data, int rngSeed) throws Exception {
List<String> linesList = data.collect(); //Requires all data in memory
if (!(linesList instanceof ArrayList))
linesList = new ArrayList<>(linesList);
Collections.shuffle(linesList, new Random(rngSeed));
FileUtils.writeLines(outputFile, linesList);
} | java | public static void exportStringLocal(File outputFile, JavaRDD<String> data, int rngSeed) throws Exception {
List<String> linesList = data.collect(); //Requires all data in memory
if (!(linesList instanceof ArrayList))
linesList = new ArrayList<>(linesList);
Collections.shuffle(linesList, new Random(rngSeed));
FileUtils.writeLines(outputFile, linesList);
} | [
"public",
"static",
"void",
"exportStringLocal",
"(",
"File",
"outputFile",
",",
"JavaRDD",
"<",
"String",
">",
"data",
",",
"int",
"rngSeed",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"linesList",
"=",
"data",
".",
"collect",
"(",
")",
... | Another quick and dirty CSV export (local). Dumps all values into a single file | [
"Another",
"quick",
"and",
"dirty",
"CSV",
"export",
"(",
"local",
")",
".",
"Dumps",
"all",
"values",
"into",
"a",
"single",
"file"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java#L153-L160 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java | AdHocCommandManager.registerCommand | public void registerCommand(String node, final String name, LocalCommandFactory factory) {
AdHocCommandInfo commandInfo = new AdHocCommandInfo(node, name, connection().getUser(), factory);
commands.put(node, commandInfo);
// Set the NodeInformationProvider that will provide information about
// the added command
serviceDiscoveryManager.setNodeInformationProvider(node,
new AbstractNodeInformationProvider() {
@Override
public List<String> getNodeFeatures() {
List<String> answer = new ArrayList<>();
answer.add(NAMESPACE);
// TODO: check if this service is provided by the
// TODO: current connection.
answer.add("jabber:x:data");
return answer;
}
@Override
public List<DiscoverInfo.Identity> getNodeIdentities() {
List<DiscoverInfo.Identity> answer = new ArrayList<>();
DiscoverInfo.Identity identity = new DiscoverInfo.Identity(
"automation", name, "command-node");
answer.add(identity);
return answer;
}
});
} | java | public void registerCommand(String node, final String name, LocalCommandFactory factory) {
AdHocCommandInfo commandInfo = new AdHocCommandInfo(node, name, connection().getUser(), factory);
commands.put(node, commandInfo);
// Set the NodeInformationProvider that will provide information about
// the added command
serviceDiscoveryManager.setNodeInformationProvider(node,
new AbstractNodeInformationProvider() {
@Override
public List<String> getNodeFeatures() {
List<String> answer = new ArrayList<>();
answer.add(NAMESPACE);
// TODO: check if this service is provided by the
// TODO: current connection.
answer.add("jabber:x:data");
return answer;
}
@Override
public List<DiscoverInfo.Identity> getNodeIdentities() {
List<DiscoverInfo.Identity> answer = new ArrayList<>();
DiscoverInfo.Identity identity = new DiscoverInfo.Identity(
"automation", name, "command-node");
answer.add(identity);
return answer;
}
});
} | [
"public",
"void",
"registerCommand",
"(",
"String",
"node",
",",
"final",
"String",
"name",
",",
"LocalCommandFactory",
"factory",
")",
"{",
"AdHocCommandInfo",
"commandInfo",
"=",
"new",
"AdHocCommandInfo",
"(",
"node",
",",
"name",
",",
"connection",
"(",
")",... | Registers a new command with this command manager, which is related to a
connection. The <tt>node</tt> is an unique identifier of that
command for the connection related to this command manager. The <tt>name</tt>
is the human readable name of the command. The <tt>factory</tt> generates
new instances of the command.
@param node the unique identifier of the command.
@param name the human readable name of the command.
@param factory a factory to create new instances of the command. | [
"Registers",
"a",
"new",
"command",
"with",
"this",
"command",
"manager",
"which",
"is",
"related",
"to",
"a",
"connection",
".",
"The",
"<tt",
">",
"node<",
"/",
"tt",
">",
"is",
"an",
"unique",
"identifier",
"of",
"that",
"command",
"for",
"the",
"conn... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/AdHocCommandManager.java#L225-L251 |
RKumsher/utils | src/main/java/com/github/rkumsher/number/RandomNumberUtils.java | RandomNumberUtils.randomLongGreaterThan | public static long randomLongGreaterThan(long minExclusive) {
checkArgument(
minExclusive < Long.MAX_VALUE, "Cannot produce long greater than %s", Long.MAX_VALUE);
return randomLong(minExclusive + 1, Long.MAX_VALUE);
} | java | public static long randomLongGreaterThan(long minExclusive) {
checkArgument(
minExclusive < Long.MAX_VALUE, "Cannot produce long greater than %s", Long.MAX_VALUE);
return randomLong(minExclusive + 1, Long.MAX_VALUE);
} | [
"public",
"static",
"long",
"randomLongGreaterThan",
"(",
"long",
"minExclusive",
")",
"{",
"checkArgument",
"(",
"minExclusive",
"<",
"Long",
".",
"MAX_VALUE",
",",
"\"Cannot produce long greater than %s\"",
",",
"Long",
".",
"MAX_VALUE",
")",
";",
"return",
"rando... | Returns a random long that is greater than the given long.
@param minExclusive the value that returned long must be greater than
@return the random long
@throws IllegalArgumentException if minExclusive is greater than or equal to {@link
Long#MAX_VALUE} | [
"Returns",
"a",
"random",
"long",
"that",
"is",
"greater",
"than",
"the",
"given",
"long",
"."
] | train | https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/number/RandomNumberUtils.java#L139-L143 |
trellis-ldp/trellis | core/http/src/main/java/org/trellisldp/http/TrellisHttpResource.java | TrellisHttpResource.updateResource | @PATCH
@Timed
public void updateResource(@Suspended final AsyncResponse response, @Context final Request request,
@Context final UriInfo uriInfo, @Context final HttpHeaders headers,
@Context final SecurityContext secContext, final String body) {
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, secContext);
final String urlBase = getBaseUrl(req);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final PatchHandler patchHandler = new PatchHandler(req, body, trellis, defaultJsonLdProfile, urlBase);
getParent(identifier).thenCombine(trellis.getResourceService().get(identifier), patchHandler::initialize)
.thenCompose(patchHandler::updateResource).thenCompose(patchHandler::updateMemento)
.thenApply(ResponseBuilder::build).exceptionally(this::handleException).thenApply(response::resume);
} | java | @PATCH
@Timed
public void updateResource(@Suspended final AsyncResponse response, @Context final Request request,
@Context final UriInfo uriInfo, @Context final HttpHeaders headers,
@Context final SecurityContext secContext, final String body) {
final TrellisRequest req = new TrellisRequest(request, uriInfo, headers, secContext);
final String urlBase = getBaseUrl(req);
final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + req.getPath());
final PatchHandler patchHandler = new PatchHandler(req, body, trellis, defaultJsonLdProfile, urlBase);
getParent(identifier).thenCombine(trellis.getResourceService().get(identifier), patchHandler::initialize)
.thenCompose(patchHandler::updateResource).thenCompose(patchHandler::updateMemento)
.thenApply(ResponseBuilder::build).exceptionally(this::handleException).thenApply(response::resume);
} | [
"@",
"PATCH",
"@",
"Timed",
"public",
"void",
"updateResource",
"(",
"@",
"Suspended",
"final",
"AsyncResponse",
"response",
",",
"@",
"Context",
"final",
"Request",
"request",
",",
"@",
"Context",
"final",
"UriInfo",
"uriInfo",
",",
"@",
"Context",
"final",
... | Perform a PATCH operation on an LDP Resource.
@param response the async response
@param uriInfo the URI info
@param secContext the security context
@param headers the HTTP headers
@param request the request
@param body the body | [
"Perform",
"a",
"PATCH",
"operation",
"on",
"an",
"LDP",
"Resource",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/TrellisHttpResource.java#L261-L274 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java | StereoTool.getHandedness | public static TetrahedralSign getHandedness(IAtom baseAtomA, IAtom baseAtomB, IAtom baseAtomC, IAtom apexAtom) {
Point3d pointA = baseAtomA.getPoint3d();
Point3d pointB = baseAtomB.getPoint3d();
Point3d pointC = baseAtomC.getPoint3d();
Point3d pointD = apexAtom.getPoint3d();
return StereoTool.getHandedness(pointA, pointB, pointC, pointD);
} | java | public static TetrahedralSign getHandedness(IAtom baseAtomA, IAtom baseAtomB, IAtom baseAtomC, IAtom apexAtom) {
Point3d pointA = baseAtomA.getPoint3d();
Point3d pointB = baseAtomB.getPoint3d();
Point3d pointC = baseAtomC.getPoint3d();
Point3d pointD = apexAtom.getPoint3d();
return StereoTool.getHandedness(pointA, pointB, pointC, pointD);
} | [
"public",
"static",
"TetrahedralSign",
"getHandedness",
"(",
"IAtom",
"baseAtomA",
",",
"IAtom",
"baseAtomB",
",",
"IAtom",
"baseAtomC",
",",
"IAtom",
"apexAtom",
")",
"{",
"Point3d",
"pointA",
"=",
"baseAtomA",
".",
"getPoint3d",
"(",
")",
";",
"Point3d",
"po... | Gets the tetrahedral handedness of four atoms - three of which form the
'base' of the tetrahedron, and the other the apex. Note that it assumes
a right-handed coordinate system, and that the points {A,B,C} are in
a counter-clockwise order in the plane they share.
@param baseAtomA the first atom in the base of the tetrahedron
@param baseAtomB the second atom in the base of the tetrahedron
@param baseAtomC the third atom in the base of the tetrahedron
@param apexAtom the atom in the point of the tetrahedron
@return the sign of the tetrahedron | [
"Gets",
"the",
"tetrahedral",
"handedness",
"of",
"four",
"atoms",
"-",
"three",
"of",
"which",
"form",
"the",
"base",
"of",
"the",
"tetrahedron",
"and",
"the",
"other",
"the",
"apex",
".",
"Note",
"that",
"it",
"assumes",
"a",
"right",
"-",
"handed",
"c... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/StereoTool.java#L305-L311 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java | SoundStore.getMOD | public Audio getMOD(String ref, InputStream in) throws IOException {
if (!soundWorks) {
return new NullAudio();
}
if (!inited) {
throw new RuntimeException("Can't load sounds until SoundStore is init(). Use the container init() method.");
}
if (deferred) {
return new DeferredSound(ref, in, DeferredSound.MOD);
}
return new MODSound(this, in);
} | java | public Audio getMOD(String ref, InputStream in) throws IOException {
if (!soundWorks) {
return new NullAudio();
}
if (!inited) {
throw new RuntimeException("Can't load sounds until SoundStore is init(). Use the container init() method.");
}
if (deferred) {
return new DeferredSound(ref, in, DeferredSound.MOD);
}
return new MODSound(this, in);
} | [
"public",
"Audio",
"getMOD",
"(",
"String",
"ref",
",",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"soundWorks",
")",
"{",
"return",
"new",
"NullAudio",
"(",
")",
";",
"}",
"if",
"(",
"!",
"inited",
")",
"{",
"throw",
"ne... | Get a MOD sound (mod/xm etc)
@param ref The stream to the MOD to load
@param in The stream to the MOD to load
@return The sound for play back
@throws IOException Indicates a failure to read the data | [
"Get",
"a",
"MOD",
"sound",
"(",
"mod",
"/",
"xm",
"etc",
")"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java#L574-L586 |
lucee/Lucee | loader/src/main/java/lucee/loader/engine/CFMLEngineFactorySupport.java | CFMLEngineFactorySupport.toVersion | public static Version toVersion(String version, final Version defaultValue) {
// remove extension if there is any
final int rIndex = version.lastIndexOf(".lco");
if (rIndex != -1) version = version.substring(0, rIndex);
try {
return Version.parseVersion(version);
}
catch (final IllegalArgumentException iae) {
return defaultValue;
}
} | java | public static Version toVersion(String version, final Version defaultValue) {
// remove extension if there is any
final int rIndex = version.lastIndexOf(".lco");
if (rIndex != -1) version = version.substring(0, rIndex);
try {
return Version.parseVersion(version);
}
catch (final IllegalArgumentException iae) {
return defaultValue;
}
} | [
"public",
"static",
"Version",
"toVersion",
"(",
"String",
"version",
",",
"final",
"Version",
"defaultValue",
")",
"{",
"// remove extension if there is any",
"final",
"int",
"rIndex",
"=",
"version",
".",
"lastIndexOf",
"(",
"\".lco\"",
")",
";",
"if",
"(",
"r... | cast a lucee string version to a int version
@param version
@return int version | [
"cast",
"a",
"lucee",
"string",
"version",
"to",
"a",
"int",
"version"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/engine/CFMLEngineFactorySupport.java#L106-L117 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/util/Utils.java | Utils.shutdownAndAwaitTermination | public static void shutdownAndAwaitTermination(ExecutorService pool,
long timeToWait4ShutDown,
long timeToWait4ShutDownNow) {
synchronized (pool) {
// Disable new tasks from being submitted
pool.shutdown();
}
try {
// Wait a while for existing tasks to terminate
if (!pool.awaitTermination(timeToWait4ShutDown, TimeUnit.SECONDS)) {
synchronized (pool) {
pool.shutdownNow(); // Cancel currently executing tasks
}
// Wait a while for tasks to respond to being cancelled
if (!pool.awaitTermination(timeToWait4ShutDownNow, TimeUnit.SECONDS)) {
Log.e(Log.TAG_DATABASE, "Pool did not terminate");
}
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
synchronized (pool) {
pool.shutdownNow();
}
// Preserve interrupt status
Thread.currentThread().interrupt();
}
} | java | public static void shutdownAndAwaitTermination(ExecutorService pool,
long timeToWait4ShutDown,
long timeToWait4ShutDownNow) {
synchronized (pool) {
// Disable new tasks from being submitted
pool.shutdown();
}
try {
// Wait a while for existing tasks to terminate
if (!pool.awaitTermination(timeToWait4ShutDown, TimeUnit.SECONDS)) {
synchronized (pool) {
pool.shutdownNow(); // Cancel currently executing tasks
}
// Wait a while for tasks to respond to being cancelled
if (!pool.awaitTermination(timeToWait4ShutDownNow, TimeUnit.SECONDS)) {
Log.e(Log.TAG_DATABASE, "Pool did not terminate");
}
}
} catch (InterruptedException ie) {
// (Re-)Cancel if current thread also interrupted
synchronized (pool) {
pool.shutdownNow();
}
// Preserve interrupt status
Thread.currentThread().interrupt();
}
} | [
"public",
"static",
"void",
"shutdownAndAwaitTermination",
"(",
"ExecutorService",
"pool",
",",
"long",
"timeToWait4ShutDown",
",",
"long",
"timeToWait4ShutDownNow",
")",
"{",
"synchronized",
"(",
"pool",
")",
"{",
"// Disable new tasks from being submitted",
"pool",
".",... | The following method shuts down an ExecutorService in two phases,
first by calling shutdown to reject incoming tasks, and then calling shutdownNow,
if necessary, to cancel any lingering tasks:
http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html
@param timeToWait4ShutDown - Seconds
@param timeToWait4ShutDownNow - Seconds | [
"The",
"following",
"method",
"shuts",
"down",
"an",
"ExecutorService",
"in",
"two",
"phases",
"first",
"by",
"calling",
"shutdown",
"to",
"reject",
"incoming",
"tasks",
"and",
"then",
"calling",
"shutdownNow",
"if",
"necessary",
"to",
"cancel",
"any",
"lingerin... | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/util/Utils.java#L315-L341 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Base16.java | Base16.encodeWithColons | public static String encodeWithColons(byte[] in) {
if (in == null) {
return null;
}
return encodeWithColons(in, 0, in.length);
} | java | public static String encodeWithColons(byte[] in) {
if (in == null) {
return null;
}
return encodeWithColons(in, 0, in.length);
} | [
"public",
"static",
"String",
"encodeWithColons",
"(",
"byte",
"[",
"]",
"in",
")",
"{",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"encodeWithColons",
"(",
"in",
",",
"0",
",",
"in",
".",
"length",
")",
";",
"}"... | Encodes the given bytes into a base-16 string, inserting colons after
every 2 characters of output.
@param in
the bytes to encode.
@return The formatted base-16 string, or null if {@code in} is null. | [
"Encodes",
"the",
"given",
"bytes",
"into",
"a",
"base",
"-",
"16",
"string",
"inserting",
"colons",
"after",
"every",
"2",
"characters",
"of",
"output",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Base16.java#L75-L80 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java | AssertKripton.assertTrueOrUnknownClassInJQLException | public static void assertTrueOrUnknownClassInJQLException(boolean expression, SQLiteModelMethod method,
String className) {
if (!expression) {
throw (new UnknownClassInJQLException(method, className));
}
} | java | public static void assertTrueOrUnknownClassInJQLException(boolean expression, SQLiteModelMethod method,
String className) {
if (!expression) {
throw (new UnknownClassInJQLException(method, className));
}
} | [
"public",
"static",
"void",
"assertTrueOrUnknownClassInJQLException",
"(",
"boolean",
"expression",
",",
"SQLiteModelMethod",
"method",
",",
"String",
"className",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"(",
"new",
"UnknownClassInJQLException",
"... | Assert true or unknown class in JQL exception.
@param expression
the expression
@param method
the method
@param className
the class name | [
"Assert",
"true",
"or",
"unknown",
"class",
"in",
"JQL",
"exception",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java#L275-L280 |
duracloud/management-console | account-management-monitor/src/main/java/org/duracloud/account/monitor/duplication/DuplicationMonitor.java | DuplicationMonitor.getStoreManager | private ContentStoreManager getStoreManager(String host)
throws DBNotFoundException {
ContentStoreManager storeManager =
new ContentStoreManagerImpl(host, PORT, CONTEXT);
Credential credential = getRootCredential();
storeManager.login(credential);
return storeManager;
} | java | private ContentStoreManager getStoreManager(String host)
throws DBNotFoundException {
ContentStoreManager storeManager =
new ContentStoreManagerImpl(host, PORT, CONTEXT);
Credential credential = getRootCredential();
storeManager.login(credential);
return storeManager;
} | [
"private",
"ContentStoreManager",
"getStoreManager",
"(",
"String",
"host",
")",
"throws",
"DBNotFoundException",
"{",
"ContentStoreManager",
"storeManager",
"=",
"new",
"ContentStoreManagerImpl",
"(",
"host",
",",
"PORT",
",",
"CONTEXT",
")",
";",
"Credential",
"cred... | /*
Create the store manager to connect to this DuraCloud account instance | [
"/",
"*",
"Create",
"the",
"store",
"manager",
"to",
"connect",
"to",
"this",
"DuraCloud",
"account",
"instance"
] | train | https://github.com/duracloud/management-console/blob/7331015c01f9ac5cc5c0aa8ae9a2a1a77e9f4ac6/account-management-monitor/src/main/java/org/duracloud/account/monitor/duplication/DuplicationMonitor.java#L107-L114 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.arrayMinLike | public static PactDslJsonBody arrayMinLike(int minSize, int numberExamples) {
if (numberExamples < minSize) {
throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
numberExamples, minSize));
}
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(minSize));
return new PactDslJsonBody(".", "", parent);
} | java | public static PactDslJsonBody arrayMinLike(int minSize, int numberExamples) {
if (numberExamples < minSize) {
throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
numberExamples, minSize));
}
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(minSize));
return new PactDslJsonBody(".", "", parent);
} | [
"public",
"static",
"PactDslJsonBody",
"arrayMinLike",
"(",
"int",
"minSize",
",",
"int",
"numberExamples",
")",
"{",
"if",
"(",
"numberExamples",
"<",
"minSize",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Number ... | Array with a minimum size where each item must match the following example
@param minSize minimum size
@param numberExamples Number of examples to generate | [
"Array",
"with",
"a",
"minimum",
"size",
"where",
"each",
"item",
"must",
"match",
"the",
"following",
"example"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L778-L787 |
mcxiaoke/Android-Next | ui/src/main/java/com/mcxiaoke/next/ui/widget/AdvancedShareActionProvider.java | AdvancedShareActionProvider.setIntentExtras | public void setIntentExtras(String subject, String text, Uri imageUri) {
if (DEBUG) {
Log.v(TAG, "setIntentExtras() subject=" + subject);
Log.v(TAG, "setIntentExtras() text=" + text);
Log.v(TAG, "setIntentExtras() imageUri=" + imageUri);
}
mIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
mIntent.putExtra(Intent.EXTRA_TEXT, text);
if (imageUri != null) {
mIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
}
} | java | public void setIntentExtras(String subject, String text, Uri imageUri) {
if (DEBUG) {
Log.v(TAG, "setIntentExtras() subject=" + subject);
Log.v(TAG, "setIntentExtras() text=" + text);
Log.v(TAG, "setIntentExtras() imageUri=" + imageUri);
}
mIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
mIntent.putExtra(Intent.EXTRA_TEXT, text);
if (imageUri != null) {
mIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
}
} | [
"public",
"void",
"setIntentExtras",
"(",
"String",
"subject",
",",
"String",
"text",
",",
"Uri",
"imageUri",
")",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"Log",
".",
"v",
"(",
"TAG",
",",
"\"setIntentExtras() subject=\"",
"+",
"subject",
")",
";",
"Log",
"."... | 添加额外的参数到Intent
注意:必须在setShareIntent之后调用
@param subject Intent.EXTRA_SUBJECT
@param text Intent.EXTRA_TEXT
@param imageUri Intent.EXTRA_STREAM | [
"添加额外的参数到Intent",
"注意:必须在setShareIntent之后调用"
] | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/ui/src/main/java/com/mcxiaoke/next/ui/widget/AdvancedShareActionProvider.java#L220-L231 |
jingwei/krati | krati-main/src/examples/java/krati/examples/KratiDataStore.java | KratiDataStore.createDataStore | protected DataStore<byte[], byte[]> createDataStore(File homeDir, int initialCapacity) throws Exception {
StoreConfig config = new StoreConfig(homeDir, initialCapacity);
config.setSegmentFactory(new MemorySegmentFactory());
config.setSegmentFileSizeMB(64);
return StoreFactory.createStaticDataStore(config);
} | java | protected DataStore<byte[], byte[]> createDataStore(File homeDir, int initialCapacity) throws Exception {
StoreConfig config = new StoreConfig(homeDir, initialCapacity);
config.setSegmentFactory(new MemorySegmentFactory());
config.setSegmentFileSizeMB(64);
return StoreFactory.createStaticDataStore(config);
} | [
"protected",
"DataStore",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
"createDataStore",
"(",
"File",
"homeDir",
",",
"int",
"initialCapacity",
")",
"throws",
"Exception",
"{",
"StoreConfig",
"config",
"=",
"new",
"StoreConfig",
"(",
"homeDir",
",",
... | Creates a DataStore instance.
<p>
Subclasses can override this method to provide a specific DataStore implementation
such as DynamicDataStore and IndexedDataStore or provide a specific SegmentFactory
such as ChannelSegmentFactory, MappedSegmentFactory and WriteBufferSegment. | [
"Creates",
"a",
"DataStore",
"instance",
".",
"<p",
">",
"Subclasses",
"can",
"override",
"this",
"method",
"to",
"provide",
"a",
"specific",
"DataStore",
"implementation",
"such",
"as",
"DynamicDataStore",
"and",
"IndexedDataStore",
"or",
"provide",
"a",
"specifi... | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/examples/java/krati/examples/KratiDataStore.java#L65-L71 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java | MapTileCollisionLoader.checkConstraint | private boolean checkConstraint(Collection<String> constraints, Tile tile)
{
return tile != null
&& constraints.contains(mapGroup.getGroup(tile))
&& !tile.getFeature(TileCollision.class).getCollisionFormulas().isEmpty();
} | java | private boolean checkConstraint(Collection<String> constraints, Tile tile)
{
return tile != null
&& constraints.contains(mapGroup.getGroup(tile))
&& !tile.getFeature(TileCollision.class).getCollisionFormulas().isEmpty();
} | [
"private",
"boolean",
"checkConstraint",
"(",
"Collection",
"<",
"String",
">",
"constraints",
",",
"Tile",
"tile",
")",
"{",
"return",
"tile",
"!=",
"null",
"&&",
"constraints",
".",
"contains",
"(",
"mapGroup",
".",
"getGroup",
"(",
"tile",
")",
")",
"&&... | Check the constraint with the specified tile.
@param constraints The constraint groups to check.
@param tile The tile to check with.
@return <code>true</code> if can be ignored, <code>false</code> else. | [
"Check",
"the",
"constraint",
"with",
"the",
"specified",
"tile",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java#L369-L374 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getDateTimeInstance | static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle,
int timeStyle, ULocale locale)
{
if (cal == null) {
throw new IllegalArgumentException("Calendar must be supplied");
}
return get(dateStyle, timeStyle, locale, cal);
} | java | static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle,
int timeStyle, ULocale locale)
{
if (cal == null) {
throw new IllegalArgumentException("Calendar must be supplied");
}
return get(dateStyle, timeStyle, locale, cal);
} | [
"static",
"final",
"public",
"DateFormat",
"getDateTimeInstance",
"(",
"Calendar",
"cal",
",",
"int",
"dateStyle",
",",
"int",
"timeStyle",
",",
"ULocale",
"locale",
")",
"{",
"if",
"(",
"cal",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Creates a {@link DateFormat} object that can be used to format dates and times in
the calendar system specified by <code>cal</code>.
@param cal The calendar system for which a date/time format is desired.
@param dateStyle The type of date format desired. This can be
{@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
etc.
@param timeStyle The type of time format desired. This can be
{@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
etc.
@param locale The locale for which the date/time format is desired.
@see DateFormat#getDateTimeInstance | [
"Creates",
"a",
"{",
"@link",
"DateFormat",
"}",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"dates",
"and",
"times",
"in",
"the",
"calendar",
"system",
"specified",
"by",
"<code",
">",
"cal<",
"/",
"code",
">",
".",
"@param",
"cal",
"The",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1851-L1858 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java | TimePickerDialog.setStartTime | @Deprecated
public void setStartTime(int hourOfDay, int minute, int second) {
mInitialTime = roundToNearest(new Timepoint(hourOfDay, minute, second));
mInKbMode = false;
} | java | @Deprecated
public void setStartTime(int hourOfDay, int minute, int second) {
mInitialTime = roundToNearest(new Timepoint(hourOfDay, minute, second));
mInKbMode = false;
} | [
"@",
"Deprecated",
"public",
"void",
"setStartTime",
"(",
"int",
"hourOfDay",
",",
"int",
"minute",
",",
"int",
"second",
")",
"{",
"mInitialTime",
"=",
"roundToNearest",
"(",
"new",
"Timepoint",
"(",
"hourOfDay",
",",
"minute",
",",
"second",
")",
")",
";... | Set the time that will be shown when the picker opens for the first time
Overrides the value given in newInstance()
@deprecated in favor of {@link #setInitialSelection(int, int, int)}
@param hourOfDay the hour of the day
@param minute the minute of the hour
@param second the second of the minute | [
"Set",
"the",
"time",
"that",
"will",
"be",
"shown",
"when",
"the",
"picker",
"opens",
"for",
"the",
"first",
"time",
"Overrides",
"the",
"value",
"given",
"in",
"newInstance",
"()"
] | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L499-L503 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/HistoryResources.java | HistoryResources.findByEntityId | @GET
@Path("/job/{jobId}")
@Description("Returns the job history for the given job Id")
@Produces(MediaType.APPLICATION_JSON)
public List<HistoryDTO> findByEntityId(@Context HttpServletRequest req,
@PathParam("jobId") BigInteger jobId,
@QueryParam("limit") int limit,
@QueryParam("status") JobStatus status) {
if (jobId == null || jobId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Job ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Alert alert= _alertService.findAlertByPrimaryKey(jobId);
if (alert == null) {
throw new WebApplicationException(MessageFormat.format("The job with id {0} does not exist.", jobId), Response.Status.NOT_FOUND);
}
if(!alert.isShared()){
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
}
List<History> historyList = status != null ? _historyService.findByJobAndStatus(jobId, limit, status)
: _historyService.findByJob(jobId, limit);
return HistoryDTO.transformToDto(historyList);
} | java | @GET
@Path("/job/{jobId}")
@Description("Returns the job history for the given job Id")
@Produces(MediaType.APPLICATION_JSON)
public List<HistoryDTO> findByEntityId(@Context HttpServletRequest req,
@PathParam("jobId") BigInteger jobId,
@QueryParam("limit") int limit,
@QueryParam("status") JobStatus status) {
if (jobId == null || jobId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Job ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Alert alert= _alertService.findAlertByPrimaryKey(jobId);
if (alert == null) {
throw new WebApplicationException(MessageFormat.format("The job with id {0} does not exist.", jobId), Response.Status.NOT_FOUND);
}
if(!alert.isShared()){
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
}
List<History> historyList = status != null ? _historyService.findByJobAndStatus(jobId, limit, status)
: _historyService.findByJob(jobId, limit);
return HistoryDTO.transformToDto(historyList);
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/job/{jobId}\"",
")",
"@",
"Description",
"(",
"\"Returns the job history for the given job Id\"",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"public",
"List",
"<",
"HistoryDTO",
">",
"findByEntityId",
"(",... | Returns the list of job history record for the given job id.
@param req The HTTP request.
@param jobId The job id. Cannot be null.
@param limit max no of records for a given job
@param status The job status filter.
@return The list of job history records.
@throws WebApplicationException Throws the exception for invalid input data. | [
"Returns",
"the",
"list",
"of",
"job",
"history",
"record",
"for",
"the",
"given",
"job",
"id",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/HistoryResources.java#L85-L109 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java | HttpSmartProxyHandler.doHandshake | public void doHandshake(final NextFilter nextFilter)
throws ProxyAuthException {
logger.debug(" doHandshake()");
if (authHandler != null) {
authHandler.doHandshake(nextFilter);
} else {
if (requestSent) {
// Safety check
throw new ProxyAuthException(
"Authentication request already sent");
}
logger.debug(" sending HTTP request");
// Compute request headers
HttpProxyRequest req = (HttpProxyRequest) getProxyIoSession()
.getRequest();
Map<String, List<String>> headers = req.getHeaders() != null ? req
.getHeaders() : new HashMap<>();
AbstractAuthLogicHandler.addKeepAliveHeaders(headers);
req.setHeaders(headers);
// Write request to the proxy
writeRequest(nextFilter, req);
requestSent = true;
}
} | java | public void doHandshake(final NextFilter nextFilter)
throws ProxyAuthException {
logger.debug(" doHandshake()");
if (authHandler != null) {
authHandler.doHandshake(nextFilter);
} else {
if (requestSent) {
// Safety check
throw new ProxyAuthException(
"Authentication request already sent");
}
logger.debug(" sending HTTP request");
// Compute request headers
HttpProxyRequest req = (HttpProxyRequest) getProxyIoSession()
.getRequest();
Map<String, List<String>> headers = req.getHeaders() != null ? req
.getHeaders() : new HashMap<>();
AbstractAuthLogicHandler.addKeepAliveHeaders(headers);
req.setHeaders(headers);
// Write request to the proxy
writeRequest(nextFilter, req);
requestSent = true;
}
} | [
"public",
"void",
"doHandshake",
"(",
"final",
"NextFilter",
"nextFilter",
")",
"throws",
"ProxyAuthException",
"{",
"logger",
".",
"debug",
"(",
"\" doHandshake()\"",
")",
";",
"if",
"(",
"authHandler",
"!=",
"null",
")",
"{",
"authHandler",
".",
"doHandshake",... | Performs the handshake processing.
@param nextFilter the next filter | [
"Performs",
"the",
"handshake",
"processing",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java#L59-L87 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java | DatabaseRepresentation.revertToRevision | public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException,
TTException {
ISession session = null;
INodeWriteTrx wtx = null;
boolean abort = false;
try {
session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY));
wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
wtx.revertTo(backToRevision);
wtx.commit();
} catch (final TTException exce) {
abort = true;
throw new JaxRxException(exce);
} finally {
WorkerHelper.closeWTX(abort, wtx, session);
}
} | java | public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException,
TTException {
ISession session = null;
INodeWriteTrx wtx = null;
boolean abort = false;
try {
session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY));
wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
wtx.revertTo(backToRevision);
wtx.commit();
} catch (final TTException exce) {
abort = true;
throw new JaxRxException(exce);
} finally {
WorkerHelper.closeWTX(abort, wtx, session);
}
} | [
"public",
"void",
"revertToRevision",
"(",
"final",
"String",
"resourceName",
",",
"final",
"long",
"backToRevision",
")",
"throws",
"JaxRxException",
",",
"TTException",
"{",
"ISession",
"session",
"=",
"null",
";",
"INodeWriteTrx",
"wtx",
"=",
"null",
";",
"bo... | This method reverts the latest revision data to the requested.
@param resourceName
The name of the XML resource.
@param backToRevision
The revision value, which has to be set as the latest.
@throws WebApplicationException
@throws TTException | [
"This",
"method",
"reverts",
"the",
"latest",
"revision",
"data",
"to",
"the",
"requested",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java#L609-L625 |
JodaOrg/joda-time | src/main/java/org/joda/time/Period.java | Period.withMillis | public Period withMillis(int millis) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.MILLI_INDEX, values, millis);
return new Period(values, getPeriodType());
} | java | public Period withMillis(int millis) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.MILLI_INDEX, values, millis);
return new Period(values, getPeriodType());
} | [
"public",
"Period",
"withMillis",
"(",
"int",
"millis",
")",
"{",
"int",
"[",
"]",
"values",
"=",
"getValues",
"(",
")",
";",
"// cloned",
"getPeriodType",
"(",
")",
".",
"setIndexedField",
"(",
"this",
",",
"PeriodType",
".",
"MILLI_INDEX",
",",
"values",... | Returns a new period with the specified number of millis.
<p>
This period instance is immutable and unaffected by this method call.
@param millis the amount of millis to add, may be negative
@return the new period with the increased millis
@throws UnsupportedOperationException if the field is not supported | [
"Returns",
"a",
"new",
"period",
"with",
"the",
"specified",
"number",
"of",
"millis",
".",
"<p",
">",
"This",
"period",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1019-L1023 |
PureSolTechnologies/commons | misc/src/main/java/com/puresoltechnologies/commons/misc/progress/AbstractProgressObservable.java | AbstractProgressObservable.fireUpdateWork | protected final void fireUpdateWork(String message, long finished) {
Iterator<WeakReference<ProgressObserver<Observable>>> iterator = observers
.iterator();
while (iterator.hasNext()) {
WeakReference<ProgressObserver<Observable>> weakReference = iterator
.next();
ProgressObserver<Observable> observer = weakReference.get();
if (observer == null) {
observers.remove(weakReference);
} else {
observer.updateWork(observable, message, finished);
}
}
} | java | protected final void fireUpdateWork(String message, long finished) {
Iterator<WeakReference<ProgressObserver<Observable>>> iterator = observers
.iterator();
while (iterator.hasNext()) {
WeakReference<ProgressObserver<Observable>> weakReference = iterator
.next();
ProgressObserver<Observable> observer = weakReference.get();
if (observer == null) {
observers.remove(weakReference);
} else {
observer.updateWork(observable, message, finished);
}
}
} | [
"protected",
"final",
"void",
"fireUpdateWork",
"(",
"String",
"message",
",",
"long",
"finished",
")",
"{",
"Iterator",
"<",
"WeakReference",
"<",
"ProgressObserver",
"<",
"Observable",
">>>",
"iterator",
"=",
"observers",
".",
"iterator",
"(",
")",
";",
"whi... | This method is used to fire the
{@link ProgressObserver#updateWork(Object, String, long)} for all
observers.
@param message
is the message to be broadcasted.
@param finished
is the finished amount since the last call of this method. | [
"This",
"method",
"is",
"used",
"to",
"fire",
"the",
"{",
"@link",
"ProgressObserver#updateWork",
"(",
"Object",
"String",
"long",
")",
"}",
"for",
"all",
"observers",
"."
] | train | https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/progress/AbstractProgressObservable.java#L95-L108 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java | ServerPluginRepository.overrideAndRegisterPlugin | private void overrideAndRegisterPlugin(File sourceFile) {
File destDir = fs.getInstalledPluginsDir();
File destFile = new File(destDir, sourceFile.getName());
if (destFile.exists()) {
// plugin with same filename already installed
deleteQuietly(destFile);
}
try {
moveFile(sourceFile, destFile);
} catch (IOException e) {
throw new IllegalStateException(format("Fail to move plugin: %s to %s",
sourceFile.getAbsolutePath(), destFile.getAbsolutePath()), e);
}
PluginInfo info = PluginInfo.create(destFile);
PluginInfo existing = pluginInfosByKeys.put(info.getKey(), info);
if (existing != null) {
if (!existing.getNonNullJarFile().getName().equals(destFile.getName())) {
deleteQuietly(existing.getNonNullJarFile());
}
LOG.info("Plugin {} [{}] updated to version {}", info.getName(), info.getKey(), info.getVersion());
} else {
LOG.info("Plugin {} [{}] installed", info.getName(), info.getKey());
}
} | java | private void overrideAndRegisterPlugin(File sourceFile) {
File destDir = fs.getInstalledPluginsDir();
File destFile = new File(destDir, sourceFile.getName());
if (destFile.exists()) {
// plugin with same filename already installed
deleteQuietly(destFile);
}
try {
moveFile(sourceFile, destFile);
} catch (IOException e) {
throw new IllegalStateException(format("Fail to move plugin: %s to %s",
sourceFile.getAbsolutePath(), destFile.getAbsolutePath()), e);
}
PluginInfo info = PluginInfo.create(destFile);
PluginInfo existing = pluginInfosByKeys.put(info.getKey(), info);
if (existing != null) {
if (!existing.getNonNullJarFile().getName().equals(destFile.getName())) {
deleteQuietly(existing.getNonNullJarFile());
}
LOG.info("Plugin {} [{}] updated to version {}", info.getName(), info.getKey(), info.getVersion());
} else {
LOG.info("Plugin {} [{}] installed", info.getName(), info.getKey());
}
} | [
"private",
"void",
"overrideAndRegisterPlugin",
"(",
"File",
"sourceFile",
")",
"{",
"File",
"destDir",
"=",
"fs",
".",
"getInstalledPluginsDir",
"(",
")",
";",
"File",
"destFile",
"=",
"new",
"File",
"(",
"destDir",
",",
"sourceFile",
".",
"getName",
"(",
"... | Move or copy plugin to directory extensions/plugins. If a version of this plugin
already exists then it's deleted. | [
"Move",
"or",
"copy",
"plugin",
"to",
"directory",
"extensions",
"/",
"plugins",
".",
"If",
"a",
"version",
"of",
"this",
"plugin",
"already",
"exists",
"then",
"it",
"s",
"deleted",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java#L173-L199 |
bq-development/lib-ws | src/main/java/io/corbel/lib/ws/cli/ServiceRunnerWithVersionResource.java | ServiceRunnerWithVersionResource.configureService | @Override
protected void configureService(Environment environment, ApplicationContext context) {
super.configureService(environment, context);
environment.jersey().register(new ArtifactIdVersionResource(getArtifactId()));
} | java | @Override
protected void configureService(Environment environment, ApplicationContext context) {
super.configureService(environment, context);
environment.jersey().register(new ArtifactIdVersionResource(getArtifactId()));
} | [
"@",
"Override",
"protected",
"void",
"configureService",
"(",
"Environment",
"environment",
",",
"ApplicationContext",
"context",
")",
"{",
"super",
".",
"configureService",
"(",
"environment",
",",
"context",
")",
";",
"environment",
".",
"jersey",
"(",
")",
"... | Subclasses have to call super.configureService(...) to register version resource | [
"Subclasses",
"have",
"to",
"call",
"super",
".",
"configureService",
"(",
"...",
")",
"to",
"register",
"version",
"resource"
] | train | https://github.com/bq-development/lib-ws/blob/2a32235adcbcea961a9b6bc6ebce2629896d177b/src/main/java/io/corbel/lib/ws/cli/ServiceRunnerWithVersionResource.java#L22-L26 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java | PlainChangesLogImpl.createCopy | public static PlainChangesLogImpl createCopy(List<ItemState> items, String pairId, PlainChangesLog originalLog)
{
if (originalLog.getSession() != null)
{
return new PlainChangesLogImpl(items, originalLog.getSession().getId(), originalLog.getEventType(), pairId,
originalLog.getSession());
}
return new PlainChangesLogImpl(items, originalLog.getSessionId(), originalLog.getEventType(), pairId, null);
} | java | public static PlainChangesLogImpl createCopy(List<ItemState> items, String pairId, PlainChangesLog originalLog)
{
if (originalLog.getSession() != null)
{
return new PlainChangesLogImpl(items, originalLog.getSession().getId(), originalLog.getEventType(), pairId,
originalLog.getSession());
}
return new PlainChangesLogImpl(items, originalLog.getSessionId(), originalLog.getEventType(), pairId, null);
} | [
"public",
"static",
"PlainChangesLogImpl",
"createCopy",
"(",
"List",
"<",
"ItemState",
">",
"items",
",",
"String",
"pairId",
",",
"PlainChangesLog",
"originalLog",
")",
"{",
"if",
"(",
"originalLog",
".",
"getSession",
"(",
")",
"!=",
"null",
")",
"{",
"re... | Creates a new instance of {@link PlainChangesLogImpl} by copying metadata from originalLog
instance with Items and PairID provided. Metadata will be copied excluding PairID.
@param items
@param originalLog
@return | [
"Creates",
"a",
"new",
"instance",
"of",
"{",
"@link",
"PlainChangesLogImpl",
"}",
"by",
"copying",
"metadata",
"from",
"originalLog",
"instance",
"with",
"Items",
"and",
"PairID",
"provided",
".",
"Metadata",
"will",
"be",
"copied",
"excluding",
"PairID",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/PlainChangesLogImpl.java#L348-L356 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/redis/Cache.java | Cache.zcount | public Long zcount(Object key, double min, double max) {
Jedis jedis = getJedis();
try {
return jedis.zcount(keyToBytes(key), min, max);
}
finally {close(jedis);}
} | java | public Long zcount(Object key, double min, double max) {
Jedis jedis = getJedis();
try {
return jedis.zcount(keyToBytes(key), min, max);
}
finally {close(jedis);}
} | [
"public",
"Long",
"zcount",
"(",
"Object",
"key",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
";",
"try",
"{",
"return",
"jedis",
".",
"zcount",
"(",
"keyToBytes",
"(",
"key",
")",
",",
"min",
... | 返回有序集 key 中, score 值在 min 和 max 之间(默认包括 score 值等于 min 或 max )的成员的数量。
关于参数 min 和 max 的详细使用方法,请参考 ZRANGEBYSCORE 命令。 | [
"返回有序集",
"key",
"中,",
"score",
"值在",
"min",
"和",
"max",
"之间",
"(",
"默认包括",
"score",
"值等于",
"min",
"或",
"max",
")",
"的成员的数量。",
"关于参数",
"min",
"和",
"max",
"的详细使用方法,请参考",
"ZRANGEBYSCORE",
"命令。"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L1030-L1036 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectMatch | public void expectMatch(String name, String anotherName, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
String anotherValue = Optional.ofNullable(get(anotherName)).orElse("");
if (( StringUtils.isBlank(value) && StringUtils.isBlank(anotherValue) ) || ( StringUtils.isNotBlank(value) && !value.equalsIgnoreCase(anotherValue) )) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.MATCH_KEY.name(), name, anotherName)));
}
} | java | public void expectMatch(String name, String anotherName, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
String anotherValue = Optional.ofNullable(get(anotherName)).orElse("");
if (( StringUtils.isBlank(value) && StringUtils.isBlank(anotherValue) ) || ( StringUtils.isNotBlank(value) && !value.equalsIgnoreCase(anotherValue) )) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.MATCH_KEY.name(), name, anotherName)));
}
} | [
"public",
"void",
"expectMatch",
"(",
"String",
"name",
",",
"String",
"anotherName",
",",
"String",
"message",
")",
"{",
"String",
"value",
"=",
"Optional",
".",
"ofNullable",
"(",
"get",
"(",
"name",
")",
")",
".",
"orElse",
"(",
"\"\"",
")",
";",
"S... | Validates to fields to (case-insensitive) match
@param name The field to check
@param anotherName The field to check against
@param message A custom error message instead of the default one | [
"Validates",
"to",
"fields",
"to",
"(",
"case",
"-",
"insensitive",
")",
"match"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L208-L215 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET | public OvhOvhPabxDialplanExtensionRule billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long ruleId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, ruleId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxDialplanExtensionRule.class);
} | java | public OvhOvhPabxDialplanExtensionRule billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long ruleId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, ruleId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxDialplanExtensionRule.class);
} | [
"public",
"OvhOvhPabxDialplanExtensionRule",
"billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"dialplanId",
",",
"Long",
"extensionId",
",",
"Long",
"ruleId",
... | Get this object properties
REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required]
@param extensionId [required]
@param ruleId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7243-L7248 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java | PostConditionException.validateNull | public static void validateNull( Object object, String identifier )
throws PostConditionException
{
if( object == null )
{
return;
}
throw new PostConditionException( identifier + " was NOT NULL." );
} | java | public static void validateNull( Object object, String identifier )
throws PostConditionException
{
if( object == null )
{
return;
}
throw new PostConditionException( identifier + " was NOT NULL." );
} | [
"public",
"static",
"void",
"validateNull",
"(",
"Object",
"object",
",",
"String",
"identifier",
")",
"throws",
"PostConditionException",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"PostConditionException",
"(",
"ide... | Validates that the object is null.
@param object The object to be validated.
@param identifier The name of the object.
@throws PostConditionException if the object is not null. | [
"Validates",
"that",
"the",
"object",
"is",
"null",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L65-L73 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/validate/ParameterValidator.java | ParameterValidator.assertOne | public void assertOne(final String paramName,
final ParameterList parameters) throws ValidationException {
if (parameters.getParameters(paramName).size() != 1) {
throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {paramName});
}
} | java | public void assertOne(final String paramName,
final ParameterList parameters) throws ValidationException {
if (parameters.getParameters(paramName).size() != 1) {
throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {paramName});
}
} | [
"public",
"void",
"assertOne",
"(",
"final",
"String",
"paramName",
",",
"final",
"ParameterList",
"parameters",
")",
"throws",
"ValidationException",
"{",
"if",
"(",
"parameters",
".",
"getParameters",
"(",
"paramName",
")",
".",
"size",
"(",
")",
"!=",
"1",
... | Ensure a parameter occurs once.
@param paramName
the parameter name
@param parameters
a list of parameters to query
@throws ValidationException
when the specified parameter does not occur once | [
"Ensure",
"a",
"parameter",
"occurs",
"once",
"."
] | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/validate/ParameterValidator.java#L91-L97 |
aequologica/geppaequo | geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java | MethodUtils.getAccessibleMethod | public static Method getAccessibleMethod(
Class<?> clazz,
String methodName,
Class<?>[] parameterTypes) {
try {
MethodDescriptor md = new MethodDescriptor(clazz, methodName, parameterTypes, true);
// Check the cache first
Method method = getCachedMethod(md);
if (method != null) {
return method;
}
method = getAccessibleMethod
(clazz, clazz.getMethod(methodName, parameterTypes));
cacheMethod(md, method);
return method;
} catch (NoSuchMethodException e) {
return (null);
}
} | java | public static Method getAccessibleMethod(
Class<?> clazz,
String methodName,
Class<?>[] parameterTypes) {
try {
MethodDescriptor md = new MethodDescriptor(clazz, methodName, parameterTypes, true);
// Check the cache first
Method method = getCachedMethod(md);
if (method != null) {
return method;
}
method = getAccessibleMethod
(clazz, clazz.getMethod(methodName, parameterTypes));
cacheMethod(md, method);
return method;
} catch (NoSuchMethodException e) {
return (null);
}
} | [
"public",
"static",
"Method",
"getAccessibleMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
")",
"{",
"try",
"{",
"MethodDescriptor",
"md",
"=",
"new",
"MethodDescriptor",
... | <p>Return an accessible method (that is, one that can be invoked via
reflection) with given name and parameters. If no such method
can be found, return <code>null</code>.
This is just a convenient wrapper for
{@link #getAccessibleMethod(Method method)}.</p>
@param clazz get method from this class
@param methodName get method with this name
@param parameterTypes with these parameters types
@return The accessible method | [
"<p",
">",
"Return",
"an",
"accessible",
"method",
"(",
"that",
"is",
"one",
"that",
"can",
"be",
"invoked",
"via",
"reflection",
")",
"with",
"given",
"name",
"and",
"parameters",
".",
"If",
"no",
"such",
"method",
"can",
"be",
"found",
"return",
"<code... | train | https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L727-L747 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxRetentionPolicy.java | BoxRetentionPolicy.createIndefinitePolicy | public static BoxRetentionPolicy.Info createIndefinitePolicy(BoxAPIConnection api, String name) {
return createRetentionPolicy(api, name, TYPE_INDEFINITE, 0, ACTION_REMOVE_RETENTION);
} | java | public static BoxRetentionPolicy.Info createIndefinitePolicy(BoxAPIConnection api, String name) {
return createRetentionPolicy(api, name, TYPE_INDEFINITE, 0, ACTION_REMOVE_RETENTION);
} | [
"public",
"static",
"BoxRetentionPolicy",
".",
"Info",
"createIndefinitePolicy",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"name",
")",
"{",
"return",
"createRetentionPolicy",
"(",
"api",
",",
"name",
",",
"TYPE_INDEFINITE",
",",
"0",
",",
"ACTION_REMOVE_RETENT... | Used to create a new indefinite retention policy.
@param api the API connection to be used by the created user.
@param name the name of the retention policy.
@return the created retention policy's info. | [
"Used",
"to",
"create",
"a",
"new",
"indefinite",
"retention",
"policy",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicy.java#L93-L95 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/FulfillmentInfoUrl.java | FulfillmentInfoUrl.setFulFillmentInfoUrl | public static MozuUrl setFulFillmentInfoUrl(String orderId, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/fulfillmentinfo?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl setFulFillmentInfoUrl(String orderId, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/fulfillmentinfo?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"setFulFillmentInfoUrl",
"(",
"String",
"orderId",
",",
"String",
"responseFields",
",",
"String",
"updateMode",
",",
"String",
"version",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/orders/{o... | Get Resource Url for SetFulFillmentInfo
@param orderId Unique identifier of the order.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."
@param version Determines whether or not to check versioning of items for concurrency purposes.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"SetFulFillmentInfo"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/FulfillmentInfoUrl.java#L40-L48 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Assembly.java | Assembly.addFile | public void addFile(File file, String name) {
files.put(name, file);
// remove duplicate key
if (fileStreams.containsKey(name)) {
fileStreams.remove(name);
}
} | java | public void addFile(File file, String name) {
files.put(name, file);
// remove duplicate key
if (fileStreams.containsKey(name)) {
fileStreams.remove(name);
}
} | [
"public",
"void",
"addFile",
"(",
"File",
"file",
",",
"String",
"name",
")",
"{",
"files",
".",
"put",
"(",
"name",
",",
"file",
")",
";",
"// remove duplicate key",
"if",
"(",
"fileStreams",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"fileStreams"... | Adds a file to your assembly. If the field name specified already exists, it will override the content of the
existing name.
@param file {@link File} the file to be uploaded.
@param name {@link String} the field name of the file when submitted Transloadit. | [
"Adds",
"a",
"file",
"to",
"your",
"assembly",
".",
"If",
"the",
"field",
"name",
"specified",
"already",
"exists",
"it",
"will",
"override",
"the",
"content",
"of",
"the",
"existing",
"name",
"."
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Assembly.java#L57-L64 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/permission/PermissionPrivilegeChecker.java | PermissionPrivilegeChecker.checkProjectAdmin | public static void checkProjectAdmin(UserSession userSession, String organizationUuid, Optional<ProjectId> projectId) {
userSession.checkLoggedIn();
if (userSession.hasPermission(OrganizationPermission.ADMINISTER, organizationUuid)) {
return;
}
if (projectId.isPresent()) {
userSession.checkComponentUuidPermission(UserRole.ADMIN, projectId.get().getUuid());
} else {
throw insufficientPrivilegesException();
}
} | java | public static void checkProjectAdmin(UserSession userSession, String organizationUuid, Optional<ProjectId> projectId) {
userSession.checkLoggedIn();
if (userSession.hasPermission(OrganizationPermission.ADMINISTER, organizationUuid)) {
return;
}
if (projectId.isPresent()) {
userSession.checkComponentUuidPermission(UserRole.ADMIN, projectId.get().getUuid());
} else {
throw insufficientPrivilegesException();
}
} | [
"public",
"static",
"void",
"checkProjectAdmin",
"(",
"UserSession",
"userSession",
",",
"String",
"organizationUuid",
",",
"Optional",
"<",
"ProjectId",
">",
"projectId",
")",
"{",
"userSession",
".",
"checkLoggedIn",
"(",
")",
";",
"if",
"(",
"userSession",
".... | Checks that user is administrator of the specified project, or of the specified organization if project is not
defined.
@throws org.sonar.server.exceptions.ForbiddenException if user is not administrator | [
"Checks",
"that",
"user",
"is",
"administrator",
"of",
"the",
"specified",
"project",
"or",
"of",
"the",
"specified",
"organization",
"if",
"project",
"is",
"not",
"defined",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionPrivilegeChecker.java#L45-L57 |
VoltDB/voltdb | src/frontend/org/voltdb/parser/SQLParser.java | SQLParser.hexDigitsToLong | public static long hexDigitsToLong(String hexDigits) throws SQLParser.Exception {
// BigInteger.longValue() will truncate to the lowest 64 bits,
// so we need to explicitly check if there's too many digits.
if (hexDigits.length() > 16) {
throw new SQLParser.Exception("Too many hexadecimal digits for BIGINT value");
}
if (hexDigits.length() == 0) {
throw new SQLParser.Exception("Zero hexadecimal digits is invalid for BIGINT value");
}
// The method
// Long.parseLong(<digits>, <radix>);
// Doesn't quite do what we want---it expects a '-' to
// indicate negative values, and doesn't want the sign bit set
// in the hex digits.
//
// Once we support Java 1.8, we can use Long.parseUnsignedLong(<digits>, 16)
// instead.
long val = new BigInteger(hexDigits, 16).longValue();
return val;
} | java | public static long hexDigitsToLong(String hexDigits) throws SQLParser.Exception {
// BigInteger.longValue() will truncate to the lowest 64 bits,
// so we need to explicitly check if there's too many digits.
if (hexDigits.length() > 16) {
throw new SQLParser.Exception("Too many hexadecimal digits for BIGINT value");
}
if (hexDigits.length() == 0) {
throw new SQLParser.Exception("Zero hexadecimal digits is invalid for BIGINT value");
}
// The method
// Long.parseLong(<digits>, <radix>);
// Doesn't quite do what we want---it expects a '-' to
// indicate negative values, and doesn't want the sign bit set
// in the hex digits.
//
// Once we support Java 1.8, we can use Long.parseUnsignedLong(<digits>, 16)
// instead.
long val = new BigInteger(hexDigits, 16).longValue();
return val;
} | [
"public",
"static",
"long",
"hexDigitsToLong",
"(",
"String",
"hexDigits",
")",
"throws",
"SQLParser",
".",
"Exception",
"{",
"// BigInteger.longValue() will truncate to the lowest 64 bits,",
"// so we need to explicitly check if there's too many digits.",
"if",
"(",
"hexDigits",
... | Given a string of hex digits, produce a long value, assuming
a 2's complement representation. | [
"Given",
"a",
"string",
"of",
"hex",
"digits",
"produce",
"a",
"long",
"value",
"assuming",
"a",
"2",
"s",
"complement",
"representation",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/parser/SQLParser.java#L1624-L1647 |
matthewhorridge/binaryowl | src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java | BinaryOWLMetadata.checkForNull | private void checkForNull(String name, Object value) {
if(name == null) {
throw new NullPointerException("name must not be null");
}
if(value == null) {
throw new NullPointerException("value must not be null");
}
} | java | private void checkForNull(String name, Object value) {
if(name == null) {
throw new NullPointerException("name must not be null");
}
if(value == null) {
throw new NullPointerException("value must not be null");
}
} | [
"private",
"void",
"checkForNull",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name must not be null\"",
")",
";",
"}",
"if",
"(",
"value",
"==",
"null"... | Checks the name and value of an attibute name/value pair to see if either of them are null. If either is null
a {@link NullPointerException} is thrown.
@param name The name of the attribute to check.
@param value The value of the attribute to check. | [
"Checks",
"the",
"name",
"and",
"value",
"of",
"an",
"attibute",
"name",
"/",
"value",
"pair",
"to",
"see",
"if",
"either",
"of",
"them",
"are",
"null",
".",
"If",
"either",
"is",
"null",
"a",
"{"
] | train | https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L159-L166 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java | FileOutputCommitter.setupJob | public void setupJob(JobContext context) throws IOException {
if (outputPath != null) {
Path tmpDir = new Path(outputPath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fileSys = tmpDir.getFileSystem(context.getConfiguration());
if (!fileSys.mkdirs(tmpDir)) {
LOG.error("Mkdirs failed to create " + tmpDir.toString());
}
}
} | java | public void setupJob(JobContext context) throws IOException {
if (outputPath != null) {
Path tmpDir = new Path(outputPath, FileOutputCommitter.TEMP_DIR_NAME);
FileSystem fileSys = tmpDir.getFileSystem(context.getConfiguration());
if (!fileSys.mkdirs(tmpDir)) {
LOG.error("Mkdirs failed to create " + tmpDir.toString());
}
}
} | [
"public",
"void",
"setupJob",
"(",
"JobContext",
"context",
")",
"throws",
"IOException",
"{",
"if",
"(",
"outputPath",
"!=",
"null",
")",
"{",
"Path",
"tmpDir",
"=",
"new",
"Path",
"(",
"outputPath",
",",
"FileOutputCommitter",
".",
"TEMP_DIR_NAME",
")",
";... | Create the temporary directory that is the root of all of the task
work directories.
@param context the job's context | [
"Create",
"the",
"temporary",
"directory",
"that",
"is",
"the",
"root",
"of",
"all",
"of",
"the",
"task",
"work",
"directories",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/lib/output/FileOutputCommitter.java#L77-L85 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/Clients.java | Clients.newDerivedClient | public static <T> T newDerivedClient(
T client, Function<? super ClientOptions, ClientOptions> configurator) {
final ClientBuilderParams params = builderParams(client);
final ClientBuilder builder = new ClientBuilder(params.uri());
builder.factory(params.factory());
builder.options(configurator.apply(params.options()));
return newDerivedClient(builder, params.clientType());
} | java | public static <T> T newDerivedClient(
T client, Function<? super ClientOptions, ClientOptions> configurator) {
final ClientBuilderParams params = builderParams(client);
final ClientBuilder builder = new ClientBuilder(params.uri());
builder.factory(params.factory());
builder.options(configurator.apply(params.options()));
return newDerivedClient(builder, params.clientType());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newDerivedClient",
"(",
"T",
"client",
",",
"Function",
"<",
"?",
"super",
"ClientOptions",
",",
"ClientOptions",
">",
"configurator",
")",
"{",
"final",
"ClientBuilderParams",
"params",
"=",
"builderParams",
"(",
"clie... | Creates a new derived client that connects to the same {@link URI} with the specified {@code client}
but with different {@link ClientOption}s. For example:
<pre>{@code
HttpClient derivedHttpClient = Clients.newDerivedClient(httpClient, options -> {
ClientOptionsBuilder builder = new ClientOptionsBuilder(options);
builder.decorator(...); // Add a decorator.
builder.addHttpHeader(...); // Add an HTTP header.
return builder.build();
});
}</pre>
@param configurator a {@link Function} whose input is the original {@link ClientOptions} of the client
being derived from and whose output is the {@link ClientOptions} of the new derived
client
@see ClientBuilder ClientBuilder, for more information about how the base options and
additional options are merged when a derived client is created.
@see ClientOptionsBuilder | [
"Creates",
"a",
"new",
"derived",
"client",
"that",
"connects",
"to",
"the",
"same",
"{",
"@link",
"URI",
"}",
"with",
"the",
"specified",
"{",
"@code",
"client",
"}",
"but",
"with",
"different",
"{",
"@link",
"ClientOption",
"}",
"s",
".",
"For",
"examp... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/Clients.java#L220-L228 |
forge/furnace | manager/impl/src/main/java/org/jboss/forge/furnace/manager/impl/AddonManagerImpl.java | AddonManagerImpl.collectRequiredAddons | private void collectRequiredAddons(AddonInfo addonInfo, List<AddonInfo> addons)
{
// Move this addon to the top of the list
addons.remove(addonInfo);
addons.add(0, addonInfo);
for (AddonId addonId : addonInfo.getRequiredAddons())
{
if (!addons.contains(addonId) && (!isDeployed(addonId) || !isEnabled(addonId)))
{
AddonInfo childInfo = info(addonId);
collectRequiredAddons(childInfo, addons);
}
}
} | java | private void collectRequiredAddons(AddonInfo addonInfo, List<AddonInfo> addons)
{
// Move this addon to the top of the list
addons.remove(addonInfo);
addons.add(0, addonInfo);
for (AddonId addonId : addonInfo.getRequiredAddons())
{
if (!addons.contains(addonId) && (!isDeployed(addonId) || !isEnabled(addonId)))
{
AddonInfo childInfo = info(addonId);
collectRequiredAddons(childInfo, addons);
}
}
} | [
"private",
"void",
"collectRequiredAddons",
"(",
"AddonInfo",
"addonInfo",
",",
"List",
"<",
"AddonInfo",
">",
"addons",
")",
"{",
"// Move this addon to the top of the list",
"addons",
".",
"remove",
"(",
"addonInfo",
")",
";",
"addons",
".",
"add",
"(",
"0",
"... | Collect all required addons for a specific addon.
It traverses the whole graph
@param addonInfo
@param addons | [
"Collect",
"all",
"required",
"addons",
"for",
"a",
"specific",
"addon",
"."
] | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/manager/impl/src/main/java/org/jboss/forge/furnace/manager/impl/AddonManagerImpl.java#L256-L269 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.setCertificateIssuerAsync | public Observable<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider) {
return setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider).map(new Func1<ServiceResponse<IssuerBundle>, IssuerBundle>() {
@Override
public IssuerBundle call(ServiceResponse<IssuerBundle> response) {
return response.body();
}
});
} | java | public Observable<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider) {
return setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider).map(new Func1<ServiceResponse<IssuerBundle>, IssuerBundle>() {
@Override
public IssuerBundle call(ServiceResponse<IssuerBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IssuerBundle",
">",
"setCertificateIssuerAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
",",
"String",
"provider",
")",
"{",
"return",
"setCertificateIssuerWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"issuerName"... | Sets the specified certificate issuer.
The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@param provider The issuer provider.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IssuerBundle object | [
"Sets",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"SetCertificateIssuer",
"operation",
"adds",
"or",
"updates",
"the",
"specified",
"certificate",
"issuer",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"setissuers",
"permission",
... | 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#L5929-L5936 |
MKLab-ITI/simmo | src/main/java/gr/iti/mklab/simmo/core/morphia/ObjectDAO.java | ObjectDAO.createdInPeriod | public List<O> createdInPeriod(Date start, Date end, int numObjects) {
return findByDate("creationDate", start, end, numObjects, true);
} | java | public List<O> createdInPeriod(Date start, Date end, int numObjects) {
return findByDate("creationDate", start, end, numObjects, true);
} | [
"public",
"List",
"<",
"O",
">",
"createdInPeriod",
"(",
"Date",
"start",
",",
"Date",
"end",
",",
"int",
"numObjects",
")",
"{",
"return",
"findByDate",
"(",
"\"creationDate\"",
",",
"start",
",",
"end",
",",
"numObjects",
",",
"true",
")",
";",
"}"
] | Returns a list of images created in the time period specified by start and end
@param start
@param end
@param numObjects
@return | [
"Returns",
"a",
"list",
"of",
"images",
"created",
"in",
"the",
"time",
"period",
"specified",
"by",
"start",
"and",
"end"
] | train | https://github.com/MKLab-ITI/simmo/blob/a78436e982e160fb0260746c563c7e4d24736486/src/main/java/gr/iti/mklab/simmo/core/morphia/ObjectDAO.java#L93-L95 |
jpmml/jpmml-evaluator | pmml-evaluator/src/main/java/org/jpmml/evaluator/FunctionRegistry.java | FunctionRegistry.putFunction | static
public void putFunction(String name, Function function){
FunctionRegistry.functions.put(Objects.requireNonNull(name), function);
} | java | static
public void putFunction(String name, Function function){
FunctionRegistry.functions.put(Objects.requireNonNull(name), function);
} | [
"static",
"public",
"void",
"putFunction",
"(",
"String",
"name",
",",
"Function",
"function",
")",
"{",
"FunctionRegistry",
".",
"functions",
".",
"put",
"(",
"Objects",
".",
"requireNonNull",
"(",
"name",
")",
",",
"function",
")",
";",
"}"
] | <p>
Registers a function by a name other than its default name.
</p> | [
"<p",
">",
"Registers",
"a",
"function",
"by",
"a",
"name",
"other",
"than",
"its",
"default",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/jpmml/jpmml-evaluator/blob/ac8a48775877b6fa9dbc5f259871f3278489cc61/pmml-evaluator/src/main/java/org/jpmml/evaluator/FunctionRegistry.java#L101-L104 |
leadware/jpersistence-tools | jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java | RestrictionsContainer.addNotLike | public RestrictionsContainer addNotLike(String property, String value) {
// Ajout de la restriction
restrictions.add(new NotLike(property, value));
// On retourne le conteneur
return this;
} | java | public RestrictionsContainer addNotLike(String property, String value) {
// Ajout de la restriction
restrictions.add(new NotLike(property, value));
// On retourne le conteneur
return this;
} | [
"public",
"RestrictionsContainer",
"addNotLike",
"(",
"String",
"property",
",",
"String",
"value",
")",
"{",
"// Ajout de la restriction\r",
"restrictions",
".",
"add",
"(",
"new",
"NotLike",
"(",
"property",
",",
"value",
")",
")",
";",
"// On retourne le conteneu... | Methode d'ajout de la restriction NotLike
@param property Nom de la Propriete
@param value Valeur de la propriete
@return Conteneur | [
"Methode",
"d",
"ajout",
"de",
"la",
"restriction",
"NotLike"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L183-L190 |
sahan/DroidBallet | droidballet/src/main/java/com/lonepulse/droidballet/widget/LinearMotionListView.java | LinearMotionListView.initAttributes | private void initAttributes(Context context, AttributeSet attributeSet) {
TypedArray typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.MotionView);
friction = typedArray.getFloat(R.styleable.MotionView_friction, 0.75f) * 1000;
typedArray.recycle();
} | java | private void initAttributes(Context context, AttributeSet attributeSet) {
TypedArray typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.MotionView);
friction = typedArray.getFloat(R.styleable.MotionView_friction, 0.75f) * 1000;
typedArray.recycle();
} | [
"private",
"void",
"initAttributes",
"(",
"Context",
"context",
",",
"AttributeSet",
"attributeSet",
")",
"{",
"TypedArray",
"typedArray",
"=",
"context",
".",
"obtainStyledAttributes",
"(",
"attributeSet",
",",
"R",
".",
"styleable",
".",
"MotionView",
")",
";",
... | <p>Initializes the view with the custom attributes which were declared
in the XML layout. This
@param context
the {@link Context} in which this component is instantiated
@param attributeSet
the {@link AttributeSet} given in the layout declaration | [
"<p",
">",
"Initializes",
"the",
"view",
"with",
"the",
"custom",
"attributes",
"which",
"were",
"declared",
"in",
"the",
"XML",
"layout",
".",
"This"
] | train | https://github.com/sahan/DroidBallet/blob/c6001c9e933cb2c8dbcabe1ae561678b31b10b62/droidballet/src/main/java/com/lonepulse/droidballet/widget/LinearMotionListView.java#L109-L116 |
opencb/java-common-libs | commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java | SolrManager.createCollection | public void createCollection(String collectionName, String configSet) throws SolrException {
logger.debug("Creating collection: host={}, collection={}, config={}, numShards={}, numReplicas={}",
host, collectionName, configSet, 1, 1);
try {
CollectionAdminRequest request = CollectionAdminRequest.createCollection(collectionName, configSet, 1, 1);
request.process(solrClient);
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
} | java | public void createCollection(String collectionName, String configSet) throws SolrException {
logger.debug("Creating collection: host={}, collection={}, config={}, numShards={}, numReplicas={}",
host, collectionName, configSet, 1, 1);
try {
CollectionAdminRequest request = CollectionAdminRequest.createCollection(collectionName, configSet, 1, 1);
request.process(solrClient);
} catch (Exception e) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
} | [
"public",
"void",
"createCollection",
"(",
"String",
"collectionName",
",",
"String",
"configSet",
")",
"throws",
"SolrException",
"{",
"logger",
".",
"debug",
"(",
"\"Creating collection: host={}, collection={}, config={}, numShards={}, numReplicas={}\"",
",",
"host",
",",
... | Create a Solr collection from a configuration directory. The configuration has to be uploaded to the zookeeper,
$ ./bin/solr zk upconfig -n <config name> -d <path to the config dir> -z <host:port zookeeper>.
For Solr, collection name, configuration name and number of shards are mandatory in order to create a collection.
Number of replicas is optional.
@param collectionName Collection name
@param configSet Configuration name
@throws SolrException Exception | [
"Create",
"a",
"Solr",
"collection",
"from",
"a",
"configuration",
"directory",
".",
"The",
"configuration",
"has",
"to",
"be",
"uploaded",
"to",
"the",
"zookeeper",
"$",
".",
"/",
"bin",
"/",
"solr",
"zk",
"upconfig",
"-",
"n",
"<config",
"name",
">",
"... | train | https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java#L158-L167 |
cdk/cdk | tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/MMFF94ParametersCall.java | MMFF94ParametersCall.getBondData | public List getBondData(String code, String id1, String id2) throws Exception {
String dkey = "";
if (pSet.containsKey(("bond" + code + ";" + id1 + ";" + id2))) {
dkey = "bond" + code + ";" + id1 + ";" + id2;
} else if (pSet.containsKey(("bond" + code + ";" + id2 + ";" + id1))) {
dkey = "bond" + code + ";" + id2 + ";" + id1;
} /*
* else { System.out.println("KEYError:Unknown distance key in pSet: "
* + code + ";" + id2 + " ;" + id1+" take default bon length:" +
* DEFAULT_BOND_LENGTH); return DEFAULT_BOND_LENGTH; }
*/
//logger.debug("dkey = " + dkey);
return (List) pSet.get(dkey);
} | java | public List getBondData(String code, String id1, String id2) throws Exception {
String dkey = "";
if (pSet.containsKey(("bond" + code + ";" + id1 + ";" + id2))) {
dkey = "bond" + code + ";" + id1 + ";" + id2;
} else if (pSet.containsKey(("bond" + code + ";" + id2 + ";" + id1))) {
dkey = "bond" + code + ";" + id2 + ";" + id1;
} /*
* else { System.out.println("KEYError:Unknown distance key in pSet: "
* + code + ";" + id2 + " ;" + id1+" take default bon length:" +
* DEFAULT_BOND_LENGTH); return DEFAULT_BOND_LENGTH; }
*/
//logger.debug("dkey = " + dkey);
return (List) pSet.get(dkey);
} | [
"public",
"List",
"getBondData",
"(",
"String",
"code",
",",
"String",
"id1",
",",
"String",
"id2",
")",
"throws",
"Exception",
"{",
"String",
"dkey",
"=",
"\"\"",
";",
"if",
"(",
"pSet",
".",
"containsKey",
"(",
"(",
"\"bond\"",
"+",
"code",
"+",
"\";... | Gets the bond parameter set.
@param id1 atom1 id
@param id2 atom2 id
@return The distance value from the force field parameter set
@exception Exception Description of the Exception | [
"Gets",
"the",
"bond",
"parameter",
"set",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/MMFF94ParametersCall.java#L41-L54 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnImplCodeGen.java | ConnImplCodeGen.writeClassBody | @Override
public void writeClassBody(Definition def, Writer out) throws IOException
{
out.write("public class " + getClassName(def) + " implements " +
def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass());
writeLeftCurlyBracket(out, 0);
int indent = 1;
writeWithIndent(out, indent, "/** The logger */\n");
writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n");
writeWithIndent(out, indent, "/** ManagedConnection */\n");
writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc;\n\n");
writeWithIndent(out, indent, "/** ManagedConnectionFactory */\n");
writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf;\n\n");
//constructor
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Default constructor\n");
writeWithIndent(out, indent, " * @param mc " + def.getMcfDefs().get(getNumOfMcf()).getMcClass());
writeEol(out);
writeWithIndent(out, indent, " * @param mcf " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass());
writeEol(out);
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "public " + getClassName(def) + "(" +
def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc, " +
def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf)");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "this.mc = mc;\n");
writeWithIndent(out, indent + 1, "this.mcf = mcf;");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeMethod(def, out, indent);
writeRightCurlyBracket(out, 0);
} | java | @Override
public void writeClassBody(Definition def, Writer out) throws IOException
{
out.write("public class " + getClassName(def) + " implements " +
def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass());
writeLeftCurlyBracket(out, 0);
int indent = 1;
writeWithIndent(out, indent, "/** The logger */\n");
writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n");
writeWithIndent(out, indent, "/** ManagedConnection */\n");
writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc;\n\n");
writeWithIndent(out, indent, "/** ManagedConnectionFactory */\n");
writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf;\n\n");
//constructor
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Default constructor\n");
writeWithIndent(out, indent, " * @param mc " + def.getMcfDefs().get(getNumOfMcf()).getMcClass());
writeEol(out);
writeWithIndent(out, indent, " * @param mcf " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass());
writeEol(out);
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "public " + getClassName(def) + "(" +
def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc, " +
def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf)");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "this.mc = mc;\n");
writeWithIndent(out, indent + 1, "this.mcf = mcf;");
writeRightCurlyBracket(out, indent);
writeEol(out);
writeMethod(def, out, indent);
writeRightCurlyBracket(out, 0);
} | [
"@",
"Override",
"public",
"void",
"writeClassBody",
"(",
"Definition",
"def",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"\"public class \"",
"+",
"getClassName",
"(",
"def",
")",
"+",
"\" implements \"",
"+",
"def",
... | Output class
@param def definition
@param out Writer
@throws IOException ioException | [
"Output",
"class"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnImplCodeGen.java#L46-L83 |
korpling/ANNIS | annis-libgui/src/main/java/annis/libgui/Helper.java | Helper.createRESTClient | public static Client createRESTClient(String userName, String password)
{
DefaultApacheHttpClient4Config rc = new DefaultApacheHttpClient4Config();
rc.getClasses().add(SaltProjectProvider.class);
ThreadSafeClientConnManager clientConnMgr = new ThreadSafeClientConnManager();
clientConnMgr.setDefaultMaxPerRoute(10);
rc.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER,
clientConnMgr);
if (userName != null && password != null)
{
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(userName, password));
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER,
credentialsProvider);
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION,
true);
}
Client c = ApacheHttpClient4.create(rc);
return c;
} | java | public static Client createRESTClient(String userName, String password)
{
DefaultApacheHttpClient4Config rc = new DefaultApacheHttpClient4Config();
rc.getClasses().add(SaltProjectProvider.class);
ThreadSafeClientConnManager clientConnMgr = new ThreadSafeClientConnManager();
clientConnMgr.setDefaultMaxPerRoute(10);
rc.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER,
clientConnMgr);
if (userName != null && password != null)
{
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(userName, password));
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER,
credentialsProvider);
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION,
true);
}
Client c = ApacheHttpClient4.create(rc);
return c;
} | [
"public",
"static",
"Client",
"createRESTClient",
"(",
"String",
"userName",
",",
"String",
"password",
")",
"{",
"DefaultApacheHttpClient4Config",
"rc",
"=",
"new",
"DefaultApacheHttpClient4Config",
"(",
")",
";",
"rc",
".",
"getClasses",
"(",
")",
".",
"add",
... | Creates an authentificiated REST client
@param userName
@param password
@return A newly created client. | [
"Creates",
"an",
"authentificiated",
"REST",
"client"
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-libgui/src/main/java/annis/libgui/Helper.java#L153-L181 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussTopicsApi.java | GroupsDiscussTopicsApi.getList | public Topics getList(String groupId, int perPage, int page, boolean sign) throws JinxException {
JinxUtils.validateParams(groupId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.discuss.topics.getList");
params.put("group_id", groupId);
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Topics.class, sign);
} | java | public Topics getList(String groupId, int perPage, int page, boolean sign) throws JinxException {
JinxUtils.validateParams(groupId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.discuss.topics.getList");
params.put("group_id", groupId);
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Topics.class, sign);
} | [
"public",
"Topics",
"getList",
"(",
"String",
"groupId",
",",
"int",
"perPage",
",",
"int",
"page",
",",
"boolean",
"sign",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"groupId",
")",
";",
"Map",
"<",
"String",
",",
"Strin... | Get a list of discussion topics in a group.
<br>
This method does not require authentication. Unsigned requests can only see public topics.
@param groupId (Required) The NSID of the group to fetch information for.
@param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100.
The maximum allowed value is 500.
@param page The page of results to return. If this argument is less than 1, it defaults to 1.
@param sign if true, the request will be signed.
@return object with topic metadata and a list of topics.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.groups.discuss.topics.getList.html">flickr.groups.discuss.topics.getList</a> | [
"Get",
"a",
"list",
"of",
"discussion",
"topics",
"in",
"a",
"group",
".",
"<br",
">",
"This",
"method",
"does",
"not",
"require",
"authentication",
".",
"Unsigned",
"requests",
"can",
"only",
"see",
"public",
"topics",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussTopicsApi.java#L100-L112 |
google/closure-templates | java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java | GenIncrementalDomCodeVisitor.generateIncrementalDomRenderCalls | private Statement generateIncrementalDomRenderCalls(TemplateNode node, String alias) {
IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder();
boolean isTextTemplate = isTextContent(node.getContentKind());
Statement typeChecks = genParamTypeChecks(node, alias);
// Note: we do not try to combine this into a single return statement if the content is
// computable as a JsExpr. A JavaScript compiler, such as Closure Compiler, is able to perform
// the transformation.
if (isTextTemplate) {
// We do our own initialization below, so mark it as such.
jsCodeBuilder.pushOutputVar("output").setOutputVarInited();
}
Statement body = visitChildrenReturningCodeChunk(node);
if (isTextTemplate) {
VariableDeclaration declare =
VariableDeclaration.builder("output").setRhs(LITERAL_EMPTY_STRING).build();
jsCodeBuilder.popOutputVar();
body =
Statement.of(declare, body, returnValue(sanitize(declare.ref(), node.getContentKind())));
}
return Statement.of(typeChecks, body);
} | java | private Statement generateIncrementalDomRenderCalls(TemplateNode node, String alias) {
IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder();
boolean isTextTemplate = isTextContent(node.getContentKind());
Statement typeChecks = genParamTypeChecks(node, alias);
// Note: we do not try to combine this into a single return statement if the content is
// computable as a JsExpr. A JavaScript compiler, such as Closure Compiler, is able to perform
// the transformation.
if (isTextTemplate) {
// We do our own initialization below, so mark it as such.
jsCodeBuilder.pushOutputVar("output").setOutputVarInited();
}
Statement body = visitChildrenReturningCodeChunk(node);
if (isTextTemplate) {
VariableDeclaration declare =
VariableDeclaration.builder("output").setRhs(LITERAL_EMPTY_STRING).build();
jsCodeBuilder.popOutputVar();
body =
Statement.of(declare, body, returnValue(sanitize(declare.ref(), node.getContentKind())));
}
return Statement.of(typeChecks, body);
} | [
"private",
"Statement",
"generateIncrementalDomRenderCalls",
"(",
"TemplateNode",
"node",
",",
"String",
"alias",
")",
"{",
"IncrementalDomCodeBuilder",
"jsCodeBuilder",
"=",
"getJsCodeBuilder",
"(",
")",
";",
"boolean",
"isTextTemplate",
"=",
"isTextContent",
"(",
"nod... | Generates idom#elementOpen, idom#elementClose, etc. function calls for the given node. | [
"Generates",
"idom#elementOpen",
"idom#elementClose",
"etc",
".",
"function",
"calls",
"for",
"the",
"given",
"node",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java#L355-L377 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/PHPSimilarText.java | PHPSimilarText.similarityPercentage | public static double similarityPercentage(String txt1, String txt2) {
double sim = similarityChars(txt1, txt2);
return sim * 200.0 / (txt1.length() + txt2.length());
} | java | public static double similarityPercentage(String txt1, String txt2) {
double sim = similarityChars(txt1, txt2);
return sim * 200.0 / (txt1.length() + txt2.length());
} | [
"public",
"static",
"double",
"similarityPercentage",
"(",
"String",
"txt1",
",",
"String",
"txt2",
")",
"{",
"double",
"sim",
"=",
"similarityChars",
"(",
"txt1",
",",
"txt2",
")",
";",
"return",
"sim",
"*",
"200.0",
"/",
"(",
"txt1",
".",
"length",
"("... | Checks the similarity of two strings and returns their similarity percentage.
@param txt1
@param txt2
@return | [
"Checks",
"the",
"similarity",
"of",
"two",
"strings",
"and",
"returns",
"their",
"similarity",
"percentage",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/PHPSimilarText.java#L79-L82 |
rometools/rome | rome/src/main/java/com/rometools/rome/io/impl/Atom10Parser.java | Atom10Parser.findAtomLink | private String findAtomLink(final Element parent, final String rel) {
String ret = null;
final List<Element> linksList = parent.getChildren("link", ATOM_10_NS);
if (linksList != null) {
for (final Element element : linksList) {
final Element link = element;
final Attribute relAtt = getAttribute(link, "rel");
final Attribute hrefAtt = getAttribute(link, "href");
if (relAtt == null && "alternate".equals(rel) || relAtt != null && relAtt.getValue().equals(rel)) {
ret = hrefAtt.getValue();
break;
}
}
}
return ret;
} | java | private String findAtomLink(final Element parent, final String rel) {
String ret = null;
final List<Element> linksList = parent.getChildren("link", ATOM_10_NS);
if (linksList != null) {
for (final Element element : linksList) {
final Element link = element;
final Attribute relAtt = getAttribute(link, "rel");
final Attribute hrefAtt = getAttribute(link, "href");
if (relAtt == null && "alternate".equals(rel) || relAtt != null && relAtt.getValue().equals(rel)) {
ret = hrefAtt.getValue();
break;
}
}
}
return ret;
} | [
"private",
"String",
"findAtomLink",
"(",
"final",
"Element",
"parent",
",",
"final",
"String",
"rel",
")",
"{",
"String",
"ret",
"=",
"null",
";",
"final",
"List",
"<",
"Element",
">",
"linksList",
"=",
"parent",
".",
"getChildren",
"(",
"\"link\"",
",",
... | Return URL string of Atom link element under parent element. Link with no rel attribute is
considered to be rel="alternate"
@param parent Consider only children of this parent element
@param rel Consider only links with this relationship | [
"Return",
"URL",
"string",
"of",
"Atom",
"link",
"element",
"under",
"parent",
"element",
".",
"Link",
"with",
"no",
"rel",
"attribute",
"is",
"considered",
"to",
"be",
"rel",
"=",
"alternate"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/Atom10Parser.java#L622-L637 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/vfs/VfsUtility.java | VfsUtility.configHttpFileSystemProxy | static public void configHttpFileSystemProxy(FileSystemOptions fsOptions,
String webProxyHost, Integer webProxyPort, String webProxyUserName, String webProxyPassword){
if (webProxyHost != null && webProxyPort != null){
HttpFileSystemConfigBuilder.getInstance().setProxyHost(fsOptions, webProxyHost);
HttpFileSystemConfigBuilder.getInstance().setProxyPort(fsOptions, webProxyPort);
if (webProxyUserName != null){
StaticUserAuthenticator auth = new StaticUserAuthenticator(webProxyUserName, webProxyPassword, null);
HttpFileSystemConfigBuilder.getInstance().setProxyAuthenticator(fsOptions, auth);
}
}
} | java | static public void configHttpFileSystemProxy(FileSystemOptions fsOptions,
String webProxyHost, Integer webProxyPort, String webProxyUserName, String webProxyPassword){
if (webProxyHost != null && webProxyPort != null){
HttpFileSystemConfigBuilder.getInstance().setProxyHost(fsOptions, webProxyHost);
HttpFileSystemConfigBuilder.getInstance().setProxyPort(fsOptions, webProxyPort);
if (webProxyUserName != null){
StaticUserAuthenticator auth = new StaticUserAuthenticator(webProxyUserName, webProxyPassword, null);
HttpFileSystemConfigBuilder.getInstance().setProxyAuthenticator(fsOptions, auth);
}
}
} | [
"static",
"public",
"void",
"configHttpFileSystemProxy",
"(",
"FileSystemOptions",
"fsOptions",
",",
"String",
"webProxyHost",
",",
"Integer",
"webProxyPort",
",",
"String",
"webProxyUserName",
",",
"String",
"webProxyPassword",
")",
"{",
"if",
"(",
"webProxyHost",
"!... | Configure FileSystemOptions for HttpFileSystem
@param fsOptions
@param webProxyHost
@param webProxyPort
@param webProxyUserName
@param webProxyPassword | [
"Configure",
"FileSystemOptions",
"for",
"HttpFileSystem"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/vfs/VfsUtility.java#L119-L130 |
IBM-Cloud/gp-java-client | src/main/java/com/ibm/g11n/pipeline/client/rb/CloudResourceBundleControl.java | CloudResourceBundleControl.getInstance | public static CloudResourceBundleControl getInstance(ServiceAccount serviceAccount, LookupMode mode) {
return getInstance(serviceAccount, initCacheExpiration(), null, null, null, mode);
} | java | public static CloudResourceBundleControl getInstance(ServiceAccount serviceAccount, LookupMode mode) {
return getInstance(serviceAccount, initCacheExpiration(), null, null, null, mode);
} | [
"public",
"static",
"CloudResourceBundleControl",
"getInstance",
"(",
"ServiceAccount",
"serviceAccount",
",",
"LookupMode",
"mode",
")",
"{",
"return",
"getInstance",
"(",
"serviceAccount",
",",
"initCacheExpiration",
"(",
")",
",",
"null",
",",
"null",
",",
"null"... | Create an instance of <code>CloudResourceBundleControl</code> with the specified
service account.
@param serviceAccount The service account.
@param mode The resource bundle resolution mode, or null for default mode
({@link LookupMode#REMOTE_THEN_LOCAL}).
@return An instance of CloundResourceBundleControl.
@throws IllegalArgumentException when serviceAccount is null. | [
"Create",
"an",
"instance",
"of",
"<code",
">",
"CloudResourceBundleControl<",
"/",
"code",
">",
"with",
"the",
"specified",
"service",
"account",
"."
] | train | https://github.com/IBM-Cloud/gp-java-client/blob/b015a081d7a7313bc48c448087fbc07bce860427/src/main/java/com/ibm/g11n/pipeline/client/rb/CloudResourceBundleControl.java#L205-L207 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/Comments.java | Comments.getNextNodeOrParent | private static Tree getNextNodeOrParent(Tree current, VisitorState state) {
Tree predecessorNode = current;
TreePath enclosingPath = state.getPath();
while (enclosingPath != null
&& !(enclosingPath.getLeaf() instanceof BlockTree)
&& !(enclosingPath.getLeaf() instanceof ClassTree)) {
predecessorNode = enclosingPath.getLeaf();
enclosingPath = enclosingPath.getParentPath();
}
if (enclosingPath == null) {
return state.getPath().getParentPath().getLeaf();
}
Tree parent = enclosingPath.getLeaf();
if (parent instanceof BlockTree) {
return after(predecessorNode, ((BlockTree) parent).getStatements(), parent);
} else if (parent instanceof ClassTree) {
return after(predecessorNode, ((ClassTree) parent).getMembers(), parent);
}
return parent;
} | java | private static Tree getNextNodeOrParent(Tree current, VisitorState state) {
Tree predecessorNode = current;
TreePath enclosingPath = state.getPath();
while (enclosingPath != null
&& !(enclosingPath.getLeaf() instanceof BlockTree)
&& !(enclosingPath.getLeaf() instanceof ClassTree)) {
predecessorNode = enclosingPath.getLeaf();
enclosingPath = enclosingPath.getParentPath();
}
if (enclosingPath == null) {
return state.getPath().getParentPath().getLeaf();
}
Tree parent = enclosingPath.getLeaf();
if (parent instanceof BlockTree) {
return after(predecessorNode, ((BlockTree) parent).getStatements(), parent);
} else if (parent instanceof ClassTree) {
return after(predecessorNode, ((ClassTree) parent).getMembers(), parent);
}
return parent;
} | [
"private",
"static",
"Tree",
"getNextNodeOrParent",
"(",
"Tree",
"current",
",",
"VisitorState",
"state",
")",
"{",
"Tree",
"predecessorNode",
"=",
"current",
";",
"TreePath",
"enclosingPath",
"=",
"state",
".",
"getPath",
"(",
")",
";",
"while",
"(",
"enclosi... | Find the node which (approximately) follows this one in the tree. This works by walking upwards
to find enclosing block (or class) and then looking for the node after the subtree we walked.
If our subtree is the last of the block then we return the node for the block instead, if we
can't find a suitable block we return the parent node. | [
"Find",
"the",
"node",
"which",
"(",
"approximately",
")",
"follows",
"this",
"one",
"in",
"the",
"tree",
".",
"This",
"works",
"by",
"walking",
"upwards",
"to",
"find",
"enclosing",
"block",
"(",
"or",
"class",
")",
"and",
"then",
"looking",
"for",
"the... | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/Comments.java#L268-L290 |
cdk/cdk | base/dict/src/main/java/org/openscience/cdk/dict/DictionaryDatabase.java | DictionaryDatabase.hasEntry | public boolean hasEntry(String dictName, String entryID) {
if (hasDictionary(dictName)) {
Dictionary dictionary = (Dictionary) dictionaries.get(dictName);
return dictionary.hasEntry(entryID.toLowerCase());
} else {
return false;
}
} | java | public boolean hasEntry(String dictName, String entryID) {
if (hasDictionary(dictName)) {
Dictionary dictionary = (Dictionary) dictionaries.get(dictName);
return dictionary.hasEntry(entryID.toLowerCase());
} else {
return false;
}
} | [
"public",
"boolean",
"hasEntry",
"(",
"String",
"dictName",
",",
"String",
"entryID",
")",
"{",
"if",
"(",
"hasDictionary",
"(",
"dictName",
")",
")",
"{",
"Dictionary",
"dictionary",
"=",
"(",
"Dictionary",
")",
"dictionaries",
".",
"get",
"(",
"dictName",
... | Returns true if the given dictionary contains the given
entry. | [
"Returns",
"true",
"if",
"the",
"given",
"dictionary",
"contains",
"the",
"given",
"entry",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/dict/src/main/java/org/openscience/cdk/dict/DictionaryDatabase.java#L186-L193 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java | UnboundMethodTemplateParameter.isTemplateParent | private boolean isTemplateParent(String templateType, TemplateItem... items) {
for (TemplateItem item : items) {
if (templateType.equals(item.templateExtension)) {
return true;
}
}
return false;
} | java | private boolean isTemplateParent(String templateType, TemplateItem... items) {
for (TemplateItem item : items) {
if (templateType.equals(item.templateExtension)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"isTemplateParent",
"(",
"String",
"templateType",
",",
"TemplateItem",
"...",
"items",
")",
"{",
"for",
"(",
"TemplateItem",
"item",
":",
"items",
")",
"{",
"if",
"(",
"templateType",
".",
"equals",
"(",
"item",
".",
"templateExtension",... | looks to see if this templateType is a parent of another template type
@param templateType
the type to look for
@param items
the items to search
@return whether this template type is something another template type extends | [
"looks",
"to",
"see",
"if",
"this",
"templateType",
"is",
"a",
"parent",
"of",
"another",
"template",
"type"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java#L110-L118 |
wisdom-framework/wisdom | framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java | InternationalizationServiceSingleton.removedBundle | @Override
public void removedBundle(Bundle bundle, BundleEvent event, List<I18nExtension> list) {
String current = Long.toString(System.currentTimeMillis());
for (I18nExtension extension : list) {
synchronized (this) {
extensions.remove(extension);
etags.put(extension.locale(), current);
}
}
LOGGER.info("Bundle {} ({}) does not offer the {} resource bundle(s) anymore",
bundle.getSymbolicName(), bundle.getBundleId(), list.size());
} | java | @Override
public void removedBundle(Bundle bundle, BundleEvent event, List<I18nExtension> list) {
String current = Long.toString(System.currentTimeMillis());
for (I18nExtension extension : list) {
synchronized (this) {
extensions.remove(extension);
etags.put(extension.locale(), current);
}
}
LOGGER.info("Bundle {} ({}) does not offer the {} resource bundle(s) anymore",
bundle.getSymbolicName(), bundle.getBundleId(), list.size());
} | [
"@",
"Override",
"public",
"void",
"removedBundle",
"(",
"Bundle",
"bundle",
",",
"BundleEvent",
"event",
",",
"List",
"<",
"I18nExtension",
">",
"list",
")",
"{",
"String",
"current",
"=",
"Long",
".",
"toString",
"(",
"System",
".",
"currentTimeMillis",
"(... | A bundle tracked by the {@code BundleTracker} has been removed.
<p/>
<p/>
This method is called after a bundle is no longer being tracked by the
{@code BundleTracker}.
@param bundle The {@code Bundle} that has been removed.
@param event The bundle event which caused this customizer method to be
called or {@code null} if there is no bundle event associated
with the call to this method.
@param list The tracked object for the specified bundle. | [
"A",
"bundle",
"tracked",
"by",
"the",
"{",
"@code",
"BundleTracker",
"}",
"has",
"been",
"removed",
".",
"<p",
"/",
">",
"<p",
"/",
">",
"This",
"method",
"is",
"called",
"after",
"a",
"bundle",
"is",
"no",
"longer",
"being",
"tracked",
"by",
"the",
... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/i18n-service/src/main/java/org/wisdom/i18n/InternationalizationServiceSingleton.java#L351-L362 |
mozilla/rhino | toolsrc/org/mozilla/javascript/tools/shell/Global.java | Global.readUrl | public static Object readUrl(Context cx, Scriptable thisObj, Object[] args,
Function funObj)
throws IOException
{
if (args.length == 0) {
throw reportRuntimeError("msg.shell.readUrl.bad.args");
}
String url = ScriptRuntime.toString(args[0]);
String charCoding = null;
if (args.length >= 2) {
charCoding = ScriptRuntime.toString(args[1]);
}
return readUrl(url, charCoding, false);
} | java | public static Object readUrl(Context cx, Scriptable thisObj, Object[] args,
Function funObj)
throws IOException
{
if (args.length == 0) {
throw reportRuntimeError("msg.shell.readUrl.bad.args");
}
String url = ScriptRuntime.toString(args[0]);
String charCoding = null;
if (args.length >= 2) {
charCoding = ScriptRuntime.toString(args[1]);
}
return readUrl(url, charCoding, false);
} | [
"public",
"static",
"Object",
"readUrl",
"(",
"Context",
"cx",
",",
"Scriptable",
"thisObj",
",",
"Object",
"[",
"]",
"args",
",",
"Function",
"funObj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"throw",
... | The readUrl opens connection to the given URL, read all its data
and converts them to a string
using the specified character coding or default character coding if
explicit coding argument is not given.
<p>
Usage:
<pre>
readUrl(url)
readUrl(url, charCoding)
</pre>
The first form converts file's context to string using the default
charCoding. | [
"The",
"readUrl",
"opens",
"connection",
"to",
"the",
"given",
"URL",
"read",
"all",
"its",
"data",
"and",
"converts",
"them",
"to",
"a",
"string",
"using",
"the",
"specified",
"character",
"coding",
"or",
"default",
"character",
"coding",
"if",
"explicit",
... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/shell/Global.java#L868-L882 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/gyroscope/GyroscopeRenderer.java | GyroscopeRenderer.decode | @Override
public void decode(FacesContext context, UIComponent component) {
Gyroscope gyroscope = (Gyroscope) component;
if (gyroscope.isDisabled()) {
return;
}
decodeBehaviors(context, gyroscope);
String clientId = gyroscope.getClientId(context);
// String submittedAlpha = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".alpha");
// String submittedBeta = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".beta");
// String submittedGamma = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".gamma");
new AJAXRenderer().decode(context, component, clientId);
} | java | @Override
public void decode(FacesContext context, UIComponent component) {
Gyroscope gyroscope = (Gyroscope) component;
if (gyroscope.isDisabled()) {
return;
}
decodeBehaviors(context, gyroscope);
String clientId = gyroscope.getClientId(context);
// String submittedAlpha = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".alpha");
// String submittedBeta = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".beta");
// String submittedGamma = (String) context.getExternalContext().getRequestParameterMap().get(clientId+".gamma");
new AJAXRenderer().decode(context, component, clientId);
} | [
"@",
"Override",
"public",
"void",
"decode",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"{",
"Gyroscope",
"gyroscope",
"=",
"(",
"Gyroscope",
")",
"component",
";",
"if",
"(",
"gyroscope",
".",
"isDisabled",
"(",
")",
")",
"{",
"... | This methods receives and processes input made by the user. More specifically, it ckecks whether the
user has interacted with the current b:gyroscope. The default implementation simply stores
the input value in the list of submitted values. If the validation checks are passed,
the values in the <code>submittedValues</code> list are store in the backend bean.
@param context the FacesContext.
@param component the current b:gyroscope. | [
"This",
"methods",
"receives",
"and",
"processes",
"input",
"made",
"by",
"the",
"user",
".",
"More",
"specifically",
"it",
"ckecks",
"whether",
"the",
"user",
"has",
"interacted",
"with",
"the",
"current",
"b",
":",
"gyroscope",
".",
"The",
"default",
"impl... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/gyroscope/GyroscopeRenderer.java#L47-L63 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/tree/CmsTreeItem.java | CmsTreeItem.insertChild | public void insertChild(CmsTreeItem item, int position) {
m_children.insert(item, position);
adopt(item);
} | java | public void insertChild(CmsTreeItem item, int position) {
m_children.insert(item, position);
adopt(item);
} | [
"public",
"void",
"insertChild",
"(",
"CmsTreeItem",
"item",
",",
"int",
"position",
")",
"{",
"m_children",
".",
"insert",
"(",
"item",
",",
"position",
")",
";",
"adopt",
"(",
"item",
")",
";",
"}"
] | Inserts the given item at the given position.<p>
@param item the item to insert
@param position the position
@see org.opencms.gwt.client.ui.CmsList#insertItem(org.opencms.gwt.client.ui.I_CmsListItem, int) | [
"Inserts",
"the",
"given",
"item",
"at",
"the",
"given",
"position",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/tree/CmsTreeItem.java#L442-L446 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.