repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
m-m-m/util | text/src/main/java/net/sf/mmm/util/text/base/DefaultLineWrapper.java | DefaultLineWrapper.appendWithAlignment | protected void appendWithAlignment(Appendable appendable, ColumnState state, boolean doIndentThisLine, CellBuffer cellBuffer) throws IOException {
int space = cellBuffer.getRest();
assert (space >= 0);
TextColumnInfo columnInfo = state.getColumnInfo();
switch (columnInfo.getAlignment()) {
case LEFT:
if (doIndentThisLine) {
appendable.append(columnInfo.getIndent());
}
appendable.append(cellBuffer.buffer);
fill(appendable, columnInfo.getFiller(), space);
break;
case RIGHT:
fill(appendable, columnInfo.getFiller(), space);
appendable.append(cellBuffer.buffer);
if (doIndentThisLine) {
appendable.append(columnInfo.getIndent());
}
break;
case CENTER:
int leftSpace = space / 2;
int rightSpace = space - leftSpace;
fill(appendable, columnInfo.getFiller(), leftSpace);
String rightIndent = "";
if (doIndentThisLine) {
String indent = columnInfo.getIndent();
int indentLength = indent.length();
int rightIndex = indentLength - (indentLength / 2);
String leftIndent = indent.substring(0, rightIndex);
rightIndent = indent.substring(rightIndex);
appendable.append(leftIndent);
}
appendable.append(cellBuffer.buffer);
if (doIndentThisLine) {
appendable.append(rightIndent);
}
fill(appendable, columnInfo.getFiller(), rightSpace);
break;
default :
throw new IllegalStateException("" + columnInfo.getAlignment());
}
} | java | protected void appendWithAlignment(Appendable appendable, ColumnState state, boolean doIndentThisLine, CellBuffer cellBuffer) throws IOException {
int space = cellBuffer.getRest();
assert (space >= 0);
TextColumnInfo columnInfo = state.getColumnInfo();
switch (columnInfo.getAlignment()) {
case LEFT:
if (doIndentThisLine) {
appendable.append(columnInfo.getIndent());
}
appendable.append(cellBuffer.buffer);
fill(appendable, columnInfo.getFiller(), space);
break;
case RIGHT:
fill(appendable, columnInfo.getFiller(), space);
appendable.append(cellBuffer.buffer);
if (doIndentThisLine) {
appendable.append(columnInfo.getIndent());
}
break;
case CENTER:
int leftSpace = space / 2;
int rightSpace = space - leftSpace;
fill(appendable, columnInfo.getFiller(), leftSpace);
String rightIndent = "";
if (doIndentThisLine) {
String indent = columnInfo.getIndent();
int indentLength = indent.length();
int rightIndex = indentLength - (indentLength / 2);
String leftIndent = indent.substring(0, rightIndex);
rightIndent = indent.substring(rightIndex);
appendable.append(leftIndent);
}
appendable.append(cellBuffer.buffer);
if (doIndentThisLine) {
appendable.append(rightIndent);
}
fill(appendable, columnInfo.getFiller(), rightSpace);
break;
default :
throw new IllegalStateException("" + columnInfo.getAlignment());
}
} | [
"protected",
"void",
"appendWithAlignment",
"(",
"Appendable",
"appendable",
",",
"ColumnState",
"state",
",",
"boolean",
"doIndentThisLine",
",",
"CellBuffer",
"cellBuffer",
")",
"throws",
"IOException",
"{",
"int",
"space",
"=",
"cellBuffer",
".",
"getRest",
"(",
... | This method actually appends the text for a single line of a single column according to
{@link TextColumnInfo#getAlignment() alignment}.
@param appendable is where to append to.
@param state is the current {@link ColumnState}.
@param doIndentThisLine - {@code true} if the current cell should be {@link TextColumnInfo#getIndent()
indented}, {@code false} otherwise.
@param cellBuffer is the text to align and append.
@throws IOException if throw by the {@link Appendable}. | [
"This",
"method",
"actually",
"appends",
"the",
"text",
"for",
"a",
"single",
"line",
"of",
"a",
"single",
"column",
"according",
"to",
"{",
"@link",
"TextColumnInfo#getAlignment",
"()",
"alignment",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/text/src/main/java/net/sf/mmm/util/text/base/DefaultLineWrapper.java#L473-L515 |
Netflix/denominator | core/src/main/java/denominator/Providers.java | Providers.withUrl | public static Provider withUrl(Provider provider, String url) {
checkNotNull(provider, "provider");
checkNotNull(url, "url");
try {
Constructor<?> ctor = provider.getClass().getDeclaredConstructor(String.class);
// allow private or package protected ctors
ctor.setAccessible(true);
return Provider.class.cast(ctor.newInstance(url));
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(
provider.getClass() + " does not have a String parameter constructor", e);
} catch (Exception e) {
throw new IllegalArgumentException(
"exception attempting to instantiate " + provider.getClass()
+ " for provider " + provider, e);
}
} | java | public static Provider withUrl(Provider provider, String url) {
checkNotNull(provider, "provider");
checkNotNull(url, "url");
try {
Constructor<?> ctor = provider.getClass().getDeclaredConstructor(String.class);
// allow private or package protected ctors
ctor.setAccessible(true);
return Provider.class.cast(ctor.newInstance(url));
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(
provider.getClass() + " does not have a String parameter constructor", e);
} catch (Exception e) {
throw new IllegalArgumentException(
"exception attempting to instantiate " + provider.getClass()
+ " for provider " + provider, e);
}
} | [
"public",
"static",
"Provider",
"withUrl",
"(",
"Provider",
"provider",
",",
"String",
"url",
")",
"{",
"checkNotNull",
"(",
"provider",
",",
"\"provider\"",
")",
";",
"checkNotNull",
"(",
"url",
",",
"\"url\"",
")",
";",
"try",
"{",
"Constructor",
"<",
"?... | Overrides the {@link Provider#url()} of a given provider via reflectively calling its url
constructor.
ex.
<pre>
provider = withUrl(getByName(providerName), overrideUrl);
module = getByName(provider);
ultraDns = ObjectGraph.create(provide(provider), module, credentials(username,
password)).get(DNSApiManager.class);
</pre>
@param url corresponds to {@link Provider#url()}. ex {@code http://apiendpoint}
@throws IllegalArgumentException if the there's no constructor that accepts a string argument. | [
"Overrides",
"the",
"{",
"@link",
"Provider#url",
"()",
"}",
"of",
"a",
"given",
"provider",
"via",
"reflectively",
"calling",
"its",
"url",
"constructor",
"."
] | train | https://github.com/Netflix/denominator/blob/c565e3b8c6043051252e0947029511f9ac5d306f/core/src/main/java/denominator/Providers.java#L75-L91 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java | CommerceRegionPersistenceImpl.findAll | @Override
public List<CommerceRegion> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceRegion> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceRegion",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce regions.
@return the commerce regions | [
"Returns",
"all",
"the",
"commerce",
"regions",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java#L3490-L3493 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/assembly/DockerAssemblyManager.java | DockerAssemblyManager.createBuildTarBall | private File createBuildTarBall(BuildDirs buildDirs, List<ArchiverCustomizer> archiverCustomizers,
AssemblyConfiguration assemblyConfig, ArchiveCompression compression) throws MojoExecutionException {
File archive = new File(buildDirs.getTemporaryRootDirectory(), "docker-build." + compression.getFileSuffix());
try {
TarArchiver archiver = createBuildArchiver(buildDirs.getOutputDirectory(), archive, assemblyConfig);
for (ArchiverCustomizer customizer : archiverCustomizers) {
if (customizer != null) {
archiver = customizer.customize(archiver);
}
}
archiver.setCompression(compression.getTarCompressionMethod());
archiver.createArchive();
return archive;
} catch (NoSuchArchiverException e) {
throw new MojoExecutionException("No archiver for type 'tar' found", e);
} catch (IOException e) {
throw new MojoExecutionException("Cannot create archive " + archive, e);
}
} | java | private File createBuildTarBall(BuildDirs buildDirs, List<ArchiverCustomizer> archiverCustomizers,
AssemblyConfiguration assemblyConfig, ArchiveCompression compression) throws MojoExecutionException {
File archive = new File(buildDirs.getTemporaryRootDirectory(), "docker-build." + compression.getFileSuffix());
try {
TarArchiver archiver = createBuildArchiver(buildDirs.getOutputDirectory(), archive, assemblyConfig);
for (ArchiverCustomizer customizer : archiverCustomizers) {
if (customizer != null) {
archiver = customizer.customize(archiver);
}
}
archiver.setCompression(compression.getTarCompressionMethod());
archiver.createArchive();
return archive;
} catch (NoSuchArchiverException e) {
throw new MojoExecutionException("No archiver for type 'tar' found", e);
} catch (IOException e) {
throw new MojoExecutionException("Cannot create archive " + archive, e);
}
} | [
"private",
"File",
"createBuildTarBall",
"(",
"BuildDirs",
"buildDirs",
",",
"List",
"<",
"ArchiverCustomizer",
">",
"archiverCustomizers",
",",
"AssemblyConfiguration",
"assemblyConfig",
",",
"ArchiveCompression",
"compression",
")",
"throws",
"MojoExecutionException",
"{"... | Create final tar-ball to be used for building the archive to send to the Docker daemon | [
"Create",
"final",
"tar",
"-",
"ball",
"to",
"be",
"used",
"for",
"building",
"the",
"archive",
"to",
"send",
"to",
"the",
"Docker",
"daemon"
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/assembly/DockerAssemblyManager.java#L305-L323 |
keyboardsurfer/Crouton | library/src/main/java/de/keyboardsurfer/android/widget/crouton/Manager.java | Manager.sendMessage | private void sendMessage(Crouton crouton, final int messageId) {
final Message message = obtainMessage(messageId);
message.obj = crouton;
sendMessage(message);
} | java | private void sendMessage(Crouton crouton, final int messageId) {
final Message message = obtainMessage(messageId);
message.obj = crouton;
sendMessage(message);
} | [
"private",
"void",
"sendMessage",
"(",
"Crouton",
"crouton",
",",
"final",
"int",
"messageId",
")",
"{",
"final",
"Message",
"message",
"=",
"obtainMessage",
"(",
"messageId",
")",
";",
"message",
".",
"obj",
"=",
"crouton",
";",
"sendMessage",
"(",
"message... | Sends a {@link Crouton} within a {@link Message}.
@param crouton
The {@link Crouton} that should be sent.
@param messageId
The {@link Message} id. | [
"Sends",
"a",
"{",
"@link",
"Crouton",
"}",
"within",
"a",
"{",
"@link",
"Message",
"}",
"."
] | train | https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Manager.java#L126-L130 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java | ClusterManagerClient.listOperations | public final ListOperationsResponse listOperations(String projectId, String zone) {
ListOperationsRequest request =
ListOperationsRequest.newBuilder().setProjectId(projectId).setZone(zone).build();
return listOperations(request);
} | java | public final ListOperationsResponse listOperations(String projectId, String zone) {
ListOperationsRequest request =
ListOperationsRequest.newBuilder().setProjectId(projectId).setZone(zone).build();
return listOperations(request);
} | [
"public",
"final",
"ListOperationsResponse",
"listOperations",
"(",
"String",
"projectId",
",",
"String",
"zone",
")",
"{",
"ListOperationsRequest",
"request",
"=",
"ListOperationsRequest",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
"(",
"projectId",
")",
"."... | Lists all operations in a project in a specific zone or all zones.
<p>Sample code:
<pre><code>
try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) {
String projectId = "";
String zone = "";
ListOperationsResponse response = clusterManagerClient.listOperations(projectId, zone);
}
</code></pre>
@param projectId Deprecated. The Google Developers Console [project ID or project
number](https://support.google.com/cloud/answer/6158840). This field has been deprecated
and replaced by the parent field.
@param zone Deprecated. The name of the Google Compute Engine
[zone](/compute/docs/zones#available) to return operations for, or `-` for all zones. This
field has been deprecated and replaced by the parent field.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Lists",
"all",
"operations",
"in",
"a",
"project",
"in",
"a",
"specific",
"zone",
"or",
"all",
"zones",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L1396-L1401 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/AbstractWizard.java | AbstractWizard.addPage | protected void addPage(String wizardConfigurationKey, WizardPage page) {
pages.add(page);
page.setWizard(this);
if (autoConfigureChildPages) {
String key = ((wizardConfigurationKey != null) ? wizardConfigurationKey + "." : "") + page.getId();
ValkyrieRepository.getInstance().getApplicationConfig().applicationObjectConfigurer().configure(page, key);
}
} | java | protected void addPage(String wizardConfigurationKey, WizardPage page) {
pages.add(page);
page.setWizard(this);
if (autoConfigureChildPages) {
String key = ((wizardConfigurationKey != null) ? wizardConfigurationKey + "." : "") + page.getId();
ValkyrieRepository.getInstance().getApplicationConfig().applicationObjectConfigurer().configure(page, key);
}
} | [
"protected",
"void",
"addPage",
"(",
"String",
"wizardConfigurationKey",
",",
"WizardPage",
"page",
")",
"{",
"pages",
".",
"add",
"(",
"page",
")",
";",
"page",
".",
"setWizard",
"(",
"this",
")",
";",
"if",
"(",
"autoConfigureChildPages",
")",
"{",
"Stri... | Adds a new page to this wizard. The page is inserted at the end of the
page list.
@param wizardConfigurationKey
the parent configuration key of the page, used for
configuration, by default this wizard's id *
@param page
the new page | [
"Adds",
"a",
"new",
"page",
"to",
"this",
"wizard",
".",
"The",
"page",
"is",
"inserted",
"at",
"the",
"end",
"of",
"the",
"page",
"list",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/AbstractWizard.java#L176-L183 |
zandero/settings | src/main/java/com/zandero/settings/Settings.java | Settings.getBool | public boolean getBool(String name) {
Object value = super.get(name);
if (value instanceof Boolean) {
return (Boolean) value;
}
if (value instanceof String) {
String txt = (String)value;
txt = txt.trim().toLowerCase();
if ("yes".equals(txt) || "y".equals(txt) || "1".equals(txt) || "true".equals(txt) || "t".equals(txt)) {
return true;
}
if ("no".equals(txt) || "n".equals(txt) || "0".equals(txt) || "false".equals(txt) || "f".equals(txt)) {
return false;
}
}
if (value == null) {
throw new IllegalArgumentException("Setting: '" + name + "', not found!");
}
throw new IllegalArgumentException("Setting: '" + name + "', can't be converted to boolean: '" + value + "'!");
} | java | public boolean getBool(String name) {
Object value = super.get(name);
if (value instanceof Boolean) {
return (Boolean) value;
}
if (value instanceof String) {
String txt = (String)value;
txt = txt.trim().toLowerCase();
if ("yes".equals(txt) || "y".equals(txt) || "1".equals(txt) || "true".equals(txt) || "t".equals(txt)) {
return true;
}
if ("no".equals(txt) || "n".equals(txt) || "0".equals(txt) || "false".equals(txt) || "f".equals(txt)) {
return false;
}
}
if (value == null) {
throw new IllegalArgumentException("Setting: '" + name + "', not found!");
}
throw new IllegalArgumentException("Setting: '" + name + "', can't be converted to boolean: '" + value + "'!");
} | [
"public",
"boolean",
"getBool",
"(",
"String",
"name",
")",
"{",
"Object",
"value",
"=",
"super",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"{",
"return",
"(",
"Boolean",
")",
"value",
";",
"}",
"if",
"(",
... | Returns boolean flag
@param name of flag
@return true or false
@throws IllegalArgumentException in case setting is not a boolean setting | [
"Returns",
"boolean",
"flag"
] | train | https://github.com/zandero/settings/blob/802b44f41bc75e7eb2761028db8c73b7e59620c7/src/main/java/com/zandero/settings/Settings.java#L126-L152 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java | RequestParam.getFloat | public static float getFloat(@NotNull ServletRequest request, @NotNull String param, float defaultValue) {
String value = request.getParameter(param);
return NumberUtils.toFloat(value, defaultValue);
} | java | public static float getFloat(@NotNull ServletRequest request, @NotNull String param, float defaultValue) {
String value = request.getParameter(param);
return NumberUtils.toFloat(value, defaultValue);
} | [
"public",
"static",
"float",
"getFloat",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
",",
"float",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"getParameter",
"(",
"param",
")",
";",
"return... | Returns a request parameter as float.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or default value if it does not exist or is not a number. | [
"Returns",
"a",
"request",
"parameter",
"as",
"float",
"."
] | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L200-L203 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/sfm/ExamplePnP.java | ExamplePnP.createObservations | public List<Point2D3D> createObservations( Se3_F64 worldToCamera , int total ) {
Se3_F64 cameraToWorld = worldToCamera.invert(null);
// transform from pixel coordinates to normalized pixel coordinates, which removes lens distortion
Point2Transform2_F64 pixelToNorm = LensDistortionFactory.narrow(intrinsic).undistort_F64(true,false);
List<Point2D3D> observations = new ArrayList<>();
Point2D_F64 norm = new Point2D_F64();
for (int i = 0; i < total; i++) {
// randomly pixel a point inside the image
double x = rand.nextDouble()*intrinsic.width;
double y = rand.nextDouble()*intrinsic.height;
// Convert to normalized image coordinates because that's what PNP needs.
// it can't process pixel coordinates
pixelToNorm.compute(x,y,norm);
// Randomly pick a depth and compute 3D coordinate
double Z = rand.nextDouble()+4;
double X = norm.x*Z;
double Y = norm.y*Z;
// Change the point's reference frame from camera to world
Point3D_F64 cameraPt = new Point3D_F64(X,Y,Z);
Point3D_F64 worldPt = new Point3D_F64();
SePointOps_F64.transform(cameraToWorld,cameraPt,worldPt);
// Save the perfect noise free observation
Point2D3D o = new Point2D3D();
o.getLocation().set(worldPt);
o.getObservation().set(norm.x,norm.y);
observations.add(o);
}
return observations;
} | java | public List<Point2D3D> createObservations( Se3_F64 worldToCamera , int total ) {
Se3_F64 cameraToWorld = worldToCamera.invert(null);
// transform from pixel coordinates to normalized pixel coordinates, which removes lens distortion
Point2Transform2_F64 pixelToNorm = LensDistortionFactory.narrow(intrinsic).undistort_F64(true,false);
List<Point2D3D> observations = new ArrayList<>();
Point2D_F64 norm = new Point2D_F64();
for (int i = 0; i < total; i++) {
// randomly pixel a point inside the image
double x = rand.nextDouble()*intrinsic.width;
double y = rand.nextDouble()*intrinsic.height;
// Convert to normalized image coordinates because that's what PNP needs.
// it can't process pixel coordinates
pixelToNorm.compute(x,y,norm);
// Randomly pick a depth and compute 3D coordinate
double Z = rand.nextDouble()+4;
double X = norm.x*Z;
double Y = norm.y*Z;
// Change the point's reference frame from camera to world
Point3D_F64 cameraPt = new Point3D_F64(X,Y,Z);
Point3D_F64 worldPt = new Point3D_F64();
SePointOps_F64.transform(cameraToWorld,cameraPt,worldPt);
// Save the perfect noise free observation
Point2D3D o = new Point2D3D();
o.getLocation().set(worldPt);
o.getObservation().set(norm.x,norm.y);
observations.add(o);
}
return observations;
} | [
"public",
"List",
"<",
"Point2D3D",
">",
"createObservations",
"(",
"Se3_F64",
"worldToCamera",
",",
"int",
"total",
")",
"{",
"Se3_F64",
"cameraToWorld",
"=",
"worldToCamera",
".",
"invert",
"(",
"null",
")",
";",
"// transform from pixel coordinates to normalized pi... | Generates synthetic observations randomly in front of the camera. Observations are in normalized image
coordinates and not pixels! See {@link PerspectiveOps#convertPixelToNorm} for how to go from pixels
to normalized image coordinates. | [
"Generates",
"synthetic",
"observations",
"randomly",
"in",
"front",
"of",
"the",
"camera",
".",
"Observations",
"are",
"in",
"normalized",
"image",
"coordinates",
"and",
"not",
"pixels!",
"See",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/sfm/ExamplePnP.java#L148-L187 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java | SVGPlot.elementCoordinatesFromEvent | public SVGPoint elementCoordinatesFromEvent(Element tag, Event evt) {
return SVGUtil.elementCoordinatesFromEvent(document, tag, evt);
} | java | public SVGPoint elementCoordinatesFromEvent(Element tag, Event evt) {
return SVGUtil.elementCoordinatesFromEvent(document, tag, evt);
} | [
"public",
"SVGPoint",
"elementCoordinatesFromEvent",
"(",
"Element",
"tag",
",",
"Event",
"evt",
")",
"{",
"return",
"SVGUtil",
".",
"elementCoordinatesFromEvent",
"(",
"document",
",",
"tag",
",",
"evt",
")",
";",
"}"
] | Convert screen coordinates to element coordinates.
@param tag Element to convert the coordinates for
@param evt Event object
@return Coordinates | [
"Convert",
"screen",
"coordinates",
"to",
"element",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L302-L304 |
deephacks/confit | provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanReferences.java | HBeanReferences.getIids2 | private static byte[] getIids2(final List<BeanId> ids, final UniqueIds uids) {
if (ids == null) {
return new byte[0];
}
final AbstractList<String> list = new AbstractList<String>() {
@Override
public String get(int index) {
return ids.get(index).getInstanceId();
}
@Override
public int size() {
return ids.size();
}
};
return getIids(list, uids);
} | java | private static byte[] getIids2(final List<BeanId> ids, final UniqueIds uids) {
if (ids == null) {
return new byte[0];
}
final AbstractList<String> list = new AbstractList<String>() {
@Override
public String get(int index) {
return ids.get(index).getInstanceId();
}
@Override
public int size() {
return ids.size();
}
};
return getIids(list, uids);
} | [
"private",
"static",
"byte",
"[",
"]",
"getIids2",
"(",
"final",
"List",
"<",
"BeanId",
">",
"ids",
",",
"final",
"UniqueIds",
"uids",
")",
"{",
"if",
"(",
"ids",
"==",
"null",
")",
"{",
"return",
"new",
"byte",
"[",
"0",
"]",
";",
"}",
"final",
... | Second version of getIids that takes a set of bean ids instead. | [
"Second",
"version",
"of",
"getIids",
"that",
"takes",
"a",
"set",
"of",
"bean",
"ids",
"instead",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanReferences.java#L284-L301 |
haifengl/smile | math/src/main/java/smile/math/matrix/JMatrix.java | JMatrix.balbak | private static void balbak(DenseMatrix V, double[] scale) {
int n = V.nrows();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
V.mul(i, j, scale[i]);
}
}
} | java | private static void balbak(DenseMatrix V, double[] scale) {
int n = V.nrows();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
V.mul(i, j, scale[i]);
}
}
} | [
"private",
"static",
"void",
"balbak",
"(",
"DenseMatrix",
"V",
",",
"double",
"[",
"]",
"scale",
")",
"{",
"int",
"n",
"=",
"V",
".",
"nrows",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"... | Form the eigenvectors of a real nonsymmetric matrix by back transforming
those of the corresponding balanced matrix determined by balance. | [
"Form",
"the",
"eigenvectors",
"of",
"a",
"real",
"nonsymmetric",
"matrix",
"by",
"back",
"transforming",
"those",
"of",
"the",
"corresponding",
"balanced",
"matrix",
"determined",
"by",
"balance",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/JMatrix.java#L1871-L1878 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_responder_POST | public OvhTaskSpecialAccount domain_responder_POST(String domain, String account, String content, Boolean copy, String copyTo, Date from, Date to) throws IOException {
String qPath = "/email/domain/{domain}/responder";
StringBuilder sb = path(qPath, domain);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "account", account);
addBody(o, "content", content);
addBody(o, "copy", copy);
addBody(o, "copyTo", copyTo);
addBody(o, "from", from);
addBody(o, "to", to);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | java | public OvhTaskSpecialAccount domain_responder_POST(String domain, String account, String content, Boolean copy, String copyTo, Date from, Date to) throws IOException {
String qPath = "/email/domain/{domain}/responder";
StringBuilder sb = path(qPath, domain);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "account", account);
addBody(o, "content", content);
addBody(o, "copy", copy);
addBody(o, "copyTo", copyTo);
addBody(o, "from", from);
addBody(o, "to", to);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | [
"public",
"OvhTaskSpecialAccount",
"domain_responder_POST",
"(",
"String",
"domain",
",",
"String",
"account",
",",
"String",
"content",
",",
"Boolean",
"copy",
",",
"String",
"copyTo",
",",
"Date",
"from",
",",
"Date",
"to",
")",
"throws",
"IOException",
"{",
... | Create new responder in server
REST: POST /email/domain/{domain}/responder
@param copyTo [required] Account where copy emails
@param account [required] Account of domain
@param from [required] Date of start responder
@param content [required] Content of responder
@param copy [required] If false, emails will be dropped. If true and copyTo field is empty, emails will be delivered to your mailbox. If true and copyTo is set with an address, emails will be delivered to this address
@param to [required] Date of end responder
@param domain [required] Name of your domain name | [
"Create",
"new",
"responder",
"in",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L929-L941 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java | StyleSet.setAlign | public StyleSet setAlign(HorizontalAlignment halign, VerticalAlignment valign) {
StyleUtil.setAlign(this.headCellStyle, halign, valign);
StyleUtil.setAlign(this.cellStyle, halign, valign);
StyleUtil.setAlign(this.cellStyleForNumber, halign, valign);
StyleUtil.setAlign(this.cellStyleForDate, halign, valign);
return this;
} | java | public StyleSet setAlign(HorizontalAlignment halign, VerticalAlignment valign) {
StyleUtil.setAlign(this.headCellStyle, halign, valign);
StyleUtil.setAlign(this.cellStyle, halign, valign);
StyleUtil.setAlign(this.cellStyleForNumber, halign, valign);
StyleUtil.setAlign(this.cellStyleForDate, halign, valign);
return this;
} | [
"public",
"StyleSet",
"setAlign",
"(",
"HorizontalAlignment",
"halign",
",",
"VerticalAlignment",
"valign",
")",
"{",
"StyleUtil",
".",
"setAlign",
"(",
"this",
".",
"headCellStyle",
",",
"halign",
",",
"valign",
")",
";",
"StyleUtil",
".",
"setAlign",
"(",
"t... | 设置cell文本对齐样式
@param halign 横向位置
@param valign 纵向位置
@return this
@since 4.0.0 | [
"设置cell文本对齐样式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java#L114-L120 |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsGalleryService.java | CmsGalleryService.getResourceTypeBeans | private List<CmsResourceTypeBean> getResourceTypeBeans(
GalleryMode galleryMode,
String referenceSitePath,
List<String> resourceTypesList,
final List<String> typesForTypeTab) {
List<I_CmsResourceType> resourceTypes = null;
Set<String> creatableTypes = null;
switch (galleryMode) {
case editor:
case view:
case adeView:
case widget:
resourceTypes = convertTypeNamesToTypes(resourceTypesList);
if (resourceTypes.size() == 0) {
resourceTypes = Lists.newArrayList(getDefaultTypesForGallery());
}
creatableTypes = Collections.<String> emptySet();
break;
case ade:
throw new IllegalStateException("This code should never be called");
// ADE case is handled by container page service
default:
resourceTypes = Collections.<I_CmsResourceType> emptyList();
creatableTypes = Collections.<String> emptySet();
}
return buildTypesList(resourceTypes, creatableTypes, Collections.<String> emptySet(), typesForTypeTab);
} | java | private List<CmsResourceTypeBean> getResourceTypeBeans(
GalleryMode galleryMode,
String referenceSitePath,
List<String> resourceTypesList,
final List<String> typesForTypeTab) {
List<I_CmsResourceType> resourceTypes = null;
Set<String> creatableTypes = null;
switch (galleryMode) {
case editor:
case view:
case adeView:
case widget:
resourceTypes = convertTypeNamesToTypes(resourceTypesList);
if (resourceTypes.size() == 0) {
resourceTypes = Lists.newArrayList(getDefaultTypesForGallery());
}
creatableTypes = Collections.<String> emptySet();
break;
case ade:
throw new IllegalStateException("This code should never be called");
// ADE case is handled by container page service
default:
resourceTypes = Collections.<I_CmsResourceType> emptyList();
creatableTypes = Collections.<String> emptySet();
}
return buildTypesList(resourceTypes, creatableTypes, Collections.<String> emptySet(), typesForTypeTab);
} | [
"private",
"List",
"<",
"CmsResourceTypeBean",
">",
"getResourceTypeBeans",
"(",
"GalleryMode",
"galleryMode",
",",
"String",
"referenceSitePath",
",",
"List",
"<",
"String",
">",
"resourceTypesList",
",",
"final",
"List",
"<",
"String",
">",
"typesForTypeTab",
")",... | Returns the resource types configured to be used within the given gallery mode.<p>
@param galleryMode the gallery mode
@param referenceSitePath the reference site-path to check permissions for
@param resourceTypesList the resource types parameter
@param typesForTypeTab the types which should be shown in the types tab according to the gallery configuration
@return the resource types | [
"Returns",
"the",
"resource",
"types",
"configured",
"to",
"be",
"used",
"within",
"the",
"given",
"gallery",
"mode",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L2559-L2586 |
javabeanz/owasp-security-logging | owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java | SecurityUtil.bindSystemStreamsToSLF4J | public static void bindSystemStreamsToSLF4J() {
// Enable autoflush
System.setOut(new PrintStream(new OutputStreamRedirector(sysOutLogger, false), true));
System.setErr(new PrintStream(new OutputStreamRedirector(sysErrLogger, true), true));
} | java | public static void bindSystemStreamsToSLF4J() {
// Enable autoflush
System.setOut(new PrintStream(new OutputStreamRedirector(sysOutLogger, false), true));
System.setErr(new PrintStream(new OutputStreamRedirector(sysErrLogger, true), true));
} | [
"public",
"static",
"void",
"bindSystemStreamsToSLF4J",
"(",
")",
"{",
"// Enable autoflush",
"System",
".",
"setOut",
"(",
"new",
"PrintStream",
"(",
"new",
"OutputStreamRedirector",
"(",
"sysOutLogger",
",",
"false",
")",
",",
"true",
")",
")",
";",
"System",
... | Redirect <code>System.out</code> and <code>System.err</code> streams to SLF4J logger.
This is a benefit if you have a legacy console logger application. Does not provide
benefit of a full implementation. For example, no hierarchical or logger inheritence
support but there are some ancilarity benefits like, 1) capturing messages that would
otherwise be lost, 2) redirecting console messages to centralized log services, 3)
formatting console messages in other types of output (e.g., HTML). | [
"Redirect",
"<code",
">",
"System",
".",
"out<",
"/",
"code",
">",
"and",
"<code",
">",
"System",
".",
"err<",
"/",
"code",
">",
"streams",
"to",
"SLF4J",
"logger",
".",
"This",
"is",
"a",
"benefit",
"if",
"you",
"have",
"a",
"legacy",
"console",
"lo... | train | https://github.com/javabeanz/owasp-security-logging/blob/060dcb1ab5f62aaea274597418ce41c8433a6c10/owasp-security-logging-common/src/main/java/org/owasp/security/logging/util/SecurityUtil.java#L36-L40 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withResilienceStrategy | @SuppressWarnings("rawtypes")
public CacheConfigurationBuilder<K, V> withResilienceStrategy(Class<? extends ResilienceStrategy> resilienceStrategyClass, Object... arguments) {
return addOrReplaceConfiguration(new DefaultResilienceStrategyConfiguration(requireNonNull(resilienceStrategyClass, "Null resilienceStrategyClass"), arguments));
} | java | @SuppressWarnings("rawtypes")
public CacheConfigurationBuilder<K, V> withResilienceStrategy(Class<? extends ResilienceStrategy> resilienceStrategyClass, Object... arguments) {
return addOrReplaceConfiguration(new DefaultResilienceStrategyConfiguration(requireNonNull(resilienceStrategyClass, "Null resilienceStrategyClass"), arguments));
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withResilienceStrategy",
"(",
"Class",
"<",
"?",
"extends",
"ResilienceStrategy",
">",
"resilienceStrategyClass",
",",
"Object",
"...",
"arguments",
"... | Adds a {@link ResilienceStrategy} configured through a class and optional constructor arguments to the configured
builder.
@param resilienceStrategyClass the resilience strategy class
@param arguments optional constructor arguments
@return a new builder with the added resilience strategy configuration | [
"Adds",
"a",
"{",
"@link",
"ResilienceStrategy",
"}",
"configured",
"through",
"a",
"class",
"and",
"optional",
"constructor",
"arguments",
"to",
"the",
"configured",
"builder",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L373-L376 |
JodaOrg/joda-money | src/main/java/org/joda/money/Money.java | Money.minus | public Money minus(BigDecimal amountToSubtract, RoundingMode roundingMode) {
return with(money.minusRetainScale(amountToSubtract, roundingMode));
} | java | public Money minus(BigDecimal amountToSubtract, RoundingMode roundingMode) {
return with(money.minusRetainScale(amountToSubtract, roundingMode));
} | [
"public",
"Money",
"minus",
"(",
"BigDecimal",
"amountToSubtract",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"with",
"(",
"money",
".",
"minusRetainScale",
"(",
"amountToSubtract",
",",
"roundingMode",
")",
")",
";",
"}"
] | Returns a copy of this monetary value with the amount subtracted.
<p>
This subtracts the specified amount from this monetary amount, returning a new object.
If the amount to subtract exceeds the scale of the currency, then the
rounding mode will be used to adjust the result.
<p>
This instance is immutable and unaffected by this method.
@param amountToSubtract the monetary value to subtract, not null
@param roundingMode the rounding mode to use, not null
@return the new instance with the input amount subtracted, never null | [
"Returns",
"a",
"copy",
"of",
"this",
"monetary",
"value",
"with",
"the",
"amount",
"subtracted",
".",
"<p",
">",
"This",
"subtracts",
"the",
"specified",
"amount",
"from",
"this",
"monetary",
"amount",
"returning",
"a",
"new",
"object",
".",
"If",
"the",
... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L924-L926 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F5.andThen | public <T> F5<P1, P2, P3, P4, P5, T> andThen(final Function<? super R, ? extends T> f) {
E.NPE(f);
final F5<P1, P2, P3, P4, P5, R> me = this;
return new F5<P1, P2, P3, P4, P5, T>() {
@Override
public T apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
R r = me.apply(p1, p2, p3, p4, p5);
return f.apply(r);
}
};
} | java | public <T> F5<P1, P2, P3, P4, P5, T> andThen(final Function<? super R, ? extends T> f) {
E.NPE(f);
final F5<P1, P2, P3, P4, P5, R> me = this;
return new F5<P1, P2, P3, P4, P5, T>() {
@Override
public T apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
R r = me.apply(p1, p2, p3, p4, p5);
return f.apply(r);
}
};
} | [
"public",
"<",
"T",
">",
"F5",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"P4",
",",
"P5",
",",
"T",
">",
"andThen",
"(",
"final",
"Function",
"<",
"?",
"super",
"R",
",",
"?",
"extends",
"T",
">",
"f",
")",
"{",
"E",
".",
"NPE",
"(",
"f",
")"... | Returns a composed function from this function and the specified function that takes the
result of this function. When applying the composed function, this function is applied
first to given parameter and then the specified function is applied to the result of
this function.
@param f
the function takes the <code>R</code> type parameter and return <code>T</code>
type result
@param <T>
the return type of function {@code f}
@return the composed function
@throws NullPointerException
if <code>f</code> is null | [
"Returns",
"a",
"composed",
"function",
"from",
"this",
"function",
"and",
"the",
"specified",
"function",
"that",
"takes",
"the",
"result",
"of",
"this",
"function",
".",
"When",
"applying",
"the",
"composed",
"function",
"this",
"function",
"is",
"applied",
... | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1866-L1876 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupDb.java | CmsSetupDb.createDatabase | public void createDatabase(String database, Map<String, String> replacer) {
m_errorLogging = true;
executeSql(database, "create_db.sql", replacer, true);
} | java | public void createDatabase(String database, Map<String, String> replacer) {
m_errorLogging = true;
executeSql(database, "create_db.sql", replacer, true);
} | [
"public",
"void",
"createDatabase",
"(",
"String",
"database",
",",
"Map",
"<",
"String",
",",
"String",
">",
"replacer",
")",
"{",
"m_errorLogging",
"=",
"true",
";",
"executeSql",
"(",
"database",
",",
"\"create_db.sql\"",
",",
"replacer",
",",
"true",
")"... | Calls the create database script for the given database.<p>
@param database the name of the database
@param replacer the replacements to perform in the drop script | [
"Calls",
"the",
"create",
"database",
"script",
"for",
"the",
"given",
"database",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupDb.java#L200-L204 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/executor/ControllableScheduler.java | ControllableScheduler.jumpAndExecute | public void jumpAndExecute(long duration, TimeUnit timeUnit) {
long durationInMillis = TimeUnit.MILLISECONDS.convert(duration, timeUnit);
mQueue.tick(durationInMillis);
while (!schedulerIsIdle()) {
runNextPendingCommand();
}
} | java | public void jumpAndExecute(long duration, TimeUnit timeUnit) {
long durationInMillis = TimeUnit.MILLISECONDS.convert(duration, timeUnit);
mQueue.tick(durationInMillis);
while (!schedulerIsIdle()) {
runNextPendingCommand();
}
} | [
"public",
"void",
"jumpAndExecute",
"(",
"long",
"duration",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"long",
"durationInMillis",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"duration",
",",
"timeUnit",
")",
";",
"mQueue",
".",
"tick",
"(",
"dur... | Jumps to a future time by a given duration. All the commands/tasks scheduled
for execution during this period will be executed. When this function returns,
the executor will be idle.
@param duration the duration
@param timeUnit the time unit of the duration | [
"Jumps",
"to",
"a",
"future",
"time",
"by",
"a",
"given",
"duration",
".",
"All",
"the",
"commands",
"/",
"tasks",
"scheduled",
"for",
"execution",
"during",
"this",
"period",
"will",
"be",
"executed",
".",
"When",
"this",
"function",
"returns",
"the",
"ex... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/executor/ControllableScheduler.java#L41-L47 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java | MP3FileID3Controller.setComment | public void setComment(String comment, int type)
{
if (allow(type&ID3V1))
{
id3v1.setComment(comment);
}
if (allow(type&ID3V2))
{
id3v2.setCommentFrame("", comment);
}
} | java | public void setComment(String comment, int type)
{
if (allow(type&ID3V1))
{
id3v1.setComment(comment);
}
if (allow(type&ID3V2))
{
id3v2.setCommentFrame("", comment);
}
} | [
"public",
"void",
"setComment",
"(",
"String",
"comment",
",",
"int",
"type",
")",
"{",
"if",
"(",
"allow",
"(",
"type",
"&",
"ID3V1",
")",
")",
"{",
"id3v1",
".",
"setComment",
"(",
"comment",
")",
";",
"}",
"if",
"(",
"allow",
"(",
"type",
"&",
... | Add a comment to this mp3.
@param comment a comment to add to the mp3 | [
"Add",
"a",
"comment",
"to",
"this",
"mp3",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L210-L220 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/annotations/Annotations.java | Annotations.merge | public Connector merge(Connector connector, AnnotationRepository annotationRepository, ClassLoader classLoader)
throws Exception
{
// Process annotations
if (connector == null || (connector.getVersion() == Version.V_16 || connector.getVersion() == Version.V_17))
{
boolean isMetadataComplete = false;
if (connector != null)
{
isMetadataComplete = connector.isMetadataComplete();
}
if (connector == null || !isMetadataComplete)
{
if (connector == null)
{
Connector annotationsConnector = process(annotationRepository, null, classLoader);
connector = annotationsConnector;
}
else
{
Connector annotationsConnector = process(annotationRepository,
((ResourceAdapter) connector.getResourceadapter()).getResourceadapterClass(),
classLoader);
connector = connector.merge(annotationsConnector);
}
}
}
return connector;
} | java | public Connector merge(Connector connector, AnnotationRepository annotationRepository, ClassLoader classLoader)
throws Exception
{
// Process annotations
if (connector == null || (connector.getVersion() == Version.V_16 || connector.getVersion() == Version.V_17))
{
boolean isMetadataComplete = false;
if (connector != null)
{
isMetadataComplete = connector.isMetadataComplete();
}
if (connector == null || !isMetadataComplete)
{
if (connector == null)
{
Connector annotationsConnector = process(annotationRepository, null, classLoader);
connector = annotationsConnector;
}
else
{
Connector annotationsConnector = process(annotationRepository,
((ResourceAdapter) connector.getResourceadapter()).getResourceadapterClass(),
classLoader);
connector = connector.merge(annotationsConnector);
}
}
}
return connector;
} | [
"public",
"Connector",
"merge",
"(",
"Connector",
"connector",
",",
"AnnotationRepository",
"annotationRepository",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"Exception",
"{",
"// Process annotations",
"if",
"(",
"connector",
"==",
"null",
"||",
"(",
"connecto... | Scan for annotations in the URLs specified
@param connector The connector adapter metadata
@param annotationRepository annotationRepository to use
@param classLoader The class loader used to generate the repository
@return The updated metadata
@exception Exception Thrown if an error occurs | [
"Scan",
"for",
"annotations",
"in",
"the",
"URLs",
"specified"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/annotations/Annotations.java#L119-L149 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java | ConnectionMonitorsInner.beginQuery | public ConnectionMonitorQueryResultInner beginQuery(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginQueryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).toBlocking().single().body();
} | java | public ConnectionMonitorQueryResultInner beginQuery(String resourceGroupName, String networkWatcherName, String connectionMonitorName) {
return beginQueryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).toBlocking().single().body();
} | [
"public",
"ConnectionMonitorQueryResultInner",
"beginQuery",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"connectionMonitorName",
")",
"{",
"return",
"beginQueryWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkWatcher... | Query a snapshot of the most recent connection states.
@param resourceGroupName The name of the resource group containing Network Watcher.
@param networkWatcherName The name of the Network Watcher resource.
@param connectionMonitorName The name given to the connection monitor.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ConnectionMonitorQueryResultInner object if successful. | [
"Query",
"a",
"snapshot",
"of",
"the",
"most",
"recent",
"connection",
"states",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L960-L962 |
evernote/android-intent | library/src/main/java/com/evernote/android/intent/CreateNewNoteIntentBuilder.java | CreateNewNoteIntentBuilder.setTextHtml | public CreateNewNoteIntentBuilder setTextHtml(@Nullable String html, @Nullable String baseUrl) {
if (TextUtils.isEmpty(html)) {
mIntent.setType(null);
} else {
mIntent.setType("text/html");
}
putString(Intent.EXTRA_TEXT, html);
return putString(EvernoteIntent.EXTRA_BASE_URL, baseUrl);
} | java | public CreateNewNoteIntentBuilder setTextHtml(@Nullable String html, @Nullable String baseUrl) {
if (TextUtils.isEmpty(html)) {
mIntent.setType(null);
} else {
mIntent.setType("text/html");
}
putString(Intent.EXTRA_TEXT, html);
return putString(EvernoteIntent.EXTRA_BASE_URL, baseUrl);
} | [
"public",
"CreateNewNoteIntentBuilder",
"setTextHtml",
"(",
"@",
"Nullable",
"String",
"html",
",",
"@",
"Nullable",
"String",
"baseUrl",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"html",
")",
")",
"{",
"mIntent",
".",
"setType",
"(",
"null",
... | The Evernote app will convert the HTML content to ENML. It will fetch resources and apply
supported styles. You can either send an HTML snippet or a full HTML page.
<br>
<br>
You cannot send plain text content and HTML at the same time. This method uses the {@link Intent#EXTRA_TEXT}
field and sets the type of the Intent to {@code text/html}. Previous set content with {@link #setTextPlain(String)}
is overwritten.
@param html The HTML content which is converted to ENML in the Evernote app. If {@code null}
then the current value gets removed.
@param baseUrl The base URL for resources with relative URLs within the HTML. If {@code null}
then the current value gets removed.
@return This Builder object to allow for chaining of calls to set methods.
@see Intent#EXTRA_TEXT
@see Intent#setType(String) | [
"The",
"Evernote",
"app",
"will",
"convert",
"the",
"HTML",
"content",
"to",
"ENML",
".",
"It",
"will",
"fetch",
"resources",
"and",
"apply",
"supported",
"styles",
".",
"You",
"can",
"either",
"send",
"an",
"HTML",
"snippet",
"or",
"a",
"full",
"HTML",
... | train | https://github.com/evernote/android-intent/blob/5df1bec46b0a7d27be816d62f8fd2c10bda731ea/library/src/main/java/com/evernote/android/intent/CreateNewNoteIntentBuilder.java#L215-L224 |
Tirasa/ADSDDL | src/main/java/net/tirasa/adsddl/ntsd/dacl/DACLAssertor.java | DACLAssertor.doRequiredFlagsMatch | private boolean doRequiredFlagsMatch(final List<AceFlag> aceFlags, final AceFlag requiredFlag) {
boolean res = true;
if (requiredFlag != null) {
// aceFlags could be null if the ACE applies to 'this object only' and has no other flags set
if (aceFlags == null || aceFlags.isEmpty() || !aceFlags.contains(requiredFlag)) {
res = false;
}
} else if (aceFlags != null && !aceFlags.isEmpty()) {
res = false;
}
LOG.debug("doRequiredFlagsMatch, result: {}", res);
return res;
} | java | private boolean doRequiredFlagsMatch(final List<AceFlag> aceFlags, final AceFlag requiredFlag) {
boolean res = true;
if (requiredFlag != null) {
// aceFlags could be null if the ACE applies to 'this object only' and has no other flags set
if (aceFlags == null || aceFlags.isEmpty() || !aceFlags.contains(requiredFlag)) {
res = false;
}
} else if (aceFlags != null && !aceFlags.isEmpty()) {
res = false;
}
LOG.debug("doRequiredFlagsMatch, result: {}", res);
return res;
} | [
"private",
"boolean",
"doRequiredFlagsMatch",
"(",
"final",
"List",
"<",
"AceFlag",
">",
"aceFlags",
",",
"final",
"AceFlag",
"requiredFlag",
")",
"{",
"boolean",
"res",
"=",
"true",
";",
"if",
"(",
"requiredFlag",
"!=",
"null",
")",
"{",
"// aceFlags could be... | Checks whether the AceFlags attribute of the ACE contains the given AceFlag of the AceAssertion. If the
{@code requiredFlag} is null, yet the {@code aceFlags} are not (or empty), or vice versa, or they do not contain
the required flag, a false result is returned.
@param aceFlags
list of AceFlags from the ACE
@param requiredFlag
AceFlag required by the AceAssertion (e.g., {@code AceFlag.CONTAINER_INHERIT_ACE})
@return true if match, false if not | [
"Checks",
"whether",
"the",
"AceFlags",
"attribute",
"of",
"the",
"ACE",
"contains",
"the",
"given",
"AceFlag",
"of",
"the",
"AceAssertion",
".",
"If",
"the",
"{",
"@code",
"requiredFlag",
"}",
"is",
"null",
"yet",
"the",
"{",
"@code",
"aceFlags",
"}",
"ar... | train | https://github.com/Tirasa/ADSDDL/blob/16dad53e1222c7faa904c64394af94ba18f6d09c/src/main/java/net/tirasa/adsddl/ntsd/dacl/DACLAssertor.java#L456-L468 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java | UtilReflection.setAccessible | public static void setAccessible(AccessibleObject object, boolean accessible)
{
Check.notNull(object);
if (object.isAccessible() != accessible)
{
java.security.AccessController.doPrivileged((PrivilegedAction<Void>) () ->
{
object.setAccessible(accessible);
return null;
});
}
} | java | public static void setAccessible(AccessibleObject object, boolean accessible)
{
Check.notNull(object);
if (object.isAccessible() != accessible)
{
java.security.AccessController.doPrivileged((PrivilegedAction<Void>) () ->
{
object.setAccessible(accessible);
return null;
});
}
} | [
"public",
"static",
"void",
"setAccessible",
"(",
"AccessibleObject",
"object",
",",
"boolean",
"accessible",
")",
"{",
"Check",
".",
"notNull",
"(",
"object",
")",
";",
"if",
"(",
"object",
".",
"isAccessible",
"(",
")",
"!=",
"accessible",
")",
"{",
"jav... | Set the object accessibility with an access controller.
@param object The accessible object (must not be <code>null</code>).
@param accessible <code>true</code> if accessible, <code>false</code> else.
@throws LionEngineException If invalid parameters or field not found. | [
"Set",
"the",
"object",
"accessibility",
"with",
"an",
"access",
"controller",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L281-L293 |
wuman/orientdb-android | client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java | OServerAdmin.replicationStop | public synchronized OServerAdmin replicationStop(final String iDatabaseName, final String iRemoteServer) throws IOException {
sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "stop").field("node", iRemoteServer)
.field("db", iDatabaseName), "Stop replication");
OLogManager.instance().debug(this, "Stopped replication of database '%s' from server '%s' to '%s'", iDatabaseName,
storage.getURL(), iRemoteServer);
return this;
} | java | public synchronized OServerAdmin replicationStop(final String iDatabaseName, final String iRemoteServer) throws IOException {
sendRequest(OChannelBinaryProtocol.REQUEST_REPLICATION, new ODocument().field("operation", "stop").field("node", iRemoteServer)
.field("db", iDatabaseName), "Stop replication");
OLogManager.instance().debug(this, "Stopped replication of database '%s' from server '%s' to '%s'", iDatabaseName,
storage.getURL(), iRemoteServer);
return this;
} | [
"public",
"synchronized",
"OServerAdmin",
"replicationStop",
"(",
"final",
"String",
"iDatabaseName",
",",
"final",
"String",
"iRemoteServer",
")",
"throws",
"IOException",
"{",
"sendRequest",
"(",
"OChannelBinaryProtocol",
".",
"REQUEST_REPLICATION",
",",
"new",
"ODocu... | Stops the replication between two servers.
@param iDatabaseName
database name to replicate
@param iRemoteServer
remote server alias as IP+address
@return The instance itself. Useful to execute method in chain
@throws IOException | [
"Stops",
"the",
"replication",
"between",
"two",
"servers",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/client/src/main/java/com/orientechnologies/orient/client/remote/OServerAdmin.java#L377-L384 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/ValidateFieldHandler.java | ValidateFieldHandler.init | public void init(Record record, String fieldName, String strCompare, boolean bValidIfMatch)
{ // For this to work right, the booking number field needs a listener to re-select this file whenever it changes
this.fieldName = fieldName;
m_strCompare = strCompare;
m_bValidIfMatch = bValidIfMatch;
super.init(record);
} | java | public void init(Record record, String fieldName, String strCompare, boolean bValidIfMatch)
{ // For this to work right, the booking number field needs a listener to re-select this file whenever it changes
this.fieldName = fieldName;
m_strCompare = strCompare;
m_bValidIfMatch = bValidIfMatch;
super.init(record);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"String",
"fieldName",
",",
"String",
"strCompare",
",",
"boolean",
"bValidIfMatch",
")",
"{",
"// For this to work right, the booking number field needs a listener to re-select this file whenever it changes",
"this",
".",... | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()). | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/ValidateFieldHandler.java#L61-L67 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/models/ProjectFilter.java | ProjectFilter.getQueryParams | public GitLabApiForm getQueryParams(int page, int perPage) {
return (getQueryParams()
.withParam(Constants.PAGE_PARAM, page)
.withParam(Constants.PER_PAGE_PARAM, perPage));
} | java | public GitLabApiForm getQueryParams(int page, int perPage) {
return (getQueryParams()
.withParam(Constants.PAGE_PARAM, page)
.withParam(Constants.PER_PAGE_PARAM, perPage));
} | [
"public",
"GitLabApiForm",
"getQueryParams",
"(",
"int",
"page",
",",
"int",
"perPage",
")",
"{",
"return",
"(",
"getQueryParams",
"(",
")",
".",
"withParam",
"(",
"Constants",
".",
"PAGE_PARAM",
",",
"page",
")",
".",
"withParam",
"(",
"Constants",
".",
"... | Get the query params specified by this filter.
@param page specifies the page number
@param perPage specifies the number of items per page
@return a GitLabApiForm instance holding the query parameters for this ProjectFilter instance | [
"Get",
"the",
"query",
"params",
"specified",
"by",
"this",
"filter",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/models/ProjectFilter.java#L190-L194 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/binary/VisualizeBinaryData.java | VisualizeBinaryData.renderLabeled | public static BufferedImage renderLabeled(GrayS32 labelImage, int numRegions, BufferedImage out) {
int colors[] = new int[numRegions];
Random rand = new Random(123);
for( int i = 0; i < colors.length; i++ ) {
colors[i] = rand.nextInt();
}
return renderLabeled(labelImage, colors, out);
} | java | public static BufferedImage renderLabeled(GrayS32 labelImage, int numRegions, BufferedImage out) {
int colors[] = new int[numRegions];
Random rand = new Random(123);
for( int i = 0; i < colors.length; i++ ) {
colors[i] = rand.nextInt();
}
return renderLabeled(labelImage, colors, out);
} | [
"public",
"static",
"BufferedImage",
"renderLabeled",
"(",
"GrayS32",
"labelImage",
",",
"int",
"numRegions",
",",
"BufferedImage",
"out",
")",
"{",
"int",
"colors",
"[",
"]",
"=",
"new",
"int",
"[",
"numRegions",
"]",
";",
"Random",
"rand",
"=",
"new",
"R... | Renders a labeled where each region is assigned a random color.
@param labelImage Labeled image with labels from 0 to numRegions-1
@param numRegions Number of labeled in the image
@param out Output image. If null a new image is declared
@return Colorized labeled image | [
"Renders",
"a",
"labeled",
"where",
"each",
"region",
"is",
"assigned",
"a",
"random",
"color",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/binary/VisualizeBinaryData.java#L332-L342 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java | VmlGraphicsContext.drawCircle | public void drawCircle(Object parent, String name, Coordinate position, double radius, ShapeStyle style) {
if (isAttached()) {
Element circle = helper.createOrUpdateElement(parent, name, "oval", style);
// Real position is the upper left corner of the circle:
applyAbsolutePosition(circle, new Coordinate(position.getX() - radius, position.getY() - radius));
// width and height are both radius*2
int size = (int) (2 * radius);
applyElementSize(circle, size, size, false);
}
} | java | public void drawCircle(Object parent, String name, Coordinate position, double radius, ShapeStyle style) {
if (isAttached()) {
Element circle = helper.createOrUpdateElement(parent, name, "oval", style);
// Real position is the upper left corner of the circle:
applyAbsolutePosition(circle, new Coordinate(position.getX() - radius, position.getY() - radius));
// width and height are both radius*2
int size = (int) (2 * radius);
applyElementSize(circle, size, size, false);
}
} | [
"public",
"void",
"drawCircle",
"(",
"Object",
"parent",
",",
"String",
"name",
",",
"Coordinate",
"position",
",",
"double",
"radius",
",",
"ShapeStyle",
"style",
")",
"{",
"if",
"(",
"isAttached",
"(",
")",
")",
"{",
"Element",
"circle",
"=",
"helper",
... | Draw a circle on the <code>GraphicsContext</code>.
@param parent
parent group object
@param name
The circle's name.
@param position
The center position as a coordinate.
@param radius
The circle's radius.
@param style
The styling object by which the circle should be drawn. | [
"Draw",
"a",
"circle",
"on",
"the",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java#L127-L138 |
Azure/autorest-clientruntime-for-java | client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java | FlatteningDeserializer.handleFlatteningForField | @SuppressWarnings("unchecked")
private static void handleFlatteningForField(Field classField, JsonNode jsonNode) {
final JsonProperty jsonProperty = classField.getAnnotation(JsonProperty.class);
if (jsonProperty != null) {
final String jsonPropValue = jsonProperty.value();
if (containsFlatteningDots(jsonPropValue)) {
JsonNode childJsonNode = findNestedNode(jsonNode, jsonPropValue);
((ObjectNode) jsonNode).put(jsonPropValue, childJsonNode);
}
}
} | java | @SuppressWarnings("unchecked")
private static void handleFlatteningForField(Field classField, JsonNode jsonNode) {
final JsonProperty jsonProperty = classField.getAnnotation(JsonProperty.class);
if (jsonProperty != null) {
final String jsonPropValue = jsonProperty.value();
if (containsFlatteningDots(jsonPropValue)) {
JsonNode childJsonNode = findNestedNode(jsonNode, jsonPropValue);
((ObjectNode) jsonNode).put(jsonPropValue, childJsonNode);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"void",
"handleFlatteningForField",
"(",
"Field",
"classField",
",",
"JsonNode",
"jsonNode",
")",
"{",
"final",
"JsonProperty",
"jsonProperty",
"=",
"classField",
".",
"getAnnotation",
"(",
"Js... | Given a field of a POJO class and JsonNode corresponds to the same POJO class,
check field's {@link JsonProperty} has flattening dots in it if so
flatten the nested child JsonNode corresponds to the field in the given JsonNode.
@param classField the field in a POJO class
@param jsonNode the json node corresponds to POJO class that field belongs to | [
"Given",
"a",
"field",
"of",
"a",
"POJO",
"class",
"and",
"JsonNode",
"corresponds",
"to",
"the",
"same",
"POJO",
"class",
"check",
"field",
"s",
"{",
"@link",
"JsonProperty",
"}",
"has",
"flattening",
"dots",
"in",
"it",
"if",
"so",
"flatten",
"the",
"n... | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/client-runtime/src/main/java/com/microsoft/rest/serializer/FlatteningDeserializer.java#L147-L157 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java | StringEscaper.formatHex | @Pure
public static String formatHex(int amount, int digits) {
final StringBuffer hex = new StringBuffer(Integer.toHexString(amount));
while (hex.length() < digits) {
hex.insert(0, "0"); //$NON-NLS-1$
}
return hex.toString();
} | java | @Pure
public static String formatHex(int amount, int digits) {
final StringBuffer hex = new StringBuffer(Integer.toHexString(amount));
while (hex.length() < digits) {
hex.insert(0, "0"); //$NON-NLS-1$
}
return hex.toString();
} | [
"@",
"Pure",
"public",
"static",
"String",
"formatHex",
"(",
"int",
"amount",
",",
"int",
"digits",
")",
"{",
"final",
"StringBuffer",
"hex",
"=",
"new",
"StringBuffer",
"(",
"Integer",
".",
"toHexString",
"(",
"amount",
")",
")",
";",
"while",
"(",
"hex... | Format the given int value to hexadecimal.
@param amount the value to convert.
@param digits the minimal number of digits.
@return a string representation of the given value. | [
"Format",
"the",
"given",
"int",
"value",
"to",
"hexadecimal",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java#L186-L193 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/storage/ApptentiveDatabaseHelper.java | ApptentiveDatabaseHelper.onUpgrade | @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
ApptentiveLog.d(DATABASE, "Upgrade database from %d to %d", oldVersion, newVersion);
try {
DatabaseMigrator migrator = createDatabaseMigrator(oldVersion, newVersion);
if (migrator != null) {
migrator.onUpgrade(db, oldVersion, newVersion);
}
} catch (Exception e) {
ApptentiveLog.e(DATABASE, e, "Exception while trying to migrate database from %d to %d", oldVersion, newVersion);
logException(e);
// if migration failed - create new table
db.execSQL(SQL_DELETE_PAYLOAD_TABLE);
onCreate(db);
}
} | java | @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
ApptentiveLog.d(DATABASE, "Upgrade database from %d to %d", oldVersion, newVersion);
try {
DatabaseMigrator migrator = createDatabaseMigrator(oldVersion, newVersion);
if (migrator != null) {
migrator.onUpgrade(db, oldVersion, newVersion);
}
} catch (Exception e) {
ApptentiveLog.e(DATABASE, e, "Exception while trying to migrate database from %d to %d", oldVersion, newVersion);
logException(e);
// if migration failed - create new table
db.execSQL(SQL_DELETE_PAYLOAD_TABLE);
onCreate(db);
}
} | [
"@",
"Override",
"public",
"void",
"onUpgrade",
"(",
"SQLiteDatabase",
"db",
",",
"int",
"oldVersion",
",",
"int",
"newVersion",
")",
"{",
"ApptentiveLog",
".",
"d",
"(",
"DATABASE",
",",
"\"Upgrade database from %d to %d\"",
",",
"oldVersion",
",",
"newVersion",
... | This method is called when an app is upgraded. Add alter table statements here for each version in a non-breaking
switch, so that all the necessary upgrades occur for each older version. | [
"This",
"method",
"is",
"called",
"when",
"an",
"app",
"is",
"upgraded",
".",
"Add",
"alter",
"table",
"statements",
"here",
"for",
"each",
"version",
"in",
"a",
"non",
"-",
"breaking",
"switch",
"so",
"that",
"all",
"the",
"necessary",
"upgrades",
"occur"... | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/storage/ApptentiveDatabaseHelper.java#L240-L256 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.findUniqueBoolean | public boolean findUniqueBoolean(@NotNull @SQL String sql, Object... args) {
return findUniqueBoolean(SqlQuery.query(sql, args));
} | java | public boolean findUniqueBoolean(@NotNull @SQL String sql, Object... args) {
return findUniqueBoolean(SqlQuery.query(sql, args));
} | [
"public",
"boolean",
"findUniqueBoolean",
"(",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"findUniqueBoolean",
"(",
"SqlQuery",
".",
"query",
"(",
"sql",
",",
"args",
")",
")",
";",
"}"
] | A convenience method for retrieving a single non-null boolean.
@throws NonUniqueResultException if there is more then one row
@throws EmptyResultException if there are no rows | [
"A",
"convenience",
"method",
"for",
"retrieving",
"a",
"single",
"non",
"-",
"null",
"boolean",
"."
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L513-L515 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/PendingRequestsMap.java | PendingRequestsMap.addRequest | void addRequest(final InstanceType instanceType, final int numberOfInstances) {
Integer numberOfRemainingInstances = this.pendingRequests.get(instanceType);
if (numberOfRemainingInstances == null) {
numberOfRemainingInstances = Integer.valueOf(numberOfInstances);
} else {
numberOfRemainingInstances = Integer.valueOf(numberOfRemainingInstances.intValue() + numberOfInstances);
}
this.pendingRequests.put(instanceType, numberOfRemainingInstances);
} | java | void addRequest(final InstanceType instanceType, final int numberOfInstances) {
Integer numberOfRemainingInstances = this.pendingRequests.get(instanceType);
if (numberOfRemainingInstances == null) {
numberOfRemainingInstances = Integer.valueOf(numberOfInstances);
} else {
numberOfRemainingInstances = Integer.valueOf(numberOfRemainingInstances.intValue() + numberOfInstances);
}
this.pendingRequests.put(instanceType, numberOfRemainingInstances);
} | [
"void",
"addRequest",
"(",
"final",
"InstanceType",
"instanceType",
",",
"final",
"int",
"numberOfInstances",
")",
"{",
"Integer",
"numberOfRemainingInstances",
"=",
"this",
".",
"pendingRequests",
".",
"get",
"(",
"instanceType",
")",
";",
"if",
"(",
"numberOfRem... | Adds the a pending request for the given number of instances of the given type to this map.
@param instanceType
the requested instance type
@param numberOfInstances
the requested number of instances of this type | [
"Adds",
"the",
"a",
"pending",
"request",
"for",
"the",
"given",
"number",
"of",
"instances",
"of",
"the",
"given",
"type",
"to",
"this",
"map",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/cluster/PendingRequestsMap.java#L55-L65 |
hawkular/hawkular-alerts | engine/src/main/java/org/hawkular/alerts/engine/impl/PartitionManagerImpl.java | PartitionManagerImpl.add | private void add(Map<String, List<String>> partition, PartitionEntry entry) {
String tenantId = entry.getTenantId();
String triggerId = entry.getTriggerId();
if (partition.get(tenantId) == null) {
partition.put(tenantId, new ArrayList<>());
}
partition.get(tenantId).add(triggerId);
} | java | private void add(Map<String, List<String>> partition, PartitionEntry entry) {
String tenantId = entry.getTenantId();
String triggerId = entry.getTriggerId();
if (partition.get(tenantId) == null) {
partition.put(tenantId, new ArrayList<>());
}
partition.get(tenantId).add(triggerId);
} | [
"private",
"void",
"add",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"partition",
",",
"PartitionEntry",
"entry",
")",
"{",
"String",
"tenantId",
"=",
"entry",
".",
"getTenantId",
"(",
")",
";",
"String",
"triggerId",
"=",
"entry",
... | /*
Auxiliary function to transform a PartitionEntry object into a plain map representation. | [
"/",
"*",
"Auxiliary",
"function",
"to",
"transform",
"a",
"PartitionEntry",
"object",
"into",
"a",
"plain",
"map",
"representation",
"."
] | train | https://github.com/hawkular/hawkular-alerts/blob/b4a0c2909b38e03e72cc1828219562ee8fcbf426/engine/src/main/java/org/hawkular/alerts/engine/impl/PartitionManagerImpl.java#L469-L476 |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelReceiver.java | ManagementChannelReceiver.handlePing | private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException {
final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion());
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | java | private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException {
final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion());
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | [
"private",
"static",
"void",
"handlePing",
"(",
"final",
"Channel",
"channel",
",",
"final",
"ManagementProtocolHeader",
"header",
")",
"throws",
"IOException",
"{",
"final",
"ManagementProtocolHeader",
"response",
"=",
"new",
"ManagementPongHeader",
"(",
"header",
".... | Handle a simple ping request.
@param channel the channel
@param header the protocol header
@throws IOException for any error | [
"Handle",
"a",
"simple",
"ping",
"request",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelReceiver.java#L142-L151 |
dottydingo/hyperion | client/src/main/java/com/dottydingo/hyperion/client/HyperionClient.java | HyperionClient.serializeBody | protected String serializeBody(Request request)
{
try
{
return objectMapper.writeValueAsString(request.getRequestBody());
}
catch (JsonProcessingException e)
{
throw new ClientMarshallingException("Error writing request.",e);
}
} | java | protected String serializeBody(Request request)
{
try
{
return objectMapper.writeValueAsString(request.getRequestBody());
}
catch (JsonProcessingException e)
{
throw new ClientMarshallingException("Error writing request.",e);
}
} | [
"protected",
"String",
"serializeBody",
"(",
"Request",
"request",
")",
"{",
"try",
"{",
"return",
"objectMapper",
".",
"writeValueAsString",
"(",
"request",
".",
"getRequestBody",
"(",
")",
")",
";",
"}",
"catch",
"(",
"JsonProcessingException",
"e",
")",
"{"... | Serialize the request body
@param request The data service request
@return The JSON representation of the request | [
"Serialize",
"the",
"request",
"body"
] | train | https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/client/src/main/java/com/dottydingo/hyperion/client/HyperionClient.java#L388-L398 |
neo4j/neo4j-java-driver | driver/src/main/java/org/neo4j/driver/internal/util/Futures.java | Futures.combineErrors | public static CompletionException combineErrors( Throwable error1, Throwable error2 )
{
if ( error1 != null && error2 != null )
{
Throwable cause1 = completionExceptionCause( error1 );
Throwable cause2 = completionExceptionCause( error2 );
if ( cause1 != cause2 )
{
cause1.addSuppressed( cause2 );
}
return asCompletionException( cause1 );
}
else if ( error1 != null )
{
return asCompletionException( error1 );
}
else if ( error2 != null )
{
return asCompletionException( error2 );
}
else
{
return null;
}
} | java | public static CompletionException combineErrors( Throwable error1, Throwable error2 )
{
if ( error1 != null && error2 != null )
{
Throwable cause1 = completionExceptionCause( error1 );
Throwable cause2 = completionExceptionCause( error2 );
if ( cause1 != cause2 )
{
cause1.addSuppressed( cause2 );
}
return asCompletionException( cause1 );
}
else if ( error1 != null )
{
return asCompletionException( error1 );
}
else if ( error2 != null )
{
return asCompletionException( error2 );
}
else
{
return null;
}
} | [
"public",
"static",
"CompletionException",
"combineErrors",
"(",
"Throwable",
"error1",
",",
"Throwable",
"error2",
")",
"{",
"if",
"(",
"error1",
"!=",
"null",
"&&",
"error2",
"!=",
"null",
")",
"{",
"Throwable",
"cause1",
"=",
"completionExceptionCause",
"(",
... | Combine given errors into a single {@link CompletionException} to be rethrown from inside a
{@link CompletionStage} chain.
@param error1 the first error or {@code null}.
@param error2 the second error or {@code null}.
@return {@code null} if both errors are null, {@link CompletionException} otherwise. | [
"Combine",
"given",
"errors",
"into",
"a",
"single",
"{",
"@link",
"CompletionException",
"}",
"to",
"be",
"rethrown",
"from",
"inside",
"a",
"{",
"@link",
"CompletionStage",
"}",
"chain",
"."
] | train | https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/util/Futures.java#L181-L205 |
alipay/sofa-rpc | extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/common/SofaConfigs.java | SofaConfigs.getBooleanValue | public static boolean getBooleanValue(String appName, String key, boolean defaultValue) {
String ret = getStringValue0(appName, key);
return StringUtils.isEmpty(ret) ? defaultValue : CommonUtils.parseBoolean(ret, defaultValue);
} | java | public static boolean getBooleanValue(String appName, String key, boolean defaultValue) {
String ret = getStringValue0(appName, key);
return StringUtils.isEmpty(ret) ? defaultValue : CommonUtils.parseBoolean(ret, defaultValue);
} | [
"public",
"static",
"boolean",
"getBooleanValue",
"(",
"String",
"appName",
",",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"ret",
"=",
"getStringValue0",
"(",
"appName",
",",
"key",
")",
";",
"return",
"StringUtils",
".",
"isEmpty",
... | 获取Boolean格式的Config
@param appName 应用名
@param key 配置项
@param defaultValue 默认值
@return 配置 | [
"获取Boolean格式的Config"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/common/SofaConfigs.java#L144-L147 |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.unproxyRemoteObject | public void unproxyRemoteObject (DObjectAddress addr)
{
Tuple<Subscriber<?>, DObject> bits = _proxies.remove(addr);
if (bits == null) {
log.warning("Requested to clear unknown proxy", "addr", addr);
return;
}
// If it's local, just remove the subscriber we added and bail
if (Objects.equal(addr.nodeName, _nodeName)) {
bits.right.removeSubscriber(bits.left);
return;
}
// clear out the local object manager's proxy mapping
_omgr.clearProxyObject(addr.oid, bits.right);
final Client peer = getPeerClient(addr.nodeName);
if (peer == null) {
log.warning("Unable to unsubscribe from proxy, missing peer", "addr", addr);
return;
}
// restore the object's omgr reference to our ClientDObjectMgr and its oid back to the
// remote oid so that it can properly finish the unsubscription process
bits.right.setOid(addr.oid);
bits.right.setManager(peer.getDObjectManager());
// finally unsubscribe from the object on our peer
peer.getDObjectManager().unsubscribeFromObject(addr.oid, bits.left);
} | java | public void unproxyRemoteObject (DObjectAddress addr)
{
Tuple<Subscriber<?>, DObject> bits = _proxies.remove(addr);
if (bits == null) {
log.warning("Requested to clear unknown proxy", "addr", addr);
return;
}
// If it's local, just remove the subscriber we added and bail
if (Objects.equal(addr.nodeName, _nodeName)) {
bits.right.removeSubscriber(bits.left);
return;
}
// clear out the local object manager's proxy mapping
_omgr.clearProxyObject(addr.oid, bits.right);
final Client peer = getPeerClient(addr.nodeName);
if (peer == null) {
log.warning("Unable to unsubscribe from proxy, missing peer", "addr", addr);
return;
}
// restore the object's omgr reference to our ClientDObjectMgr and its oid back to the
// remote oid so that it can properly finish the unsubscription process
bits.right.setOid(addr.oid);
bits.right.setManager(peer.getDObjectManager());
// finally unsubscribe from the object on our peer
peer.getDObjectManager().unsubscribeFromObject(addr.oid, bits.left);
} | [
"public",
"void",
"unproxyRemoteObject",
"(",
"DObjectAddress",
"addr",
")",
"{",
"Tuple",
"<",
"Subscriber",
"<",
"?",
">",
",",
"DObject",
">",
"bits",
"=",
"_proxies",
".",
"remove",
"(",
"addr",
")",
";",
"if",
"(",
"bits",
"==",
"null",
")",
"{",
... | Unsubscribes from and clears a proxied object. The caller must be sure that there are no
remaining subscribers to the object on this local server. | [
"Unsubscribes",
"from",
"and",
"clears",
"a",
"proxied",
"object",
".",
"The",
"caller",
"must",
"be",
"sure",
"that",
"there",
"are",
"no",
"remaining",
"subscribers",
"to",
"the",
"object",
"on",
"this",
"local",
"server",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L698-L729 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/JsonDataProviderImpl.java | JsonDataProviderImpl.getDataByFilter | @Override
public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter) {
Preconditions.checkArgument(resource != null, "File resource cannot be null");
logger.entering(dataFilter);
Class<?> arrayType;
JsonReader reader = null;
try {
reader = new JsonReader(getReader(resource));
arrayType = Array.newInstance(resource.getCls(), 0).getClass();
Gson myJson = new Gson();
Object[] mappedData = myJson.fromJson(reader, arrayType);
return prepareDataAsObjectArrayList(mappedData, dataFilter).iterator();
} catch (Exception e) {
throw new DataProviderException(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(reader);
}
} | java | @Override
public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter) {
Preconditions.checkArgument(resource != null, "File resource cannot be null");
logger.entering(dataFilter);
Class<?> arrayType;
JsonReader reader = null;
try {
reader = new JsonReader(getReader(resource));
arrayType = Array.newInstance(resource.getCls(), 0).getClass();
Gson myJson = new Gson();
Object[] mappedData = myJson.fromJson(reader, arrayType);
return prepareDataAsObjectArrayList(mappedData, dataFilter).iterator();
} catch (Exception e) {
throw new DataProviderException(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(reader);
}
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"Object",
"[",
"]",
">",
"getDataByFilter",
"(",
"DataProviderFilter",
"dataFilter",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"resource",
"!=",
"null",
",",
"\"File resource cannot be null\"",
")",
";",
"log... | Gets JSON data from a resource by applying the given filter.
@param dataFilter
an implementation class of {@link DataProviderFilter} | [
"Gets",
"JSON",
"data",
"from",
"a",
"resource",
"by",
"applying",
"the",
"given",
"filter",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/JsonDataProviderImpl.java#L184-L201 |
morimekta/utils | diff-util/src/main/java/net/morimekta/diff/Diff.java | Diff.fromDelta | public static Diff fromDelta(String text1, String delta)
throws IllegalArgumentException {
return new Diff(changesFromDelta(text1, delta), DiffOptions.defaults());
} | java | public static Diff fromDelta(String text1, String delta)
throws IllegalArgumentException {
return new Diff(changesFromDelta(text1, delta), DiffOptions.defaults());
} | [
"public",
"static",
"Diff",
"fromDelta",
"(",
"String",
"text1",
",",
"String",
"delta",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"new",
"Diff",
"(",
"changesFromDelta",
"(",
"text1",
",",
"delta",
")",
",",
"DiffOptions",
".",
"defaults",
"("... | Given the original text1, and an encoded string which describes the
operations required to transform text1 into text2, compute the full diff.
@param text1 Source string for the diff.
@param delta Delta text.
@return Diff object.
@throws IllegalArgumentException If invalid input. | [
"Given",
"the",
"original",
"text1",
"and",
"an",
"encoded",
"string",
"which",
"describes",
"the",
"operations",
"required",
"to",
"transform",
"text1",
"into",
"text2",
"compute",
"the",
"full",
"diff",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/diff-util/src/main/java/net/morimekta/diff/Diff.java#L66-L69 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java | ArrayOfDoublesUnion.getResult | public ArrayOfDoublesCompactSketch getResult(final WritableMemory dstMem) {
if (sketch_.getRetainedEntries() > sketch_.getNominalEntries()) {
theta_ = Math.min(theta_, sketch_.getNewTheta());
}
if (dstMem == null) {
return new HeapArrayOfDoublesCompactSketch(sketch_, theta_);
}
return new DirectArrayOfDoublesCompactSketch(sketch_, theta_, dstMem);
} | java | public ArrayOfDoublesCompactSketch getResult(final WritableMemory dstMem) {
if (sketch_.getRetainedEntries() > sketch_.getNominalEntries()) {
theta_ = Math.min(theta_, sketch_.getNewTheta());
}
if (dstMem == null) {
return new HeapArrayOfDoublesCompactSketch(sketch_, theta_);
}
return new DirectArrayOfDoublesCompactSketch(sketch_, theta_, dstMem);
} | [
"public",
"ArrayOfDoublesCompactSketch",
"getResult",
"(",
"final",
"WritableMemory",
"dstMem",
")",
"{",
"if",
"(",
"sketch_",
".",
"getRetainedEntries",
"(",
")",
">",
"sketch_",
".",
"getNominalEntries",
"(",
")",
")",
"{",
"theta_",
"=",
"Math",
".",
"min"... | Returns the resulting union in the form of a compact sketch
@param dstMem memory for the result (can be null)
@return compact sketch representing the union (off-heap if memory is provided) | [
"Returns",
"the",
"resulting",
"union",
"in",
"the",
"form",
"of",
"a",
"compact",
"sketch"
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesUnion.java#L137-L145 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.ofIndices | public static <T> IntStreamEx ofIndices(List<T> list, Predicate<T> predicate) {
return seq(IntStream.range(0, list.size()).filter(i -> predicate.test(list.get(i))));
} | java | public static <T> IntStreamEx ofIndices(List<T> list, Predicate<T> predicate) {
return seq(IntStream.range(0, list.size()).filter(i -> predicate.test(list.get(i))));
} | [
"public",
"static",
"<",
"T",
">",
"IntStreamEx",
"ofIndices",
"(",
"List",
"<",
"T",
">",
"list",
",",
"Predicate",
"<",
"T",
">",
"predicate",
")",
"{",
"return",
"seq",
"(",
"IntStream",
".",
"range",
"(",
"0",
",",
"list",
".",
"size",
"(",
")"... | Returns a sequential ordered {@code IntStreamEx} containing all the
indices of the supplied list elements which match given predicate.
<p>
The list elements are accessed using {@link List#get(int)}, so the list
should provide fast random access. The list is assumed to be unmodifiable
during the stream operations.
@param <T> list element type
@param list list to get the stream of its indices
@param predicate a predicate to test list elements
@return a sequential {@code IntStreamEx} of the matched list indices
@since 0.1.1 | [
"Returns",
"a",
"sequential",
"ordered",
"{",
"@code",
"IntStreamEx",
"}",
"containing",
"all",
"the",
"indices",
"of",
"the",
"supplied",
"list",
"elements",
"which",
"match",
"given",
"predicate",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L2029-L2031 |
osiam/connector4java | src/main/java/org/osiam/client/OsiamConnector.java | OsiamConnector.refreshAccessToken | public AccessToken refreshAccessToken(AccessToken accessToken, Scope... scopes) {
return getAuthService().refreshAccessToken(accessToken, scopes);
} | java | public AccessToken refreshAccessToken(AccessToken accessToken, Scope... scopes) {
return getAuthService().refreshAccessToken(accessToken, scopes);
} | [
"public",
"AccessToken",
"refreshAccessToken",
"(",
"AccessToken",
"accessToken",
",",
"Scope",
"...",
"scopes",
")",
"{",
"return",
"getAuthService",
"(",
")",
".",
"refreshAccessToken",
"(",
"accessToken",
",",
"scopes",
")",
";",
"}"
] | Provides a new and refreshed access token by getting the refresh token from the given access token.
@param accessToken the access token to be refreshed
@param scopes an optional parameter if the scope of the token should be changed. Otherwise the scopes of the
old token are used.
@return the new access token with the refreshed lifetime
@throws IllegalArgumentException in case the accessToken has an empty refresh token
@throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized
@throws UnauthorizedException if the request could not be authorized.
@throws IllegalStateException if OSIAM's endpoint(s) are not properly configured | [
"Provides",
"a",
"new",
"and",
"refreshed",
"access",
"token",
"by",
"getting",
"the",
"refresh",
"token",
"from",
"the",
"given",
"access",
"token",
"."
] | train | https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L381-L383 |
JOML-CI/JOML | src/org/joml/Intersectiond.java | Intersectiond.findClosestPointOnTriangle | public static int findClosestPointOnTriangle(Vector2dc v0, Vector2dc v1, Vector2dc v2, Vector2dc p, Vector2d result) {
return findClosestPointOnTriangle(v0.x(), v0.y(), v1.x(), v1.y(), v2.x(), v2.y(), p.x(), p.y(), result);
} | java | public static int findClosestPointOnTriangle(Vector2dc v0, Vector2dc v1, Vector2dc v2, Vector2dc p, Vector2d result) {
return findClosestPointOnTriangle(v0.x(), v0.y(), v1.x(), v1.y(), v2.x(), v2.y(), p.x(), p.y(), result);
} | [
"public",
"static",
"int",
"findClosestPointOnTriangle",
"(",
"Vector2dc",
"v0",
",",
"Vector2dc",
"v1",
",",
"Vector2dc",
"v2",
",",
"Vector2dc",
"p",
",",
"Vector2d",
"result",
")",
"{",
"return",
"findClosestPointOnTriangle",
"(",
"v0",
".",
"x",
"(",
")",
... | Determine the closest point on the triangle with the vertices <code>v0</code>, <code>v1</code>, <code>v2</code>
between that triangle and the given point <code>p</code> and store that point into the given <code>result</code>.
<p>
Additionally, this method returns whether the closest point is a vertex ({@link #POINT_ON_TRIANGLE_VERTEX_0}, {@link #POINT_ON_TRIANGLE_VERTEX_1}, {@link #POINT_ON_TRIANGLE_VERTEX_2})
of the triangle, lies on an edge ({@link #POINT_ON_TRIANGLE_EDGE_01}, {@link #POINT_ON_TRIANGLE_EDGE_12}, {@link #POINT_ON_TRIANGLE_EDGE_20})
or on the {@link #POINT_ON_TRIANGLE_FACE face} of the triangle.
<p>
Reference: Book "Real-Time Collision Detection" chapter 5.1.5 "Closest Point on Triangle to Point"
@param v0
the first vertex of the triangle
@param v1
the second vertex of the triangle
@param v2
the third vertex of the triangle
@param p
the point
@param result
will hold the closest point
@return one of {@link #POINT_ON_TRIANGLE_VERTEX_0}, {@link #POINT_ON_TRIANGLE_VERTEX_1}, {@link #POINT_ON_TRIANGLE_VERTEX_2},
{@link #POINT_ON_TRIANGLE_EDGE_01}, {@link #POINT_ON_TRIANGLE_EDGE_12}, {@link #POINT_ON_TRIANGLE_EDGE_20} or
{@link #POINT_ON_TRIANGLE_FACE} | [
"Determine",
"the",
"closest",
"point",
"on",
"the",
"triangle",
"with",
"the",
"vertices",
"<code",
">",
"v0<",
"/",
"code",
">",
"<code",
">",
"v1<",
"/",
"code",
">",
"<code",
">",
"v2<",
"/",
"code",
">",
"between",
"that",
"triangle",
"and",
"the"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L4192-L4194 |
sarxos/win-registry | src/main/java/com/github/sarxos/winreg/WindowsRegistry.java | WindowsRegistry.readStringValues | public Map<String, String> readStringValues(HKey hk, String key) throws RegistryException {
return readStringValues(hk, key, null);
} | java | public Map<String, String> readStringValues(HKey hk, String key) throws RegistryException {
return readStringValues(hk, key, null);
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"readStringValues",
"(",
"HKey",
"hk",
",",
"String",
"key",
")",
"throws",
"RegistryException",
"{",
"return",
"readStringValues",
"(",
"hk",
",",
"key",
",",
"null",
")",
";",
"}"
] | Read value(s) and value name(s) form given key
@param hk the HKEY
@param key the key
@return the value name(s) plus the value(s)
@throws RegistryException when something is not right | [
"Read",
"value",
"(",
"s",
")",
"and",
"value",
"name",
"(",
"s",
")",
"form",
"given",
"key"
] | train | https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/WindowsRegistry.java#L75-L77 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java | JsiiObject.jsiiGet | @Nullable
protected final <T> T jsiiGet(final String property, final Class<T> type) {
return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type);
} | java | @Nullable
protected final <T> T jsiiGet(final String property, final Class<T> type) {
return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type);
} | [
"@",
"Nullable",
"protected",
"final",
"<",
"T",
">",
"T",
"jsiiGet",
"(",
"final",
"String",
"property",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"JsiiObjectMapper",
".",
"treeToValue",
"(",
"engine",
".",
"getClient",
"(",
")",... | Gets a property value from the object.
@param property The property name.
@param type The Java type of the property.
@param <T> The Java type of the property.
@return The property value. | [
"Gets",
"a",
"property",
"value",
"from",
"the",
"object",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L105-L108 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/internal/UpgradePlanJob.java | UpgradePlanJob.tryInstallExtension | protected boolean tryInstallExtension(ExtensionId extensionId, String namespace)
{
DefaultExtensionPlanTree currentTree = this.extensionTree.clone();
try {
installExtension(extensionId, namespace, currentTree);
setExtensionTree(currentTree);
return true;
} catch (InstallException e) {
if (getRequest().isVerbose()) {
this.logger.info(FAILED_INSTALL_MESSAGE, extensionId, namespace, e);
} else {
this.logger.debug(FAILED_INSTALL_MESSAGE, extensionId, namespace, e);
}
}
return false;
} | java | protected boolean tryInstallExtension(ExtensionId extensionId, String namespace)
{
DefaultExtensionPlanTree currentTree = this.extensionTree.clone();
try {
installExtension(extensionId, namespace, currentTree);
setExtensionTree(currentTree);
return true;
} catch (InstallException e) {
if (getRequest().isVerbose()) {
this.logger.info(FAILED_INSTALL_MESSAGE, extensionId, namespace, e);
} else {
this.logger.debug(FAILED_INSTALL_MESSAGE, extensionId, namespace, e);
}
}
return false;
} | [
"protected",
"boolean",
"tryInstallExtension",
"(",
"ExtensionId",
"extensionId",
",",
"String",
"namespace",
")",
"{",
"DefaultExtensionPlanTree",
"currentTree",
"=",
"this",
".",
"extensionTree",
".",
"clone",
"(",
")",
";",
"try",
"{",
"installExtension",
"(",
... | Try to install the provided extension and update the plan if it's working.
@param extensionId the extension version to install
@param namespace the namespace where to install the extension
@return true if the installation would succeed, false otherwise | [
"Try",
"to",
"install",
"the",
"provided",
"extension",
"and",
"update",
"the",
"plan",
"if",
"it",
"s",
"working",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/internal/UpgradePlanJob.java#L192-L211 |
dkpro/dkpro-statistics | dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java | Significance.getSignificance | public static double getSignificance(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException {
double alpha = TestUtils.pairedTTest(sample1, sample2);
boolean significance = TestUtils.pairedTTest(sample1, sample2, .30);
System.err.println("sig: " + significance);
return alpha;
} | java | public static double getSignificance(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException {
double alpha = TestUtils.pairedTTest(sample1, sample2);
boolean significance = TestUtils.pairedTTest(sample1, sample2, .30);
System.err.println("sig: " + significance);
return alpha;
} | [
"public",
"static",
"double",
"getSignificance",
"(",
"double",
"[",
"]",
"sample1",
",",
"double",
"[",
"]",
"sample2",
")",
"throws",
"IllegalArgumentException",
",",
"MathException",
"{",
"double",
"alpha",
"=",
"TestUtils",
".",
"pairedTTest",
"(",
"sample1"... | Uses a paired t-test to test whether the correlation value computed from these datasets is significant.
@param sample1 The first dataset vector.
@param sample2 The second dataset vector.
@return The significance value p.
@throws MathException
@throws IllegalArgumentException | [
"Uses",
"a",
"paired",
"t",
"-",
"test",
"to",
"test",
"whether",
"the",
"correlation",
"value",
"computed",
"from",
"these",
"datasets",
"is",
"significant",
"."
] | train | https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java#L93-L98 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java | LocalDateTime.plusYears | public LocalDateTime plusYears(long years) {
LocalDate newDate = date.plusYears(years);
return with(newDate, time);
} | java | public LocalDateTime plusYears(long years) {
LocalDate newDate = date.plusYears(years);
return with(newDate, time);
} | [
"public",
"LocalDateTime",
"plusYears",
"(",
"long",
"years",
")",
"{",
"LocalDate",
"newDate",
"=",
"date",
".",
"plusYears",
"(",
"years",
")",
";",
"return",
"with",
"(",
"newDate",
",",
"time",
")",
";",
"}"
] | Returns a copy of this {@code LocalDateTime} with the specified number of years added.
<p>
This method adds the specified amount to the years field in three steps:
<ol>
<li>Add the input years to the year field</li>
<li>Check if the resulting date would be invalid</li>
<li>Adjust the day-of-month to the last valid day if necessary</li>
</ol>
<p>
For example, 2008-02-29 (leap year) plus one year would result in the
invalid date 2009-02-29 (standard year). Instead of returning an invalid
result, the last valid day of the month, 2009-02-28, is selected instead.
<p>
This instance is immutable and unaffected by this method call.
@param years the years to add, may be negative
@return a {@code LocalDateTime} based on this date-time with the years added, not null
@throws DateTimeException if the result exceeds the supported date range | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"LocalDateTime",
"}",
"with",
"the",
"specified",
"number",
"of",
"years",
"added",
".",
"<p",
">",
"This",
"method",
"adds",
"the",
"specified",
"amount",
"to",
"the",
"years",
"field",
"in",
"three",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java#L1214-L1217 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/easydl/AipEasyDL.java | AipEasyDL.sendImageRequest | public JSONObject sendImageRequest(String url, String image, HashMap<String, Object> options) {
try {
byte[] data = Util.readFileByBytes(image);
return sendImageRequest(url, data, options);
} catch (IOException e) {
e.printStackTrace();
return AipError.IMAGE_READ_ERROR.toJsonResult();
}
} | java | public JSONObject sendImageRequest(String url, String image, HashMap<String, Object> options) {
try {
byte[] data = Util.readFileByBytes(image);
return sendImageRequest(url, data, options);
} catch (IOException e) {
e.printStackTrace();
return AipError.IMAGE_READ_ERROR.toJsonResult();
}
} | [
"public",
"JSONObject",
"sendImageRequest",
"(",
"String",
"url",
",",
"String",
"image",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"data",
"=",
"Util",
".",
"readFileByBytes",
"(",
"image",
")"... | easyDL通用请求方法
@param url 服务的url
@param image 图片本地路径
@param options 可选参数
@return Json返回 | [
"easyDL通用请求方法"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/easydl/AipEasyDL.java#L30-L38 |
overturetool/overture | core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java | VarShadowingRenameCollector.visitModuleDefs | private void visitModuleDefs(List<PDefinition> defs, INode module)
throws AnalysisException
{
DefinitionInfo defInfo = getStateDefs(defs, module);
if (defInfo != null)
{
addLocalDefs(defInfo);
handleExecutables(defs);
removeLocalDefs(defInfo);
} else
{
handleExecutables(defs);
}
} | java | private void visitModuleDefs(List<PDefinition> defs, INode module)
throws AnalysisException
{
DefinitionInfo defInfo = getStateDefs(defs, module);
if (defInfo != null)
{
addLocalDefs(defInfo);
handleExecutables(defs);
removeLocalDefs(defInfo);
} else
{
handleExecutables(defs);
}
} | [
"private",
"void",
"visitModuleDefs",
"(",
"List",
"<",
"PDefinition",
">",
"defs",
",",
"INode",
"module",
")",
"throws",
"AnalysisException",
"{",
"DefinitionInfo",
"defInfo",
"=",
"getStateDefs",
"(",
"defs",
",",
"module",
")",
";",
"if",
"(",
"defInfo",
... | Note that this methods is intended to work both for SL modules and PP/RT classes | [
"Note",
"that",
"this",
"methods",
"is",
"intended",
"to",
"work",
"both",
"for",
"SL",
"modules",
"and",
"PP",
"/",
"RT",
"classes"
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java#L720-L734 |
menacher/java-game-server | jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java | NettyUtils.readStrings | public static String[] readStrings(ChannelBuffer buffer, int numOfStrings)
{
return readStrings(buffer,numOfStrings,CharsetUtil.UTF_8);
} | java | public static String[] readStrings(ChannelBuffer buffer, int numOfStrings)
{
return readStrings(buffer,numOfStrings,CharsetUtil.UTF_8);
} | [
"public",
"static",
"String",
"[",
"]",
"readStrings",
"(",
"ChannelBuffer",
"buffer",
",",
"int",
"numOfStrings",
")",
"{",
"return",
"readStrings",
"(",
"buffer",
",",
"numOfStrings",
",",
"CharsetUtil",
".",
"UTF_8",
")",
";",
"}"
] | This method will read multiple strings of the buffer and return them as a
string array. It internally uses the readString(ChannelBuffer buffer) to
accomplish this task. The strings are read back in the order they are
written.
@param buffer
The buffer containing the strings, with each string being a
strlength-strbytes combination.
@param numOfStrings
The number of strings to be read. Should not be negative or 0
@return the strings read from the buffer as an array. | [
"This",
"method",
"will",
"read",
"multiple",
"strings",
"of",
"the",
"buffer",
"and",
"return",
"them",
"as",
"a",
"string",
"array",
".",
"It",
"internally",
"uses",
"the",
"readString",
"(",
"ChannelBuffer",
"buffer",
")",
"to",
"accomplish",
"this",
"tas... | train | https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java#L65-L68 |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java | MonitorEndpointHelper.pingJmsBackoutQueue | public static String pingJmsBackoutQueue(MuleContext muleContext, String queueName) {
return pingJmsBackoutQueue(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName);
} | java | public static String pingJmsBackoutQueue(MuleContext muleContext, String queueName) {
return pingJmsBackoutQueue(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName);
} | [
"public",
"static",
"String",
"pingJmsBackoutQueue",
"(",
"MuleContext",
"muleContext",
",",
"String",
"queueName",
")",
"{",
"return",
"pingJmsBackoutQueue",
"(",
"muleContext",
",",
"DEFAULT_MULE_JMS_CONNECTOR",
",",
"queueName",
")",
";",
"}"
] | Verify access to a JMS backout queue by browsing the backout queue and ensure that no messages exists.
@param queueName
@return | [
"Verify",
"access",
"to",
"a",
"JMS",
"backout",
"queue",
"by",
"browsing",
"the",
"backout",
"queue",
"and",
"ensure",
"that",
"no",
"messages",
"exists",
"."
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L142-L144 |
tminglei/form-binder-java | src/main/java/com/github/tminglei/bind/Mappings.java | Mappings.bigInt | public static Mapping<BigInteger> bigInt(Constraint... constraints) {
return new FieldMapping(
InputMode.SINGLE,
mkSimpleConverter(s ->
isEmptyStr(s) ? BigInteger.ZERO : new BigInteger(s)
), new MappingMeta(MAPPING_BIG_INTEGER, BigInteger.class)
).constraint(checking(BigInteger::new, "error.bigint", true))
.constraint(constraints);
} | java | public static Mapping<BigInteger> bigInt(Constraint... constraints) {
return new FieldMapping(
InputMode.SINGLE,
mkSimpleConverter(s ->
isEmptyStr(s) ? BigInteger.ZERO : new BigInteger(s)
), new MappingMeta(MAPPING_BIG_INTEGER, BigInteger.class)
).constraint(checking(BigInteger::new, "error.bigint", true))
.constraint(constraints);
} | [
"public",
"static",
"Mapping",
"<",
"BigInteger",
">",
"bigInt",
"(",
"Constraint",
"...",
"constraints",
")",
"{",
"return",
"new",
"FieldMapping",
"(",
"InputMode",
".",
"SINGLE",
",",
"mkSimpleConverter",
"(",
"s",
"->",
"isEmptyStr",
"(",
"s",
")",
"?",
... | (convert to BigInteger) mapping
@param constraints constraints
@return new created mapping | [
"(",
"convert",
"to",
"BigInteger",
")",
"mapping"
] | train | https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/Mappings.java#L137-L145 |
zeroturnaround/zt-exec | src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java | PumpStreamHandler.wrapTask | protected Runnable wrapTask(Runnable task) {
// Preserve the MDC context of the caller thread.
Map contextMap = MDC.getCopyOfContextMap();
if (contextMap != null) {
return new MDCRunnableAdapter(task, contextMap);
}
return task;
} | java | protected Runnable wrapTask(Runnable task) {
// Preserve the MDC context of the caller thread.
Map contextMap = MDC.getCopyOfContextMap();
if (contextMap != null) {
return new MDCRunnableAdapter(task, contextMap);
}
return task;
} | [
"protected",
"Runnable",
"wrapTask",
"(",
"Runnable",
"task",
")",
"{",
"// Preserve the MDC context of the caller thread.",
"Map",
"contextMap",
"=",
"MDC",
".",
"getCopyOfContextMap",
"(",
")",
";",
"if",
"(",
"contextMap",
"!=",
"null",
")",
"{",
"return",
"new... | Override this to customize how the background task is created.
@param task the task to be run in the background
@return the runnable of the wrapped task | [
"Override",
"this",
"to",
"customize",
"how",
"the",
"background",
"task",
"is",
"created",
"."
] | train | https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java#L373-L380 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java | RequestIdTable.getSendListener | public synchronized SendListener getSendListener(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSendListener", ""+requestId);
if (!containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table");
throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
}
testReqIdTableEntry.requestId = requestId;
RequestIdTableEntry entry = table.get(testReqIdTableEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSendListener", entry.sendListener);
return entry.sendListener;
} | java | public synchronized SendListener getSendListener(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getSendListener", ""+requestId);
if (!containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table");
throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
}
testReqIdTableEntry.requestId = requestId;
RequestIdTableEntry entry = table.get(testReqIdTableEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getSendListener", entry.sendListener);
return entry.sendListener;
} | [
"public",
"synchronized",
"SendListener",
"getSendListener",
"(",
"int",
"requestId",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc"... | Returns the semaphore assocaited with the specified request ID. The
request ID must be present in the table otherwise a runtime exception
is thrown.
@param requestId The request ID to retreive the semaphore for.
@return Semaphore The semaphore retrieved. | [
"Returns",
"the",
"semaphore",
"assocaited",
"with",
"the",
"specified",
"request",
"ID",
".",
"The",
"request",
"ID",
"must",
"be",
"present",
"in",
"the",
"table",
"otherwise",
"a",
"runtime",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java#L164-L179 |
pravega/pravega | shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java | StreamSegmentNameUtils.getQualifiedStreamSegmentName | public static String getQualifiedStreamSegmentName(String scope, String streamName, long segmentId) {
int segmentNumber = getSegmentNumber(segmentId);
int epoch = getEpoch(segmentId);
StringBuffer sb = getScopedStreamNameInternal(scope, streamName);
sb.append('/');
sb.append(segmentNumber);
sb.append(EPOCH_DELIMITER);
sb.append(epoch);
return sb.toString();
} | java | public static String getQualifiedStreamSegmentName(String scope, String streamName, long segmentId) {
int segmentNumber = getSegmentNumber(segmentId);
int epoch = getEpoch(segmentId);
StringBuffer sb = getScopedStreamNameInternal(scope, streamName);
sb.append('/');
sb.append(segmentNumber);
sb.append(EPOCH_DELIMITER);
sb.append(epoch);
return sb.toString();
} | [
"public",
"static",
"String",
"getQualifiedStreamSegmentName",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"long",
"segmentId",
")",
"{",
"int",
"segmentNumber",
"=",
"getSegmentNumber",
"(",
"segmentId",
")",
";",
"int",
"epoch",
"=",
"getEpoch",
... | Method to generate Fully Qualified StreamSegmentName using scope, stream and segment id.
@param scope scope to be used in the ScopedStreamSegment name
@param streamName stream name to be used in ScopedStreamSegment name.
@param segmentId segment id to be used in ScopedStreamSegment name.
@return fully qualified StreamSegmentName. | [
"Method",
"to",
"generate",
"Fully",
"Qualified",
"StreamSegmentName",
"using",
"scope",
"stream",
"and",
"segment",
"id",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java#L257-L266 |
phxql/argon2-jvm | src/main/java/de/mkammerer/argon2/Argon2Helper.java | Argon2Helper.warmup | private static void warmup(Argon2 argon2, char[] password) {
for (int i = 0; i < WARMUP_RUNS; i++) {
argon2.hash(MIN_ITERATIONS, MIN_MEMORY, MIN_PARALLELISM, password);
}
} | java | private static void warmup(Argon2 argon2, char[] password) {
for (int i = 0; i < WARMUP_RUNS; i++) {
argon2.hash(MIN_ITERATIONS, MIN_MEMORY, MIN_PARALLELISM, password);
}
} | [
"private",
"static",
"void",
"warmup",
"(",
"Argon2",
"argon2",
",",
"char",
"[",
"]",
"password",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"WARMUP_RUNS",
";",
"i",
"++",
")",
"{",
"argon2",
".",
"hash",
"(",
"MIN_ITERATIONS",
","... | Calls Argon2 a number of times to warm up the JIT
@param argon2 Argon2 instance.
@param password Some password. | [
"Calls",
"Argon2",
"a",
"number",
"of",
"times",
"to",
"warm",
"up",
"the",
"JIT"
] | train | https://github.com/phxql/argon2-jvm/blob/27a13907729e67e98cca53eba279e109b60f04f1/src/main/java/de/mkammerer/argon2/Argon2Helper.java#L83-L87 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsResultListItem.java | CmsResultListItem.createDeleteButton | public static CmsPushButton createDeleteButton() {
return createButton(I_CmsButton.TRASH_SMALL, Messages.get().key(Messages.GUI_RESULT_BUTTON_DELETE_0));
} | java | public static CmsPushButton createDeleteButton() {
return createButton(I_CmsButton.TRASH_SMALL, Messages.get().key(Messages.GUI_RESULT_BUTTON_DELETE_0));
} | [
"public",
"static",
"CmsPushButton",
"createDeleteButton",
"(",
")",
"{",
"return",
"createButton",
"(",
"I_CmsButton",
".",
"TRASH_SMALL",
",",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_RESULT_BUTTON_DELETE_0",
")",
")",
";",
"}... | Creates the delete button for this item.<p>
@return the delete button | [
"Creates",
"the",
"delete",
"button",
"for",
"this",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultListItem.java#L127-L130 |
jbundle/webapp | base/src/main/java/org/jbundle/util/webapp/base/HttpServiceActivator.java | HttpServiceActivator.createServiceTracker | public HttpServiceTracker createServiceTracker(BundleContext context, HttpContext httpContext, Dictionary<String, String> dictionary)
{
if (httpContext == null)
httpContext = getHttpContext();
return new HttpServiceTracker(context, httpContext, dictionary);
} | java | public HttpServiceTracker createServiceTracker(BundleContext context, HttpContext httpContext, Dictionary<String, String> dictionary)
{
if (httpContext == null)
httpContext = getHttpContext();
return new HttpServiceTracker(context, httpContext, dictionary);
} | [
"public",
"HttpServiceTracker",
"createServiceTracker",
"(",
"BundleContext",
"context",
",",
"HttpContext",
"httpContext",
",",
"Dictionary",
"<",
"String",
",",
"String",
">",
"dictionary",
")",
"{",
"if",
"(",
"httpContext",
"==",
"null",
")",
"httpContext",
"=... | Create the service tracker.
@param context
@param httpContext
@param dictionary
@return | [
"Create",
"the",
"service",
"tracker",
"."
] | train | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/HttpServiceActivator.java#L73-L78 |
JRebirth/JRebirth | org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/service/impl/LoadEdtFileServiceImpl.java | LoadEdtFileServiceImpl.addEvent | private void addEvent(final List<JRebirthEvent> eventList, final String strLine) {
eventList.add(new JRebirthEventBase(strLine));
} | java | private void addEvent(final List<JRebirthEvent> eventList, final String strLine) {
eventList.add(new JRebirthEventBase(strLine));
} | [
"private",
"void",
"addEvent",
"(",
"final",
"List",
"<",
"JRebirthEvent",
">",
"eventList",
",",
"final",
"String",
"strLine",
")",
"{",
"eventList",
".",
"add",
"(",
"new",
"JRebirthEventBase",
"(",
"strLine",
")",
")",
";",
"}"
] | Add an event to the event list.
@param eventList the list of events
@param strLine the string to use | [
"Add",
"an",
"event",
"to",
"the",
"event",
"list",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/showcase/analyzer/src/main/java/org/jrebirth/af/showcase/analyzer/service/impl/LoadEdtFileServiceImpl.java#L108-L110 |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java | GroupService.findGroup | private GroupMetadata findGroup(GroupHierarchyConfig config, String parentGroupId) {
GroupMetadata parentGroup = findByRef(Group.refById(parentGroupId));
return parentGroup.getGroups().stream()
.filter(group -> group.getName().equals(config.getName()))
.findFirst()
.orElse(null);
} | java | private GroupMetadata findGroup(GroupHierarchyConfig config, String parentGroupId) {
GroupMetadata parentGroup = findByRef(Group.refById(parentGroupId));
return parentGroup.getGroups().stream()
.filter(group -> group.getName().equals(config.getName()))
.findFirst()
.orElse(null);
} | [
"private",
"GroupMetadata",
"findGroup",
"(",
"GroupHierarchyConfig",
"config",
",",
"String",
"parentGroupId",
")",
"{",
"GroupMetadata",
"parentGroup",
"=",
"findByRef",
"(",
"Group",
".",
"refById",
"(",
"parentGroupId",
")",
")",
";",
"return",
"parentGroup",
... | Find group based on config instance and parent group identifier
@param config group hierarchy config
@param parentGroupId parent group id
@return GroupMetadata | [
"Find",
"group",
"based",
"on",
"config",
"instance",
"and",
"parent",
"group",
"identifier"
] | train | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/GroupService.java#L251-L258 |
robocup-atan/atan | src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java | CommandFactory.addMoveBallCommand | public void addMoveBallCommand(double x, double y) {
StringBuilder buf = new StringBuilder();
buf.append("(move ");
buf.append("ball"); // TODO Manual says the format...will implement this later.
buf.append(' ');
buf.append(x);
buf.append(' ');
buf.append(y);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | java | public void addMoveBallCommand(double x, double y) {
StringBuilder buf = new StringBuilder();
buf.append("(move ");
buf.append("ball"); // TODO Manual says the format...will implement this later.
buf.append(' ');
buf.append(x);
buf.append(' ');
buf.append(y);
buf.append(')');
fifo.add(fifo.size(), buf.toString());
} | [
"public",
"void",
"addMoveBallCommand",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"(move \"",
")",
";",
"buf",
".",
"append",
"(",
"\"ball\"",
")",
... | Trainer only command.
Moves the ball to the given coordinates.
@param x The x coordinate to move to.
@param y The y coordinate to move to. | [
"Trainer",
"only",
"command",
".",
"Moves",
"the",
"ball",
"to",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/CommandFactory.java#L316-L326 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.getMethodSignature | protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
StringBuilder buffer = new StringBuilder(methodName);
buffer.append("(");
if (parameterTypes != null) {
int index = 0;
for (Class<?> parameterType : parameterTypes) {
buffer.append(index++ > 0 ? ", :" : ":");
buffer.append(getSimpleName(parameterType));
}
}
buffer.append("):");
buffer.append(returnType == null || Void.class.equals(returnType) ? "void" : getSimpleName(returnType));
return buffer.toString();
} | java | protected static String getMethodSignature(String methodName, Class<?>[] parameterTypes, Class<?> returnType) {
StringBuilder buffer = new StringBuilder(methodName);
buffer.append("(");
if (parameterTypes != null) {
int index = 0;
for (Class<?> parameterType : parameterTypes) {
buffer.append(index++ > 0 ? ", :" : ":");
buffer.append(getSimpleName(parameterType));
}
}
buffer.append("):");
buffer.append(returnType == null || Void.class.equals(returnType) ? "void" : getSimpleName(returnType));
return buffer.toString();
} | [
"protected",
"static",
"String",
"getMethodSignature",
"(",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Class",
"<",
"?",
">",
"returnType",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"me... | Builds the signature of a method based on the method's name, parameter types and return type.
@param methodName a String indicating the name of the method.
@param parameterTypes an array of Class objects indicating the type of each method parameter.
@param returnType a Class object indicating the methods return type.
@return the signature of the method as a String.
@see #getSimpleName(Class) | [
"Builds",
"the",
"signature",
"of",
"a",
"method",
"based",
"on",
"the",
"method",
"s",
"name",
"parameter",
"types",
"and",
"return",
"type",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L449-L469 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/endpoint/healthcheck/HttpHealthCheckedEndpointGroup.java | HttpHealthCheckedEndpointGroup.of | @Deprecated
public static HttpHealthCheckedEndpointGroup of(ClientFactory clientFactory,
EndpointGroup delegate,
String healthCheckPath,
Duration healthCheckRetryInterval) {
return new HttpHealthCheckedEndpointGroupBuilder(delegate, healthCheckPath)
.clientFactory(clientFactory)
.retryInterval(healthCheckRetryInterval)
.build();
} | java | @Deprecated
public static HttpHealthCheckedEndpointGroup of(ClientFactory clientFactory,
EndpointGroup delegate,
String healthCheckPath,
Duration healthCheckRetryInterval) {
return new HttpHealthCheckedEndpointGroupBuilder(delegate, healthCheckPath)
.clientFactory(clientFactory)
.retryInterval(healthCheckRetryInterval)
.build();
} | [
"@",
"Deprecated",
"public",
"static",
"HttpHealthCheckedEndpointGroup",
"of",
"(",
"ClientFactory",
"clientFactory",
",",
"EndpointGroup",
"delegate",
",",
"String",
"healthCheckPath",
",",
"Duration",
"healthCheckRetryInterval",
")",
"{",
"return",
"new",
"HttpHealthChe... | Creates a new {@link HttpHealthCheckedEndpointGroup} instance.
@deprecated Use {@link HttpHealthCheckedEndpointGroupBuilder}. | [
"Creates",
"a",
"new",
"{",
"@link",
"HttpHealthCheckedEndpointGroup",
"}",
"instance",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/endpoint/healthcheck/HttpHealthCheckedEndpointGroup.java#L65-L74 |
liferay/com-liferay-commerce | commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java | CommerceCurrencyPersistenceImpl.findAll | @Override
public List<CommerceCurrency> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceCurrency> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceCurrency",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce currencies.
<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 CommerceCurrencyModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce currencies
@param end the upper bound of the range of commerce currencies (not inclusive)
@return the range of commerce currencies | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"currencies",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L4690-L4693 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java | GoogleDriveUtils.exportFile | public static DownloadResponse exportFile(Drive drive, File file, String format) throws IOException {
return exportFile(drive, file.getId(), format);
} | java | public static DownloadResponse exportFile(Drive drive, File file, String format) throws IOException {
return exportFile(drive, file.getId(), format);
} | [
"public",
"static",
"DownloadResponse",
"exportFile",
"(",
"Drive",
"drive",
",",
"File",
"file",
",",
"String",
"format",
")",
"throws",
"IOException",
"{",
"return",
"exportFile",
"(",
"drive",
",",
"file",
".",
"getId",
"(",
")",
",",
"format",
")",
";"... | Exports file in requested format
@param drive drive client
@param file file to be exported
@param format target format
@return exported data
@throws IOException thrown when exporting fails unexpectedly | [
"Exports",
"file",
"in",
"requested",
"format"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java#L245-L247 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java | CSTransformer.transformFileList | protected static FileList transformFileList(final CSNodeWrapper node) {
final List<File> files = new LinkedList<File>();
// Add all the child files
if (node.getChildren() != null && node.getChildren().getItems() != null) {
final List<CSNodeWrapper> childNodes = node.getChildren().getItems();
final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>();
for (final CSNodeWrapper childNode : childNodes) {
fileNodes.put(childNode, transformFile(childNode));
}
// Sort the file list nodes so that they are in the right order based on next/prev values.
final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes);
// Add the child nodes to the file list now that they are in the right order.
final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<CSNodeWrapper, File> entry = iter.next();
files.add(entry.getValue());
}
}
return new FileList(CommonConstants.CS_FILE_TITLE, files);
} | java | protected static FileList transformFileList(final CSNodeWrapper node) {
final List<File> files = new LinkedList<File>();
// Add all the child files
if (node.getChildren() != null && node.getChildren().getItems() != null) {
final List<CSNodeWrapper> childNodes = node.getChildren().getItems();
final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>();
for (final CSNodeWrapper childNode : childNodes) {
fileNodes.put(childNode, transformFile(childNode));
}
// Sort the file list nodes so that they are in the right order based on next/prev values.
final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes);
// Add the child nodes to the file list now that they are in the right order.
final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<CSNodeWrapper, File> entry = iter.next();
files.add(entry.getValue());
}
}
return new FileList(CommonConstants.CS_FILE_TITLE, files);
} | [
"protected",
"static",
"FileList",
"transformFileList",
"(",
"final",
"CSNodeWrapper",
"node",
")",
"{",
"final",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")",
";",
"// Add all the child files",
"if",
"(",
"node",
"... | Transforms a MetaData CSNode into a FileList that can be added to a ContentSpec object.
@param node The CSNode to be transformed.
@return The transformed FileList object. | [
"Transforms",
"a",
"MetaData",
"CSNode",
"into",
"a",
"FileList",
"that",
"can",
"be",
"added",
"to",
"a",
"ContentSpec",
"object",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L299-L322 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java | ExpressRoutePortsInner.createOrUpdate | public ExpressRoutePortInner createOrUpdate(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).toBlocking().last().body();
} | java | public ExpressRoutePortInner createOrUpdate(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).toBlocking().last().body();
} | [
"public",
"ExpressRoutePortInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRoutePortName",
",",
"ExpressRoutePortInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRoute... | Creates or updates the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@param parameters Parameters supplied to the create ExpressRoutePort operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRoutePortInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java#L362-L364 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.updateSpaceConsumed | void updateSpaceConsumed(String path, long nsDelta, long dsDelta)
throws QuotaExceededException,
FileNotFoundException {
updateSpaceConsumed(path, null, nsDelta, dsDelta);
} | java | void updateSpaceConsumed(String path, long nsDelta, long dsDelta)
throws QuotaExceededException,
FileNotFoundException {
updateSpaceConsumed(path, null, nsDelta, dsDelta);
} | [
"void",
"updateSpaceConsumed",
"(",
"String",
"path",
",",
"long",
"nsDelta",
",",
"long",
"dsDelta",
")",
"throws",
"QuotaExceededException",
",",
"FileNotFoundException",
"{",
"updateSpaceConsumed",
"(",
"path",
",",
"null",
",",
"nsDelta",
",",
"dsDelta",
")",
... | Updates namespace and diskspace consumed for all
directories until the parent directory of file represented by path.
@param path path for the file.
@param nsDelta the delta change of namespace
@param dsDelta the delta change of diskspace
@throws QuotaExceededException if the new count violates any quota limit
@throws FileNotFound if path does not exist. | [
"Updates",
"namespace",
"and",
"diskspace",
"consumed",
"for",
"all",
"directories",
"until",
"the",
"parent",
"directory",
"of",
"file",
"represented",
"by",
"path",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2054-L2058 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java | MappedParametrizedObjectEntry.getParameterTime | public Long getParameterTime(String name, Long defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
try
{
return StringNumberParser.parseTime(value);
}
catch (NumberFormatException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
return defaultValue;
} | java | public Long getParameterTime(String name, Long defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
try
{
return StringNumberParser.parseTime(value);
}
catch (NumberFormatException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
return defaultValue;
} | [
"public",
"Long",
"getParameterTime",
"(",
"String",
"name",
",",
"Long",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getParameterValue",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"String... | Parse named parameter using {@link StringNumberParser#parseTime(String)} and return time in
milliseconds (Long value).
@param name
parameter name
@param defaultValue
default time value
@return | [
"Parse",
"named",
"parameter",
"using",
"{",
"@link",
"StringNumberParser#parseTime",
"(",
"String",
")",
"}",
"and",
"return",
"time",
"in",
"milliseconds",
"(",
"Long",
"value",
")",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L298-L317 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java | DefaultIncrementalAttributesMapper.lookupAttributes | public static Attributes lookupAttributes(LdapOperations ldapOperations, String dn, String attribute) {
return lookupAttributes(ldapOperations, LdapUtils.newLdapName(dn), attribute);
} | java | public static Attributes lookupAttributes(LdapOperations ldapOperations, String dn, String attribute) {
return lookupAttributes(ldapOperations, LdapUtils.newLdapName(dn), attribute);
} | [
"public",
"static",
"Attributes",
"lookupAttributes",
"(",
"LdapOperations",
"ldapOperations",
",",
"String",
"dn",
",",
"String",
"attribute",
")",
"{",
"return",
"lookupAttributes",
"(",
"ldapOperations",
",",
"LdapUtils",
".",
"newLdapName",
"(",
"dn",
")",
","... | Lookup all values for the specified attribute, looping through the results incrementally if necessary.
@param ldapOperations The instance to use for performing the actual lookup.
@param dn The distinguished name of the object to find.
@param attribute name of the attribute to request.
@return an Attributes instance, populated with all found values for the requested attribute.
Never <code>null</code>, though the actual attribute may not be set if it was not
set on the requested object. | [
"Lookup",
"all",
"values",
"for",
"the",
"specified",
"attribute",
"looping",
"through",
"the",
"results",
"incrementally",
"if",
"necessary",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java#L262-L264 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java | ObjectEnvelopeOrdering.addObjectReferenceEdges | private void addObjectReferenceEdges(Vertex vertex, ObjectReferenceDescriptor rds)
{
Object refObject = rds.getPersistentField().get(vertex.getEnvelope().getRealObject());
Class refClass = rds.getItemClass();
for (int i = 0; i < vertices.length; i++)
{
Edge edge = null;
// ObjectEnvelope envelope = vertex.getEnvelope();
Vertex refVertex = vertices[i];
ObjectEnvelope refEnvelope = refVertex.getEnvelope();
if (refObject == refEnvelope.getRealObject())
{
edge = buildConcrete11Edge(vertex, refVertex, rds.hasConstraint());
}
else if (refClass.isInstance(refVertex.getEnvelope().getRealObject()))
{
edge = buildPotential11Edge(vertex, refVertex, rds.hasConstraint());
}
if (edge != null)
{
if (!edgeList.contains(edge))
{
edgeList.add(edge);
}
else
{
edge.increaseWeightTo(edge.getWeight());
}
}
}
} | java | private void addObjectReferenceEdges(Vertex vertex, ObjectReferenceDescriptor rds)
{
Object refObject = rds.getPersistentField().get(vertex.getEnvelope().getRealObject());
Class refClass = rds.getItemClass();
for (int i = 0; i < vertices.length; i++)
{
Edge edge = null;
// ObjectEnvelope envelope = vertex.getEnvelope();
Vertex refVertex = vertices[i];
ObjectEnvelope refEnvelope = refVertex.getEnvelope();
if (refObject == refEnvelope.getRealObject())
{
edge = buildConcrete11Edge(vertex, refVertex, rds.hasConstraint());
}
else if (refClass.isInstance(refVertex.getEnvelope().getRealObject()))
{
edge = buildPotential11Edge(vertex, refVertex, rds.hasConstraint());
}
if (edge != null)
{
if (!edgeList.contains(edge))
{
edgeList.add(edge);
}
else
{
edge.increaseWeightTo(edge.getWeight());
}
}
}
} | [
"private",
"void",
"addObjectReferenceEdges",
"(",
"Vertex",
"vertex",
",",
"ObjectReferenceDescriptor",
"rds",
")",
"{",
"Object",
"refObject",
"=",
"rds",
".",
"getPersistentField",
"(",
")",
".",
"get",
"(",
"vertex",
".",
"getEnvelope",
"(",
")",
".",
"get... | Finds edges based to a specific object reference descriptor and
adds them to the edge map.
@param vertex the object envelope vertex holding the object reference
@param rds the object reference descriptor | [
"Finds",
"edges",
"based",
"to",
"a",
"specific",
"object",
"reference",
"descriptor",
"and",
"adds",
"them",
"to",
"the",
"edge",
"map",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java#L284-L314 |
VoltDB/voltdb | third_party/java/src/org/HdrHistogram_voltpatches/SingleWriterRecorder.java | SingleWriterRecorder.recordValueWithCount | public void recordValueWithCount(final long value, final long count) throws ArrayIndexOutOfBoundsException {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithCount(value, count);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
} | java | public void recordValueWithCount(final long value, final long count) throws ArrayIndexOutOfBoundsException {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithCount(value, count);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
} | [
"public",
"void",
"recordValueWithCount",
"(",
"final",
"long",
"value",
",",
"final",
"long",
"count",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"long",
"criticalValueAtEnter",
"=",
"recordingPhaser",
".",
"writerCriticalSectionEnter",
"(",
")",
";",
"try... | Record a value in the histogram (adding to the value's current count)
@param value The value to be recorded
@param count The number of occurrences of this value to record
@throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue | [
"Record",
"a",
"value",
"in",
"the",
"histogram",
"(",
"adding",
"to",
"the",
"value",
"s",
"current",
"count",
")"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/SingleWriterRecorder.java#L112-L119 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/extension/std/XLifecycleExtension.java | XLifecycleExtension.assignModel | public void assignModel(XLog log, String model) {
if (model != null && model.trim().length() > 0) {
XAttributeLiteral modelAttr = (XAttributeLiteral) ATTR_MODEL
.clone();
modelAttr.setValue(model.trim());
log.getAttributes().put(KEY_MODEL, modelAttr);
}
} | java | public void assignModel(XLog log, String model) {
if (model != null && model.trim().length() > 0) {
XAttributeLiteral modelAttr = (XAttributeLiteral) ATTR_MODEL
.clone();
modelAttr.setValue(model.trim());
log.getAttributes().put(KEY_MODEL, modelAttr);
}
} | [
"public",
"void",
"assignModel",
"(",
"XLog",
"log",
",",
"String",
"model",
")",
"{",
"if",
"(",
"model",
"!=",
"null",
"&&",
"model",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"XAttributeLiteral",
"modelAttr",
"=",
"(",
... | Assigns a value for the lifecycle model identifier to a given log.
@param log
Log to be tagged.
@param model
Lifecycle model identifier string to be used. | [
"Assigns",
"a",
"value",
"for",
"the",
"lifecycle",
"model",
"identifier",
"to",
"a",
"given",
"log",
"."
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XLifecycleExtension.java#L240-L247 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java | DocServiceBuilder.exampleHttpHeaders | public DocServiceBuilder exampleHttpHeaders(String serviceName, HttpHeaders... exampleHttpHeaders) {
requireNonNull(exampleHttpHeaders, "exampleHttpHeaders");
return exampleHttpHeaders(serviceName, ImmutableList.copyOf(exampleHttpHeaders));
} | java | public DocServiceBuilder exampleHttpHeaders(String serviceName, HttpHeaders... exampleHttpHeaders) {
requireNonNull(exampleHttpHeaders, "exampleHttpHeaders");
return exampleHttpHeaders(serviceName, ImmutableList.copyOf(exampleHttpHeaders));
} | [
"public",
"DocServiceBuilder",
"exampleHttpHeaders",
"(",
"String",
"serviceName",
",",
"HttpHeaders",
"...",
"exampleHttpHeaders",
")",
"{",
"requireNonNull",
"(",
"exampleHttpHeaders",
",",
"\"exampleHttpHeaders\"",
")",
";",
"return",
"exampleHttpHeaders",
"(",
"servic... | Adds the example {@link HttpHeaders} for the service with the specified name. | [
"Adds",
"the",
"example",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java#L105-L108 |
Netflix/governator | governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java | InjectorBuilder.forEachElement | public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor, Consumer<T> consumer) {
Elements
.getElements(module)
.forEach(element -> Optional.ofNullable(element.acceptVisitor(visitor)).ifPresent(consumer));
return this;
} | java | public <T> InjectorBuilder forEachElement(ElementVisitor<T> visitor, Consumer<T> consumer) {
Elements
.getElements(module)
.forEach(element -> Optional.ofNullable(element.acceptVisitor(visitor)).ifPresent(consumer));
return this;
} | [
"public",
"<",
"T",
">",
"InjectorBuilder",
"forEachElement",
"(",
"ElementVisitor",
"<",
"T",
">",
"visitor",
",",
"Consumer",
"<",
"T",
">",
"consumer",
")",
"{",
"Elements",
".",
"getElements",
"(",
"module",
")",
".",
"forEach",
"(",
"element",
"->",
... | Iterate through all elements of the current module and pass the output of the
ElementVisitor to the provided consumer. 'null' responses from the visitor are ignored.
This call will not modify any bindings
@param visitor | [
"Iterate",
"through",
"all",
"elements",
"of",
"the",
"current",
"module",
"and",
"pass",
"the",
"output",
"of",
"the",
"ElementVisitor",
"to",
"the",
"provided",
"consumer",
".",
"null",
"responses",
"from",
"the",
"visitor",
"are",
"ignored",
"."
] | train | https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L123-L128 |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackMapHeader | public int unpackMapHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedMap(b)) { // fixmap
return b & 0x0f;
}
switch (b) {
case Code.MAP16: { // map 16
int len = readNextLength16();
return len;
}
case Code.MAP32: { // map 32
int len = readNextLength32();
return len;
}
}
throw unexpected("Map", b);
} | java | public int unpackMapHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedMap(b)) { // fixmap
return b & 0x0f;
}
switch (b) {
case Code.MAP16: { // map 16
int len = readNextLength16();
return len;
}
case Code.MAP32: { // map 32
int len = readNextLength32();
return len;
}
}
throw unexpected("Map", b);
} | [
"public",
"int",
"unpackMapHeader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixedMap",
"(",
"b",
")",
")",
"{",
"// fixmap",
"return",
"b",
"&",
"0x0f",
";",
"}",
"switch",
"(",
... | Reads header of a map.
<p>
This method returns number of pairs to be read. After this method call, for each pair, you call unpacker
methods for key first, and then value. You will call unpacker methods twice as many time as the returned
count. You don't have to call anything at the end of iteration.
@return the size of the map to be read
@throws MessageTypeException when value is not MessagePack Map type
@throws MessageSizeException when size of the map is larger than 2^31 - 1
@throws IOException when underlying input throws IOException | [
"Reads",
"header",
"of",
"a",
"map",
"."
] | train | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1305-L1323 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java | TopicAccessManager.checkAccessTopic | public void checkAccessTopic(UserContext ctx, String topic) throws IllegalAccessException {
boolean tacPresent0 = checkAccessTopicGlobalAC(ctx, topic);
boolean tacPresent1 = checkAccessTopicFromJsTopicControl(ctx, topic);
boolean tacPresent2 = checkAccessTopicFromJsTopicControls(ctx, topic);
if (logger.isDebugEnabled() && !(tacPresent0 | tacPresent1 | tacPresent2)) {
logger.debug("No '{}' access control found in project, add {} implementation annotated with {}({}) in your project for add subscription security.", topic, JsTopicAccessController.class, JsTopicControl.class, topic);
}
} | java | public void checkAccessTopic(UserContext ctx, String topic) throws IllegalAccessException {
boolean tacPresent0 = checkAccessTopicGlobalAC(ctx, topic);
boolean tacPresent1 = checkAccessTopicFromJsTopicControl(ctx, topic);
boolean tacPresent2 = checkAccessTopicFromJsTopicControls(ctx, topic);
if (logger.isDebugEnabled() && !(tacPresent0 | tacPresent1 | tacPresent2)) {
logger.debug("No '{}' access control found in project, add {} implementation annotated with {}({}) in your project for add subscription security.", topic, JsTopicAccessController.class, JsTopicControl.class, topic);
}
} | [
"public",
"void",
"checkAccessTopic",
"(",
"UserContext",
"ctx",
",",
"String",
"topic",
")",
"throws",
"IllegalAccessException",
"{",
"boolean",
"tacPresent0",
"=",
"checkAccessTopicGlobalAC",
"(",
"ctx",
",",
"topic",
")",
";",
"boolean",
"tacPresent1",
"=",
"ch... | Process Access Topic Controller
@param ctx
@param topic
@throws IllegalAccessException | [
"Process",
"Access",
"Topic",
"Controller"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L51-L58 |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java | Bzip2BitWriter.writeBoolean | void writeBoolean(ByteBuf out, final boolean value) {
int bitCount = this.bitCount + 1;
long bitBuffer = this.bitBuffer | (value ? 1L << 64 - bitCount : 0L);
if (bitCount == 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer = 0;
bitCount = 0;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | java | void writeBoolean(ByteBuf out, final boolean value) {
int bitCount = this.bitCount + 1;
long bitBuffer = this.bitBuffer | (value ? 1L << 64 - bitCount : 0L);
if (bitCount == 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer = 0;
bitCount = 0;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | [
"void",
"writeBoolean",
"(",
"ByteBuf",
"out",
",",
"final",
"boolean",
"value",
")",
"{",
"int",
"bitCount",
"=",
"this",
".",
"bitCount",
"+",
"1",
";",
"long",
"bitBuffer",
"=",
"this",
".",
"bitBuffer",
"|",
"(",
"value",
"?",
"1L",
"<<",
"64",
"... | Writes a single bit to the output {@link ByteBuf}.
@param value The bit to write | [
"Writes",
"a",
"single",
"bit",
"to",
"the",
"output",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java#L62-L73 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscaleprofile.java | autoscaleprofile.get | public static autoscaleprofile get(nitro_service service, String name) throws Exception{
autoscaleprofile obj = new autoscaleprofile();
obj.set_name(name);
autoscaleprofile response = (autoscaleprofile) obj.get_resource(service);
return response;
} | java | public static autoscaleprofile get(nitro_service service, String name) throws Exception{
autoscaleprofile obj = new autoscaleprofile();
obj.set_name(name);
autoscaleprofile response = (autoscaleprofile) obj.get_resource(service);
return response;
} | [
"public",
"static",
"autoscaleprofile",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"autoscaleprofile",
"obj",
"=",
"new",
"autoscaleprofile",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"... | Use this API to fetch autoscaleprofile resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"autoscaleprofile",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscaleprofile.java#L299-L304 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java | SimpleElementVisitor6.visitVariable | public R visitVariable(VariableElement e, P p) {
if (e.getKind() != ElementKind.RESOURCE_VARIABLE)
return defaultAction(e, p);
else
return visitUnknown(e, p);
} | java | public R visitVariable(VariableElement e, P p) {
if (e.getKind() != ElementKind.RESOURCE_VARIABLE)
return defaultAction(e, p);
else
return visitUnknown(e, p);
} | [
"public",
"R",
"visitVariable",
"(",
"VariableElement",
"e",
",",
"P",
"p",
")",
"{",
"if",
"(",
"e",
".",
"getKind",
"(",
")",
"!=",
"ElementKind",
".",
"RESOURCE_VARIABLE",
")",
"return",
"defaultAction",
"(",
"e",
",",
"p",
")",
";",
"else",
"return... | {@inheritDoc}
This implementation calls {@code defaultAction}, unless the
element is a {@code RESOURCE_VARIABLE} in which case {@code
visitUnknown} is called.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} or {@code visitUnknown} | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java#L160-L165 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_license_compliantWindowsSqlServer_GET | public ArrayList<OvhWindowsSqlVersionEnum> serviceName_license_compliantWindowsSqlServer_GET(String serviceName) throws IOException {
String qPath = "/dedicated/server/{serviceName}/license/compliantWindowsSqlServer";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | java | public ArrayList<OvhWindowsSqlVersionEnum> serviceName_license_compliantWindowsSqlServer_GET(String serviceName) throws IOException {
String qPath = "/dedicated/server/{serviceName}/license/compliantWindowsSqlServer";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | [
"public",
"ArrayList",
"<",
"OvhWindowsSqlVersionEnum",
">",
"serviceName_license_compliantWindowsSqlServer_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/license/compliantWindowsSqlServer\"",
";",
... | Get the windows SQL server license compliant with your server.
REST: GET /dedicated/server/{serviceName}/license/compliantWindowsSqlServer
@param serviceName [required] The internal name of your dedicated server | [
"Get",
"the",
"windows",
"SQL",
"server",
"license",
"compliant",
"with",
"your",
"server",
"."
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1193-L1198 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionAddressId.java | RegionAddressId.of | public static RegionAddressId of(RegionId regionId, String address) {
return new RegionAddressId(regionId.getProject(), regionId.getRegion(), address);
} | java | public static RegionAddressId of(RegionId regionId, String address) {
return new RegionAddressId(regionId.getProject(), regionId.getRegion(), address);
} | [
"public",
"static",
"RegionAddressId",
"of",
"(",
"RegionId",
"regionId",
",",
"String",
"address",
")",
"{",
"return",
"new",
"RegionAddressId",
"(",
"regionId",
".",
"getProject",
"(",
")",
",",
"regionId",
".",
"getRegion",
"(",
")",
",",
"address",
")",
... | Returns a region address identity given the region identity and the address name. The address
name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63
characters long and match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means
the first character must be a lowercase letter, and all following characters must be a dash,
lowercase letter, or digit, except the last character, which cannot be a dash.
@see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a> | [
"Returns",
"a",
"region",
"address",
"identity",
"given",
"the",
"region",
"identity",
"and",
"the",
"address",
"name",
".",
"The",
"address",
"name",
"must",
"be",
"1",
"-",
"63",
"characters",
"long",
"and",
"comply",
"with",
"RFC1035",
".",
"Specifically"... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionAddressId.java#L99-L101 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/SqlPredicate.java | SqlPredicate.flattenCompound | static <T extends CompoundPredicate> T flattenCompound(Predicate predicateLeft, Predicate predicateRight, Class<T> klass) {
// The following could have been achieved with {@link com.hazelcast.query.impl.predicates.FlatteningVisitor},
// however since we only care for 2-argument flattening, we can avoid constructing a visitor and its internals
// for each token pass at the cost of the following explicit code.
Predicate[] predicates;
if (klass.isInstance(predicateLeft) || klass.isInstance(predicateRight)) {
Predicate[] left = getSubPredicatesIfClass(predicateLeft, klass);
Predicate[] right = getSubPredicatesIfClass(predicateRight, klass);
predicates = new Predicate[left.length + right.length];
ArrayUtils.concat(left, right, predicates);
} else {
predicates = new Predicate[]{predicateLeft, predicateRight};
}
try {
CompoundPredicate compoundPredicate = klass.newInstance();
compoundPredicate.setPredicates(predicates);
return (T) compoundPredicate;
} catch (InstantiationException e) {
throw new RuntimeException(String.format("%s should have a public default constructor", klass.getName()));
} catch (IllegalAccessException e) {
throw new RuntimeException(String.format("%s should have a public default constructor", klass.getName()));
}
} | java | static <T extends CompoundPredicate> T flattenCompound(Predicate predicateLeft, Predicate predicateRight, Class<T> klass) {
// The following could have been achieved with {@link com.hazelcast.query.impl.predicates.FlatteningVisitor},
// however since we only care for 2-argument flattening, we can avoid constructing a visitor and its internals
// for each token pass at the cost of the following explicit code.
Predicate[] predicates;
if (klass.isInstance(predicateLeft) || klass.isInstance(predicateRight)) {
Predicate[] left = getSubPredicatesIfClass(predicateLeft, klass);
Predicate[] right = getSubPredicatesIfClass(predicateRight, klass);
predicates = new Predicate[left.length + right.length];
ArrayUtils.concat(left, right, predicates);
} else {
predicates = new Predicate[]{predicateLeft, predicateRight};
}
try {
CompoundPredicate compoundPredicate = klass.newInstance();
compoundPredicate.setPredicates(predicates);
return (T) compoundPredicate;
} catch (InstantiationException e) {
throw new RuntimeException(String.format("%s should have a public default constructor", klass.getName()));
} catch (IllegalAccessException e) {
throw new RuntimeException(String.format("%s should have a public default constructor", klass.getName()));
}
} | [
"static",
"<",
"T",
"extends",
"CompoundPredicate",
">",
"T",
"flattenCompound",
"(",
"Predicate",
"predicateLeft",
",",
"Predicate",
"predicateRight",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"// The following could have been achieved with {@link com.hazelcast.que... | Return a {@link CompoundPredicate}, possibly flattened if one or both arguments is an instance of
{@code CompoundPredicate}. | [
"Return",
"a",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/SqlPredicate.java#L371-L394 |
jingwei/krati | krati-main/src/retention/java/krati/retention/clock/SourceWaterMarksClock.java | SourceWaterMarksClock.updateHWMark | @Override
public synchronized Clock updateHWMark(String source, long hwm) {
_sourceWaterMarks.saveHWMark(source, hwm);
return current();
} | java | @Override
public synchronized Clock updateHWMark(String source, long hwm) {
_sourceWaterMarks.saveHWMark(source, hwm);
return current();
} | [
"@",
"Override",
"public",
"synchronized",
"Clock",
"updateHWMark",
"(",
"String",
"source",
",",
"long",
"hwm",
")",
"{",
"_sourceWaterMarks",
".",
"saveHWMark",
"(",
"source",
",",
"hwm",
")",
";",
"return",
"current",
"(",
")",
";",
"}"
] | Save the high water mark of a given source.
@param source
@param hwm | [
"Save",
"the",
"high",
"water",
"mark",
"of",
"a",
"given",
"source",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/clock/SourceWaterMarksClock.java#L134-L138 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/UIManager.java | UIManager.getRenderer | public static Renderer getRenderer(final WComponent component, final RenderContext context) {
Class<? extends WComponent> clazz = component.getClass();
Duplet<String, Class<?>> key = new Duplet<String, Class<?>>(context.getRenderPackage(),
clazz);
Renderer renderer = INSTANCE.renderers.get(key);
if (renderer == null) {
renderer = INSTANCE.findRenderer(component, key);
} else if (renderer == NULL_RENDERER) {
return null;
}
return renderer;
} | java | public static Renderer getRenderer(final WComponent component, final RenderContext context) {
Class<? extends WComponent> clazz = component.getClass();
Duplet<String, Class<?>> key = new Duplet<String, Class<?>>(context.getRenderPackage(),
clazz);
Renderer renderer = INSTANCE.renderers.get(key);
if (renderer == null) {
renderer = INSTANCE.findRenderer(component, key);
} else if (renderer == NULL_RENDERER) {
return null;
}
return renderer;
} | [
"public",
"static",
"Renderer",
"getRenderer",
"(",
"final",
"WComponent",
"component",
",",
"final",
"RenderContext",
"context",
")",
"{",
"Class",
"<",
"?",
"extends",
"WComponent",
">",
"clazz",
"=",
"component",
".",
"getClass",
"(",
")",
";",
"Duplet",
... | Retrieves a renderer which can renderer the given component to the context.
@param component the component to retrieve the renderer for.
@param context the render context.
@return an appropriate renderer for the component and context, or null if a suitable renderer could not be found. | [
"Retrieves",
"a",
"renderer",
"which",
"can",
"renderer",
"the",
"given",
"component",
"to",
"the",
"context",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/UIManager.java#L120-L134 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/SnsAPI.java | SnsAPI.oauth2AccessToken | public static SnsToken oauth2AccessToken(String appid,String secret,String code){
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setUri(BASE_URI + "/sns/oauth2/access_token")
.addParameter("appid", appid)
.addParameter("secret", secret)
.addParameter("code", code)
.addParameter("grant_type", "authorization_code")
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,SnsToken.class);
} | java | public static SnsToken oauth2AccessToken(String appid,String secret,String code){
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setUri(BASE_URI + "/sns/oauth2/access_token")
.addParameter("appid", appid)
.addParameter("secret", secret)
.addParameter("code", code)
.addParameter("grant_type", "authorization_code")
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest,SnsToken.class);
} | [
"public",
"static",
"SnsToken",
"oauth2AccessToken",
"(",
"String",
"appid",
",",
"String",
"secret",
",",
"String",
"code",
")",
"{",
"HttpUriRequest",
"httpUriRequest",
"=",
"RequestBuilder",
".",
"post",
"(",
")",
".",
"setUri",
"(",
"BASE_URI",
"+",
"\"/sn... | 通过code换取网页授权access_token
@param appid appid
@param secret secret
@param code code
@return SnsToken | [
"通过code换取网页授权access_token"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/SnsAPI.java#L34-L43 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/References.java | References.getOptional | public List<Object> getOptional(Object locator) {
try {
return find(Object.class, locator, false);
} catch (Exception ex) {
return new ArrayList<Object>();
}
} | java | public List<Object> getOptional(Object locator) {
try {
return find(Object.class, locator, false);
} catch (Exception ex) {
return new ArrayList<Object>();
}
} | [
"public",
"List",
"<",
"Object",
">",
"getOptional",
"(",
"Object",
"locator",
")",
"{",
"try",
"{",
"return",
"find",
"(",
"Object",
".",
"class",
",",
"locator",
",",
"false",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"return",
"new... | Gets all component references that match specified locator.
@param locator the locator to find references by.
@return a list with matching component references or empty list if nothing
was found. | [
"Gets",
"all",
"component",
"references",
"that",
"match",
"specified",
"locator",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/References.java#L226-L232 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/HftpFileSystem.java | HftpFileSystem.openConnection | protected HttpURLConnection openConnection(String path, String query)
throws IOException {
try {
final URL url = new URI("http", null, nnAddr.getAddress().getHostAddress(),
nnAddr.getPort(), path, query, null).toURL();
if (LOG.isTraceEnabled()) {
LOG.trace("url=" + url);
}
return (HttpURLConnection)url.openConnection();
} catch (URISyntaxException e) {
throw (IOException)new IOException().initCause(e);
}
} | java | protected HttpURLConnection openConnection(String path, String query)
throws IOException {
try {
final URL url = new URI("http", null, nnAddr.getAddress().getHostAddress(),
nnAddr.getPort(), path, query, null).toURL();
if (LOG.isTraceEnabled()) {
LOG.trace("url=" + url);
}
return (HttpURLConnection)url.openConnection();
} catch (URISyntaxException e) {
throw (IOException)new IOException().initCause(e);
}
} | [
"protected",
"HttpURLConnection",
"openConnection",
"(",
"String",
"path",
",",
"String",
"query",
")",
"throws",
"IOException",
"{",
"try",
"{",
"final",
"URL",
"url",
"=",
"new",
"URI",
"(",
"\"http\"",
",",
"null",
",",
"nnAddr",
".",
"getAddress",
"(",
... | Open an HTTP connection to the namenode to read file data and metadata.
@param path The path component of the URL
@param query The query component of the URL | [
"Open",
"an",
"HTTP",
"connection",
"to",
"the",
"namenode",
"to",
"read",
"file",
"data",
"and",
"metadata",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/HftpFileSystem.java#L133-L145 |
azkaban/azkaban | az-core/src/main/java/azkaban/utils/PropsUtils.java | PropsUtils.loadPropsInDir | public static Props loadPropsInDir(final Props parent, final File dir, final String... suffixes) {
try {
final Props props = new Props(parent);
final File[] files = dir.listFiles();
Arrays.sort(files);
if (files != null) {
for (final File f : files) {
if (f.isFile() && endsWith(f, suffixes)) {
props.putAll(new Props(null, f.getAbsolutePath()));
}
}
}
return props;
} catch (final IOException e) {
throw new RuntimeException("Error loading properties.", e);
}
} | java | public static Props loadPropsInDir(final Props parent, final File dir, final String... suffixes) {
try {
final Props props = new Props(parent);
final File[] files = dir.listFiles();
Arrays.sort(files);
if (files != null) {
for (final File f : files) {
if (f.isFile() && endsWith(f, suffixes)) {
props.putAll(new Props(null, f.getAbsolutePath()));
}
}
}
return props;
} catch (final IOException e) {
throw new RuntimeException("Error loading properties.", e);
}
} | [
"public",
"static",
"Props",
"loadPropsInDir",
"(",
"final",
"Props",
"parent",
",",
"final",
"File",
"dir",
",",
"final",
"String",
"...",
"suffixes",
")",
"{",
"try",
"{",
"final",
"Props",
"props",
"=",
"new",
"Props",
"(",
"parent",
")",
";",
"final"... | Load job schedules from the given directories
@param parent The parent properties for these properties
@param dir The directory to look in
@param suffixes File suffixes to load
@return The loaded set of schedules | [
"Load",
"job",
"schedules",
"from",
"the",
"given",
"directories"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/PropsUtils.java#L74-L90 |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java | BackendConnection.setTransactionType | public void setTransactionType(final TransactionType transactionType) {
if (null == schemaName) {
throw new ShardingException("Please select database, then switch transaction type.");
}
if (isSwitchFailed()) {
throw new ShardingException("Failed to switch transaction type, please terminate current transaction.");
}
this.transactionType = transactionType;
} | java | public void setTransactionType(final TransactionType transactionType) {
if (null == schemaName) {
throw new ShardingException("Please select database, then switch transaction type.");
}
if (isSwitchFailed()) {
throw new ShardingException("Failed to switch transaction type, please terminate current transaction.");
}
this.transactionType = transactionType;
} | [
"public",
"void",
"setTransactionType",
"(",
"final",
"TransactionType",
"transactionType",
")",
"{",
"if",
"(",
"null",
"==",
"schemaName",
")",
"{",
"throw",
"new",
"ShardingException",
"(",
"\"Please select database, then switch transaction type.\"",
")",
";",
"}",
... | Change transaction type of current channel.
@param transactionType transaction type | [
"Change",
"transaction",
"type",
"of",
"current",
"channel",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java#L90-L98 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/MembersView.java | MembersView.createNew | public static MembersView createNew(int version, Collection<MemberImpl> members) {
List<MemberInfo> list = new ArrayList<>(members.size());
for (MemberImpl member : members) {
list.add(new MemberInfo(member));
}
return new MembersView(version, unmodifiableList(list));
} | java | public static MembersView createNew(int version, Collection<MemberImpl> members) {
List<MemberInfo> list = new ArrayList<>(members.size());
for (MemberImpl member : members) {
list.add(new MemberInfo(member));
}
return new MembersView(version, unmodifiableList(list));
} | [
"public",
"static",
"MembersView",
"createNew",
"(",
"int",
"version",
",",
"Collection",
"<",
"MemberImpl",
">",
"members",
")",
"{",
"List",
"<",
"MemberInfo",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"members",
".",
"size",
"(",
")",
")",
";",... | Creates a new {@code MemberMap} including given members.
@param version version
@param members members
@return a new {@code MemberMap} | [
"Creates",
"a",
"new",
"{",
"@code",
"MemberMap",
"}",
"including",
"given",
"members",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/MembersView.java#L81-L89 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/MainFieldHandler.java | MainFieldHandler.init | public void init(BaseField field, String keyName)
{
super.init(field);
this.keyName = keyName;
m_bInitMove = false; // DONT respond to these moves!
m_bReadMove = false;
m_bReadOnly = false;
} | java | public void init(BaseField field, String keyName)
{
super.init(field);
this.keyName = keyName;
m_bInitMove = false; // DONT respond to these moves!
m_bReadMove = false;
m_bReadOnly = false;
} | [
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"String",
"keyName",
")",
"{",
"super",
".",
"init",
"(",
"field",
")",
";",
"this",
".",
"keyName",
"=",
"keyName",
";",
"m_bInitMove",
"=",
"false",
";",
"// DONT respond to these moves!",
"m_bReadM... | Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param iKeySeq The key area this field accesses. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MainFieldHandler.java#L65-L73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.