repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
orbisgis/h2gis
postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java
JtsBinaryParser.parseGeometry
protected Geometry parseGeometry(ValueGetter data, int srid, boolean inheritSrid) { byte endian = data.getByte(); if (endian != data.endian) { throw new IllegalArgumentException("Endian inconsistency!"); } else { int typeword = data.getInt(); int realtype = typeword & 536870911; boolean haveZ = (typeword & -2147483648) != 0; boolean haveM = (typeword & 1073741824) != 0; boolean haveS = (typeword & 536870912) != 0; if (haveS) { int newsrid = org.postgis.Geometry.parseSRID(data.getInt()); if (inheritSrid && newsrid != srid) { throw new IllegalArgumentException("Inconsistent srids in complex geometry: " + srid + ", " + newsrid); } srid = newsrid; } else if (!inheritSrid) { srid = 0; } Geometry result; switch(realtype) { case 1: result = this.parsePoint(data, haveZ, haveM); break; case 2: result = this.parseLineString(data, haveZ, haveM); break; case 3: result = this.parsePolygon(data, haveZ, haveM, srid); break; case 4: result = this.parseMultiPoint(data, srid); break; case 5: result = this.parseMultiLineString(data, srid); break; case 6: result = this.parseMultiPolygon(data, srid); break; case 7: result = this.parseCollection(data, srid); break; default: throw new IllegalArgumentException("Unknown Geometry Type!"); } result.setSRID(srid); return result; } }
java
protected Geometry parseGeometry(ValueGetter data, int srid, boolean inheritSrid) { byte endian = data.getByte(); if (endian != data.endian) { throw new IllegalArgumentException("Endian inconsistency!"); } else { int typeword = data.getInt(); int realtype = typeword & 536870911; boolean haveZ = (typeword & -2147483648) != 0; boolean haveM = (typeword & 1073741824) != 0; boolean haveS = (typeword & 536870912) != 0; if (haveS) { int newsrid = org.postgis.Geometry.parseSRID(data.getInt()); if (inheritSrid && newsrid != srid) { throw new IllegalArgumentException("Inconsistent srids in complex geometry: " + srid + ", " + newsrid); } srid = newsrid; } else if (!inheritSrid) { srid = 0; } Geometry result; switch(realtype) { case 1: result = this.parsePoint(data, haveZ, haveM); break; case 2: result = this.parseLineString(data, haveZ, haveM); break; case 3: result = this.parsePolygon(data, haveZ, haveM, srid); break; case 4: result = this.parseMultiPoint(data, srid); break; case 5: result = this.parseMultiLineString(data, srid); break; case 6: result = this.parseMultiPolygon(data, srid); break; case 7: result = this.parseCollection(data, srid); break; default: throw new IllegalArgumentException("Unknown Geometry Type!"); } result.setSRID(srid); return result; } }
[ "protected", "Geometry", "parseGeometry", "(", "ValueGetter", "data", ",", "int", "srid", ",", "boolean", "inheritSrid", ")", "{", "byte", "endian", "=", "data", ".", "getByte", "(", ")", ";", "if", "(", "endian", "!=", "data", ".", "endian", ")", "{", ...
Parse data from the given {@link org.postgis.binary.ValueGetter} into a JTS {@link org.locationtech.jts.geom.Geometry} with the given SRID. @param data {@link org.postgis.binary.ValueGetter} to parse. @param srid SRID to give to the parsed geometry (different of the inherited SRID). @param inheritSrid Make the new {@link org.locationtech.jts.geom.Geometry} inherit its SRID if set to true, otherwise use the parameter given SRID. @return Parsed JTS {@link org.locationtech.jts.geom.Geometry} with SRID.
[ "Parse", "data", "from", "the", "given", "{", "@link", "org", ".", "postgis", ".", "binary", ".", "ValueGetter", "}", "into", "a", "JTS", "{", "@link", "org", ".", "locationtech", ".", "jts", ".", "geom", ".", "Geometry", "}", "with", "the", "given", ...
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java#L105-L156
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.createFolder
public JenkinsServer createFolder(FolderJob folder, String jobName) throws IOException { return createFolder(folder, jobName, false); }
java
public JenkinsServer createFolder(FolderJob folder, String jobName) throws IOException { return createFolder(folder, jobName, false); }
[ "public", "JenkinsServer", "createFolder", "(", "FolderJob", "folder", ",", "String", "jobName", ")", "throws", "IOException", "{", "return", "createFolder", "(", "folder", ",", "jobName", ",", "false", ")", ";", "}" ]
Create a job on the server (in the given folder) @param folder {@link FolderJob} @param jobName name of the job. @throws IOException in case of an error.
[ "Create", "a", "job", "on", "the", "server", "(", "in", "the", "given", "folder", ")" ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L478-L480
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java
ManagedDatabasesInner.beginUpdateAsync
public Observable<ManagedDatabaseInner> beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() { @Override public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) { return response.body(); } }); }
java
public Observable<ManagedDatabaseInner> beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() { @Override public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedDatabaseInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "ManagedDatabaseUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResp...
Updates an existing database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param parameters The requested database resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedDatabaseInner object
[ "Updates", "an", "existing", "database", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L984-L991
actframework/actframework
src/main/java/act/event/EventBus.java
EventBus.emitAsync
public EventBus emitAsync(EventObject event, Object... args) { return _emitWithOnceBus(eventContextAsync(event, args)); }
java
public EventBus emitAsync(EventObject event, Object... args) { return _emitWithOnceBus(eventContextAsync(event, args)); }
[ "public", "EventBus", "emitAsync", "(", "EventObject", "event", ",", "Object", "...", "args", ")", "{", "return", "_emitWithOnceBus", "(", "eventContextAsync", "(", "event", ",", "args", ")", ")", ";", "}" ]
Emit a event object with parameters and force all listeners to be called asynchronously. @param event the target event @param args the arguments passed in @see #emit(EventObject, Object...)
[ "Emit", "a", "event", "object", "with", "parameters", "and", "force", "all", "listeners", "to", "be", "called", "asynchronously", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1035-L1037
litsec/eidas-opensaml
opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java
AttributeUtils.createAttribute
public static Attribute createAttribute(String name, String friendlyName, String nameFormat) { Attribute attribute = attributeBuilder.buildObject(); attribute.setName(name); attribute.setFriendlyName(friendlyName); attribute.setNameFormat(nameFormat); return attribute; }
java
public static Attribute createAttribute(String name, String friendlyName, String nameFormat) { Attribute attribute = attributeBuilder.buildObject(); attribute.setName(name); attribute.setFriendlyName(friendlyName); attribute.setNameFormat(nameFormat); return attribute; }
[ "public", "static", "Attribute", "createAttribute", "(", "String", "name", ",", "String", "friendlyName", ",", "String", "nameFormat", ")", "{", "Attribute", "attribute", "=", "attributeBuilder", ".", "buildObject", "(", ")", ";", "attribute", ".", "setName", "(...
Utility method that creates an {@code Attribute} given its name, friendly name and name format. @param name the attribute name @param friendlyName the attribute friendly name (may be {@code null}) @param nameFormat the name format @return an {@code Attribute} object
[ "Utility", "method", "that", "creates", "an", "{", "@code", "Attribute", "}", "given", "its", "name", "friendly", "name", "and", "name", "format", "." ]
train
https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java#L52-L58
samskivert/pythagoras
src/main/java/pythagoras/d/Transforms.java
Transforms.multiply
public static <T extends Transform> T multiply ( double m00, double m01, double m10, double m11, double tx, double ty, AffineTransform b, T into) { return multiply(m00, m01, m10, m11, tx, ty, b.m00, b.m01, b.m10, b.m11, b.tx, b.ty, into); }
java
public static <T extends Transform> T multiply ( double m00, double m01, double m10, double m11, double tx, double ty, AffineTransform b, T into) { return multiply(m00, m01, m10, m11, tx, ty, b.m00, b.m01, b.m10, b.m11, b.tx, b.ty, into); }
[ "public", "static", "<", "T", "extends", "Transform", ">", "T", "multiply", "(", "double", "m00", ",", "double", "m01", ",", "double", "m10", ",", "double", "m11", ",", "double", "tx", ",", "double", "ty", ",", "AffineTransform", "b", ",", "T", "into",...
Multiplies the supplied two affine transforms, storing the result in {@code into}. {@code into} may refer to the same instance as {@code b}. @return {@code into} for chaining.
[ "Multiplies", "the", "supplied", "two", "affine", "transforms", "storing", "the", "result", "in", "{" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Transforms.java#L54-L57
alkacon/opencms-core
src/org/opencms/db/CmsAliasManager.java
CmsAliasManager.hasPermissionsForMassEdit
public boolean hasPermissionsForMassEdit(CmsObject cms, String siteRoot) { String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(siteRoot); return OpenCms.getRoleManager().hasRoleForResource(cms, CmsRole.ADMINISTRATOR, "/"); } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } }
java
public boolean hasPermissionsForMassEdit(CmsObject cms, String siteRoot) { String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(siteRoot); return OpenCms.getRoleManager().hasRoleForResource(cms, CmsRole.ADMINISTRATOR, "/"); } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } }
[ "public", "boolean", "hasPermissionsForMassEdit", "(", "CmsObject", "cms", ",", "String", "siteRoot", ")", "{", "String", "originalSiteRoot", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ";", "try", "{", "cms", ".", "getRequest...
Checks whether the current user has permissions for mass editing the alias table.<p> @param cms the current CMS context @param siteRoot the site root to check @return true if the user from the CMS context is allowed to mass edit the alias table
[ "Checks", "whether", "the", "current", "user", "has", "permissions", "for", "mass", "editing", "the", "alias", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L185-L195
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.buildSelectExplorerFileEntries
public String buildSelectExplorerFileEntries(String htmlAttributes) { String emptyOption = OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerFileEntryOptions(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(emptyOption)) { emptyOption = "50,100,200,300,400,500"; } // remove all non digits without ',' emptyOption = emptyOption.replaceAll("[^0-9|^,]", ""); // remove all empty entries emptyOption = emptyOption.replaceAll(",,", ","); List<String> opts = CmsStringUtil.splitAsList(emptyOption, ",", true); opts.add(key(Messages.GUI_LABEL_UNLIMITED_0)); opts.remove("0"); List<String> vals = CmsStringUtil.splitAsList(emptyOption, ",", true); vals.add("" + Integer.MAX_VALUE); vals.remove("0"); int selectedIndex = 2; for (int i = 0; i < vals.size(); i++) { if (vals.get(i).equals(getParamTabExFileEntries())) { selectedIndex = i; break; } } return buildSelect(htmlAttributes, opts, vals, selectedIndex); }
java
public String buildSelectExplorerFileEntries(String htmlAttributes) { String emptyOption = OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerFileEntryOptions(); if (CmsStringUtil.isEmptyOrWhitespaceOnly(emptyOption)) { emptyOption = "50,100,200,300,400,500"; } // remove all non digits without ',' emptyOption = emptyOption.replaceAll("[^0-9|^,]", ""); // remove all empty entries emptyOption = emptyOption.replaceAll(",,", ","); List<String> opts = CmsStringUtil.splitAsList(emptyOption, ",", true); opts.add(key(Messages.GUI_LABEL_UNLIMITED_0)); opts.remove("0"); List<String> vals = CmsStringUtil.splitAsList(emptyOption, ",", true); vals.add("" + Integer.MAX_VALUE); vals.remove("0"); int selectedIndex = 2; for (int i = 0; i < vals.size(); i++) { if (vals.get(i).equals(getParamTabExFileEntries())) { selectedIndex = i; break; } } return buildSelect(htmlAttributes, opts, vals, selectedIndex); }
[ "public", "String", "buildSelectExplorerFileEntries", "(", "String", "htmlAttributes", ")", "{", "String", "emptyOption", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getDefaultUserSettings", "(", ")", ".", "getExplorerFileEntryOptions", "(", ")", ";", ...
Builds the html for the explorer number of entries per page select box.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the explorer number of entries per page select box
[ "Builds", "the", "html", "for", "the", "explorer", "number", "of", "entries", "per", "page", "select", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L681-L705
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/CmsSearchIndexList.java
CmsSearchIndexList.fillDetailIndexSource
private void fillDetailIndexSource(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); // search for the corresponding A_CmsSearchIndex: I_CmsSearchIndex idx = OpenCms.getSearchManager().getIndex((String)item.get(LIST_COLUMN_NAME)); html.append("<ul>\n"); // get the index sources (nice API) for (CmsSearchIndexSource idxSource : idx.getSources()) { html.append(" <li>\n").append(" ").append("name : ").append(idxSource.getName()).append("\n"); html.append(" </li>"); html.append(" <li>\n").append(" ").append("indexer : ").append( idxSource.getIndexerClassName()).append("\n"); html.append(" </li>"); html.append(" <li>\n").append(" ").append("resources : ").append("\n"); html.append(" <ul>\n"); List<String> resources = idxSource.getResourcesNames(); Iterator<String> itResources = resources.iterator(); while (itResources.hasNext()) { html.append(" <li>\n").append(" ").append(itResources.next()).append("\n"); html.append(" </li>\n"); } html.append(" </ul>\n"); html.append(" </li>"); html.append(" <li>\n").append(" ").append("doctypes : ").append("\n"); html.append(" <ul>\n"); resources = idxSource.getDocumentTypes(); itResources = resources.iterator(); while (itResources.hasNext()) { html.append(" <li>\n").append(" ").append(itResources.next()).append("\n"); html.append(" </li>\n"); } html.append(" </ul>\n"); html.append(" </li>"); } html.append("</ul>\n"); item.set(detailId, html.toString()); }
java
private void fillDetailIndexSource(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); // search for the corresponding A_CmsSearchIndex: I_CmsSearchIndex idx = OpenCms.getSearchManager().getIndex((String)item.get(LIST_COLUMN_NAME)); html.append("<ul>\n"); // get the index sources (nice API) for (CmsSearchIndexSource idxSource : idx.getSources()) { html.append(" <li>\n").append(" ").append("name : ").append(idxSource.getName()).append("\n"); html.append(" </li>"); html.append(" <li>\n").append(" ").append("indexer : ").append( idxSource.getIndexerClassName()).append("\n"); html.append(" </li>"); html.append(" <li>\n").append(" ").append("resources : ").append("\n"); html.append(" <ul>\n"); List<String> resources = idxSource.getResourcesNames(); Iterator<String> itResources = resources.iterator(); while (itResources.hasNext()) { html.append(" <li>\n").append(" ").append(itResources.next()).append("\n"); html.append(" </li>\n"); } html.append(" </ul>\n"); html.append(" </li>"); html.append(" <li>\n").append(" ").append("doctypes : ").append("\n"); html.append(" <ul>\n"); resources = idxSource.getDocumentTypes(); itResources = resources.iterator(); while (itResources.hasNext()) { html.append(" <li>\n").append(" ").append(itResources.next()).append("\n"); html.append(" </li>\n"); } html.append(" </ul>\n"); html.append(" </li>"); } html.append("</ul>\n"); item.set(detailId, html.toString()); }
[ "private", "void", "fillDetailIndexSource", "(", "CmsListItem", "item", ",", "String", "detailId", ")", "{", "StringBuffer", "html", "=", "new", "StringBuffer", "(", ")", ";", "// search for the corresponding A_CmsSearchIndex:", "I_CmsSearchIndex", "idx", "=", "OpenCms"...
Fills details of the index source into the given item. <p> @param item the list item to fill @param detailId the id for the detail to fill
[ "Fills", "details", "of", "the", "index", "source", "into", "the", "given", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsSearchIndexList.java#L641-L682
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.buildMapClickMessage
public String buildMapClickMessage(LatLng latLng, View view, GoogleMap map) { return buildMapClickMessage(latLng, view, map, null); }
java
public String buildMapClickMessage(LatLng latLng, View view, GoogleMap map) { return buildMapClickMessage(latLng, view, map, null); }
[ "public", "String", "buildMapClickMessage", "(", "LatLng", "latLng", ",", "View", "view", ",", "GoogleMap", "map", ")", "{", "return", "buildMapClickMessage", "(", "latLng", ",", "view", ",", "map", ",", "null", ")", ";", "}" ]
Perform a query based upon the map click location and build a info message @param latLng location @param view view @param map Google Map @return information message on what was clicked, or null
[ "Perform", "a", "query", "based", "upon", "the", "map", "click", "location", "and", "build", "a", "info", "message" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L342-L344
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/math/Permutation.java
Permutation.createForNElements
public static Permutation createForNElements(final int numElements, final Random rng) { final int[] permutation = IntUtils.arange(numElements); IntUtils.shuffle(permutation, checkNotNull(rng)); return new Permutation(permutation); }
java
public static Permutation createForNElements(final int numElements, final Random rng) { final int[] permutation = IntUtils.arange(numElements); IntUtils.shuffle(permutation, checkNotNull(rng)); return new Permutation(permutation); }
[ "public", "static", "Permutation", "createForNElements", "(", "final", "int", "numElements", ",", "final", "Random", "rng", ")", "{", "final", "int", "[", "]", "permutation", "=", "IntUtils", ".", "arange", "(", "numElements", ")", ";", "IntUtils", ".", "shu...
Creates a random permutation of n elements using the supplied random number generator. Note that for all but small numbers of elements most possible permutations will not be sampled by this because the random generator's space is much smaller than the number of possible permutations.
[ "Creates", "a", "random", "permutation", "of", "n", "elements", "using", "the", "supplied", "random", "number", "generator", ".", "Note", "that", "for", "all", "but", "small", "numbers", "of", "elements", "most", "possible", "permutations", "will", "not", "be"...
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/math/Permutation.java#L44-L48
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
Matrix3x2d.transformPosition
public Vector2d transformPosition(double x, double y, Vector2d dest) { return dest.set(m00 * x + m10 * y + m20, m01 * x + m11 * y + m21); }
java
public Vector2d transformPosition(double x, double y, Vector2d dest) { return dest.set(m00 * x + m10 * y + m20, m01 * x + m11 * y + m21); }
[ "public", "Vector2d", "transformPosition", "(", "double", "x", ",", "double", "y", ",", "Vector2d", "dest", ")", "{", "return", "dest", ".", "set", "(", "m00", "*", "x", "+", "m10", "*", "y", "+", "m20", ",", "m01", "*", "x", "+", "m11", "*", "y"...
Transform/multiply the given 2D-vector <code>(x, y)</code>, as if it was a 3D-vector with z=1, by this matrix and store the result in <code>dest</code>. <p> The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction. <p> In order to store the result in the same vector, use {@link #transformPosition(Vector2d)}. @see #transformPosition(Vector2d) @see #transform(Vector3dc, Vector3d) @param x the x component of the vector to transform @param y the y component of the vector to transform @param dest will hold the result @return dest
[ "Transform", "/", "multiply", "the", "given", "2D", "-", "vector", "<code", ">", "(", "x", "y", ")", "<", "/", "code", ">", "as", "if", "it", "was", "a", "3D", "-", "vector", "with", "z", "=", "1", "by", "this", "matrix", "and", "store", "the", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1766-L1768
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentHandler.java
ComponentHandler.getFacetName
protected final String getFacetName(FaceletContext ctx, UIComponent parent) { // TODO: REFACTOR - "facelets.FACET_NAME" should be a constant somewhere, used to be in FacetHandler // from real Facelets return (String) parent.getAttributes().get("facelets.FACET_NAME"); }
java
protected final String getFacetName(FaceletContext ctx, UIComponent parent) { // TODO: REFACTOR - "facelets.FACET_NAME" should be a constant somewhere, used to be in FacetHandler // from real Facelets return (String) parent.getAttributes().get("facelets.FACET_NAME"); }
[ "protected", "final", "String", "getFacetName", "(", "FaceletContext", "ctx", ",", "UIComponent", "parent", ")", "{", "// TODO: REFACTOR - \"facelets.FACET_NAME\" should be a constant somewhere, used to be in FacetHandler", "// from real Facelets", "return", "(", "St...
Return the Facet name we are scoped in, otherwise null @param ctx @return
[ "Return", "the", "Facet", "name", "we", "are", "scoped", "in", "otherwise", "null" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/jsf/ComponentHandler.java#L198-L203
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.fixForNamespace
public static String fixForNamespace(String namespace, String path) { return fixForNamespace(namespace, path, false); }
java
public static String fixForNamespace(String namespace, String path) { return fixForNamespace(namespace, path, false); }
[ "public", "static", "String", "fixForNamespace", "(", "String", "namespace", ",", "String", "path", ")", "{", "return", "fixForNamespace", "(", "namespace", ",", "path", ",", "false", ")", ";", "}" ]
Apply the namespace to the given path @param namespace namespace (can be null) @param path path @return adjusted path
[ "Apply", "the", "namespace", "to", "the", "given", "path" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L89-L92
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/util/Geometry.java
Geometry.drawArcJoinedLines
public static final void drawArcJoinedLines(final PathPartList list, final Point2DArray points, final double radius) { final int size = points.size(); Point2D p0 = points.get(0); Point2D p2 = points.get(1); Point2D p0new = null; Point2D plast = points.get(size - 1); final Point2D plastmin1 = points.get(size - 2); double closingRadius = 0; // check if start and finish have same point (i.e. is the line closed) boolean closed = false; if ((p0.getX() == plast.getX()) && (p0.getY() == plast.getY())) { closed = true; } if (closed && (false == Geometry.collinear(plastmin1, p0, p2))) { p0new = new Point2D(0, 0); plast = new Point2D(0, 0); closingRadius = closingArc(list, plastmin1, p0, p2, plast, p0new, radius); } for (int i = 2; i < size; i++) { final Point2D p4 = points.get(i); if (Geometry.collinear(p0, p2, p4)) { list.L(p2.getX(), p2.getY()); } else { drawLines(list, p0, p2, p4, radius); } p0 = p2; p2 = p4; } list.L(plast.getX(), plast.getY()); if (p0new != null) { p0 = points.get(0); list.A(p0.getX(), p0.getY(), p0new.getX(), p0new.getY(), closingRadius); list.Z(); } }
java
public static final void drawArcJoinedLines(final PathPartList list, final Point2DArray points, final double radius) { final int size = points.size(); Point2D p0 = points.get(0); Point2D p2 = points.get(1); Point2D p0new = null; Point2D plast = points.get(size - 1); final Point2D plastmin1 = points.get(size - 2); double closingRadius = 0; // check if start and finish have same point (i.e. is the line closed) boolean closed = false; if ((p0.getX() == plast.getX()) && (p0.getY() == plast.getY())) { closed = true; } if (closed && (false == Geometry.collinear(plastmin1, p0, p2))) { p0new = new Point2D(0, 0); plast = new Point2D(0, 0); closingRadius = closingArc(list, plastmin1, p0, p2, plast, p0new, radius); } for (int i = 2; i < size; i++) { final Point2D p4 = points.get(i); if (Geometry.collinear(p0, p2, p4)) { list.L(p2.getX(), p2.getY()); } else { drawLines(list, p0, p2, p4, radius); } p0 = p2; p2 = p4; } list.L(plast.getX(), plast.getY()); if (p0new != null) { p0 = points.get(0); list.A(p0.getX(), p0.getY(), p0new.getX(), p0new.getY(), closingRadius); list.Z(); } }
[ "public", "static", "final", "void", "drawArcJoinedLines", "(", "final", "PathPartList", "list", ",", "final", "Point2DArray", "points", ",", "final", "double", "radius", ")", "{", "final", "int", "size", "=", "points", ".", "size", "(", ")", ";", "Point2D",...
This will build a PathPartList of lines and arcs from the Point2DArray. The radius is the size of the arc for the line joins. For each join the radius is capped at 1/2 the length of the smallest line in the three points Collinear points are detected and handled as a straight line If p0 and plast are the same it will close of the shape with an arc. If p0 and plast are not the same, they will be left as lines starting at p0 and ending at plast. For convention p0,p2 and p4 are used for the three points in the line. p1 and p2 refer to the calculated arc offsets for the new start and end points of the two lines. For maths see Example 1 http://www.rasmus.is/uk/t/F/Su55k02.htm @param list @param points @param radius
[ "This", "will", "build", "a", "PathPartList", "of", "lines", "and", "arcs", "from", "the", "Point2DArray", ".", "The", "radius", "is", "the", "size", "of", "the", "arc", "for", "the", "line", "joins", ".", "For", "each", "join", "the", "radius", "is", ...
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/util/Geometry.java#L667-L725
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.getMemtableFor
public Memtable getMemtableFor(OpOrder.Group opGroup, ReplayPosition replayPosition) { // since any new memtables appended to the list after we fetch it will be for operations started // after us, we can safely assume that we will always find the memtable that 'accepts' us; // if the barrier for any memtable is set whilst we are reading the list, it must accept us. // there may be multiple memtables in the list that would 'accept' us, however we only ever choose // the oldest such memtable, as accepts() only prevents us falling behind (i.e. ensures we don't // assign operations to a memtable that was retired/queued before we started) for (Memtable memtable : view.get().liveMemtables) { if (memtable.accepts(opGroup, replayPosition)) return memtable; } throw new AssertionError(view.get().liveMemtables.toString()); }
java
public Memtable getMemtableFor(OpOrder.Group opGroup, ReplayPosition replayPosition) { // since any new memtables appended to the list after we fetch it will be for operations started // after us, we can safely assume that we will always find the memtable that 'accepts' us; // if the barrier for any memtable is set whilst we are reading the list, it must accept us. // there may be multiple memtables in the list that would 'accept' us, however we only ever choose // the oldest such memtable, as accepts() only prevents us falling behind (i.e. ensures we don't // assign operations to a memtable that was retired/queued before we started) for (Memtable memtable : view.get().liveMemtables) { if (memtable.accepts(opGroup, replayPosition)) return memtable; } throw new AssertionError(view.get().liveMemtables.toString()); }
[ "public", "Memtable", "getMemtableFor", "(", "OpOrder", ".", "Group", "opGroup", ",", "ReplayPosition", "replayPosition", ")", "{", "// since any new memtables appended to the list after we fetch it will be for operations started", "// after us, we can safely assume that we will always f...
get the Memtable that the ordered writeOp should be directed to
[ "get", "the", "Memtable", "that", "the", "ordered", "writeOp", "should", "be", "directed", "to" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L60-L75
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createContextClass
public Class<?> createContextClass(ClassLoader loader, ContextClassEntry[] contextClasses) throws Exception { Object[] ret = loadContextClasses(loader, contextClasses); Class<?>[] classes = (Class[]) ret[0]; String[] prefixNames = (String[]) ret[1]; return createContextClass(loader, classes, prefixNames); }
java
public Class<?> createContextClass(ClassLoader loader, ContextClassEntry[] contextClasses) throws Exception { Object[] ret = loadContextClasses(loader, contextClasses); Class<?>[] classes = (Class[]) ret[0]; String[] prefixNames = (String[]) ret[1]; return createContextClass(loader, classes, prefixNames); }
[ "public", "Class", "<", "?", ">", "createContextClass", "(", "ClassLoader", "loader", ",", "ContextClassEntry", "[", "]", "contextClasses", ")", "throws", "Exception", "{", "Object", "[", "]", "ret", "=", "loadContextClasses", "(", "loader", ",", "contextClasses...
Merges several classes together, producing a new class that has all of the methods of the combined classes. All methods in the combined class delegate to instances of the source classes. If multiple classes implement the same method, the first one provided is used. The merged class implements all of the interfaces provided by the source classes or interfaces. <p> This method uses org.teatrove.trove.util.MergedClass
[ "Merges", "several", "classes", "together", "producing", "a", "new", "class", "that", "has", "all", "of", "the", "methods", "of", "the", "combined", "classes", ".", "All", "methods", "in", "the", "combined", "class", "delegate", "to", "instances", "of", "the...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L786-L795
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ArrayDeque.java
ArrayDeque.doubleCapacity
private void doubleCapacity() { assert head == tail; int p = head; int n = elements.length; int r = n - p; // number of elements to the right of p int newCapacity = n << 1; if (newCapacity < 0) throw new IllegalStateException("Sorry, deque too big"); Object[] a = new Object[newCapacity]; System.arraycopy(elements, p, a, 0, r); System.arraycopy(elements, 0, a, r, p); elements = a; head = 0; tail = n; }
java
private void doubleCapacity() { assert head == tail; int p = head; int n = elements.length; int r = n - p; // number of elements to the right of p int newCapacity = n << 1; if (newCapacity < 0) throw new IllegalStateException("Sorry, deque too big"); Object[] a = new Object[newCapacity]; System.arraycopy(elements, p, a, 0, r); System.arraycopy(elements, 0, a, r, p); elements = a; head = 0; tail = n; }
[ "private", "void", "doubleCapacity", "(", ")", "{", "assert", "head", "==", "tail", ";", "int", "p", "=", "head", ";", "int", "n", "=", "elements", ".", "length", ";", "int", "r", "=", "n", "-", "p", ";", "// number of elements to the right of p", "int",...
Doubles the capacity of this deque. Call only when full, i.e., when head and tail have wrapped around to become equal.
[ "Doubles", "the", "capacity", "of", "this", "deque", ".", "Call", "only", "when", "full", "i", ".", "e", ".", "when", "head", "and", "tail", "have", "wrapped", "around", "to", "become", "equal", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ArrayDeque.java#L151-L165
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java
ClassBuilder.getInstance
public static ClassBuilder getInstance(Context context, TypeElement typeElement, ClassWriter writer) { return new ClassBuilder(context, typeElement, writer); }
java
public static ClassBuilder getInstance(Context context, TypeElement typeElement, ClassWriter writer) { return new ClassBuilder(context, typeElement, writer); }
[ "public", "static", "ClassBuilder", "getInstance", "(", "Context", "context", ",", "TypeElement", "typeElement", ",", "ClassWriter", "writer", ")", "{", "return", "new", "ClassBuilder", "(", "context", ",", "typeElement", ",", "writer", ")", ";", "}" ]
Constructs a new ClassBuilder. @param context the build context @param typeElement the class being documented. @param writer the doclet specific writer. @return the new ClassBuilder
[ "Constructs", "a", "new", "ClassBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java#L115-L118
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java
Aggregations.longMin
public static <Key, Value> Aggregation<Key, Long, Long> longMin() { return new AggregationAdapter(new LongMinAggregation<Key, Value>()); }
java
public static <Key, Value> Aggregation<Key, Long, Long> longMin() { return new AggregationAdapter(new LongMinAggregation<Key, Value>()); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Aggregation", "<", "Key", ",", "Long", ",", "Long", ">", "longMin", "(", ")", "{", "return", "new", "AggregationAdapter", "(", "new", "LongMinAggregation", "<", "Key", ",", "Value", ">", "(", ")", ")"...
Returns an aggregation to find the long minimum of all supplied values.<br/> This aggregation is similar to: <pre>SELECT MIN(value) FROM x</pre> @param <Key> the input key type @param <Value> the supplied value type @return the minimum value over all supplied values
[ "Returns", "an", "aggregation", "to", "find", "the", "long", "minimum", "of", "all", "supplied", "values", ".", "<br", "/", ">", "This", "aggregation", "is", "similar", "to", ":", "<pre", ">", "SELECT", "MIN", "(", "value", ")", "FROM", "x<", "/", "pre...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L174-L176
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java
StringUtils.removeStartingChars
public static String removeStartingChars(String s, char c) { int lastToRemove = -1; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == c) { lastToRemove = i; continue; } if (s.charAt(i) != c) { break; } } if (lastToRemove < 0) return s; return s.substring(lastToRemove + 1); }
java
public static String removeStartingChars(String s, char c) { int lastToRemove = -1; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == c) { lastToRemove = i; continue; } if (s.charAt(i) != c) { break; } } if (lastToRemove < 0) return s; return s.substring(lastToRemove + 1); }
[ "public", "static", "String", "removeStartingChars", "(", "String", "s", ",", "char", "c", ")", "{", "int", "lastToRemove", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", ...
Remove all consecutive chars c from the beginning of the string @param s String to process @param c Char to search for @return The string stripped from the starting chars.
[ "Remove", "all", "consecutive", "chars", "c", "from", "the", "beginning", "of", "the", "string" ]
train
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/utils/StringUtils.java#L325-L340
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.copyIndex
public JSONObject copyIndex(String srcIndexName, String dstIndexName) throws AlgoliaException { return operationOnIndex("copy", srcIndexName, dstIndexName, null, RequestOptions.empty); }
java
public JSONObject copyIndex(String srcIndexName, String dstIndexName) throws AlgoliaException { return operationOnIndex("copy", srcIndexName, dstIndexName, null, RequestOptions.empty); }
[ "public", "JSONObject", "copyIndex", "(", "String", "srcIndexName", ",", "String", "dstIndexName", ")", "throws", "AlgoliaException", "{", "return", "operationOnIndex", "(", "\"copy\"", ",", "srcIndexName", ",", "dstIndexName", ",", "null", ",", "RequestOptions", "....
Copy an existing index. @param srcIndexName the name of index to copy. @param dstIndexName the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).
[ "Copy", "an", "existing", "index", "." ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L351-L353
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/argparser/ClassFinder.java
ClassFinder.scanJar
protected void scanJar(final File file, final String packagePath) throws IOException { final ZipFile zip = new ZipFile(file); final Enumeration<? extends ZipEntry> entries = zip.entries(); while ( entries.hasMoreElements() ) { final ZipEntry entry = entries.nextElement(); final String name = entry.getName(); if (name.startsWith(packagePath)) { handleItem(name); } } }
java
protected void scanJar(final File file, final String packagePath) throws IOException { final ZipFile zip = new ZipFile(file); final Enumeration<? extends ZipEntry> entries = zip.entries(); while ( entries.hasMoreElements() ) { final ZipEntry entry = entries.nextElement(); final String name = entry.getName(); if (name.startsWith(packagePath)) { handleItem(name); } } }
[ "protected", "void", "scanJar", "(", "final", "File", "file", ",", "final", "String", "packagePath", ")", "throws", "IOException", "{", "final", "ZipFile", "zip", "=", "new", "ZipFile", "(", "file", ")", ";", "final", "Enumeration", "<", "?", "extends", "Z...
Scans the entries in a ZIP/JAR file for classes under the parent package. @param file the jar file to be scanned @param packagePath the top level package to start from
[ "Scans", "the", "entries", "in", "a", "ZIP", "/", "JAR", "file", "for", "classes", "under", "the", "parent", "package", "." ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/ClassFinder.java#L107-L117
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java
DateFormat.getDateTimeInstance
public final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) { return get(timeStyle, dateStyle, 3, aLocale); }
java
public final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) { return get(timeStyle, dateStyle, 3, aLocale); }
[ "public", "final", "static", "DateFormat", "getDateTimeInstance", "(", "int", "dateStyle", ",", "int", "timeStyle", ",", "Locale", "aLocale", ")", "{", "return", "get", "(", "timeStyle", ",", "dateStyle", ",", "3", ",", "aLocale", ")", ";", "}" ]
Gets the date/time formatter with the given formatting styles for the given locale. @param dateStyle the given date formatting style. @param timeStyle the given time formatting style. @param aLocale the given locale. @return a date/time formatter.
[ "Gets", "the", "date", "/", "time", "formatter", "with", "the", "given", "formatting", "styles", "for", "the", "given", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L546-L550
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/messaging/AtomAPIMMessage.java
AtomAPIMMessage.getParameterName
private static String getParameterName(Method m, int paramIndex) { PName pName = getParameterAnnotation(m, paramIndex, PName.class); if (pName != null) { return pName.value(); } else { return ""; } }
java
private static String getParameterName(Method m, int paramIndex) { PName pName = getParameterAnnotation(m, paramIndex, PName.class); if (pName != null) { return pName.value(); } else { return ""; } }
[ "private", "static", "String", "getParameterName", "(", "Method", "m", ",", "int", "paramIndex", ")", "{", "PName", "pName", "=", "getParameterAnnotation", "(", "m", ",", "paramIndex", ",", "PName", ".", "class", ")", ";", "if", "(", "pName", "!=", "null",...
Get the name of a method parameter via its <code>PName</code> annotation. @param m @param paramIndex the index of the parameter array. @return the parameter name or an empty string if not available.
[ "Get", "the", "name", "of", "a", "method", "parameter", "via", "its", "<code", ">", "PName<", "/", "code", ">", "annotation", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/messaging/AtomAPIMMessage.java#L380-L387
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.beginDelete
public void beginDelete(String resourceGroupName, String name, Boolean forceDelete) { beginDeleteWithServiceResponseAsync(resourceGroupName, name, forceDelete).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String name, Boolean forceDelete) { beginDeleteWithServiceResponseAsync(resourceGroupName, name, forceDelete).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "name", ",", "Boolean", "forceDelete", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "forceDelete", ")", ".", "toBlocking", "(", ")", ...
Delete an App Service Environment. Delete an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param forceDelete Specify &lt;code&gt;true&lt;/code&gt; to force the deletion even if the App Service Environment contains resources. The default is &lt;code&gt;false&lt;/code&gt;. @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
[ "Delete", "an", "App", "Service", "Environment", ".", "Delete", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1099-L1101
DigitalPebble/TextClassification
src/main/java/com/digitalpebble/classification/MultiFieldDocument.java
MultiFieldDocument.getScore
private double getScore(int pos, Lexicon lexicon, double numdocs) { double score = 0; int indexTerm = this.indices[pos]; double occurences = (double) this.freqs[pos]; int fieldNum = this.indexToField[pos]; double frequency = occurences / tokensPerField[fieldNum]; // is there a custom weight for this field? String fieldName = lexicon.getFields()[fieldNum]; WeightingMethod method = lexicon.getMethod(fieldName); if (method.equals(Parameters.WeightingMethod.BOOLEAN)) { score = 1; } else if (method.equals(Parameters.WeightingMethod.OCCURRENCES)) { score = occurences; } else if (method.equals(Parameters.WeightingMethod.FREQUENCY)) { score = frequency; } else if (method.equals(Parameters.WeightingMethod.TFIDF)) { int df = lexicon.getDocFreq(indexTerm); double idf = numdocs / (double) df; score = frequency * Math.log(idf); if (idf == 1) score = frequency; } return score; }
java
private double getScore(int pos, Lexicon lexicon, double numdocs) { double score = 0; int indexTerm = this.indices[pos]; double occurences = (double) this.freqs[pos]; int fieldNum = this.indexToField[pos]; double frequency = occurences / tokensPerField[fieldNum]; // is there a custom weight for this field? String fieldName = lexicon.getFields()[fieldNum]; WeightingMethod method = lexicon.getMethod(fieldName); if (method.equals(Parameters.WeightingMethod.BOOLEAN)) { score = 1; } else if (method.equals(Parameters.WeightingMethod.OCCURRENCES)) { score = occurences; } else if (method.equals(Parameters.WeightingMethod.FREQUENCY)) { score = frequency; } else if (method.equals(Parameters.WeightingMethod.TFIDF)) { int df = lexicon.getDocFreq(indexTerm); double idf = numdocs / (double) df; score = frequency * Math.log(idf); if (idf == 1) score = frequency; } return score; }
[ "private", "double", "getScore", "(", "int", "pos", ",", "Lexicon", "lexicon", ",", "double", "numdocs", ")", "{", "double", "score", "=", "0", ";", "int", "indexTerm", "=", "this", ".", "indices", "[", "pos", "]", ";", "double", "occurences", "=", "("...
Returns the score of an attribute given the weighting scheme specified in the lexicon or for a specific field
[ "Returns", "the", "score", "of", "an", "attribute", "given", "the", "weighting", "scheme", "specified", "in", "the", "lexicon", "or", "for", "a", "specific", "field" ]
train
https://github.com/DigitalPebble/TextClassification/blob/c510719c31633841af2bf393a20707d4624f865d/src/main/java/com/digitalpebble/classification/MultiFieldDocument.java#L301-L327
structurizr/java
structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java
Arc42DocumentationTemplate.addCrosscuttingConceptsSection
public Section addCrosscuttingConceptsSection(SoftwareSystem softwareSystem, File... files) throws IOException { return addSection(softwareSystem, "Crosscutting Concepts", files); }
java
public Section addCrosscuttingConceptsSection(SoftwareSystem softwareSystem, File... files) throws IOException { return addSection(softwareSystem, "Crosscutting Concepts", files); }
[ "public", "Section", "addCrosscuttingConceptsSection", "(", "SoftwareSystem", "softwareSystem", ",", "File", "...", "files", ")", "throws", "IOException", "{", "return", "addSection", "(", "softwareSystem", ",", "\"Crosscutting Concepts\"", ",", "files", ")", ";", "}"...
Adds a "Crosscutting Concepts" section relating to a {@link SoftwareSystem} from one or more files. @param softwareSystem the {@link SoftwareSystem} the documentation content relates to @param files one or more File objects that point to the documentation content @return a documentation {@link Section} @throws IOException if there is an error reading the files
[ "Adds", "a", "Crosscutting", "Concepts", "section", "relating", "to", "a", "{", "@link", "SoftwareSystem", "}", "from", "one", "or", "more", "files", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java#L217-L219
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.decode
public static String decode(String url, String charset) throws UtilException { if (StrUtil.isEmpty(url)) { return url; } try { return URLDecoder.decode(url, charset); } catch (UnsupportedEncodingException e) { throw new UtilException(e, "Unsupported encoding: [{}]", charset); } }
java
public static String decode(String url, String charset) throws UtilException { if (StrUtil.isEmpty(url)) { return url; } try { return URLDecoder.decode(url, charset); } catch (UnsupportedEncodingException e) { throw new UtilException(e, "Unsupported encoding: [{}]", charset); } }
[ "public", "static", "String", "decode", "(", "String", "url", ",", "String", "charset", ")", "throws", "UtilException", "{", "if", "(", "StrUtil", ".", "isEmpty", "(", "url", ")", ")", "{", "return", "url", ";", "}", "try", "{", "return", "URLDecoder", ...
解码URL<br> 将%开头的16进制表示的内容解码。 @param url URL @param charset 编码 @return 解码后的URL @exception UtilException UnsupportedEncodingException
[ "解码URL<br", ">", "将%开头的16进制表示的内容解码。" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L373-L382
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.getInteger
@PublicEvolving public int getInteger(ConfigOption<Integer> configOption) { Object o = getValueOrDefaultFromOption(configOption); return convertToInt(o, configOption.defaultValue()); }
java
@PublicEvolving public int getInteger(ConfigOption<Integer> configOption) { Object o = getValueOrDefaultFromOption(configOption); return convertToInt(o, configOption.defaultValue()); }
[ "@", "PublicEvolving", "public", "int", "getInteger", "(", "ConfigOption", "<", "Integer", ">", "configOption", ")", "{", "Object", "o", "=", "getValueOrDefaultFromOption", "(", "configOption", ")", ";", "return", "convertToInt", "(", "o", ",", "configOption", "...
Returns the value associated with the given config option as an integer. @param configOption The configuration option @return the (default) value associated with the given config option
[ "Returns", "the", "value", "associated", "with", "the", "given", "config", "option", "as", "an", "integer", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L219-L223
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java
CompareFixture.differenceBetweenIgnoreWhitespaceAnd
public String differenceBetweenIgnoreWhitespaceAnd(String first, String second) { String cleanFirst = allWhitespaceToSingleSpace(first); String cleanSecond = allWhitespaceToSingleSpace(second); String cleanDiff = differenceBetweenAnd(cleanFirst, cleanSecond); if (cleanDiff != null) { if (("<div>"+ cleanFirst + "</div>").equals(cleanDiff)) { cleanDiff = "<div>" + first + "</div>"; } else if (cleanFirst != null && cleanFirst.equals(cleanDiff)) { cleanDiff = first; } } return cleanDiff; }
java
public String differenceBetweenIgnoreWhitespaceAnd(String first, String second) { String cleanFirst = allWhitespaceToSingleSpace(first); String cleanSecond = allWhitespaceToSingleSpace(second); String cleanDiff = differenceBetweenAnd(cleanFirst, cleanSecond); if (cleanDiff != null) { if (("<div>"+ cleanFirst + "</div>").equals(cleanDiff)) { cleanDiff = "<div>" + first + "</div>"; } else if (cleanFirst != null && cleanFirst.equals(cleanDiff)) { cleanDiff = first; } } return cleanDiff; }
[ "public", "String", "differenceBetweenIgnoreWhitespaceAnd", "(", "String", "first", ",", "String", "second", ")", "{", "String", "cleanFirst", "=", "allWhitespaceToSingleSpace", "(", "first", ")", ";", "String", "cleanSecond", "=", "allWhitespaceToSingleSpace", "(", "...
Determines difference between two strings, ignoring whitespace changes. @param first first string to compare. @param second second string to compare. @return HTML of difference between the two.
[ "Determines", "difference", "between", "two", "strings", "ignoring", "whitespace", "changes", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java#L106-L118
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/ZipResourceLoader.java
ZipResourceLoader.extractJarContents
private void extractJarContents(final List<String> entries, final File destdir) throws IOException { if (!destdir.exists()) { if (!destdir.mkdir()) { //log.warn("Unable to create cache dir for plugin: " + destdir.getAbsolutePath()); } } //debug("extracting lib files from jar: " + pluginJar); for (final String path : entries) { //debug("Expand zip " + pluginJar.getAbsolutePath() + " to dir: " + destdir + ", file: " + path); ZipUtil.extractZipFile(zipFile.getAbsolutePath(), destdir, path); } }
java
private void extractJarContents(final List<String> entries, final File destdir) throws IOException { if (!destdir.exists()) { if (!destdir.mkdir()) { //log.warn("Unable to create cache dir for plugin: " + destdir.getAbsolutePath()); } } //debug("extracting lib files from jar: " + pluginJar); for (final String path : entries) { //debug("Expand zip " + pluginJar.getAbsolutePath() + " to dir: " + destdir + ", file: " + path); ZipUtil.extractZipFile(zipFile.getAbsolutePath(), destdir, path); } }
[ "private", "void", "extractJarContents", "(", "final", "List", "<", "String", ">", "entries", ",", "final", "File", "destdir", ")", "throws", "IOException", "{", "if", "(", "!", "destdir", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "destdir", "...
Extract specific entries from the jar to a destination directory. Creates the destination directory if it does not exist @param entries the entries to extract @param destdir destination directory
[ "Extract", "specific", "entries", "from", "the", "jar", "to", "a", "destination", "directory", ".", "Creates", "the", "destination", "directory", "if", "it", "does", "not", "exist" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/ZipResourceLoader.java#L150-L163
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.phoneNumber
public static Validator<CharSequence> phoneNumber(@NonNull final Context context, @StringRes final int resourceId) { return new PhoneNumberValidator(context, resourceId); }
java
public static Validator<CharSequence> phoneNumber(@NonNull final Context context, @StringRes final int resourceId) { return new PhoneNumberValidator(context, resourceId); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "phoneNumber", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "return", "new", "PhoneNumberValidator", "(", "context", ",", "resourceId...
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid phone numbers. Phone numbers, which are only consisting of numbers are allowed as well as international phone numbers, e.g. +49 1624812382. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "represent", "valid", "phone", "numbers", ".", "Phone", "numbers", "which", "are", "only", "consisting", "of", "numbers", "are", "allow...
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L1137-L1140
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/internal/model/CounterStorage.java
CounterStorage.writeToFile
int writeToFile() throws IOException { if (storageDisabled) { return -1; } final File file = getFile(); if (counter.getRequestsCount() == 0 && counter.getErrorsCount() == 0 && !file.exists()) { // s'il n'y a pas de requête, inutile d'écrire des fichiers de compteurs vides // (par exemple pour le compteur ejb s'il n'y a pas d'ejb) return -1; } final File directory = file.getParentFile(); if (!directory.mkdirs() && !directory.exists()) { throw new IOException("JavaMelody directory can't be created: " + directory.getPath()); } return writeToFile(counter, file); }
java
int writeToFile() throws IOException { if (storageDisabled) { return -1; } final File file = getFile(); if (counter.getRequestsCount() == 0 && counter.getErrorsCount() == 0 && !file.exists()) { // s'il n'y a pas de requête, inutile d'écrire des fichiers de compteurs vides // (par exemple pour le compteur ejb s'il n'y a pas d'ejb) return -1; } final File directory = file.getParentFile(); if (!directory.mkdirs() && !directory.exists()) { throw new IOException("JavaMelody directory can't be created: " + directory.getPath()); } return writeToFile(counter, file); }
[ "int", "writeToFile", "(", ")", "throws", "IOException", "{", "if", "(", "storageDisabled", ")", "{", "return", "-", "1", ";", "}", "final", "File", "file", "=", "getFile", "(", ")", ";", "if", "(", "counter", ".", "getRequestsCount", "(", ")", "==", ...
Enregistre le counter. @return Taille sérialisée non compressée du counter (estimation pessimiste de l'occupation mémoire) @throws IOException Exception d'entrée/sortie
[ "Enregistre", "le", "counter", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/model/CounterStorage.java#L103-L118
MindscapeHQ/raygun4java
core/src/main/java/com/mindscapehq/raygun4java/core/RaygunSettings.java
RaygunSettings.setHttpProxy
public void setHttpProxy(String host, int port) { if (host == null) { this.proxy = null; } else { this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); } }
java
public void setHttpProxy(String host, int port) { if (host == null) { this.proxy = null; } else { this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); } }
[ "public", "void", "setHttpProxy", "(", "String", "host", ",", "int", "port", ")", "{", "if", "(", "host", "==", "null", ")", "{", "this", ".", "proxy", "=", "null", ";", "}", "else", "{", "this", ".", "proxy", "=", "new", "Proxy", "(", "Proxy", "...
Set your proxy information, if your proxy server requires authentication set a default Authenticator in your code: <p> Authenticator authenticator = new Authenticator() { <p> public PasswordAuthentication getPasswordAuthentication() { return (new PasswordAuthentication("user", "password".toCharArray())); } }; Authenticator.setDefault(authenticator); <p> This will allow different proxy authentication credentials to be used for different target urls. @param host The host name @param port The TCP port
[ "Set", "your", "proxy", "information", "if", "your", "proxy", "server", "requires", "authentication", "set", "a", "default", "Authenticator", "in", "your", "code", ":", "<p", ">", "Authenticator", "authenticator", "=", "new", "Authenticator", "()", "{", "<p", ...
train
https://github.com/MindscapeHQ/raygun4java/blob/284a818446cfc6f0c2f83b5365514bc1bfc129b0/core/src/main/java/com/mindscapehq/raygun4java/core/RaygunSettings.java#L55-L61
j256/simplejmx
src/main/java/com/j256/simplejmx/client/CommandLineJmxClient.java
CommandLineJmxClient.runScript
private void runScript(String alias, int levelC) throws IOException { String scriptFile = alias; InputStream stream; try { stream = getInputStream(scriptFile); if (stream == null) { System.out.println("Error. Script file is not found: " + scriptFile); return; } } catch (IOException e) { System.out.println("Error. Could not load script file " + scriptFile + ": " + e.getMessage()); return; } final BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); try { doLines(levelC + 1, new LineReader() { @Override public String getNextLine(String prompt) throws IOException { return reader.readLine(); } }, true); } finally { reader.close(); } }
java
private void runScript(String alias, int levelC) throws IOException { String scriptFile = alias; InputStream stream; try { stream = getInputStream(scriptFile); if (stream == null) { System.out.println("Error. Script file is not found: " + scriptFile); return; } } catch (IOException e) { System.out.println("Error. Could not load script file " + scriptFile + ": " + e.getMessage()); return; } final BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); try { doLines(levelC + 1, new LineReader() { @Override public String getNextLine(String prompt) throws IOException { return reader.readLine(); } }, true); } finally { reader.close(); } }
[ "private", "void", "runScript", "(", "String", "alias", ",", "int", "levelC", ")", "throws", "IOException", "{", "String", "scriptFile", "=", "alias", ";", "InputStream", "stream", ";", "try", "{", "stream", "=", "getInputStream", "(", "scriptFile", ")", ";"...
Run a script. This might go recursive if we run from within a script.
[ "Run", "a", "script", ".", "This", "might", "go", "recursive", "if", "we", "run", "from", "within", "a", "script", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/CommandLineJmxClient.java#L319-L343
rsocket/rsocket-java
rsocket-core/src/main/java/io/rsocket/util/NumberUtils.java
NumberUtils.requireNonNegative
public static int requireNonNegative(int i, String message) { Objects.requireNonNull(message, "message must not be null"); if (i < 0) { throw new IllegalArgumentException(message); } return i; }
java
public static int requireNonNegative(int i, String message) { Objects.requireNonNull(message, "message must not be null"); if (i < 0) { throw new IllegalArgumentException(message); } return i; }
[ "public", "static", "int", "requireNonNegative", "(", "int", "i", ",", "String", "message", ")", "{", "Objects", ".", "requireNonNull", "(", "message", ",", "\"message must not be null\"", ")", ";", "if", "(", "i", "<", "0", ")", "{", "throw", "new", "Ille...
Requires that an {@code int} is greater than or equal to zero. @param i the {@code int} to test @param message detail message to be used in the event that a {@link IllegalArgumentException} is thrown @return the {@code int} if greater than or equal to zero @throws IllegalArgumentException if {@code i} is less than zero
[ "Requires", "that", "an", "{", "@code", "int", "}", "is", "greater", "than", "or", "equal", "to", "zero", "." ]
train
https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-core/src/main/java/io/rsocket/util/NumberUtils.java#L49-L57
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbKeywords.java
TmdbKeywords.getKeyword
public Keyword getKeyword(String keywordId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, keywordId); URL url = new ApiUrl(apiKey, MethodBase.KEYWORD).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, Keyword.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keyword " + keywordId, url, ex); } }
java
public Keyword getKeyword(String keywordId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, keywordId); URL url = new ApiUrl(apiKey, MethodBase.KEYWORD).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, Keyword.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keyword " + keywordId, url, ex); } }
[ "public", "Keyword", "getKeyword", "(", "String", "keywordId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "keywordId", ")", ";", ...
Get the basic information for a specific keyword id. @param keywordId @return @throws MovieDbException
[ "Get", "the", "basic", "information", "for", "a", "specific", "keyword", "id", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbKeywords.java#L61-L74
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java
DefaultPropertyPlaceholderResolver.resolveReplacement
@Deprecated protected boolean resolveReplacement(StringBuilder builder, String str, String expr) { if (environment.containsProperty(expr)) { builder.append(environment.getProperty(expr, String.class).orElseThrow(() -> new ConfigurationException("Could not resolve placeholder ${" + expr + "} in value: " + str))); return true; } return false; }
java
@Deprecated protected boolean resolveReplacement(StringBuilder builder, String str, String expr) { if (environment.containsProperty(expr)) { builder.append(environment.getProperty(expr, String.class).orElseThrow(() -> new ConfigurationException("Could not resolve placeholder ${" + expr + "} in value: " + str))); return true; } return false; }
[ "@", "Deprecated", "protected", "boolean", "resolveReplacement", "(", "StringBuilder", "builder", ",", "String", "str", ",", "String", "expr", ")", "{", "if", "(", "environment", ".", "containsProperty", "(", "expr", ")", ")", "{", "builder", ".", "append", ...
Resolves a replacement for the given expression. Returning true if the replacement was resolved. @deprecated No longer used internally. See {@link #resolveExpression(String, String, Class)} @param builder The builder @param str The full string @param expr The current expression @return True if a placeholder was resolved
[ "Resolves", "a", "replacement", "for", "the", "given", "expression", ".", "Returning", "true", "if", "the", "replacement", "was", "resolved", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java#L155-L162
aws/aws-sdk-java
aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java
EntityFilter.withTags
public EntityFilter withTags(java.util.Map<String, String>... tags) { if (this.tags == null) { setTags(new java.util.ArrayList<java.util.Map<String, String>>(tags.length)); } for (java.util.Map<String, String> ele : tags) { this.tags.add(ele); } return this; }
java
public EntityFilter withTags(java.util.Map<String, String>... tags) { if (this.tags == null) { setTags(new java.util.ArrayList<java.util.Map<String, String>>(tags.length)); } for (java.util.Map<String, String> ele : tags) { this.tags.add(ele); } return this; }
[ "public", "EntityFilter", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "...", "tags", ")", "{", "if", "(", "this", ".", "tags", "==", "null", ")", "{", "setTags", "(", "new", "java", ".", "util", ".", "ArrayL...
<p> A map of entity tags attached to the affected entity. </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the existing values. </p> @param tags A map of entity tags attached to the affected entity. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "of", "entity", "tags", "attached", "to", "the", "affected", "entity", ".", "<", "/", "p", ">", "<p", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "This", "method", "appends", "the", "values", "to", "the", "existing", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java#L402-L410
cojen/Cojen
src/main/java/org/cojen/classfile/ConstantPool.java
ConstantPool.addConstantNameAndType
public ConstantNameAndTypeInfo addConstantNameAndType(ConstantUTFInfo nameConstant, ConstantUTFInfo descConstant) { return (ConstantNameAndTypeInfo)addConstant (new ConstantNameAndTypeInfo(nameConstant, descConstant)); }
java
public ConstantNameAndTypeInfo addConstantNameAndType(ConstantUTFInfo nameConstant, ConstantUTFInfo descConstant) { return (ConstantNameAndTypeInfo)addConstant (new ConstantNameAndTypeInfo(nameConstant, descConstant)); }
[ "public", "ConstantNameAndTypeInfo", "addConstantNameAndType", "(", "ConstantUTFInfo", "nameConstant", ",", "ConstantUTFInfo", "descConstant", ")", "{", "return", "(", "ConstantNameAndTypeInfo", ")", "addConstant", "(", "new", "ConstantNameAndTypeInfo", "(", "nameConstant", ...
Get or create a constant name and type structure from the constant pool.
[ "Get", "or", "create", "a", "constant", "name", "and", "type", "structure", "from", "the", "constant", "pool", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ConstantPool.java#L243-L247
Javen205/IJPay
src/main/java/com/jpay/weixin/api/hb/RedHbApi.java
RedHbApi.sendGroupRedPack
public static String sendGroupRedPack(Map<String, String> params, String certPath, String certPassword) { return HttpUtils.postSSL(sendGroupRedPackUrl, PaymentKit.toXml(params), certPath, certPassword); }
java
public static String sendGroupRedPack(Map<String, String> params, String certPath, String certPassword) { return HttpUtils.postSSL(sendGroupRedPackUrl, PaymentKit.toXml(params), certPath, certPassword); }
[ "public", "static", "String", "sendGroupRedPack", "(", "Map", "<", "String", ",", "String", ">", "params", ",", "String", "certPath", ",", "String", "certPassword", ")", "{", "return", "HttpUtils", ".", "postSSL", "(", "sendGroupRedPackUrl", ",", "PaymentKit", ...
发送裂变红包 @param params 请求参数 @param certPath 证书文件目录 @param certPassword 证书密码 @return {String}
[ "发送裂变红包" ]
train
https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/weixin/api/hb/RedHbApi.java#L56-L58
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java
SecureAction.getURL
public URL getURL(final String protocol, final String host, final int port, final String file, final URLStreamHandler handler) throws MalformedURLException { if (System.getSecurityManager() == null) return new URL(protocol, host, port, file, handler); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() { @Override public URL run() throws MalformedURLException { return new URL(protocol, host, port, file, handler); } }, controlContext); } catch (PrivilegedActionException e) { if (e.getException() instanceof MalformedURLException) throw (MalformedURLException) e.getException(); throw (RuntimeException) e.getException(); } }
java
public URL getURL(final String protocol, final String host, final int port, final String file, final URLStreamHandler handler) throws MalformedURLException { if (System.getSecurityManager() == null) return new URL(protocol, host, port, file, handler); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() { @Override public URL run() throws MalformedURLException { return new URL(protocol, host, port, file, handler); } }, controlContext); } catch (PrivilegedActionException e) { if (e.getException() instanceof MalformedURLException) throw (MalformedURLException) e.getException(); throw (RuntimeException) e.getException(); } }
[ "public", "URL", "getURL", "(", "final", "String", "protocol", ",", "final", "String", "host", ",", "final", "int", "port", ",", "final", "String", "file", ",", "final", "URLStreamHandler", "handler", ")", "throws", "MalformedURLException", "{", "if", "(", "...
Gets a URL. Same a calling {@link URL#URL(java.lang.String, java.lang.String, int, java.lang.String, java.net.URLStreamHandler)} @param protocol the protocol @param host the host @param port the port @param file the file @param handler the URLStreamHandler @return a URL @throws MalformedURLException
[ "Gets", "a", "URL", ".", "Same", "a", "calling", "{", "@link", "URL#URL", "(", "java", ".", "lang", ".", "String", "java", ".", "lang", ".", "String", "int", "java", ".", "lang", ".", "String", "java", ".", "net", ".", "URLStreamHandler", ")", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java#L401-L416
javers/javers
javers-core/src/main/java/org/javers/core/JaversBuilder.java
JaversBuilder.registerValueGsonTypeAdapter
public JaversBuilder registerValueGsonTypeAdapter(Class valueType, TypeAdapter nativeAdapter) { registerValue(valueType); jsonConverterBuilder().registerNativeTypeAdapter(valueType, nativeAdapter); return this; }
java
public JaversBuilder registerValueGsonTypeAdapter(Class valueType, TypeAdapter nativeAdapter) { registerValue(valueType); jsonConverterBuilder().registerNativeTypeAdapter(valueType, nativeAdapter); return this; }
[ "public", "JaversBuilder", "registerValueGsonTypeAdapter", "(", "Class", "valueType", ",", "TypeAdapter", "nativeAdapter", ")", "{", "registerValue", "(", "valueType", ")", ";", "jsonConverterBuilder", "(", ")", ".", "registerNativeTypeAdapter", "(", "valueType", ",", ...
Registers {@link ValueType} and its custom native <a href="http://code.google.com/p/google-gson/">Gson</a> adapter. <br/><br/> Useful when you already have Gson {@link TypeAdapter}s implemented. @see TypeAdapter
[ "Registers", "{", "@link", "ValueType", "}", "and", "its", "custom", "native", "<a", "href", "=", "http", ":", "//", "code", ".", "google", ".", "com", "/", "p", "/", "google", "-", "gson", "/", ">", "Gson<", "/", "a", ">", "adapter", ".", "<br", ...
train
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L508-L512
BigBadaboom/androidsvg
androidsvg/src/main/java/com/caverock/androidsvg/RenderOptions.java
RenderOptions.viewBox
public RenderOptions viewBox(float minX, float minY, float width, float height) { this.viewBox = new SVG.Box(minX, minY, width, height); return this; }
java
public RenderOptions viewBox(float minX, float minY, float width, float height) { this.viewBox = new SVG.Box(minX, minY, width, height); return this; }
[ "public", "RenderOptions", "viewBox", "(", "float", "minX", ",", "float", "minY", ",", "float", "width", ",", "float", "height", ")", "{", "this", ".", "viewBox", "=", "new", "SVG", ".", "Box", "(", "minX", ",", "minY", ",", "width", ",", "height", "...
Specifies alternative values to use for the root element {@code viewBox}. Any existing {@code viewBox} attribute value will be ignored. Note: will be overridden if a {@link #view(String)} is set. @param minX The left X coordinate of the viewBox @param minY The top Y coordinate of the viewBox @param width The width of the viewBox @param height The height of the viewBox @return this same <code>RenderOptions</code> instance
[ "Specifies", "alternative", "values", "to", "use", "for", "the", "root", "element", "{", "@code", "viewBox", "}", ".", "Any", "existing", "{", "@code", "viewBox", "}", "attribute", "value", "will", "be", "ignored", "." ]
train
https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/RenderOptions.java#L173-L177
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java
PoiUtil.searchColCell
public static Cell searchColCell(Sheet sheet, short colIndex, String searchKey) { if (StringUtils.isEmpty(searchKey)) return null; for (int i = sheet.getFirstRowNum(), ii = sheet.getLastRowNum(); i < ii; ++i) { val row = sheet.getRow(i); if (row == null) continue; val cell = matchCell(row, colIndex, searchKey); if (cell != null) return cell; } return null; }
java
public static Cell searchColCell(Sheet sheet, short colIndex, String searchKey) { if (StringUtils.isEmpty(searchKey)) return null; for (int i = sheet.getFirstRowNum(), ii = sheet.getLastRowNum(); i < ii; ++i) { val row = sheet.getRow(i); if (row == null) continue; val cell = matchCell(row, colIndex, searchKey); if (cell != null) return cell; } return null; }
[ "public", "static", "Cell", "searchColCell", "(", "Sheet", "sheet", ",", "short", "colIndex", ",", "String", "searchKey", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "searchKey", ")", ")", "return", "null", ";", "for", "(", "int", "i", "=", ...
查找单元格。 @param sheet 表单 @param colIndex 列索引 @param searchKey 单元格中包含的关键字 @return 单元格,没有找到时返回null
[ "查找单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L326-L338
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java
ImportHelpers.findImportByExportingInstance
public static Import findImportByExportingInstance( Collection<Import> imports, String exportingInstancePath ) { Import result = null; if( imports != null && exportingInstancePath != null ) { for( Import imp : imports ) { if( exportingInstancePath.equals( imp.getInstancePath())) { result = imp; break; } } } return result; }
java
public static Import findImportByExportingInstance( Collection<Import> imports, String exportingInstancePath ) { Import result = null; if( imports != null && exportingInstancePath != null ) { for( Import imp : imports ) { if( exportingInstancePath.equals( imp.getInstancePath())) { result = imp; break; } } } return result; }
[ "public", "static", "Import", "findImportByExportingInstance", "(", "Collection", "<", "Import", ">", "imports", ",", "String", "exportingInstancePath", ")", "{", "Import", "result", "=", "null", ";", "if", "(", "imports", "!=", "null", "&&", "exportingInstancePat...
Finds a specific import from the path of the instance that exports it. @param imports a collection of imports (that can be null) @param exportingInstancePath the path of the exporting instance @return an import, or null if none was found
[ "Finds", "a", "specific", "import", "from", "the", "path", "of", "the", "instance", "that", "exports", "it", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java#L175-L188
protostuff/protostuff
protostuff-core/src/main/java/io/protostuff/ProtobufIOUtil.java
ProtobufIOUtil.writeTo
public static <T> int writeTo(LinkedBuffer buffer, T message, Schema<T> schema) { if (buffer.start != buffer.offset) throw new IllegalArgumentException("Buffer previously used and had not been reset."); final ProtobufOutput output = new ProtobufOutput(buffer); try { schema.writeTo(output, message); } catch (IOException e) { throw new RuntimeException("Serializing to a LinkedBuffer threw an IOException " + "(should never happen).", e); } return output.getSize(); }
java
public static <T> int writeTo(LinkedBuffer buffer, T message, Schema<T> schema) { if (buffer.start != buffer.offset) throw new IllegalArgumentException("Buffer previously used and had not been reset."); final ProtobufOutput output = new ProtobufOutput(buffer); try { schema.writeTo(output, message); } catch (IOException e) { throw new RuntimeException("Serializing to a LinkedBuffer threw an IOException " + "(should never happen).", e); } return output.getSize(); }
[ "public", "static", "<", "T", ">", "int", "writeTo", "(", "LinkedBuffer", "buffer", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ")", "{", "if", "(", "buffer", ".", "start", "!=", "buffer", ".", "offset", ")", "throw", "new", "Illegal...
Writes the {@code message} into the {@link LinkedBuffer} using the given schema. @return the size of the message
[ "Writes", "the", "{", "@code", "message", "}", "into", "the", "{", "@link", "LinkedBuffer", "}", "using", "the", "given", "schema", "." ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-core/src/main/java/io/protostuff/ProtobufIOUtil.java#L201-L218
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java
JwtEndpointServices.processJWKRequest
private void processJWKRequest(HttpServletResponse response, JwtConfig jwtConfig) throws IOException { /* * if (!jwtConfig.isJwkEnabled()) { String errorMsg = * Tr.formatMessage(tc, "JWK_ENDPOINT_JWK_NOT_ENABLED", new Object[] { * jwtConfig.getId() }); Tr.error(tc, errorMsg); * response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg); * return; } */ String signatureAlg = jwtConfig.getSignatureAlgorithm(); if (!Constants.SIGNATURE_ALG_RS256.equals(signatureAlg)) { String errorMsg = Tr.formatMessage(tc, "JWK_ENDPOINT_WRONG_ALGORITHM", new Object[] { jwtConfig.getId(), signatureAlg, Constants.SIGNATURE_ALG_RS256 }); Tr.error(tc, errorMsg); response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg); return; } String jwkString = jwtConfig.getJwkJsonString(); addNoCacheHeaders(response); response.setStatus(200); if (jwkString == null) { return; } try { PrintWriter pw = response.getWriter(); response.setHeader(WebConstants.HTTP_HEADER_CONTENT_TYPE, WebConstants.HTTP_CONTENT_TYPE_JSON); pw.write(jwkString); pw.flush(); pw.close(); } catch (IOException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Caught an exception attempting to get the response writer: " + e.getLocalizedMessage()); } } }
java
private void processJWKRequest(HttpServletResponse response, JwtConfig jwtConfig) throws IOException { /* * if (!jwtConfig.isJwkEnabled()) { String errorMsg = * Tr.formatMessage(tc, "JWK_ENDPOINT_JWK_NOT_ENABLED", new Object[] { * jwtConfig.getId() }); Tr.error(tc, errorMsg); * response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg); * return; } */ String signatureAlg = jwtConfig.getSignatureAlgorithm(); if (!Constants.SIGNATURE_ALG_RS256.equals(signatureAlg)) { String errorMsg = Tr.formatMessage(tc, "JWK_ENDPOINT_WRONG_ALGORITHM", new Object[] { jwtConfig.getId(), signatureAlg, Constants.SIGNATURE_ALG_RS256 }); Tr.error(tc, errorMsg); response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg); return; } String jwkString = jwtConfig.getJwkJsonString(); addNoCacheHeaders(response); response.setStatus(200); if (jwkString == null) { return; } try { PrintWriter pw = response.getWriter(); response.setHeader(WebConstants.HTTP_HEADER_CONTENT_TYPE, WebConstants.HTTP_CONTENT_TYPE_JSON); pw.write(jwkString); pw.flush(); pw.close(); } catch (IOException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Caught an exception attempting to get the response writer: " + e.getLocalizedMessage()); } } }
[ "private", "void", "processJWKRequest", "(", "HttpServletResponse", "response", ",", "JwtConfig", "jwtConfig", ")", "throws", "IOException", "{", "/*\n\t\t * if (!jwtConfig.isJwkEnabled()) { String errorMsg =\n\t\t * Tr.formatMessage(tc, \"JWK_ENDPOINT_JWK_NOT_ENABLED\", new Object[] {\n\t...
Obtains the JWK string that is active in the specified config and prints it in JSON format in the response. If a JWK is not found, the response will be empty. @param response @param jwtConfig @throws IOException
[ "Obtains", "the", "JWK", "string", "that", "is", "active", "in", "the", "specified", "config", "and", "prints", "it", "in", "JSON", "format", "in", "the", "response", ".", "If", "a", "JWK", "is", "not", "found", "the", "response", "will", "be", "empty", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/web/JwtEndpointServices.java#L255-L293
jayantk/jklol
src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java
FeatureStandardizer.centerFeatures
public static DiscreteFactor centerFeatures(DiscreteFactor featureFactor, int featureVariableNum) { return featureFactor.add(getMeans(featureFactor, featureVariableNum).product(-1.0)).coerceToDiscrete(); }
java
public static DiscreteFactor centerFeatures(DiscreteFactor featureFactor, int featureVariableNum) { return featureFactor.add(getMeans(featureFactor, featureVariableNum).product(-1.0)).coerceToDiscrete(); }
[ "public", "static", "DiscreteFactor", "centerFeatures", "(", "DiscreteFactor", "featureFactor", ",", "int", "featureVariableNum", ")", "{", "return", "featureFactor", ".", "add", "(", "getMeans", "(", "featureFactor", ",", "featureVariableNum", ")", ".", "product", ...
Computes the empirical mean of the features in {@code featureFactor}, then subtracts that mean from each feature. @param featureFactor @param featureVariableNum @return
[ "Computes", "the", "empirical", "mean", "of", "the", "features", "in", "{", "@code", "featureFactor", "}", "then", "subtracts", "that", "mean", "from", "each", "feature", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/preprocessing/FeatureStandardizer.java#L214-L216
alkacon/opencms-core
src/org/opencms/ui/dialogs/embedded/CmsDataViewParams.java
CmsDataViewParams.createViewInstance
public I_CmsDataView createViewInstance(CmsObject cms, Locale locale) { try { Class<?> cls = Class.forName(m_viewClass); Object viewObj = cls.newInstance(); I_CmsDataView dataView = (I_CmsDataView)viewObj; dataView.initialize(cms, m_viewArg, locale); return dataView; } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return null; } }
java
public I_CmsDataView createViewInstance(CmsObject cms, Locale locale) { try { Class<?> cls = Class.forName(m_viewClass); Object viewObj = cls.newInstance(); I_CmsDataView dataView = (I_CmsDataView)viewObj; dataView.initialize(cms, m_viewArg, locale); return dataView; } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return null; } }
[ "public", "I_CmsDataView", "createViewInstance", "(", "CmsObject", "cms", ",", "Locale", "locale", ")", "{", "try", "{", "Class", "<", "?", ">", "cls", "=", "Class", ".", "forName", "(", "m_viewClass", ")", ";", "Object", "viewObj", "=", "cls", ".", "new...
Creates the data view instance.<p> @param cms the CMS context @param locale the locale @return the new data view instance
[ "Creates", "the", "data", "view", "instance", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/embedded/CmsDataViewParams.java#L103-L115
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getAccountInvoices
public Invoices getAccountInvoices(final String accountCode, final InvoiceState state, final QueryParams params) { if (state != null) params.put("state", state.getType()); return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Invoices.INVOICES_RESOURCE, Invoices.class, params); }
java
public Invoices getAccountInvoices(final String accountCode, final InvoiceState state, final QueryParams params) { if (state != null) params.put("state", state.getType()); return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Invoices.INVOICES_RESOURCE, Invoices.class, params); }
[ "public", "Invoices", "getAccountInvoices", "(", "final", "String", "accountCode", ",", "final", "InvoiceState", "state", ",", "final", "QueryParams", "params", ")", "{", "if", "(", "state", "!=", "null", ")", "params", ".", "put", "(", "\"state\"", ",", "st...
Lookup an account's invoices given query params <p> Returns the account's invoices @param accountCode recurly account id @param state {@link InvoiceState} state of the invoices @param params {@link QueryParams} @return the invoices associated with this account on success, null otherwise
[ "Lookup", "an", "account", "s", "invoices", "given", "query", "params", "<p", ">", "Returns", "the", "account", "s", "invoices" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1245-L1249
apereo/cas
support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/AmazonEnvironmentAwareClientBuilder.java
AmazonEnvironmentAwareClientBuilder.getSetting
public <T> T getSetting(final String key, final Class<T> targetType) { return environment.getProperty(this.propertyPrefix + '.' + key, targetType); }
java
public <T> T getSetting(final String key, final Class<T> targetType) { return environment.getProperty(this.propertyPrefix + '.' + key, targetType); }
[ "public", "<", "T", ">", "T", "getSetting", "(", "final", "String", "key", ",", "final", "Class", "<", "T", ">", "targetType", ")", "{", "return", "environment", ".", "getProperty", "(", "this", ".", "propertyPrefix", "+", "'", "'", "+", "key", ",", ...
Gets setting. @param <T> the type parameter @param key the key @param targetType the target type @return the setting
[ "Gets", "setting", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/AmazonEnvironmentAwareClientBuilder.java#L56-L58
rundeck/rundeck
rundeckapp/src/main/groovy/com/dtolabs/rundeck/jetty/jaas/JettyCachingLdapLoginModule.java
JettyCachingLdapLoginModule.getUserRoles
@SuppressWarnings("unchecked") protected List getUserRoles(DirContext dirContext, String username) throws LoginException, NamingException { String userDn = _userRdnAttribute + "=" + username + "," + _userBaseDn; return getUserRolesByDn(dirContext, userDn, username); }
java
@SuppressWarnings("unchecked") protected List getUserRoles(DirContext dirContext, String username) throws LoginException, NamingException { String userDn = _userRdnAttribute + "=" + username + "," + _userBaseDn; return getUserRolesByDn(dirContext, userDn, username); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "List", "getUserRoles", "(", "DirContext", "dirContext", ",", "String", "username", ")", "throws", "LoginException", ",", "NamingException", "{", "String", "userDn", "=", "_userRdnAttribute", "+", "\"=...
attempts to get the users roles from the root context NOTE: this is not an user authenticated operation @param dirContext @param username @return @throws LoginException
[ "attempts", "to", "get", "the", "users", "roles", "from", "the", "root", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeckapp/src/main/groovy/com/dtolabs/rundeck/jetty/jaas/JettyCachingLdapLoginModule.java#L437-L443
alkacon/opencms-core
src-gwt/org/opencms/ade/editprovider/client/CmsEditablePositionCalculator.java
CmsEditablePositionCalculator.intersectsVertically
protected boolean intersectsVertically(CmsPositionBean p1, CmsPositionBean p2) { return intersectIntervals(p1.getTop(), p1.getTop() + HEIGHT, p2.getTop(), p2.getTop() + HEIGHT); }
java
protected boolean intersectsVertically(CmsPositionBean p1, CmsPositionBean p2) { return intersectIntervals(p1.getTop(), p1.getTop() + HEIGHT, p2.getTop(), p2.getTop() + HEIGHT); }
[ "protected", "boolean", "intersectsVertically", "(", "CmsPositionBean", "p1", ",", "CmsPositionBean", "p2", ")", "{", "return", "intersectIntervals", "(", "p1", ".", "getTop", "(", ")", ",", "p1", ".", "getTop", "(", ")", "+", "HEIGHT", ",", "p2", ".", "ge...
Checks whether two positions intersect vertically.<p> @param p1 the first position @param p2 the second position @return if the positions intersect vertically
[ "Checks", "whether", "two", "positions", "intersect", "vertically", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/editprovider/client/CmsEditablePositionCalculator.java#L185-L188
alkacon/opencms-core
src/org/opencms/synchronize/CmsSynchronize.java
CmsSynchronize.writeFileByte
private void writeFileByte(byte[] content, File file) throws IOException { FileOutputStream fOut = null; DataOutputStream dOut = null; try { // write the content to the file in server filesystem fOut = new FileOutputStream(file); dOut = new DataOutputStream(fOut); dOut.write(content); dOut.flush(); } catch (IOException e) { throw e; } finally { try { if (fOut != null) { fOut.close(); } } catch (IOException e) { // ignore } try { if (dOut != null) { dOut.close(); } } catch (IOException e) { // ignore } } }
java
private void writeFileByte(byte[] content, File file) throws IOException { FileOutputStream fOut = null; DataOutputStream dOut = null; try { // write the content to the file in server filesystem fOut = new FileOutputStream(file); dOut = new DataOutputStream(fOut); dOut.write(content); dOut.flush(); } catch (IOException e) { throw e; } finally { try { if (fOut != null) { fOut.close(); } } catch (IOException e) { // ignore } try { if (dOut != null) { dOut.close(); } } catch (IOException e) { // ignore } } }
[ "private", "void", "writeFileByte", "(", "byte", "[", "]", "content", ",", "File", "file", ")", "throws", "IOException", "{", "FileOutputStream", "fOut", "=", "null", ";", "DataOutputStream", "dOut", "=", "null", ";", "try", "{", "// write the content to the fil...
This writes the byte content of a resource to the file on the server file system.<p> @param content the content of the file in the VFS @param file the file in SFS that has to be updated with content @throws IOException if something goes wrong
[ "This", "writes", "the", "byte", "content", "of", "a", "resource", "to", "the", "file", "on", "the", "server", "file", "system", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/synchronize/CmsSynchronize.java#L1017-L1045
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.rotateLocalX
public Matrix4x3f rotateLocalX(float ang, Matrix4x3f dest) { float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm01 = cos * m01 - sin * m02; float nm02 = sin * m01 + cos * m02; float nm11 = cos * m11 - sin * m12; float nm12 = sin * m11 + cos * m12; float nm21 = cos * m21 - sin * m22; float nm22 = sin * m21 + cos * m22; float nm31 = cos * m31 - sin * m32; float nm32 = sin * m31 + cos * m32; dest._m00(m00); dest._m01(nm01); dest._m02(nm02); dest._m10(m10); dest._m11(nm11); dest._m12(nm12); dest._m20(m20); dest._m21(nm21); dest._m22(nm22); dest._m30(m30); dest._m31(nm31); dest._m32(nm32); dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
java
public Matrix4x3f rotateLocalX(float ang, Matrix4x3f dest) { float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm01 = cos * m01 - sin * m02; float nm02 = sin * m01 + cos * m02; float nm11 = cos * m11 - sin * m12; float nm12 = sin * m11 + cos * m12; float nm21 = cos * m21 - sin * m22; float nm22 = sin * m21 + cos * m22; float nm31 = cos * m31 - sin * m32; float nm32 = sin * m31 + cos * m32; dest._m00(m00); dest._m01(nm01); dest._m02(nm02); dest._m10(m10); dest._m11(nm11); dest._m12(nm12); dest._m20(m20); dest._m21(nm21); dest._m22(nm22); dest._m30(m30); dest._m31(nm31); dest._m32(nm32); dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
[ "public", "Matrix4x3f", "rotateLocalX", "(", "float", "ang", ",", "Matrix4x3f", "dest", ")", "{", "float", "sin", "=", "(", "float", ")", "Math", ".", "sin", "(", "ang", ")", ";", "float", "cos", "=", "(", "float", ")", "Math", ".", "cosFromSin", "("...
Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationX(float) rotationX()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationX(float) @param ang the angle in radians to rotate about the X axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "X", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "X", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L4244-L4269
negusoft/holoaccent
HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java
BitmapUtils.writeToFile
public static void writeToFile(Bitmap bitmap, String dir, String filename) throws FileNotFoundException, IOException { File sdCard = Environment.getExternalStorageDirectory(); File dirFile = new File (sdCard.getAbsolutePath() + "/" + dir); dirFile.mkdirs(); File f = new File(dirFile, filename); FileOutputStream fos = new FileOutputStream(f, false); bitmap.compress(CompressFormat.PNG, 100 /*ignored for PNG*/, fos); fos.flush(); fos.close(); }
java
public static void writeToFile(Bitmap bitmap, String dir, String filename) throws FileNotFoundException, IOException { File sdCard = Environment.getExternalStorageDirectory(); File dirFile = new File (sdCard.getAbsolutePath() + "/" + dir); dirFile.mkdirs(); File f = new File(dirFile, filename); FileOutputStream fos = new FileOutputStream(f, false); bitmap.compress(CompressFormat.PNG, 100 /*ignored for PNG*/, fos); fos.flush(); fos.close(); }
[ "public", "static", "void", "writeToFile", "(", "Bitmap", "bitmap", ",", "String", "dir", ",", "String", "filename", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "File", "sdCard", "=", "Environment", ".", "getExternalStorageDirectory", "(", ")"...
Write the given bitmap to a file in the external storage. Requires "android.permission.WRITE_EXTERNAL_STORAGE" permission.
[ "Write", "the", "given", "bitmap", "to", "a", "file", "in", "the", "external", "storage", ".", "Requires", "android", ".", "permission", ".", "WRITE_EXTERNAL_STORAGE", "permission", "." ]
train
https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java#L232-L241
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DefaultPageShell.java
DefaultPageShell.addHeadlines
private void addHeadlines(final PrintWriter writer, final List headlines) { if (headlines == null || headlines.isEmpty()) { return; } writer.write("\n<!-- Start general headlines -->"); for (Object line : headlines) { writer.write("\n" + line); } writer.println("\n<!-- End general headlines -->"); }
java
private void addHeadlines(final PrintWriter writer, final List headlines) { if (headlines == null || headlines.isEmpty()) { return; } writer.write("\n<!-- Start general headlines -->"); for (Object line : headlines) { writer.write("\n" + line); } writer.println("\n<!-- End general headlines -->"); }
[ "private", "void", "addHeadlines", "(", "final", "PrintWriter", "writer", ",", "final", "List", "headlines", ")", "{", "if", "(", "headlines", "==", "null", "||", "headlines", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "writer", ".", "write"...
Add a list of html headline entries intended to be added only once to the page. @param writer the writer to write to. @param headlines a list of html entries to be added to the page as a whole.
[ "Add", "a", "list", "of", "html", "headline", "entries", "intended", "to", "be", "added", "only", "once", "to", "the", "page", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DefaultPageShell.java#L142-L154
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/ParallelAggregation.java
ParallelAggregation.or
public static RoaringBitmap or(RoaringBitmap... bitmaps) { SortedMap<Short, List<Container>> grouped = groupByKey(bitmaps); short[] keys = new short[grouped.size()]; Container[] values = new Container[grouped.size()]; List<List<Container>> slices = new ArrayList<>(grouped.size()); int i = 0; for (Map.Entry<Short, List<Container>> slice : grouped.entrySet()) { keys[i++] = slice.getKey(); slices.add(slice.getValue()); } IntStream.range(0, i) .parallel() .forEach(position -> values[position] = or(slices.get(position))); return new RoaringBitmap(new RoaringArray(keys, values, i)); }
java
public static RoaringBitmap or(RoaringBitmap... bitmaps) { SortedMap<Short, List<Container>> grouped = groupByKey(bitmaps); short[] keys = new short[grouped.size()]; Container[] values = new Container[grouped.size()]; List<List<Container>> slices = new ArrayList<>(grouped.size()); int i = 0; for (Map.Entry<Short, List<Container>> slice : grouped.entrySet()) { keys[i++] = slice.getKey(); slices.add(slice.getValue()); } IntStream.range(0, i) .parallel() .forEach(position -> values[position] = or(slices.get(position))); return new RoaringBitmap(new RoaringArray(keys, values, i)); }
[ "public", "static", "RoaringBitmap", "or", "(", "RoaringBitmap", "...", "bitmaps", ")", "{", "SortedMap", "<", "Short", ",", "List", "<", "Container", ">", ">", "grouped", "=", "groupByKey", "(", "bitmaps", ")", ";", "short", "[", "]", "keys", "=", "new"...
Computes the bitwise union of the input bitmaps @param bitmaps the input bitmaps @return the union of the bitmaps
[ "Computes", "the", "bitwise", "union", "of", "the", "input", "bitmaps" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/ParallelAggregation.java#L164-L178
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java
DebugUtil.printDebug
public static void printDebug(final Map pMap, final String pMethodName) { printDebug(pMap, pMethodName, System.out); }
java
public static void printDebug(final Map pMap, final String pMethodName) { printDebug(pMap, pMethodName, System.out); }
[ "public", "static", "void", "printDebug", "(", "final", "Map", "pMap", ",", "final", "String", "pMethodName", ")", "{", "printDebug", "(", "pMap", ",", "pMethodName", ",", "System", ".", "out", ")", ";", "}" ]
Invokes a given method of every object in a {@code java.util.Map} to {@code System.out}. The method called must have no formal parameters. <p> If an exception is throwed during the method invocation, the element's {@code toString()} method is called.<br> For bulk data types, recursive invocations and invocations of other methods in this class, are used. <p> @param pMap the {@code java.util.Map} to be printed. @param pMethodName a {@code java.lang.String} holding the name of the method to be invoked on each mapped object. @see <a href="http://java.sun.com/products/jdk/1.3/docs/api/java/util/Map.html">{@code java.util.Map}</a>
[ "Invokes", "a", "given", "method", "of", "every", "object", "in", "a", "{" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L660-L662
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cart_GET
public ArrayList<String> cart_GET(String description) throws IOException { String qPath = "/order/cart"; StringBuilder sb = path(qPath); query(sb, "description", description); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> cart_GET(String description) throws IOException { String qPath = "/order/cart"; StringBuilder sb = path(qPath); query(sb, "description", description); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "cart_GET", "(", "String", "description", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cart\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"...
List of your OVH order carts REST: GET /order/cart @param description [required] Filter the value of description property (=)
[ "List", "of", "your", "OVH", "order", "carts" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L7345-L7351
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java
JBossASClient.getAttribute
public ModelNode getAttribute(boolean runtime, String attributeName, Address address) throws Exception { final ModelNode op = createReadAttributeRequest(runtime, attributeName, address); final ModelNode results = execute(op); if (isSuccess(results)) { return getResults(results); } else { throw new FailureException(results, "Failed to get attribute [" + attributeName + "] from [" + address + "]"); } }
java
public ModelNode getAttribute(boolean runtime, String attributeName, Address address) throws Exception { final ModelNode op = createReadAttributeRequest(runtime, attributeName, address); final ModelNode results = execute(op); if (isSuccess(results)) { return getResults(results); } else { throw new FailureException(results, "Failed to get attribute [" + attributeName + "] from [" + address + "]"); } }
[ "public", "ModelNode", "getAttribute", "(", "boolean", "runtime", ",", "String", "attributeName", ",", "Address", "address", ")", "throws", "Exception", "{", "final", "ModelNode", "op", "=", "createReadAttributeRequest", "(", "runtime", ",", "attributeName", ",", ...
Convienence method that allows you to obtain a single attribute's value from a resource. @param runtime if <code>true</code>, the attribute to be retrieved is a runtime attribute @param attributeName the attribute whose value is to be returned @param address identifies the resource @return the attribute value @throws Exception if failed to obtain the attribute value
[ "Convienence", "method", "that", "allows", "you", "to", "obtain", "a", "single", "attribute", "s", "value", "from", "a", "resource", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L361-L370
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowActionServlet.java
PageFlowActionServlet.moduleCanHandlePath
protected boolean moduleCanHandlePath( ModuleConfig moduleConfig, RequestProcessor rp, String servletPath ) { if ( moduleConfig.getPrefix().equals( "" ) && servletPath.lastIndexOf( '/' ) > 0 && rp instanceof PageFlowRequestProcessor ) { return false; } return true; }
java
protected boolean moduleCanHandlePath( ModuleConfig moduleConfig, RequestProcessor rp, String servletPath ) { if ( moduleConfig.getPrefix().equals( "" ) && servletPath.lastIndexOf( '/' ) > 0 && rp instanceof PageFlowRequestProcessor ) { return false; } return true; }
[ "protected", "boolean", "moduleCanHandlePath", "(", "ModuleConfig", "moduleConfig", ",", "RequestProcessor", "rp", ",", "String", "servletPath", ")", "{", "if", "(", "moduleConfig", ".", "getPrefix", "(", ")", ".", "equals", "(", "\"\"", ")", "&&", "servletPath"...
Tell whether the given module can handle the given path. If this is the root module (path=="") and it's a Page Flow module, then it shouldn't try to handle any path that has a slash in it -- it only handles local actions.
[ "Tell", "whether", "the", "given", "module", "can", "handle", "the", "given", "path", ".", "If", "this", "is", "the", "root", "module", "(", "path", "==", ")", "and", "it", "s", "a", "Page", "Flow", "module", "then", "it", "shouldn", "t", "try", "to"...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowActionServlet.java#L194-L203
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ParameterMapper.java
ParameterMapper.findMethod
public static Method findMethod(Class<?> c, String methodName) { for (Method m : c.getMethods()) { if (!m.getName().equalsIgnoreCase(methodName)) { continue; } if (m.getParameterCount() != 1) { continue; } return m; } return null; }
java
public static Method findMethod(Class<?> c, String methodName) { for (Method m : c.getMethods()) { if (!m.getName().equalsIgnoreCase(methodName)) { continue; } if (m.getParameterCount() != 1) { continue; } return m; } return null; }
[ "public", "static", "Method", "findMethod", "(", "Class", "<", "?", ">", "c", ",", "String", "methodName", ")", "{", "for", "(", "Method", "m", ":", "c", ".", "getMethods", "(", ")", ")", "{", "if", "(", "!", "m", ".", "getName", "(", ")", ".", ...
Find method method. @param c the c @param methodName the method name @return the method
[ "Find", "method", "method", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ParameterMapper.java#L92-L104
alexa/alexa-skills-kit-sdk-for-java
ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java
ResponseBuilder.withSpeech
public ResponseBuilder withSpeech(String speechText, com.amazon.ask.model.ui.PlayBehavior playBehavior) { this.speech = SsmlOutputSpeech.builder() .withSsml("<speak>" + trimOutputSpeech(speechText) + "</speak>") .withPlayBehavior(playBehavior) .build(); return this; }
java
public ResponseBuilder withSpeech(String speechText, com.amazon.ask.model.ui.PlayBehavior playBehavior) { this.speech = SsmlOutputSpeech.builder() .withSsml("<speak>" + trimOutputSpeech(speechText) + "</speak>") .withPlayBehavior(playBehavior) .build(); return this; }
[ "public", "ResponseBuilder", "withSpeech", "(", "String", "speechText", ",", "com", ".", "amazon", ".", "ask", ".", "model", ".", "ui", ".", "PlayBehavior", "playBehavior", ")", "{", "this", ".", "speech", "=", "SsmlOutputSpeech", ".", "builder", "(", ")", ...
Sets {@link OutputSpeech} on the response. Speech is always wrapped in SSML tags. @param speechText speech text @param playBehavior determines the queuing and playback of this output speech @return response builder
[ "Sets", "{", "@link", "OutputSpeech", "}", "on", "the", "response", ".", "Speech", "is", "always", "wrapped", "in", "SSML", "tags", "." ]
train
https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java#L92-L98
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/StringUtils.java
StringUtils.toDelimitedString
public static String toDelimitedString(Collection<?> list, String delim) { if (list == null || list.isEmpty()) { return EMPTY; } StringBuilder sb = new StringBuilder(); boolean first = true; for (Object o : list) { if (!first) { sb.append(delim); } sb.append(o); first = false; } return sb.toString(); }
java
public static String toDelimitedString(Collection<?> list, String delim) { if (list == null || list.isEmpty()) { return EMPTY; } StringBuilder sb = new StringBuilder(); boolean first = true; for (Object o : list) { if (!first) { sb.append(delim); } sb.append(o); first = false; } return sb.toString(); }
[ "public", "static", "String", "toDelimitedString", "(", "Collection", "<", "?", ">", "list", ",", "String", "delim", ")", "{", "if", "(", "list", "==", "null", "||", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "EMPTY", ";", "}", "StringBuilde...
Convert a {@code Collection} into a delimited {@code String} (e.g. CSV). <p>Useful for {@code toString()} implementations. @param list the collection @param delim the delimiter to use (typically a ",") @return the delimited {@code String}
[ "Convert", "a", "{", "@code", "Collection", "}", "into", "a", "delimited", "{", "@code", "String", "}", "(", "e", ".", "g", ".", "CSV", ")", ".", "<p", ">", "Useful", "for", "{", "@code", "toString", "()", "}", "implementations", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L666-L680
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java
BoxApiUser.getDownloadAvatarRequest
public BoxRequestsFile.DownloadFile getDownloadAvatarRequest(OutputStream outputStream, String userId) { BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(userId, outputStream, getAvatarDownloadUrl(userId), mSession); return request; }
java
public BoxRequestsFile.DownloadFile getDownloadAvatarRequest(OutputStream outputStream, String userId) { BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(userId, outputStream, getAvatarDownloadUrl(userId), mSession); return request; }
[ "public", "BoxRequestsFile", ".", "DownloadFile", "getDownloadAvatarRequest", "(", "OutputStream", "outputStream", ",", "String", "userId", ")", "{", "BoxRequestsFile", ".", "DownloadFile", "request", "=", "new", "BoxRequestsFile", ".", "DownloadFile", "(", "userId", ...
Gets a request that downloads the given avatar to the provided outputStream. Developer is responsible for closing the outputStream provided. @param outputStream outputStream to write file contents to. @param userId the file id to download. @return request to download a file thumbnail
[ "Gets", "a", "request", "that", "downloads", "the", "given", "avatar", "to", "the", "provided", "outputStream", ".", "Developer", "is", "responsible", "for", "closing", "the", "outputStream", "provided", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java#L133-L136
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
XSLTAttributeDef.processSTRINGLIST
StringVector processSTRINGLIST(StylesheetHandler handler, String uri, String name, String rawName, String value) { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nStrings = tokenizer.countTokens(); StringVector strings = new StringVector(nStrings); for (int i = 0; i < nStrings; i++) { strings.addElement(tokenizer.nextToken()); } return strings; }
java
StringVector processSTRINGLIST(StylesheetHandler handler, String uri, String name, String rawName, String value) { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nStrings = tokenizer.countTokens(); StringVector strings = new StringVector(nStrings); for (int i = 0; i < nStrings; i++) { strings.addElement(tokenizer.nextToken()); } return strings; }
[ "StringVector", "processSTRINGLIST", "(", "StylesheetHandler", "handler", ",", "String", "uri", ",", "String", "name", ",", "String", "rawName", ",", "String", "value", ")", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "value", ",", "...
Process an attribute string of type T_STRINGLIST into a vector of XPath match patterns. @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value a whitespace delimited list of string values. @return A StringVector of the tokenized strings.
[ "Process", "an", "attribute", "string", "of", "type", "T_STRINGLIST", "into", "a", "vector", "of", "XPath", "match", "patterns", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1198-L1212
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/EfficientCacheView.java
EfficientCacheView.findViewByIdEfficient
public <T extends View> T findViewByIdEfficient(int parentId, int id) { View viewRetrieve = retrieveFromCache(parentId, id); if (viewRetrieve == null) { viewRetrieve = findViewById(parentId, id); if (viewRetrieve != null) { storeView(parentId, id, viewRetrieve); } } return castView(viewRetrieve); }
java
public <T extends View> T findViewByIdEfficient(int parentId, int id) { View viewRetrieve = retrieveFromCache(parentId, id); if (viewRetrieve == null) { viewRetrieve = findViewById(parentId, id); if (viewRetrieve != null) { storeView(parentId, id, viewRetrieve); } } return castView(viewRetrieve); }
[ "public", "<", "T", "extends", "View", ">", "T", "findViewByIdEfficient", "(", "int", "parentId", ",", "int", "id", ")", "{", "View", "viewRetrieve", "=", "retrieveFromCache", "(", "parentId", ",", "id", ")", ";", "if", "(", "viewRetrieve", "==", "null", ...
Look for a child view of the parent view id with the given id. If this view has the given id, return this view. The method is more efficient than a "normal" "findViewById" : the second time you will called this method with the same argument, the view return will come from the cache. @param id The id to search for. @return The view that has the given id in the hierarchy or null
[ "Look", "for", "a", "child", "view", "of", "the", "parent", "view", "id", "with", "the", "given", "id", ".", "If", "this", "view", "has", "the", "given", "id", "return", "this", "view", ".", "The", "method", "is", "more", "efficient", "than", "a", "n...
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/EfficientCacheView.java#L72-L81
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java
ElementPlugin.registerListener
public void registerListener(IPluginEventListener listener) { if (pluginEventListeners2 == null) { pluginEventListeners2 = new ArrayList<>(); } if (!pluginEventListeners2.contains(listener)) { pluginEventListeners2.add(listener); listener.onPluginEvent(new PluginEvent(this, PluginAction.SUBSCRIBE)); } }
java
public void registerListener(IPluginEventListener listener) { if (pluginEventListeners2 == null) { pluginEventListeners2 = new ArrayList<>(); } if (!pluginEventListeners2.contains(listener)) { pluginEventListeners2.add(listener); listener.onPluginEvent(new PluginEvent(this, PluginAction.SUBSCRIBE)); } }
[ "public", "void", "registerListener", "(", "IPluginEventListener", "listener", ")", "{", "if", "(", "pluginEventListeners2", "==", "null", ")", "{", "pluginEventListeners2", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "if", "(", "!", "pluginEventListeners...
Registers a listener for the IPluginEventListener callback event. If the listener has already been registered, the request is ignored. @param listener Listener to be registered.
[ "Registers", "a", "listener", "for", "the", "IPluginEventListener", "callback", "event", ".", "If", "the", "listener", "has", "already", "been", "registered", "the", "request", "is", "ignored", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java#L663-L672
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/ModClusterContainer.java
ModClusterContainer.enableContext
public synchronized boolean enableContext(final String contextPath, final String jvmRoute, final List<String> aliases) { final Node node = nodes.get(jvmRoute); if (node != null) { Context context = node.getContext(contextPath, aliases); if (context == null) { context = node.registerContext(contextPath, aliases); UndertowLogger.ROOT_LOGGER.registeringContext(contextPath, jvmRoute); UndertowLogger.ROOT_LOGGER.registeringContext(contextPath, jvmRoute, aliases); for (final String alias : aliases) { VirtualHost virtualHost = hosts.get(alias); if (virtualHost == null) { virtualHost = new VirtualHost(); hosts.put(alias, virtualHost); } virtualHost.registerContext(contextPath, jvmRoute, context); } } context.enable(); return true; } return false; }
java
public synchronized boolean enableContext(final String contextPath, final String jvmRoute, final List<String> aliases) { final Node node = nodes.get(jvmRoute); if (node != null) { Context context = node.getContext(contextPath, aliases); if (context == null) { context = node.registerContext(contextPath, aliases); UndertowLogger.ROOT_LOGGER.registeringContext(contextPath, jvmRoute); UndertowLogger.ROOT_LOGGER.registeringContext(contextPath, jvmRoute, aliases); for (final String alias : aliases) { VirtualHost virtualHost = hosts.get(alias); if (virtualHost == null) { virtualHost = new VirtualHost(); hosts.put(alias, virtualHost); } virtualHost.registerContext(contextPath, jvmRoute, context); } } context.enable(); return true; } return false; }
[ "public", "synchronized", "boolean", "enableContext", "(", "final", "String", "contextPath", ",", "final", "String", "jvmRoute", ",", "final", "List", "<", "String", ">", "aliases", ")", "{", "final", "Node", "node", "=", "nodes", ".", "get", "(", "jvmRoute"...
Register a web context. If the web context already exists, just enable it. @param contextPath the context path @param jvmRoute the jvmRoute @param aliases the virtual host aliases
[ "Register", "a", "web", "context", ".", "If", "the", "web", "context", "already", "exists", "just", "enable", "it", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/ModClusterContainer.java#L317-L338
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/OAuth20DefaultTokenGenerator.java
OAuth20DefaultTokenGenerator.addTicketToRegistry
protected void addTicketToRegistry(final Ticket ticket, final TicketGrantingTicket ticketGrantingTicket) { LOGGER.debug("Adding ticket [{}] to registry", ticket); this.ticketRegistry.addTicket(ticket); if (ticketGrantingTicket != null) { LOGGER.debug("Updating parent ticket-granting ticket [{}]", ticketGrantingTicket); this.ticketRegistry.updateTicket(ticketGrantingTicket); } }
java
protected void addTicketToRegistry(final Ticket ticket, final TicketGrantingTicket ticketGrantingTicket) { LOGGER.debug("Adding ticket [{}] to registry", ticket); this.ticketRegistry.addTicket(ticket); if (ticketGrantingTicket != null) { LOGGER.debug("Updating parent ticket-granting ticket [{}]", ticketGrantingTicket); this.ticketRegistry.updateTicket(ticketGrantingTicket); } }
[ "protected", "void", "addTicketToRegistry", "(", "final", "Ticket", "ticket", ",", "final", "TicketGrantingTicket", "ticketGrantingTicket", ")", "{", "LOGGER", ".", "debug", "(", "\"Adding ticket [{}] to registry\"", ",", "ticket", ")", ";", "this", ".", "ticketRegist...
Add ticket to registry. @param ticket the ticket @param ticketGrantingTicket the ticket granting ticket
[ "Add", "ticket", "to", "registry", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/OAuth20DefaultTokenGenerator.java#L241-L248
thiagokimo/Alexei
library/src/main/java/com/kimo/lib/alexei/CalculusBuilder.java
CalculusBuilder.showMe
public void showMe(Answer<T> callback) { CalculusTask<T> task = new CalculusTask(image,calculus,callback); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if(executor == null) { executor = AsyncTask.THREAD_POOL_EXECUTOR; } task.executeOnExecutor(executor); } else { task.execute(); } }
java
public void showMe(Answer<T> callback) { CalculusTask<T> task = new CalculusTask(image,calculus,callback); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if(executor == null) { executor = AsyncTask.THREAD_POOL_EXECUTOR; } task.executeOnExecutor(executor); } else { task.execute(); } }
[ "public", "void", "showMe", "(", "Answer", "<", "T", ">", "callback", ")", "{", "CalculusTask", "<", "T", ">", "task", "=", "new", "CalculusTask", "(", "image", ",", "calculus", ",", "callback", ")", ";", "if", "(", "Build", ".", "VERSION", ".", "SDK...
Executes the calculation. Must be called after a {@link com.kimo.lib.alexei.Calculus} is set. @param callback to use when the calculation finish. The callback will be called in UI thread.
[ "Executes", "the", "calculation", ".", "Must", "be", "called", "after", "a", "{", "@link", "com", ".", "kimo", ".", "lib", ".", "alexei", ".", "Calculus", "}", "is", "set", "." ]
train
https://github.com/thiagokimo/Alexei/blob/dc4e7e8b4651fe8d0679f75fe67f8a3361efc42c/library/src/main/java/com/kimo/lib/alexei/CalculusBuilder.java#L37-L51
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/AbstractInteractableComponent.java
AbstractInteractableComponent.onLeaveFocus
@Override public final void onLeaveFocus(FocusChangeDirection direction, Interactable nextInFocus) { inFocus = false; afterLeaveFocus(direction, nextInFocus); }
java
@Override public final void onLeaveFocus(FocusChangeDirection direction, Interactable nextInFocus) { inFocus = false; afterLeaveFocus(direction, nextInFocus); }
[ "@", "Override", "public", "final", "void", "onLeaveFocus", "(", "FocusChangeDirection", "direction", ",", "Interactable", "nextInFocus", ")", "{", "inFocus", "=", "false", ";", "afterLeaveFocus", "(", "direction", ",", "nextInFocus", ")", ";", "}" ]
{@inheritDoc} <p> This method is final in {@code AbstractInteractableComponent}, please override {@code afterLeaveFocus} instead
[ "{" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/AbstractInteractableComponent.java#L86-L90
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java
ComponentFactory.newWebMarkupContainer
public static <T> WebMarkupContainer newWebMarkupContainer(final String id, final IModel<T> model) { final WebMarkupContainer webMarkupContainer = new WebMarkupContainer(id, model); webMarkupContainer.setOutputMarkupId(true); return webMarkupContainer; }
java
public static <T> WebMarkupContainer newWebMarkupContainer(final String id, final IModel<T> model) { final WebMarkupContainer webMarkupContainer = new WebMarkupContainer(id, model); webMarkupContainer.setOutputMarkupId(true); return webMarkupContainer; }
[ "public", "static", "<", "T", ">", "WebMarkupContainer", "newWebMarkupContainer", "(", "final", "String", "id", ",", "final", "IModel", "<", "T", ">", "model", ")", "{", "final", "WebMarkupContainer", "webMarkupContainer", "=", "new", "WebMarkupContainer", "(", ...
Factory method for create a new {@link WebMarkupContainer}. @param <T> the generic type of the model @param id the id @param model the model @return the new {@link WebMarkupContainer}.
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "WebMarkupContainer", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L712-L718
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsBuilder.java
FindBugsBuilder.doBuild
private void doBuild(final Map<?, ?> args, final IProgressMonitor monitor, int kind) throws CoreException { boolean incremental = (kind == IncrementalProjectBuilder.INCREMENTAL_BUILD || kind == IncrementalProjectBuilder.AUTO_BUILD); IProject project = getProject(); IResource resource = project; List<WorkItem> files; if (incremental) { IResourceDelta resourceDelta = getDelta(project); boolean configChanged = !isConfigUnchanged(resourceDelta); if (configChanged) { files = new ArrayList<>(); files.add(new WorkItem(project)); } else { files = ResourceUtils.collectIncremental(resourceDelta); if(files.size() == 1){ IResource corespondingResource = files.get(0).getCorespondingResource(); if(corespondingResource != null) { resource = corespondingResource; } } } } else { files = new ArrayList<>(); files.add(new WorkItem(project)); } work(resource, files, monitor); }
java
private void doBuild(final Map<?, ?> args, final IProgressMonitor monitor, int kind) throws CoreException { boolean incremental = (kind == IncrementalProjectBuilder.INCREMENTAL_BUILD || kind == IncrementalProjectBuilder.AUTO_BUILD); IProject project = getProject(); IResource resource = project; List<WorkItem> files; if (incremental) { IResourceDelta resourceDelta = getDelta(project); boolean configChanged = !isConfigUnchanged(resourceDelta); if (configChanged) { files = new ArrayList<>(); files.add(new WorkItem(project)); } else { files = ResourceUtils.collectIncremental(resourceDelta); if(files.size() == 1){ IResource corespondingResource = files.get(0).getCorespondingResource(); if(corespondingResource != null) { resource = corespondingResource; } } } } else { files = new ArrayList<>(); files.add(new WorkItem(project)); } work(resource, files, monitor); }
[ "private", "void", "doBuild", "(", "final", "Map", "<", "?", ",", "?", ">", "args", ",", "final", "IProgressMonitor", "monitor", ",", "int", "kind", ")", "throws", "CoreException", "{", "boolean", "incremental", "=", "(", "kind", "==", "IncrementalProjectBui...
Performs the build process. This method gets all files in the current project and has a <code>FindBugsVisitor</code> run on them. @param args A <code>Map</code> containing additional build parameters. @param monitor The <code>IProgressMonitor</code> displaying the build progress. @param kind kind the kind of build being requested, see IncrementalProjectBuilder @throws CoreException
[ "Performs", "the", "build", "process", ".", "This", "method", "gets", "all", "files", "in", "the", "current", "project", "and", "has", "a", "<code", ">", "FindBugsVisitor<", "/", "code", ">", "run", "on", "them", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/builder/FindBugsBuilder.java#L130-L157
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java
FileSystemUtilities.createDirectory
public static void createDirectory(final File aDirectory, final boolean cleanBeforeCreate) throws MojoExecutionException { // Check sanity Validate.notNull(aDirectory, "aDirectory"); validateFileOrDirectoryName(aDirectory); // Clean an existing directory? if (cleanBeforeCreate) { try { FileUtils.deleteDirectory(aDirectory); } catch (IOException e) { throw new MojoExecutionException("Could not clean directory [" + getCanonicalPath(aDirectory) + "]", e); } } // Now, make the required directory, if it does not already exist as a directory. final boolean existsAsFile = aDirectory.exists() && aDirectory.isFile(); if (existsAsFile) { throw new MojoExecutionException("[" + getCanonicalPath(aDirectory) + "] exists and is a file. " + "Cannot make directory"); } else if (!aDirectory.exists() && !aDirectory.mkdirs()) { throw new MojoExecutionException("Could not create directory [" + getCanonicalPath(aDirectory) + "]"); } }
java
public static void createDirectory(final File aDirectory, final boolean cleanBeforeCreate) throws MojoExecutionException { // Check sanity Validate.notNull(aDirectory, "aDirectory"); validateFileOrDirectoryName(aDirectory); // Clean an existing directory? if (cleanBeforeCreate) { try { FileUtils.deleteDirectory(aDirectory); } catch (IOException e) { throw new MojoExecutionException("Could not clean directory [" + getCanonicalPath(aDirectory) + "]", e); } } // Now, make the required directory, if it does not already exist as a directory. final boolean existsAsFile = aDirectory.exists() && aDirectory.isFile(); if (existsAsFile) { throw new MojoExecutionException("[" + getCanonicalPath(aDirectory) + "] exists and is a file. " + "Cannot make directory"); } else if (!aDirectory.exists() && !aDirectory.mkdirs()) { throw new MojoExecutionException("Could not create directory [" + getCanonicalPath(aDirectory) + "]"); } }
[ "public", "static", "void", "createDirectory", "(", "final", "File", "aDirectory", ",", "final", "boolean", "cleanBeforeCreate", ")", "throws", "MojoExecutionException", "{", "// Check sanity", "Validate", ".", "notNull", "(", "aDirectory", ",", "\"aDirectory\"", ")",...
Convenience method to successfully create a directory - or throw an exception if failing to create it. @param aDirectory The directory to create. @param cleanBeforeCreate if {@code true}, the directory and all its content will be deleted before being re-created. This will ensure that the created directory is really clean. @throws MojoExecutionException if the aDirectory could not be created (and/or cleaned).
[ "Convenience", "method", "to", "successfully", "create", "a", "directory", "-", "or", "throw", "an", "exception", "if", "failing", "to", "create", "it", "." ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/FileSystemUtilities.java#L495-L519
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.fromCollection
public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, Class<OUT> type) { return fromCollection(data, TypeExtractor.getForClass(type)); }
java
public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, Class<OUT> type) { return fromCollection(data, TypeExtractor.getForClass(type)); }
[ "public", "<", "OUT", ">", "DataStreamSource", "<", "OUT", ">", "fromCollection", "(", "Iterator", "<", "OUT", ">", "data", ",", "Class", "<", "OUT", ">", "type", ")", "{", "return", "fromCollection", "(", "data", ",", "TypeExtractor", ".", "getForClass", ...
Creates a data stream from the given iterator. <p>Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the iterator must be given explicitly in the form of the type class (this is due to the fact that the Java compiler erases the generic type information). <p>Note that this operation will result in a non-parallel data stream source, i.e., a data stream source with a parallelism of one. @param data The iterator of elements to create the data stream from @param type The class of the data produced by the iterator. Must not be a generic class. @param <OUT> The type of the returned data stream @return The data stream representing the elements in the iterator @see #fromCollection(java.util.Iterator, org.apache.flink.api.common.typeinfo.TypeInformation)
[ "Creates", "a", "data", "stream", "from", "the", "given", "iterator", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L840-L842
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/ascii/rest/HttpCommand.java
HttpCommand.setResponse
public void setResponse(Map<String, Object> headers) { int size = RES_200.length; byte[] len = stringToBytes(String.valueOf(0)); size += CONTENT_LENGTH.length; size += len.length; size += TextCommandConstants.RETURN.length; if (headers != null) { for (Map.Entry<String, Object> entry : headers.entrySet()) { size += stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": ").length; size += stringToBytes(entry.getValue().toString()).length; size += TextCommandConstants.RETURN.length; } } size += TextCommandConstants.RETURN.length; this.response = ByteBuffer.allocate(size); response.put(RES_200); response.put(CONTENT_LENGTH); response.put(len); response.put(TextCommandConstants.RETURN); if (headers != null) { for (Map.Entry<String, Object> entry : headers.entrySet()) { response.put(stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": ")); response.put(stringToBytes(entry.getValue().toString())); response.put(TextCommandConstants.RETURN); } } response.put(TextCommandConstants.RETURN); response.flip(); }
java
public void setResponse(Map<String, Object> headers) { int size = RES_200.length; byte[] len = stringToBytes(String.valueOf(0)); size += CONTENT_LENGTH.length; size += len.length; size += TextCommandConstants.RETURN.length; if (headers != null) { for (Map.Entry<String, Object> entry : headers.entrySet()) { size += stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": ").length; size += stringToBytes(entry.getValue().toString()).length; size += TextCommandConstants.RETURN.length; } } size += TextCommandConstants.RETURN.length; this.response = ByteBuffer.allocate(size); response.put(RES_200); response.put(CONTENT_LENGTH); response.put(len); response.put(TextCommandConstants.RETURN); if (headers != null) { for (Map.Entry<String, Object> entry : headers.entrySet()) { response.put(stringToBytes(HEADER_CUSTOM_PREFIX + entry.getKey() + ": ")); response.put(stringToBytes(entry.getValue().toString())); response.put(TextCommandConstants.RETURN); } } response.put(TextCommandConstants.RETURN); response.flip(); }
[ "public", "void", "setResponse", "(", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "int", "size", "=", "RES_200", ".", "length", ";", "byte", "[", "]", "len", "=", "stringToBytes", "(", "String", ".", "valueOf", "(", "0", ")", ")", ...
HTTP/1.0 200 OK Content-Length: 0 Custom-Header1: val1 Custom-Header2: val2 @param headers
[ "HTTP", "/", "1", ".", "0", "200", "OK", "Content", "-", "Length", ":", "0", "Custom", "-", "Header1", ":", "val1", "Custom", "-", "Header2", ":", "val2" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/ascii/rest/HttpCommand.java#L111-L139
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
JavaScriptUtils.getUnencodedHtmlCookieString
public String getUnencodedHtmlCookieString(String name, String value) { return getUnencodedHtmlCookieString(name, value, null); }
java
public String getUnencodedHtmlCookieString(String name, String value) { return getUnencodedHtmlCookieString(name, value, null); }
[ "public", "String", "getUnencodedHtmlCookieString", "(", "String", "name", ",", "String", "value", ")", "{", "return", "getUnencodedHtmlCookieString", "(", "name", ",", "value", ",", "null", ")", ";", "}" ]
Creates and returns a JavaScript line for setting a cookie with the specified name, value, and cookie properties. Note: The name and value will not be HTML encoded.
[ "Creates", "and", "returns", "a", "JavaScript", "line", "for", "setting", "a", "cookie", "with", "the", "specified", "name", "value", "and", "cookie", "properties", ".", "Note", ":", "The", "name", "and", "value", "will", "not", "be", "HTML", "encoded", "....
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L91-L93
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/DefaultConnectionNameGenerator.java
DefaultConnectionNameGenerator.truncateAsJson
private static String truncateAsJson(String s, int maxSerializedLength) { int resultLength = 0; int spaceLeft = maxSerializedLength - 2; // enclosing quotes always consume 2 slots for (char c : s.toCharArray()) { final boolean charNeedsEscape = c == '\\' || c == '"' || c == '\t'; spaceLeft -= charNeedsEscape ? 2 : 1; if (spaceLeft < 0) { break; } resultLength++; } return truncate(s, resultLength); }
java
private static String truncateAsJson(String s, int maxSerializedLength) { int resultLength = 0; int spaceLeft = maxSerializedLength - 2; // enclosing quotes always consume 2 slots for (char c : s.toCharArray()) { final boolean charNeedsEscape = c == '\\' || c == '"' || c == '\t'; spaceLeft -= charNeedsEscape ? 2 : 1; if (spaceLeft < 0) { break; } resultLength++; } return truncate(s, resultLength); }
[ "private", "static", "String", "truncateAsJson", "(", "String", "s", ",", "int", "maxSerializedLength", ")", "{", "int", "resultLength", "=", "0", ";", "int", "spaceLeft", "=", "maxSerializedLength", "-", "2", ";", "// enclosing quotes always consume 2 slots", "for"...
Returns the given string truncated so its JSON representation does not exceed the given length. <p> Assumes the input contains only printable characters, with whitespace restricted to spaces and horizontal tabs.
[ "Returns", "the", "given", "string", "truncated", "so", "its", "JSON", "representation", "does", "not", "exceed", "the", "given", "length", ".", "<p", ">", "Assumes", "the", "input", "contains", "only", "printable", "characters", "with", "whitespace", "restricte...
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/DefaultConnectionNameGenerator.java#L92-L107
j256/simplejmx
src/main/java/com/j256/simplejmx/client/JmxClient.java
JmxClient.invokeOperation
public Object invokeOperation(String domain, String beanName, String operName, String... paramStrings) throws Exception { if (paramStrings.length == 0) { return invokeOperation(ObjectNameUtil.makeObjectName(domain, beanName), operName, null, null); } else { return invokeOperation(ObjectNameUtil.makeObjectName(domain, beanName), operName, paramStrings); } }
java
public Object invokeOperation(String domain, String beanName, String operName, String... paramStrings) throws Exception { if (paramStrings.length == 0) { return invokeOperation(ObjectNameUtil.makeObjectName(domain, beanName), operName, null, null); } else { return invokeOperation(ObjectNameUtil.makeObjectName(domain, beanName), operName, paramStrings); } }
[ "public", "Object", "invokeOperation", "(", "String", "domain", ",", "String", "beanName", ",", "String", "operName", ",", "String", "...", "paramStrings", ")", "throws", "Exception", "{", "if", "(", "paramStrings", ".", "length", "==", "0", ")", "{", "retur...
Invoke a JMX method with a domain/object-name as an array of parameter strings. @return The value returned by the method or null if none.
[ "Invoke", "a", "JMX", "method", "with", "a", "domain", "/", "object", "-", "name", "as", "an", "array", "of", "parameter", "strings", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L407-L414
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.unzip
public static File unzip(File zipFile, Charset charset) throws UtilException { return unzip(zipFile, FileUtil.file(zipFile.getParentFile(), FileUtil.mainName(zipFile)), charset); }
java
public static File unzip(File zipFile, Charset charset) throws UtilException { return unzip(zipFile, FileUtil.file(zipFile.getParentFile(), FileUtil.mainName(zipFile)), charset); }
[ "public", "static", "File", "unzip", "(", "File", "zipFile", ",", "Charset", "charset", ")", "throws", "UtilException", "{", "return", "unzip", "(", "zipFile", ",", "FileUtil", ".", "file", "(", "zipFile", ".", "getParentFile", "(", ")", ",", "FileUtil", "...
解压到文件名相同的目录中 @param zipFile 压缩文件 @param charset 编码 @return 解压的目录 @throws UtilException IO异常 @since 3.2.2
[ "解压到文件名相同的目录中" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L333-L335
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/wallet/SendRequest.java
SendRequest.childPaysForParent
public static SendRequest childPaysForParent(Wallet wallet, Transaction parentTransaction, Coin feeRaise) { TransactionOutput outputToSpend = null; for (final TransactionOutput output : parentTransaction.getOutputs()) { if (output.isMine(wallet) && output.isAvailableForSpending() && output.getValue().isGreaterThan(feeRaise)) { outputToSpend = output; break; } } // TODO spend another confirmed output of own wallet if needed checkNotNull(outputToSpend, "Can't find adequately sized output that spends to us"); final Transaction tx = new Transaction(parentTransaction.getParams()); tx.addInput(outputToSpend); tx.addOutput(outputToSpend.getValue().subtract(feeRaise), wallet.freshAddress(KeyPurpose.CHANGE)); tx.setPurpose(Transaction.Purpose.RAISE_FEE); final SendRequest req = forTx(tx); req.completed = true; return req; }
java
public static SendRequest childPaysForParent(Wallet wallet, Transaction parentTransaction, Coin feeRaise) { TransactionOutput outputToSpend = null; for (final TransactionOutput output : parentTransaction.getOutputs()) { if (output.isMine(wallet) && output.isAvailableForSpending() && output.getValue().isGreaterThan(feeRaise)) { outputToSpend = output; break; } } // TODO spend another confirmed output of own wallet if needed checkNotNull(outputToSpend, "Can't find adequately sized output that spends to us"); final Transaction tx = new Transaction(parentTransaction.getParams()); tx.addInput(outputToSpend); tx.addOutput(outputToSpend.getValue().subtract(feeRaise), wallet.freshAddress(KeyPurpose.CHANGE)); tx.setPurpose(Transaction.Purpose.RAISE_FEE); final SendRequest req = forTx(tx); req.completed = true; return req; }
[ "public", "static", "SendRequest", "childPaysForParent", "(", "Wallet", "wallet", ",", "Transaction", "parentTransaction", ",", "Coin", "feeRaise", ")", "{", "TransactionOutput", "outputToSpend", "=", "null", ";", "for", "(", "final", "TransactionOutput", "output", ...
Construct a SendRequest for a CPFP (child-pays-for-parent) transaction. The resulting transaction is already completed, so you should directly proceed to signing and broadcasting/committing the transaction. CPFP is currently only supported by a few miners, so use with care.
[ "Construct", "a", "SendRequest", "for", "a", "CPFP", "(", "child", "-", "pays", "-", "for", "-", "parent", ")", "transaction", ".", "The", "resulting", "transaction", "is", "already", "completed", "so", "you", "should", "directly", "proceed", "to", "signing"...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/SendRequest.java#L217-L236
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java
NaaccrXmlUtils.readFlatFile
public static NaaccrData readFlatFile(File flatFile, NaaccrOptions options, List<NaaccrDictionary> userDictionaries, NaaccrObserver observer) throws NaaccrIOException { if (flatFile == null) throw new NaaccrIOException("Source flat file is required"); if (!flatFile.exists()) throw new NaaccrIOException("Source flat file must exist"); try (PatientFlatReader reader = new PatientFlatReader(createReader(flatFile), options, userDictionaries)) { NaaccrData data = reader.getRootData(); Patient patient = reader.readPatient(); while (patient != null && !Thread.currentThread().isInterrupted()) { if (observer != null) observer.patientRead(patient); data.addPatient(patient); patient = reader.readPatient(); } return data; } }
java
public static NaaccrData readFlatFile(File flatFile, NaaccrOptions options, List<NaaccrDictionary> userDictionaries, NaaccrObserver observer) throws NaaccrIOException { if (flatFile == null) throw new NaaccrIOException("Source flat file is required"); if (!flatFile.exists()) throw new NaaccrIOException("Source flat file must exist"); try (PatientFlatReader reader = new PatientFlatReader(createReader(flatFile), options, userDictionaries)) { NaaccrData data = reader.getRootData(); Patient patient = reader.readPatient(); while (patient != null && !Thread.currentThread().isInterrupted()) { if (observer != null) observer.patientRead(patient); data.addPatient(patient); patient = reader.readPatient(); } return data; } }
[ "public", "static", "NaaccrData", "readFlatFile", "(", "File", "flatFile", ",", "NaaccrOptions", "options", ",", "List", "<", "NaaccrDictionary", ">", "userDictionaries", ",", "NaaccrObserver", "observer", ")", "throws", "NaaccrIOException", "{", "if", "(", "flatFil...
Reads an NAACCR flat file data file and returns the corresponding data. <br/> ATTENTION: THIS METHOD WILL RETURN THE FULL CONTENT OF THE FILE AND IS NOT SUITABLE FOR LARGE FILE; CONSIDER USING A STREAM INSTEAD. @param flatFile source flat file, must exists @param options optional validating options @param userDictionaries optional user-defined dictionaries (will be merged with the base dictionary) @param observer an optional observer, useful to keep track of the progress @throws NaaccrIOException if there is problem reading/writing the file
[ "Reads", "an", "NAACCR", "flat", "file", "data", "file", "and", "returns", "the", "corresponding", "data", ".", "<br", "/", ">", "ATTENTION", ":", "THIS", "METHOD", "WILL", "RETURN", "THE", "FULL", "CONTENT", "OF", "THE", "FILE", "AND", "IS", "NOT", "SUI...
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java#L202-L219
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/model/many2many/M2MEntity.java
M2MEntity.extractEntityManagedByDAO
public static M2MEntity extractEntityManagedByDAO(TypeElement daoElement) { ClassName entity1 = null; ClassName entity2 = null; String prefixId = null; String tableName = null; String entityName = null; PackageElement pkg = null; String packageName = null; boolean needToCreate = true; boolean generatedMethods=true; boolean immutable=true; if (daoElement.getAnnotation(BindDaoMany2Many.class) != null) { entity1 = TypeUtility.className(AnnotationUtility.extractAsClassName(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.ENTITY_1)); entity2 = TypeUtility.className(AnnotationUtility.extractAsClassName(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.ENTITY_2)); prefixId = AnnotationUtility.extractAsString(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.ID_NAME); tableName = AnnotationUtility.extractAsString(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.TABLE_NAME); tableName = AnnotationUtility.extractAsString(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.TABLE_NAME); immutable = AnnotationUtility.extractAsBoolean(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.IMMUTABLE); generatedMethods=AnnotationUtility.extractAsBoolean(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.METHODS); entityName = entity1.simpleName() + entity2.simpleName(); pkg = BaseProcessor.elementUtils.getPackageOf(daoElement); packageName = pkg.isUnnamed() ? null : pkg.getQualifiedName().toString(); } if (daoElement.getAnnotation(BindDao.class) != null) { // we have @BindDao String derived = AnnotationUtility.extractAsClassName(daoElement, BindDao.class, AnnotationAttributeType.VALUE); ClassName clazz = TypeUtility.className(derived); packageName = clazz.packageName(); entityName = clazz.simpleName(); String tableTemp = AnnotationUtility.extractAsClassName(daoElement, BindDao.class, AnnotationAttributeType.TABLE_NAME); if (StringUtils.hasText(tableTemp)) { tableName = tableTemp; } needToCreate = false; } M2MEntity entity = new M2MEntity(daoElement, packageName, entityName, TypeUtility.className(daoElement.asType().toString()), entity1, entity2, prefixId, tableName, needToCreate, generatedMethods, immutable); return entity; }
java
public static M2MEntity extractEntityManagedByDAO(TypeElement daoElement) { ClassName entity1 = null; ClassName entity2 = null; String prefixId = null; String tableName = null; String entityName = null; PackageElement pkg = null; String packageName = null; boolean needToCreate = true; boolean generatedMethods=true; boolean immutable=true; if (daoElement.getAnnotation(BindDaoMany2Many.class) != null) { entity1 = TypeUtility.className(AnnotationUtility.extractAsClassName(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.ENTITY_1)); entity2 = TypeUtility.className(AnnotationUtility.extractAsClassName(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.ENTITY_2)); prefixId = AnnotationUtility.extractAsString(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.ID_NAME); tableName = AnnotationUtility.extractAsString(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.TABLE_NAME); tableName = AnnotationUtility.extractAsString(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.TABLE_NAME); immutable = AnnotationUtility.extractAsBoolean(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.IMMUTABLE); generatedMethods=AnnotationUtility.extractAsBoolean(daoElement, BindDaoMany2Many.class, AnnotationAttributeType.METHODS); entityName = entity1.simpleName() + entity2.simpleName(); pkg = BaseProcessor.elementUtils.getPackageOf(daoElement); packageName = pkg.isUnnamed() ? null : pkg.getQualifiedName().toString(); } if (daoElement.getAnnotation(BindDao.class) != null) { // we have @BindDao String derived = AnnotationUtility.extractAsClassName(daoElement, BindDao.class, AnnotationAttributeType.VALUE); ClassName clazz = TypeUtility.className(derived); packageName = clazz.packageName(); entityName = clazz.simpleName(); String tableTemp = AnnotationUtility.extractAsClassName(daoElement, BindDao.class, AnnotationAttributeType.TABLE_NAME); if (StringUtils.hasText(tableTemp)) { tableName = tableTemp; } needToCreate = false; } M2MEntity entity = new M2MEntity(daoElement, packageName, entityName, TypeUtility.className(daoElement.asType().toString()), entity1, entity2, prefixId, tableName, needToCreate, generatedMethods, immutable); return entity; }
[ "public", "static", "M2MEntity", "extractEntityManagedByDAO", "(", "TypeElement", "daoElement", ")", "{", "ClassName", "entity1", "=", "null", ";", "ClassName", "entity2", "=", "null", ";", "String", "prefixId", "=", "null", ";", "String", "tableName", "=", "nul...
Works with @BindDaoMany2Many and @BindDao to extract entity name. @param schema @param daoElement the dao element @return the m 2 M entity
[ "Works", "with", "@BindDaoMany2Many", "and", "@BindDao", "to", "extract", "entity", "name", ".", "@param", "schema" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/model/many2many/M2MEntity.java#L145-L192
lievendoclo/Valkyrie-RCP
valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/perspective/Perspective.java
Perspective.switchPerspective
public void switchPerspective(JideApplicationWindow window, String pageId, boolean saveCurrent){ DockingManager manager = window.getDockingManager(); PerspectiveManager perspectiveManager = ((JideApplicationPage)window.getPage()).getPerspectiveManager(); if(saveCurrent){ LayoutManager.savePageLayoutData(manager, pageId, perspectiveManager.getCurrentPerspective().getId()); } if(!LayoutManager.loadPageLayoutData(manager, pageId, this)){ display(manager); } perspectiveManager.setCurrentPerspective(this); }
java
public void switchPerspective(JideApplicationWindow window, String pageId, boolean saveCurrent){ DockingManager manager = window.getDockingManager(); PerspectiveManager perspectiveManager = ((JideApplicationPage)window.getPage()).getPerspectiveManager(); if(saveCurrent){ LayoutManager.savePageLayoutData(manager, pageId, perspectiveManager.getCurrentPerspective().getId()); } if(!LayoutManager.loadPageLayoutData(manager, pageId, this)){ display(manager); } perspectiveManager.setCurrentPerspective(this); }
[ "public", "void", "switchPerspective", "(", "JideApplicationWindow", "window", ",", "String", "pageId", ",", "boolean", "saveCurrent", ")", "{", "DockingManager", "manager", "=", "window", ".", "getDockingManager", "(", ")", ";", "PerspectiveManager", "perspectiveMana...
/* To switch a perspective is a three stage process: i) Possibly save the layout of the current perspective ii) Change the layout to that of the new perspective using an existing layout if it exists or the display definition if not iii) Set the current perspective in the perspective manager to the new one.
[ "/", "*", "To", "switch", "a", "perspective", "is", "a", "three", "stage", "process", ":", "i", ")", "Possibly", "save", "the", "layout", "of", "the", "current", "perspective", "ii", ")", "Change", "the", "layout", "to", "that", "of", "the", "new", "pe...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/perspective/Perspective.java#L90-L101
mongodb/stitch-android-sdk
core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/StitchError.java
StitchError.handleRequestError
public static void handleRequestError(final Response response) { if (response.getBody() == null) { throw new StitchServiceException( String.format( Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()), StitchServiceErrorCode.UNKNOWN); } final String body; try { body = readAllToString(response.getBody()); } catch (final Exception e) { throw new StitchServiceException( String.format( Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()), StitchServiceErrorCode.UNKNOWN); } final String errorMsg = handleRichError(response, body); throw new StitchServiceException(errorMsg, StitchServiceErrorCode.UNKNOWN); }
java
public static void handleRequestError(final Response response) { if (response.getBody() == null) { throw new StitchServiceException( String.format( Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()), StitchServiceErrorCode.UNKNOWN); } final String body; try { body = readAllToString(response.getBody()); } catch (final Exception e) { throw new StitchServiceException( String.format( Locale.ENGLISH, "received unexpected status code %d", response.getStatusCode()), StitchServiceErrorCode.UNKNOWN); } final String errorMsg = handleRichError(response, body); throw new StitchServiceException(errorMsg, StitchServiceErrorCode.UNKNOWN); }
[ "public", "static", "void", "handleRequestError", "(", "final", "Response", "response", ")", "{", "if", "(", "response", ".", "getBody", "(", ")", "==", "null", ")", "{", "throw", "new", "StitchServiceException", "(", "String", ".", "format", "(", "Locale", ...
Static utility method that accepts an HTTP response object, and throws the {@link StitchServiceException} representing the the error in the response. If the error cannot be recognized, this will throw a {@link StitchServiceException} with the "UNKNOWN" error code. @param response the network response.
[ "Static", "utility", "method", "that", "accepts", "an", "HTTP", "response", "object", "and", "throws", "the", "{", "@link", "StitchServiceException", "}", "representing", "the", "the", "error", "in", "the", "response", ".", "If", "the", "error", "cannot", "be"...
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/StitchError.java#L43-L63
xerial/larray
larray-mmap/src/main/java/xerial/larray/impl/LArrayLoader.java
LArrayLoader.md5sum
public static String md5sum(InputStream input) throws IOException { InputStream in = new BufferedInputStream(input); try { MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); DigestInputStream digestInputStream = new DigestInputStream(in, digest); while(digestInputStream.read() >= 0) { } OutputStream md5out = new ByteArrayOutputStream(); md5out.write(digest.digest()); return md5out.toString(); } catch(NoSuchAlgorithmException e) { throw new IllegalStateException("MD5 algorithm is not available: " + e.getMessage()); } finally { in.close(); } }
java
public static String md5sum(InputStream input) throws IOException { InputStream in = new BufferedInputStream(input); try { MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); DigestInputStream digestInputStream = new DigestInputStream(in, digest); while(digestInputStream.read() >= 0) { } OutputStream md5out = new ByteArrayOutputStream(); md5out.write(digest.digest()); return md5out.toString(); } catch(NoSuchAlgorithmException e) { throw new IllegalStateException("MD5 algorithm is not available: " + e.getMessage()); } finally { in.close(); } }
[ "public", "static", "String", "md5sum", "(", "InputStream", "input", ")", "throws", "IOException", "{", "InputStream", "in", "=", "new", "BufferedInputStream", "(", "input", ")", ";", "try", "{", "MessageDigest", "digest", "=", "java", ".", "security", ".", ...
Computes the MD5 value of the input stream @param input @return @throws IOException @throws IllegalStateException
[ "Computes", "the", "MD5", "value", "of", "the", "input", "stream" ]
train
https://github.com/xerial/larray/blob/9a1462623c0e56ca67c5341ea29832963c29479f/larray-mmap/src/main/java/xerial/larray/impl/LArrayLoader.java#L103-L120
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/jni/SerialInterrupt.java
SerialInterrupt.onDataReceiveCallback
private static void onDataReceiveCallback(int fileDescriptor, byte[] data) { // notify event listeners if(listeners.containsKey(fileDescriptor)){ SerialInterruptListener listener = listeners.get(fileDescriptor); if(listener != null) { SerialInterruptEvent event = new SerialInterruptEvent(listener, fileDescriptor, data); listener.onDataReceive(event); } } //System.out.println("SERIAL PORT [" + fileDescriptor + "] DATA LENGTH = " + data.length + " / " + new String(data)); }
java
private static void onDataReceiveCallback(int fileDescriptor, byte[] data) { // notify event listeners if(listeners.containsKey(fileDescriptor)){ SerialInterruptListener listener = listeners.get(fileDescriptor); if(listener != null) { SerialInterruptEvent event = new SerialInterruptEvent(listener, fileDescriptor, data); listener.onDataReceive(event); } } //System.out.println("SERIAL PORT [" + fileDescriptor + "] DATA LENGTH = " + data.length + " / " + new String(data)); }
[ "private", "static", "void", "onDataReceiveCallback", "(", "int", "fileDescriptor", ",", "byte", "[", "]", "data", ")", "{", "// notify event listeners", "if", "(", "listeners", ".", "containsKey", "(", "fileDescriptor", ")", ")", "{", "SerialInterruptListener", "...
<p> This method is provided as the callback handler for the Pi4J native library to invoke when a GPIO interrupt is detected. This method should not be called from any Java consumers. (Thus is is marked as a private method.) </p> @param fileDescriptor the serial file descriptor/handle //@param data byte array of data received on this event from the serial receive buffer
[ "<p", ">", "This", "method", "is", "provided", "as", "the", "callback", "handler", "for", "the", "Pi4J", "native", "library", "to", "invoke", "when", "a", "GPIO", "interrupt", "is", "detected", ".", "This", "method", "should", "not", "be", "called", "from"...
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/jni/SerialInterrupt.java#L102-L114
liyiorg/weixin-popular
src/main/java/weixin/popular/api/MediaAPI.java
MediaAPI.mediaUpload
public static Media mediaUpload(String access_token,MediaType mediaType,File media){ HttpPost httpPost = new HttpPost(BASE_URI+"/cgi-bin/media/upload"); FileBody bin = new FileBody(media); HttpEntity reqEntity = MultipartEntityBuilder.create() .addPart("media", bin) .addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addTextBody("type",mediaType.uploadType()) .build(); httpPost.setEntity(reqEntity); return LocalHttpClient.executeJsonResult(httpPost,Media.class); }
java
public static Media mediaUpload(String access_token,MediaType mediaType,File media){ HttpPost httpPost = new HttpPost(BASE_URI+"/cgi-bin/media/upload"); FileBody bin = new FileBody(media); HttpEntity reqEntity = MultipartEntityBuilder.create() .addPart("media", bin) .addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addTextBody("type",mediaType.uploadType()) .build(); httpPost.setEntity(reqEntity); return LocalHttpClient.executeJsonResult(httpPost,Media.class); }
[ "public", "static", "Media", "mediaUpload", "(", "String", "access_token", ",", "MediaType", "mediaType", ",", "File", "media", ")", "{", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "BASE_URI", "+", "\"/cgi-bin/media/upload\"", ")", ";", "FileBody", "bi...
新增临时素材 媒体文件在后台保存时间为3天,即3天后media_id失效。 @param access_token access_token @param mediaType mediaType @param media 多媒体文件有格式和大小限制,如下: 图片(image): 2M,支持bmp/png/jpeg/jpg/gif格式 语音(voice):2M,播放长度不超过60s,支持AMR\MP3格式 视频(video):10MB,支持MP4格式 缩略图(thumb):64KB,支持JPG格式 @return Media
[ "新增临时素材", "媒体文件在后台保存时间为3天,即3天后media_id失效。" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MediaAPI.java#L60-L70
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/Operators.java
Operators.request
public static <T> boolean request(AtomicLongFieldUpdater<T> updater, T instance, long toAdd) { if (validate(toAdd)) { addCap(updater, instance, toAdd); return true; } return false; }
java
public static <T> boolean request(AtomicLongFieldUpdater<T> updater, T instance, long toAdd) { if (validate(toAdd)) { addCap(updater, instance, toAdd); return true; } return false; }
[ "public", "static", "<", "T", ">", "boolean", "request", "(", "AtomicLongFieldUpdater", "<", "T", ">", "updater", ",", "T", "instance", ",", "long", "toAdd", ")", "{", "if", "(", "validate", "(", "toAdd", ")", ")", "{", "addCap", "(", "updater", ",", ...
Concurrent addition bound to Long.MAX_VALUE. Any concurrent write will "happen before" this operation. @param <T> the parent instance type @param updater current field updater @param instance current instance to update @param toAdd delta to add @return {@literal true} if the operation succeeded. @since 5.0.1
[ "Concurrent", "addition", "bound", "to", "Long", ".", "MAX_VALUE", ".", "Any", "concurrent", "write", "will", "happen", "before", "this", "operation", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/Operators.java#L120-L129
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/AbstractPlanNode.java
AbstractPlanNode.setAndLinkChild
public void setAndLinkChild(int index, AbstractPlanNode child) { assert(child != null); m_children.set(index, child); child.m_parents.add(this); }
java
public void setAndLinkChild(int index, AbstractPlanNode child) { assert(child != null); m_children.set(index, child); child.m_parents.add(this); }
[ "public", "void", "setAndLinkChild", "(", "int", "index", ",", "AbstractPlanNode", "child", ")", "{", "assert", "(", "child", "!=", "null", ")", ";", "m_children", ".", "set", "(", "index", ",", "child", ")", ";", "child", ".", "m_parents", ".", "add", ...
Used to re-link the child without changing the order. This is called by PushDownLimit and RemoveUnnecessaryProjectNodes. @param index @param child
[ "Used", "to", "re", "-", "link", "the", "child", "without", "changing", "the", "order", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/AbstractPlanNode.java#L639-L643
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/logging/Redwood.java
Redwood.captureSystemStreams
protected static void captureSystemStreams(boolean captureOut, boolean captureErr){ if(captureOut){ System.setOut(new RedwoodPrintStream(STDOUT, realSysOut)); } if(captureErr){ System.setErr(new RedwoodPrintStream(STDERR, realSysErr)); } }
java
protected static void captureSystemStreams(boolean captureOut, boolean captureErr){ if(captureOut){ System.setOut(new RedwoodPrintStream(STDOUT, realSysOut)); } if(captureErr){ System.setErr(new RedwoodPrintStream(STDERR, realSysErr)); } }
[ "protected", "static", "void", "captureSystemStreams", "(", "boolean", "captureOut", ",", "boolean", "captureErr", ")", "{", "if", "(", "captureOut", ")", "{", "System", ".", "setOut", "(", "new", "RedwoodPrintStream", "(", "STDOUT", ",", "realSysOut", ")", ")...
Captures System.out and System.err and redirects them to Redwood logging. @param captureOut True is System.out should be captured @param captureErr True if System.err should be captured
[ "Captures", "System", ".", "out", "and", "System", ".", "err", "and", "redirects", "them", "to", "Redwood", "logging", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/logging/Redwood.java#L381-L388
maxschuster/DataUrl
src/main/java/eu/maxschuster/dataurl/DataUrlBuilder.java
DataUrlBuilder.build
public DataUrl build() throws NullPointerException { if (data == null) { throw new NullPointerException("data is null!"); } else if (encoding == null) { throw new NullPointerException("encoding is null!"); } return new DataUrl(data, encoding, mimeType, headers); }
java
public DataUrl build() throws NullPointerException { if (data == null) { throw new NullPointerException("data is null!"); } else if (encoding == null) { throw new NullPointerException("encoding is null!"); } return new DataUrl(data, encoding, mimeType, headers); }
[ "public", "DataUrl", "build", "(", ")", "throws", "NullPointerException", "{", "if", "(", "data", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"data is null!\"", ")", ";", "}", "else", "if", "(", "encoding", "==", "null", ")", "{"...
Creates a new {@link DataUrl} instance @return New {@link DataUrl} instance @throws NullPointerException if data or encoding is {@code null}
[ "Creates", "a", "new", "{" ]
train
https://github.com/maxschuster/DataUrl/blob/6b2e2c54e50bb8ee5a7d8b30c8c2b3b24ddcb628/src/main/java/eu/maxschuster/dataurl/DataUrlBuilder.java#L55-L62
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.getStream
public GetStreamResponse getStream(String domain, String app, String stream) { GetStreamRequest request = new GetStreamRequest(); request.withPlayDomain(domain).withApp(app).withStream(stream); return getStream(request); }
java
public GetStreamResponse getStream(String domain, String app, String stream) { GetStreamRequest request = new GetStreamRequest(); request.withPlayDomain(domain).withApp(app).withStream(stream); return getStream(request); }
[ "public", "GetStreamResponse", "getStream", "(", "String", "domain", ",", "String", "app", ",", "String", "stream", ")", "{", "GetStreamRequest", "request", "=", "new", "GetStreamRequest", "(", ")", ";", "request", ".", "withPlayDomain", "(", "domain", ")", "....
Get detail of stream in the live stream service. @param domain The requested domain @param app The requested app @param stream The requested stream @return the response
[ "Get", "detail", "of", "stream", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1485-L1489
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java
MapExtensions.forEach
public static <K, V> void forEach(Map<K, V> map, Procedure2<? super K, ? super V> procedure) { if (procedure == null) throw new NullPointerException("procedure"); for (Map.Entry<K, V> entry : map.entrySet()) { procedure.apply(entry.getKey(), entry.getValue()); } }
java
public static <K, V> void forEach(Map<K, V> map, Procedure2<? super K, ? super V> procedure) { if (procedure == null) throw new NullPointerException("procedure"); for (Map.Entry<K, V> entry : map.entrySet()) { procedure.apply(entry.getKey(), entry.getValue()); } }
[ "public", "static", "<", "K", ",", "V", ">", "void", "forEach", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Procedure2", "<", "?", "super", "K", ",", "?", "super", "V", ">", "procedure", ")", "{", "if", "(", "procedure", "==", "null", ")"...
Applies the given {@code procedure} for each {@link java.util.Map.Entry key value pair} of the given {@code map}. @param map the map. May not be <code>null</code>. @param procedure the procedure. May not be <code>null</code>.
[ "Applies", "the", "given", "{", "@code", "procedure", "}", "for", "each", "{", "@link", "java", ".", "util", ".", "Map", ".", "Entry", "key", "value", "pair", "}", "of", "the", "given", "{", "@code", "map", "}", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L44-L50
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathFinderImpl.java
PathFinderImpl.getHeuristicCost
public double getHeuristicCost(int stx, int sty, int dtx, int dty) { return heuristic.getCost(stx, sty, dtx, dty); }
java
public double getHeuristicCost(int stx, int sty, int dtx, int dty) { return heuristic.getCost(stx, sty, dtx, dty); }
[ "public", "double", "getHeuristicCost", "(", "int", "stx", ",", "int", "sty", ",", "int", "dtx", ",", "int", "dty", ")", "{", "return", "heuristic", ".", "getCost", "(", "stx", ",", "sty", ",", "dtx", ",", "dty", ")", ";", "}" ]
Get the heuristic cost for the given location. This determines in which order the locations are processed. @param stx The x coordinate of the tile whose cost is being determined @param sty The y coordinate of the tile whose cost is being determined @param dtx The x coordinate of the target location @param dty The y coordinate of the target location @return The heuristic cost assigned to the tile
[ "Get", "the", "heuristic", "cost", "for", "the", "given", "location", ".", "This", "determines", "in", "which", "order", "the", "locations", "are", "processed", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathFinderImpl.java#L97-L100
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java
SlingApi.postQueryAsync
public com.squareup.okhttp.Call postQueryAsync(String path, BigDecimal pLimit, String _1Property, String _1PropertyValue, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postQueryValidateBeforeCall(path, pLimit, _1Property, _1PropertyValue, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call postQueryAsync(String path, BigDecimal pLimit, String _1Property, String _1PropertyValue, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postQueryValidateBeforeCall(path, pLimit, _1Property, _1PropertyValue, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postQueryAsync", "(", "String", "path", ",", "BigDecimal", "pLimit", ",", "String", "_1Property", ",", "String", "_1PropertyValue", ",", "final", "ApiCallback", "<", "String", ">", "callback", ")",...
(asynchronously) @param path (required) @param pLimit (required) @param _1Property (required) @param _1PropertyValue (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java#L4196-L4221