repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifier.java
LinearClassifier.scoreOf
public double scoreOf(Datum<L, F> example, L label) { if(example instanceof RVFDatum<?, ?>)return scoreOfRVFDatum((RVFDatum<L,F>)example, label); int iLabel = labelIndex.indexOf(label); double score = 0.0; for (F f : example.asFeatures()) { score += weight(f, iLabel); } return score + thresholds[iLabel]; }
java
public double scoreOf(Datum<L, F> example, L label) { if(example instanceof RVFDatum<?, ?>)return scoreOfRVFDatum((RVFDatum<L,F>)example, label); int iLabel = labelIndex.indexOf(label); double score = 0.0; for (F f : example.asFeatures()) { score += weight(f, iLabel); } return score + thresholds[iLabel]; }
[ "public", "double", "scoreOf", "(", "Datum", "<", "L", ",", "F", ">", "example", ",", "L", "label", ")", "{", "if", "(", "example", "instanceof", "RVFDatum", "<", "?", ",", "?", ">", ")", "return", "scoreOfRVFDatum", "(", "(", "RVFDatum", "<", "L", ...
Returns of the score of the Datum for the specified label. Ignores the true label of the Datum.
[ "Returns", "of", "the", "score", "of", "the", "Datum", "for", "the", "specified", "label", ".", "Ignores", "the", "true", "label", "of", "the", "Datum", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L165-L173
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/utils/BsfUtils.java
BsfUtils.selectMomentJSDateFormat
public static String selectMomentJSDateFormat(Locale locale, String format) { String selFormat; if (format == null) { selFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern(); // Since DateFormat.SHORT is silly, return a smart format if (selFormat.equals("M/d/yy")) { return "MM/DD/YYYY"; } if (selFormat.equals("d/M/yy")) { return "DD/MM/YYYY"; } return LocaleUtils.javaToMomentFormat(selFormat); } else { selFormat = format; } return selFormat; }
java
public static String selectMomentJSDateFormat(Locale locale, String format) { String selFormat; if (format == null) { selFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern(); // Since DateFormat.SHORT is silly, return a smart format if (selFormat.equals("M/d/yy")) { return "MM/DD/YYYY"; } if (selFormat.equals("d/M/yy")) { return "DD/MM/YYYY"; } return LocaleUtils.javaToMomentFormat(selFormat); } else { selFormat = format; } return selFormat; }
[ "public", "static", "String", "selectMomentJSDateFormat", "(", "Locale", "locale", ",", "String", "format", ")", "{", "String", "selFormat", ";", "if", "(", "format", "==", "null", ")", "{", "selFormat", "=", "(", "(", "SimpleDateFormat", ")", "DateFormat", ...
Selects the Date Pattern to use based on the given Locale if the input format is null @param locale Locale (may be the result of a call to selectLocale) @param format optional Input format String, given as Moment.js date format @return Moment.js Date Pattern eg. DD/MM/YYYY
[ "Selects", "the", "Date", "Pattern", "to", "use", "based", "on", "the", "given", "Locale", "if", "the", "input", "format", "is", "null" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/BsfUtils.java#L507-L524
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/GetItemRequest.java
GetItemRequest.setKey
public void setKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey) throws IllegalArgumentException { java.util.HashMap<String, AttributeValue> key = new java.util.HashMap<String, AttributeValue>(); if (hashKey != null) { key.put(hashKey.getKey(), hashKey.getValue()); } else { throw new IllegalArgumentException("hashKey must be non-null object."); } if (rangeKey != null) { key.put(rangeKey.getKey(), rangeKey.getValue()); } setKey(key); }
java
public void setKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey) throws IllegalArgumentException { java.util.HashMap<String, AttributeValue> key = new java.util.HashMap<String, AttributeValue>(); if (hashKey != null) { key.put(hashKey.getKey(), hashKey.getValue()); } else { throw new IllegalArgumentException("hashKey must be non-null object."); } if (rangeKey != null) { key.put(rangeKey.getKey(), rangeKey.getValue()); } setKey(key); }
[ "public", "void", "setKey", "(", "java", ".", "util", ".", "Map", ".", "Entry", "<", "String", ",", "AttributeValue", ">", "hashKey", ",", "java", ".", "util", ".", "Map", ".", "Entry", "<", "String", ",", "AttributeValue", ">", "rangeKey", ")", "throw...
Set the hash and range key attributes of the item. <p> For a hash-only table, you only need to provide the hash attribute. For a hash-and-range table, you must provide both. @param hashKey a map entry including the name and value of the primary hash key. @param rangeKey a map entry including the name and value of the primary range key, or null if it is a hash-only table.
[ "Set", "the", "hash", "and", "range", "key", "attributes", "of", "the", "item", ".", "<p", ">", "For", "a", "hash", "-", "only", "table", "you", "only", "need", "to", "provide", "the", "hash", "attribute", ".", "For", "a", "hash", "-", "and", "-", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/GetItemRequest.java#L1088-L1100
fuinorg/utils4j
src/main/java/org/fuin/utils4j/PropertiesUtils.java
PropertiesUtils.loadProperties
public static Properties loadProperties(final Class<?> clasz, final String filename) { checkNotNull("clasz", clasz); checkNotNull("filename", filename); final String path = getPackagePath(clasz); final String resPath = path + "/" + filename; return loadProperties(clasz.getClassLoader(), resPath); }
java
public static Properties loadProperties(final Class<?> clasz, final String filename) { checkNotNull("clasz", clasz); checkNotNull("filename", filename); final String path = getPackagePath(clasz); final String resPath = path + "/" + filename; return loadProperties(clasz.getClassLoader(), resPath); }
[ "public", "static", "Properties", "loadProperties", "(", "final", "Class", "<", "?", ">", "clasz", ",", "final", "String", "filename", ")", "{", "checkNotNull", "(", "\"clasz\"", ",", "clasz", ")", ";", "checkNotNull", "(", "\"filename\"", ",", "filename", "...
Load properties from classpath. @param clasz Class in the same package as the properties file - Cannot be <code>null</code>. @param filename Name of the properties file (without path) - Cannot be <code>null</code>. @return Properties.
[ "Load", "properties", "from", "classpath", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/PropertiesUtils.java#L57-L65
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java
RefinePolyLineCorner.computeCost
protected double computeCost(List<Point2D_I32> contour, int c0, int c1, int c2, int offset) { c1 = CircularIndex.addOffset(c1, offset, contour.size()); createLine(c0,c1,contour,line0); createLine(c1,c2,contour,line1); return distanceSum(line0,c0,c1,contour)+distanceSum(line1,c1,c2,contour); }
java
protected double computeCost(List<Point2D_I32> contour, int c0, int c1, int c2, int offset) { c1 = CircularIndex.addOffset(c1, offset, contour.size()); createLine(c0,c1,contour,line0); createLine(c1,c2,contour,line1); return distanceSum(line0,c0,c1,contour)+distanceSum(line1,c1,c2,contour); }
[ "protected", "double", "computeCost", "(", "List", "<", "Point2D_I32", ">", "contour", ",", "int", "c0", ",", "int", "c1", ",", "int", "c2", ",", "int", "offset", ")", "{", "c1", "=", "CircularIndex", ".", "addOffset", "(", "c1", ",", "offset", ",", ...
Computes the distance between the two lines defined by corner points in the contour @param contour list of contour points @param c0 end point of line 0 @param c1 start of line 0 and 1 @param c2 end point of line 1 @param offset added to c1 to make start of lines @return sum of distance of points along contour
[ "Computes", "the", "distance", "between", "the", "two", "lines", "defined", "by", "corner", "points", "in", "the", "contour" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java#L163-L170
gallandarakhneorg/afc
advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java
XMLRoadUtil.readRoadNetwork
public static StandardRoadNetwork readRoadNetwork(Element xmlNode, PathBuilder pathBuilder, XMLResources resources) throws IOException { final double x = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_X); final double y = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_Y); final double width = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_WIDTH); final double height = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_HEIGHT); if (Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(width) || Double.isNaN(height)) { throw new IOException("invalid road network bounds"); //$NON-NLS-1$ } final Rectangle2d bounds = new Rectangle2d(x, y, width, height); final StandardRoadNetwork roadNetwork = new StandardRoadNetwork(bounds); readRoadNetwork(xmlNode, roadNetwork, pathBuilder, resources); return roadNetwork; }
java
public static StandardRoadNetwork readRoadNetwork(Element xmlNode, PathBuilder pathBuilder, XMLResources resources) throws IOException { final double x = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_X); final double y = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_Y); final double width = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_WIDTH); final double height = getAttributeDoubleWithDefault(xmlNode, Double.NaN, ATTR_HEIGHT); if (Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(width) || Double.isNaN(height)) { throw new IOException("invalid road network bounds"); //$NON-NLS-1$ } final Rectangle2d bounds = new Rectangle2d(x, y, width, height); final StandardRoadNetwork roadNetwork = new StandardRoadNetwork(bounds); readRoadNetwork(xmlNode, roadNetwork, pathBuilder, resources); return roadNetwork; }
[ "public", "static", "StandardRoadNetwork", "readRoadNetwork", "(", "Element", "xmlNode", ",", "PathBuilder", "pathBuilder", ",", "XMLResources", "resources", ")", "throws", "IOException", "{", "final", "double", "x", "=", "getAttributeDoubleWithDefault", "(", "xmlNode",...
Read the roads from the XML description. @param xmlNode is the XML node to fill with the container data. @param pathBuilder is the tool to make paths relative. @param resources is the tool that permits to gather the resources. @return the road network. @throws IOException in case of error.
[ "Read", "the", "roads", "from", "the", "XML", "description", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java#L212-L229
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java
RESTServlet.decodeAuthorizationHeader
private void decodeAuthorizationHeader(String authString, StringBuilder userID, StringBuilder password) { userID.setLength(0); password.setLength(0); if (!Utils.isEmpty(authString) && authString.toLowerCase().startsWith("basic ")) { String decoded = Utils.base64ToString(authString.substring("basic ".length())); int inx = decoded.indexOf(':'); if (inx < 0) { userID.append(decoded); } else { userID.append(decoded.substring(0, inx)); password.append(decoded.substring(inx + 1)); } } }
java
private void decodeAuthorizationHeader(String authString, StringBuilder userID, StringBuilder password) { userID.setLength(0); password.setLength(0); if (!Utils.isEmpty(authString) && authString.toLowerCase().startsWith("basic ")) { String decoded = Utils.base64ToString(authString.substring("basic ".length())); int inx = decoded.indexOf(':'); if (inx < 0) { userID.append(decoded); } else { userID.append(decoded.substring(0, inx)); password.append(decoded.substring(inx + 1)); } } }
[ "private", "void", "decodeAuthorizationHeader", "(", "String", "authString", ",", "StringBuilder", "userID", ",", "StringBuilder", "password", ")", "{", "userID", ".", "setLength", "(", "0", ")", ";", "password", ".", "setLength", "(", "0", ")", ";", "if", "...
Decode the given Authorization header value into its user/password components.
[ "Decode", "the", "given", "Authorization", "header", "value", "into", "its", "user", "/", "password", "components", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java#L253-L266
Jasig/uPortal
uPortal-core/src/main/java/org/apereo/portal/i18n/LocaleManager.java
LocaleManager.addToLocaleList
private void addToLocaleList(List localeList, List<Locale> locales) { if (locales != null) { for (Locale locale : locales) { if (locale != null && !localeList.contains(locale)) localeList.add(locale); } } }
java
private void addToLocaleList(List localeList, List<Locale> locales) { if (locales != null) { for (Locale locale : locales) { if (locale != null && !localeList.contains(locale)) localeList.add(locale); } } }
[ "private", "void", "addToLocaleList", "(", "List", "localeList", ",", "List", "<", "Locale", ">", "locales", ")", "{", "if", "(", "locales", "!=", "null", ")", "{", "for", "(", "Locale", "locale", ":", "locales", ")", "{", "if", "(", "locale", "!=", ...
Add locales to the locale list if they aren't in there already
[ "Add", "locales", "to", "the", "locale", "list", "if", "they", "aren", "t", "in", "there", "already" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/i18n/LocaleManager.java#L103-L109
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java
VirtualMachineScaleSetRollingUpgradesInner.beginStartOSUpgradeAsync
public Observable<OperationStatusResponseInner> beginStartOSUpgradeAsync(String resourceGroupName, String vmScaleSetName) { return beginStartOSUpgradeWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginStartOSUpgradeAsync(String resourceGroupName, String vmScaleSetName) { return beginStartOSUpgradeWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginStartOSUpgradeAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "beginStartOSUpgradeWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName",...
Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version. Instances which are already running the latest available OS version are not affected. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "Starts", "a", "rolling", "upgrade", "to", "move", "all", "virtual", "machine", "scale", "set", "instances", "to", "the", "latest", "available", "Platform", "Image", "OS", "version", ".", "Instances", "which", "are", "already", "running", "the", "latest", "ava...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java#L337-L344
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java
RegExHelper.getAsIdentifier
@Nullable public static String getAsIdentifier (@Nullable final String s, @Nonnull final String sReplacement) { ValueEnforcer.notNull (sReplacement, "Replacement"); if (StringHelper.hasNoText (s)) return s; // replace all non-word characters with the replacement character // Important: replacement does not need to be quoted, because it is not // treated as a regular expression! final String ret = stringReplacePattern ("\\W", s, sReplacement); if (ret.length () == 0) return sReplacement; if (!Character.isJavaIdentifierStart (ret.charAt (0))) return sReplacement + ret; return ret; }
java
@Nullable public static String getAsIdentifier (@Nullable final String s, @Nonnull final String sReplacement) { ValueEnforcer.notNull (sReplacement, "Replacement"); if (StringHelper.hasNoText (s)) return s; // replace all non-word characters with the replacement character // Important: replacement does not need to be quoted, because it is not // treated as a regular expression! final String ret = stringReplacePattern ("\\W", s, sReplacement); if (ret.length () == 0) return sReplacement; if (!Character.isJavaIdentifierStart (ret.charAt (0))) return sReplacement + ret; return ret; }
[ "@", "Nullable", "public", "static", "String", "getAsIdentifier", "(", "@", "Nullable", "final", "String", "s", ",", "@", "Nonnull", "final", "String", "sReplacement", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sReplacement", ",", "\"Replacement\"", ")", ...
Convert an identifier to a programming language identifier by replacing all non-word characters with an underscore. @param s The string to convert. May be <code>null</code> or empty. @param sReplacement The replacement string to be used for all non-identifier characters. May be empty but not be <code>null</code>. @return The converted string or <code>null</code> if the input string is <code>null</code>. Maybe an invalid identifier, if the replacement is empty, and the identifier starts with an illegal character, or if the replacement is empty and the source string only contains invalid characters!
[ "Convert", "an", "identifier", "to", "a", "programming", "language", "identifier", "by", "replacing", "all", "non", "-", "word", "characters", "with", "an", "underscore", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java#L319-L336
alkacon/opencms-core
src/org/opencms/flex/CmsFlexController.java
CmsFlexController.isNotModifiedSince
public static boolean isNotModifiedSince(HttpServletRequest req, long dateLastModified) { // check if the request contains a last modified header try { long lastModifiedHeader = req.getDateHeader(CmsRequestUtil.HEADER_IF_MODIFIED_SINCE); // if last modified header is set (> -1), compare it to the requested resource return ((lastModifiedHeader > -1) && (((dateLastModified / 1000) * 1000) == lastModifiedHeader)); } catch (Exception ex) { // some clients (e.g. User-Agent: BlackBerry7290/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/111) // send an invalid "If-Modified-Since" header (e.g. in german locale) // which breaks with http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html // this has to be caught because the subsequent request for the 500 error handler // would run into the same exception. LOG.warn( Messages.get().getBundle().key( Messages.ERR_HEADER_IFMODIFIEDSINCE_FORMAT_3, new Object[] { CmsRequestUtil.HEADER_IF_MODIFIED_SINCE, req.getHeader(CmsRequestUtil.HEADER_USER_AGENT), req.getHeader(CmsRequestUtil.HEADER_IF_MODIFIED_SINCE)})); } return false; }
java
public static boolean isNotModifiedSince(HttpServletRequest req, long dateLastModified) { // check if the request contains a last modified header try { long lastModifiedHeader = req.getDateHeader(CmsRequestUtil.HEADER_IF_MODIFIED_SINCE); // if last modified header is set (> -1), compare it to the requested resource return ((lastModifiedHeader > -1) && (((dateLastModified / 1000) * 1000) == lastModifiedHeader)); } catch (Exception ex) { // some clients (e.g. User-Agent: BlackBerry7290/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/111) // send an invalid "If-Modified-Since" header (e.g. in german locale) // which breaks with http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html // this has to be caught because the subsequent request for the 500 error handler // would run into the same exception. LOG.warn( Messages.get().getBundle().key( Messages.ERR_HEADER_IFMODIFIEDSINCE_FORMAT_3, new Object[] { CmsRequestUtil.HEADER_IF_MODIFIED_SINCE, req.getHeader(CmsRequestUtil.HEADER_USER_AGENT), req.getHeader(CmsRequestUtil.HEADER_IF_MODIFIED_SINCE)})); } return false; }
[ "public", "static", "boolean", "isNotModifiedSince", "(", "HttpServletRequest", "req", ",", "long", "dateLastModified", ")", "{", "// check if the request contains a last modified header", "try", "{", "long", "lastModifiedHeader", "=", "req", ".", "getDateHeader", "(", "C...
Checks if the request has the "If-Modified-Since" header set, and if so, if the header date value is equal to the provided last modification date.<p> @param req the request to set the "If-Modified-Since" date header from @param dateLastModified the date to compare the header with @return <code>true</code> if the header is set and the header date is equal to the provided date
[ "Checks", "if", "the", "request", "has", "the", "If", "-", "Modified", "-", "Since", "header", "set", "and", "if", "so", "if", "the", "header", "date", "value", "is", "equal", "to", "the", "provided", "last", "modification", "date", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexController.java#L265-L287
apereo/cas
support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/DelegatedClientWebflowManager.java
DelegatedClientWebflowManager.retrieveSessionTicketViaClientId
protected TransientSessionTicket retrieveSessionTicketViaClientId(final WebContext webContext, final String clientId) { val ticket = this.ticketRegistry.getTicket(clientId, TransientSessionTicket.class); if (ticket == null) { LOGGER.error("Delegated client identifier cannot be located in the authentication request [{}]", webContext.getFullRequestURL()); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY); } if (ticket.isExpired()) { LOGGER.error("Delegated client identifier [{}] has expired in the authentication request", ticket.getId()); this.ticketRegistry.deleteTicket(ticket.getId()); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY); } LOGGER.debug("Located delegated client identifier as [{}]", ticket.getId()); return ticket; }
java
protected TransientSessionTicket retrieveSessionTicketViaClientId(final WebContext webContext, final String clientId) { val ticket = this.ticketRegistry.getTicket(clientId, TransientSessionTicket.class); if (ticket == null) { LOGGER.error("Delegated client identifier cannot be located in the authentication request [{}]", webContext.getFullRequestURL()); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY); } if (ticket.isExpired()) { LOGGER.error("Delegated client identifier [{}] has expired in the authentication request", ticket.getId()); this.ticketRegistry.deleteTicket(ticket.getId()); throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY); } LOGGER.debug("Located delegated client identifier as [{}]", ticket.getId()); return ticket; }
[ "protected", "TransientSessionTicket", "retrieveSessionTicketViaClientId", "(", "final", "WebContext", "webContext", ",", "final", "String", "clientId", ")", "{", "val", "ticket", "=", "this", ".", "ticketRegistry", ".", "getTicket", "(", "clientId", ",", "TransientSe...
Retrieve session ticket via client id. @param webContext the web context @param clientId the client id @return the transient session ticket
[ "Retrieve", "session", "ticket", "via", "client", "id", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/DelegatedClientWebflowManager.java#L182-L195
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/android/Facebook.java
Facebook.authorizeCallback
@Deprecated public void authorizeCallback(int requestCode, int resultCode, Intent data) { checkUserSession("authorizeCallback"); Session pending = this.pendingOpeningSession; if (pending != null) { if (pending.onActivityResult(this.pendingAuthorizationActivity, requestCode, resultCode, data)) { this.pendingOpeningSession = null; this.pendingAuthorizationActivity = null; this.pendingAuthorizationPermissions = null; } } }
java
@Deprecated public void authorizeCallback(int requestCode, int resultCode, Intent data) { checkUserSession("authorizeCallback"); Session pending = this.pendingOpeningSession; if (pending != null) { if (pending.onActivityResult(this.pendingAuthorizationActivity, requestCode, resultCode, data)) { this.pendingOpeningSession = null; this.pendingAuthorizationActivity = null; this.pendingAuthorizationPermissions = null; } } }
[ "@", "Deprecated", "public", "void", "authorizeCallback", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "data", ")", "{", "checkUserSession", "(", "\"authorizeCallback\"", ")", ";", "Session", "pending", "=", "this", ".", "pendingOpeningSessi...
IMPORTANT: If you are using the deprecated authorize() method, this method must be invoked at the top of the calling activity's onActivityResult() function or Facebook authentication will not function properly! <p/> If your calling activity does not currently implement onActivityResult(), you must implement it and include a call to this method if you intend to use the authorize() method in this SDK. <p/> For more information, see http://developer.android.com/reference/android/app/ Activity.html#onActivityResult(int, int, android.content.Intent) <p/> This method is deprecated. See {@link Facebook} and {@link Session} for more info.
[ "IMPORTANT", ":", "If", "you", "are", "using", "the", "deprecated", "authorize", "()", "method", "this", "method", "must", "be", "invoked", "at", "the", "top", "of", "the", "calling", "activity", "s", "onActivityResult", "()", "function", "or", "Facebook", "...
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/android/Facebook.java#L422-L433
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.saturatedAdd
@SuppressWarnings("ShortCircuitBoolean") private static long saturatedAdd(long a, long b) { long naiveSum = a + b; if ((a ^ b) < 0 | (a ^ naiveSum) >= 0) { // If a and b have different signs or a has the same sign as the result then there was no // overflow, return. return naiveSum; } // we did over/under flow, if the sign is negative we should return MAX otherwise MIN return Long.MAX_VALUE + ((naiveSum >>> (Long.SIZE - 1)) ^ 1); }
java
@SuppressWarnings("ShortCircuitBoolean") private static long saturatedAdd(long a, long b) { long naiveSum = a + b; if ((a ^ b) < 0 | (a ^ naiveSum) >= 0) { // If a and b have different signs or a has the same sign as the result then there was no // overflow, return. return naiveSum; } // we did over/under flow, if the sign is negative we should return MAX otherwise MIN return Long.MAX_VALUE + ((naiveSum >>> (Long.SIZE - 1)) ^ 1); }
[ "@", "SuppressWarnings", "(", "\"ShortCircuitBoolean\"", ")", "private", "static", "long", "saturatedAdd", "(", "long", "a", ",", "long", "b", ")", "{", "long", "naiveSum", "=", "a", "+", "b", ";", "if", "(", "(", "a", "^", "b", ")", "<", "0", "|", ...
Returns the sum of {@code a} and {@code b} unless it would overflow or underflow in which case {@code Long.MAX_VALUE} or {@code Long.MIN_VALUE} is returned, respectively. <p>Copy of {@link com.google.common.math.LongMath#saturatedAdd}.</p>
[ "Returns", "the", "sum", "of", "{", "@code", "a", "}", "and", "{", "@code", "b", "}", "unless", "it", "would", "overflow", "or", "underflow", "in", "which", "case", "{", "@code", "Long", ".", "MAX_VALUE", "}", "or", "{", "@code", "Long", ".", "MIN_VA...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L659-L669
logic-ng/LogicNG
src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java
MiniSatStyleSolver.lt
public boolean lt(int x, int y) { return this.vars.get(x).activity() > this.vars.get(y).activity(); }
java
public boolean lt(int x, int y) { return this.vars.get(x).activity() > this.vars.get(y).activity(); }
[ "public", "boolean", "lt", "(", "int", "x", ",", "int", "y", ")", "{", "return", "this", ".", "vars", ".", "get", "(", "x", ")", ".", "activity", "(", ")", ">", "this", ".", "vars", ".", "get", "(", "y", ")", ".", "activity", "(", ")", ";", ...
Compares two variables by their activity. @param x the first variable @param y the second variable @return {@code true} if the first variable's activity is larger then the second one's
[ "Compares", "two", "variables", "by", "their", "activity", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L266-L268
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_disclaimer_GET
public OvhDisclaimer organizationName_service_exchangeService_domain_domainName_disclaimer_GET(String organizationName, String exchangeService, String domainName) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer"; StringBuilder sb = path(qPath, organizationName, exchangeService, domainName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDisclaimer.class); }
java
public OvhDisclaimer organizationName_service_exchangeService_domain_domainName_disclaimer_GET(String organizationName, String exchangeService, String domainName) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer"; StringBuilder sb = path(qPath, organizationName, exchangeService, domainName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDisclaimer.class); }
[ "public", "OvhDisclaimer", "organizationName_service_exchangeService_domain_domainName_disclaimer_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "domainName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchang...
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param domainName [required] Domain name
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L529-L534
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ItemRule.java
ItemRule.makeReferenceToken
public static Token makeReferenceToken(String bean, String template, String parameter, String attribute, String property) { Token token; if (bean != null) { token = new Token(TokenType.BEAN, bean); } else if (template != null) { token = new Token(TokenType.TEMPLATE, template); } else if (parameter != null) { token = new Token(TokenType.PARAMETER, parameter); } else if (attribute != null) { token = new Token(TokenType.ATTRIBUTE, attribute); } else if (property != null) { token = new Token(TokenType.PROPERTY, property); } else { token = null; } return token; }
java
public static Token makeReferenceToken(String bean, String template, String parameter, String attribute, String property) { Token token; if (bean != null) { token = new Token(TokenType.BEAN, bean); } else if (template != null) { token = new Token(TokenType.TEMPLATE, template); } else if (parameter != null) { token = new Token(TokenType.PARAMETER, parameter); } else if (attribute != null) { token = new Token(TokenType.ATTRIBUTE, attribute); } else if (property != null) { token = new Token(TokenType.PROPERTY, property); } else { token = null; } return token; }
[ "public", "static", "Token", "makeReferenceToken", "(", "String", "bean", ",", "String", "template", ",", "String", "parameter", ",", "String", "attribute", ",", "String", "property", ")", "{", "Token", "token", ";", "if", "(", "bean", "!=", "null", ")", "...
Returns a made reference token. @param bean the bean id @param template the template id @param parameter the parameter name @param attribute the attribute name @param property the property name @return the token
[ "Returns", "a", "made", "reference", "token", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L726-L743
matthewhorridge/owlexplanation
src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java
LaconicExplanationGeneratorBasedOnOPlus.getExplanations
public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit) throws ExplanationException { OWLDataFactory dataFactory = new OWLDataFactoryImpl(); OPlusGenerator transformation = new OPlusGenerator(dataFactory, oplusSplitting); OWLOntologyManager man = OWLManager.createOWLOntologyManager(); Set<OWLAxiom> oplusInput; if(modularityTreatment.equals(ModularityTreatment.MODULE)) { SyntacticLocalityModuleExtractor extractor = new SyntacticLocalityModuleExtractor(man, (OWLOntology) null, inputAxioms, ModuleType.STAR); oplusInput = extractor.extract(entailment.getSignature()); } else { oplusInput = new HashSet<OWLAxiom>(inputAxioms); } Set<OWLAxiom> oplusAxioms = transformation.transform(oplusInput); ExplanationGenerator<OWLAxiom> gen = delegateFactory.createExplanationGenerator(oplusAxioms, new MediatingProgresssMonitor()); Set<Explanation<OWLAxiom>> oplusExpls = gen.getExplanations(entailment); IsLaconicChecker checker = new IsLaconicChecker(dataFactory, entailmentCheckerFactory, LaconicCheckerMode.EARLY_TERMINATING); Set<Explanation<OWLAxiom>> laconicExplanations = new HashSet<Explanation<OWLAxiom>>(); for (Explanation<OWLAxiom> expl : oplusExpls) { if (checker.isLaconic(expl)) { laconicExplanations.add(expl); } } Set<Explanation<OWLAxiom>> reconstitutedLaconicExpls = getReconstitutedExplanations(dataFactory, transformation, laconicExplanations); removeWeakerExplanations(dataFactory, transformation, reconstitutedLaconicExpls); Set<Explanation<OWLAxiom>> progressMonitorExplanations = new HashSet<Explanation<OWLAxiom>>(); for (Explanation<OWLAxiom> expl : reconstitutedLaconicExpls) { progressMonitorExplanations.add(expl); progressMonitor.foundExplanation(this, expl, progressMonitorExplanations); } return laconicExplanations; }
java
public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit) throws ExplanationException { OWLDataFactory dataFactory = new OWLDataFactoryImpl(); OPlusGenerator transformation = new OPlusGenerator(dataFactory, oplusSplitting); OWLOntologyManager man = OWLManager.createOWLOntologyManager(); Set<OWLAxiom> oplusInput; if(modularityTreatment.equals(ModularityTreatment.MODULE)) { SyntacticLocalityModuleExtractor extractor = new SyntacticLocalityModuleExtractor(man, (OWLOntology) null, inputAxioms, ModuleType.STAR); oplusInput = extractor.extract(entailment.getSignature()); } else { oplusInput = new HashSet<OWLAxiom>(inputAxioms); } Set<OWLAxiom> oplusAxioms = transformation.transform(oplusInput); ExplanationGenerator<OWLAxiom> gen = delegateFactory.createExplanationGenerator(oplusAxioms, new MediatingProgresssMonitor()); Set<Explanation<OWLAxiom>> oplusExpls = gen.getExplanations(entailment); IsLaconicChecker checker = new IsLaconicChecker(dataFactory, entailmentCheckerFactory, LaconicCheckerMode.EARLY_TERMINATING); Set<Explanation<OWLAxiom>> laconicExplanations = new HashSet<Explanation<OWLAxiom>>(); for (Explanation<OWLAxiom> expl : oplusExpls) { if (checker.isLaconic(expl)) { laconicExplanations.add(expl); } } Set<Explanation<OWLAxiom>> reconstitutedLaconicExpls = getReconstitutedExplanations(dataFactory, transformation, laconicExplanations); removeWeakerExplanations(dataFactory, transformation, reconstitutedLaconicExpls); Set<Explanation<OWLAxiom>> progressMonitorExplanations = new HashSet<Explanation<OWLAxiom>>(); for (Explanation<OWLAxiom> expl : reconstitutedLaconicExpls) { progressMonitorExplanations.add(expl); progressMonitor.foundExplanation(this, expl, progressMonitorExplanations); } return laconicExplanations; }
[ "public", "Set", "<", "Explanation", "<", "OWLAxiom", ">", ">", "getExplanations", "(", "OWLAxiom", "entailment", ",", "int", "limit", ")", "throws", "ExplanationException", "{", "OWLDataFactory", "dataFactory", "=", "new", "OWLDataFactoryImpl", "(", ")", ";", "...
Gets explanations for an entailment, with limit on the number of explanations returned. @param entailment The entailment for which explanations will be generated. @param limit The maximum number of explanations to generate. This should be a positive integer. @return A set containing explanations. The maximum cardinality of the set is specified by the limit parameter. The set may be empty if the entailment does not hold, or if a limit of zero or less is supplied. @throws org.semanticweb.owl.explanation.api.ExplanationException if there was a problem generating the explanation.
[ "Gets", "explanations", "for", "an", "entailment", "with", "limit", "on", "the", "number", "of", "explanations", "returned", "." ]
train
https://github.com/matthewhorridge/owlexplanation/blob/439c5ca67835f5e421adde725e4e8a3bcd760ac8/src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java#L60-L101
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/BitvUnit.java
BitvUnit.assertAccessibility
public static void assertAccessibility(HtmlPage htmlPage, Testable testable) { assertThat(htmlPage, is(compliantTo(testable))); }
java
public static void assertAccessibility(HtmlPage htmlPage, Testable testable) { assertThat(htmlPage, is(compliantTo(testable))); }
[ "public", "static", "void", "assertAccessibility", "(", "HtmlPage", "htmlPage", ",", "Testable", "testable", ")", "{", "assertThat", "(", "htmlPage", ",", "is", "(", "compliantTo", "(", "testable", ")", ")", ")", ";", "}" ]
JUnit Assertion to verify a {@link com.gargoylesoftware.htmlunit.html.HtmlPage} instance for accessibility. @param htmlPage {@link com.gargoylesoftware.htmlunit.html.HtmlPage} instance @param testable rule(s) to apply
[ "JUnit", "Assertion", "to", "verify", "a", "{", "@link", "com", ".", "gargoylesoftware", ".", "htmlunit", ".", "html", ".", "HtmlPage", "}", "instance", "for", "accessibility", "." ]
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/BitvUnit.java#L58-L60
alkacon/opencms-core
src-gwt/org/opencms/ade/publish/client/CmsPublishDataModel.java
CmsPublishDataModel.countResourcesInGroup
public int countResourcesInGroup(I_CmsPublishResourceCheck check, List<CmsPublishResource> group) { int result = 0; for (CmsPublishResource res : group) { if (check.check(res)) { result += 1; } } return result; }
java
public int countResourcesInGroup(I_CmsPublishResourceCheck check, List<CmsPublishResource> group) { int result = 0; for (CmsPublishResource res : group) { if (check.check(res)) { result += 1; } } return result; }
[ "public", "int", "countResourcesInGroup", "(", "I_CmsPublishResourceCheck", "check", ",", "List", "<", "CmsPublishResource", ">", "group", ")", "{", "int", "result", "=", "0", ";", "for", "(", "CmsPublishResource", "res", ":", "group", ")", "{", "if", "(", "...
Counts the resources of a group which pass a given check.<p> @param check the check to apply @param group the group of publish resources @return the number of resources in that group which passed the check
[ "Counts", "the", "resources", "of", "a", "group", "which", "pass", "a", "given", "check", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/publish/client/CmsPublishDataModel.java#L220-L230
twitter/hraven
hraven-etl/src/main/java/com/twitter/hraven/mapreduce/JobFileTableMapper.java
JobFileTableMapper.getJobCostPut
private Put getJobCostPut(Double jobCost, JobKey jobKey) { Put pJobCost = new Put(jobKeyConv.toBytes(jobKey)); pJobCost.addColumn(Constants.INFO_FAM_BYTES, Constants.JOBCOST_BYTES, Bytes.toBytes(jobCost)); return pJobCost; }
java
private Put getJobCostPut(Double jobCost, JobKey jobKey) { Put pJobCost = new Put(jobKeyConv.toBytes(jobKey)); pJobCost.addColumn(Constants.INFO_FAM_BYTES, Constants.JOBCOST_BYTES, Bytes.toBytes(jobCost)); return pJobCost; }
[ "private", "Put", "getJobCostPut", "(", "Double", "jobCost", ",", "JobKey", "jobKey", ")", "{", "Put", "pJobCost", "=", "new", "Put", "(", "jobKeyConv", ".", "toBytes", "(", "jobKey", ")", ")", ";", "pJobCost", ".", "addColumn", "(", "Constants", ".", "I...
generates a put for the job cost @param jobCost @param jobKey @return the put with job cost
[ "generates", "a", "put", "for", "the", "job", "cost" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/mapreduce/JobFileTableMapper.java#L536-L541
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.trimEnd
@Nullable @CheckReturnValue public static String trimEnd (@Nullable final String sSrc, final char cTail) { return endsWith (sSrc, cTail) ? sSrc.substring (0, sSrc.length () - 1) : sSrc; }
java
@Nullable @CheckReturnValue public static String trimEnd (@Nullable final String sSrc, final char cTail) { return endsWith (sSrc, cTail) ? sSrc.substring (0, sSrc.length () - 1) : sSrc; }
[ "@", "Nullable", "@", "CheckReturnValue", "public", "static", "String", "trimEnd", "(", "@", "Nullable", "final", "String", "sSrc", ",", "final", "char", "cTail", ")", "{", "return", "endsWith", "(", "sSrc", ",", "cTail", ")", "?", "sSrc", ".", "substring"...
Trim the passed tail from the source value. If the source value does not end with the passed tail, nothing happens. @param sSrc The input source string @param cTail The char to be trimmed of the end @return The trimmed string, or the original input string, if the tail was not found @see #trimStart(String, String) @see #trimStartAndEnd(String, String) @see #trimStartAndEnd(String, String, String)
[ "Trim", "the", "passed", "tail", "from", "the", "source", "value", ".", "If", "the", "source", "value", "does", "not", "end", "with", "the", "passed", "tail", "nothing", "happens", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3414-L3419
apereo/cas
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/AbstractServiceFactory.java
AbstractServiceFactory.getSourceParameter
protected static String getSourceParameter(final HttpServletRequest request, final String... paramNames) { if (request != null) { val parameterMap = request.getParameterMap(); return Stream.of(paramNames) .filter(p -> parameterMap.containsKey(p) || request.getAttribute(p) != null) .findFirst() .orElse(null); } return null; }
java
protected static String getSourceParameter(final HttpServletRequest request, final String... paramNames) { if (request != null) { val parameterMap = request.getParameterMap(); return Stream.of(paramNames) .filter(p -> parameterMap.containsKey(p) || request.getAttribute(p) != null) .findFirst() .orElse(null); } return null; }
[ "protected", "static", "String", "getSourceParameter", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "...", "paramNames", ")", "{", "if", "(", "request", "!=", "null", ")", "{", "val", "parameterMap", "=", "request", ".", "getParameterMa...
Gets source parameter. @param request the request @param paramNames the param names @return the source parameter
[ "Gets", "source", "parameter", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/AbstractServiceFactory.java#L55-L64
zaproxy/zaproxy
src/org/parosproxy/paros/extension/ExtensionLoader.java
ExtensionLoader.initModelAllExtension
private void initModelAllExtension(Model model, double progressFactor) { double factorPerc = progressFactor / getExtensionCount(); for (int i = 0; i < getExtensionCount(); i++) { Extension extension = getExtension(i); try { extension.initModel(model); if (view != null) { view.addSplashScreenLoadingCompletion(factorPerc); } } catch (Exception e) { logExtensionInitError(extension, e); } } }
java
private void initModelAllExtension(Model model, double progressFactor) { double factorPerc = progressFactor / getExtensionCount(); for (int i = 0; i < getExtensionCount(); i++) { Extension extension = getExtension(i); try { extension.initModel(model); if (view != null) { view.addSplashScreenLoadingCompletion(factorPerc); } } catch (Exception e) { logExtensionInitError(extension, e); } } }
[ "private", "void", "initModelAllExtension", "(", "Model", "model", ",", "double", "progressFactor", ")", "{", "double", "factorPerc", "=", "progressFactor", "/", "getExtensionCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getExtensi...
Init all extensions with the same Model @param model the model to apply to all extensions
[ "Init", "all", "extensions", "with", "the", "same", "Model" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/ExtensionLoader.java#L1310-L1325
LearnLib/automatalib
util/src/main/java/net/automatalib/util/minimizer/MinimizationResult.java
MinimizationResult.getRepresentative
public S getRepresentative(Block<S, L> block) { return block.getStates().choose().getOriginalState(); }
java
public S getRepresentative(Block<S, L> block) { return block.getStates().choose().getOriginalState(); }
[ "public", "S", "getRepresentative", "(", "Block", "<", "S", ",", "L", ">", "block", ")", "{", "return", "block", ".", "getStates", "(", ")", ".", "choose", "(", ")", ".", "getOriginalState", "(", ")", ";", "}" ]
Chooses a representative (i.e., an arbitrary element of the set of states) from a block. @param block the block. @return an arbitrary element of the state set of the given block.
[ "Chooses", "a", "representative", "(", "i", ".", "e", ".", "an", "arbitrary", "element", "of", "the", "set", "of", "states", ")", "from", "a", "block", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/minimizer/MinimizationResult.java#L105-L107
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/game/GameLoginSignUtil.java
GameLoginSignUtil.sendRequest
private static void sendRequest(String url, byte[] body, String publicKey, ICheckLoginSignHandler callback) { HttpURLConnection conn = null; OutputStream out = null; InputStream is = null; InputStreamReader isr = null; try { URL urlReq = new URL(url); conn = (HttpURLConnection)urlReq.openConnection(); // 设置HttpURLConnection选项 conn.setRequestMethod("POST"); conn.setConnectTimeout(CONN_TIMEOUT); conn.setReadTimeout(READ_TIMEOUT); conn.setUseCaches(false); conn.setDoOutput(true); conn.setRequestProperty("Content-Type", "application/json"); conn.setFixedLengthStreamingMode(body.length); // 写入body数据 out = conn.getOutputStream(); out.write(body); out.flush(); int httpCode = conn.getResponseCode(); if (httpCode == HttpURLConnection.HTTP_OK) { StringBuilder sb = new StringBuilder(); char[] buffer = new char[512]; is = conn.getInputStream(); isr = new InputStreamReader(is, "UTF-8"); int readLen = 0; while ((readLen = isr.read(buffer)) != -1) { sb.append(buffer, 0, readLen); } // 资源释放 close(out); out = null; close(is); is = null; close(isr); isr = null; // 调用子类解析函数 String str = sb.toString(); if (!TextUtils.isEmpty(str)) { callbackResult(str, publicKey, callback); } else { callback.onCheckResult(null, "response string is empty!", false); } } else { // 资源释放 close(out); out = null; callback.onCheckResult(null, "http request code is " + httpCode, false); } }catch (Exception e) { // 资源释放 close(out); close(is); close(isr); callback.onCheckResult(null, "http request exception:" + e.getMessage(), false); } }
java
private static void sendRequest(String url, byte[] body, String publicKey, ICheckLoginSignHandler callback) { HttpURLConnection conn = null; OutputStream out = null; InputStream is = null; InputStreamReader isr = null; try { URL urlReq = new URL(url); conn = (HttpURLConnection)urlReq.openConnection(); // 设置HttpURLConnection选项 conn.setRequestMethod("POST"); conn.setConnectTimeout(CONN_TIMEOUT); conn.setReadTimeout(READ_TIMEOUT); conn.setUseCaches(false); conn.setDoOutput(true); conn.setRequestProperty("Content-Type", "application/json"); conn.setFixedLengthStreamingMode(body.length); // 写入body数据 out = conn.getOutputStream(); out.write(body); out.flush(); int httpCode = conn.getResponseCode(); if (httpCode == HttpURLConnection.HTTP_OK) { StringBuilder sb = new StringBuilder(); char[] buffer = new char[512]; is = conn.getInputStream(); isr = new InputStreamReader(is, "UTF-8"); int readLen = 0; while ((readLen = isr.read(buffer)) != -1) { sb.append(buffer, 0, readLen); } // 资源释放 close(out); out = null; close(is); is = null; close(isr); isr = null; // 调用子类解析函数 String str = sb.toString(); if (!TextUtils.isEmpty(str)) { callbackResult(str, publicKey, callback); } else { callback.onCheckResult(null, "response string is empty!", false); } } else { // 资源释放 close(out); out = null; callback.onCheckResult(null, "http request code is " + httpCode, false); } }catch (Exception e) { // 资源释放 close(out); close(is); close(isr); callback.onCheckResult(null, "http request exception:" + e.getMessage(), false); } }
[ "private", "static", "void", "sendRequest", "(", "String", "url", ",", "byte", "[", "]", "body", ",", "String", "publicKey", ",", "ICheckLoginSignHandler", "callback", ")", "{", "HttpURLConnection", "conn", "=", "null", ";", "OutputStream", "out", "=", "null",...
发送验签请求 @param url 请求url @param body 请求body @param publicKey 验签所使用的公钥 @param callback 验签结果回调
[ "发送验签请求" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/game/GameLoginSignUtil.java#L93-L158
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.mapSheet2Excel
public void mapSheet2Excel(List<MapSheetWrapper> sheetWrappers, String templatePath, OutputStream os) throws Excel4JException { try (SheetTemplate sheetTemplate = exportExcelByMapHandler(sheetWrappers, templatePath)) { sheetTemplate.write2Stream(os); } catch (IOException e) { throw new Excel4JException(e); } }
java
public void mapSheet2Excel(List<MapSheetWrapper> sheetWrappers, String templatePath, OutputStream os) throws Excel4JException { try (SheetTemplate sheetTemplate = exportExcelByMapHandler(sheetWrappers, templatePath)) { sheetTemplate.write2Stream(os); } catch (IOException e) { throw new Excel4JException(e); } }
[ "public", "void", "mapSheet2Excel", "(", "List", "<", "MapSheetWrapper", ">", "sheetWrappers", ",", "String", "templatePath", ",", "OutputStream", "os", ")", "throws", "Excel4JException", "{", "try", "(", "SheetTemplate", "sheetTemplate", "=", "exportExcelByMapHandler...
基于模板、注解的多sheet导出{@code Map[String, List[?]]}类型数据 模板定制详见定制说明 @param sheetWrappers sheet包装类 @param templatePath Excel模板 @param os 输出流 @throws Excel4JException 异常
[ "基于模板、注解的多sheet导出", "{", "@code", "Map", "[", "String", "List", "[", "?", "]]", "}", "类型数据", "模板定制详见定制说明" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L906-L914
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/MoveIDToCodeHandler.java
MoveIDToCodeHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); if (iChangeType == DBConstants.AFTER_REFRESH_TYPE) iErrorCode = this.moveIDToCodeField(); else if ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (this.getCodeField().isNull())) { try { Record record = this.getOwner(); Object bookmark = record.getLastModified(DBConstants.BOOKMARK_HANDLE); record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); record.edit(); iErrorCode = this.moveIDToCodeField(); record.set(); } catch (DBException ex) { ex.printStackTrace(); } } return iErrorCode; }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); if (iChangeType == DBConstants.AFTER_REFRESH_TYPE) iErrorCode = this.moveIDToCodeField(); else if ((iChangeType == DBConstants.AFTER_ADD_TYPE) && (this.getCodeField().isNull())) { try { Record record = this.getOwner(); Object bookmark = record.getLastModified(DBConstants.BOOKMARK_HANDLE); record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); record.edit(); iErrorCode = this.moveIDToCodeField(); record.set(); } catch (DBException ex) { ex.printStackTrace(); } } return iErrorCode; }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "int", "iErrorCode", "=", "super", ".", "doRecordChange", "(", "field", ",", "iChangeType", ",", "bDisplayOption", ")", ";", "i...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/MoveIDToCodeHandler.java#L70-L91
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.inHostsList
private boolean inHostsList(DatanodeID node, String ipAddr) { Set<String> hostsList = hostsReader.getHosts(); try { if (hostsList.isEmpty() || (ipAddr != null && hostsList.contains(ipAddr)) || hostsList.contains(node.getHost()) || hostsList.contains(node.getName()) || ((node instanceof DatanodeInfo) && (hostsList.contains(((DatanodeInfo) node) .getHostName()) || hostsList.contains(((DatanodeInfo) node).getHostName() + ":" + node.getPort()))) // this is for the mixed mode in which the hostnames in the includes file // are followed with a "." and the datanodes are using IP addresses // during registration || (ipAddr != null && hostsList.contains(InetAddress.getByName(ipAddr).getHostName() + "."))) { return true; } // for several calls we pass ipAddr = null, but the datanode name // is an IP address, for this we need to do best effort reverse DNS // resolution String host = getHostNameForIp(node.getHost()); if (host != null) { return hostsList.contains(host + ".") || hostsList.contains(host); } // host is not in the list return false; } catch (UnknownHostException e) { LOG.error(e); } return false; }
java
private boolean inHostsList(DatanodeID node, String ipAddr) { Set<String> hostsList = hostsReader.getHosts(); try { if (hostsList.isEmpty() || (ipAddr != null && hostsList.contains(ipAddr)) || hostsList.contains(node.getHost()) || hostsList.contains(node.getName()) || ((node instanceof DatanodeInfo) && (hostsList.contains(((DatanodeInfo) node) .getHostName()) || hostsList.contains(((DatanodeInfo) node).getHostName() + ":" + node.getPort()))) // this is for the mixed mode in which the hostnames in the includes file // are followed with a "." and the datanodes are using IP addresses // during registration || (ipAddr != null && hostsList.contains(InetAddress.getByName(ipAddr).getHostName() + "."))) { return true; } // for several calls we pass ipAddr = null, but the datanode name // is an IP address, for this we need to do best effort reverse DNS // resolution String host = getHostNameForIp(node.getHost()); if (host != null) { return hostsList.contains(host + ".") || hostsList.contains(host); } // host is not in the list return false; } catch (UnknownHostException e) { LOG.error(e); } return false; }
[ "private", "boolean", "inHostsList", "(", "DatanodeID", "node", ",", "String", "ipAddr", ")", "{", "Set", "<", "String", ">", "hostsList", "=", "hostsReader", ".", "getHosts", "(", ")", ";", "try", "{", "if", "(", "hostsList", ".", "isEmpty", "(", ")", ...
Keeps track of which datanodes/ipaddress are allowed to connect to the namenode.
[ "Keeps", "track", "of", "which", "datanodes", "/", "ipaddress", "are", "allowed", "to", "connect", "to", "the", "namenode", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8256-L8290
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowContext.java
PageFlowContext.get
public Object get(String name, PageFlowContextActivator activator) { assert (name != null) : "Parameter 'name' must not be null"; assert (activator != null) : "Parameter 'activator' must not be null"; Object ret = _contexts.get(name); if (ret == null) { ret = activator.activate(); _contexts.put(name,ret); } return ret; }
java
public Object get(String name, PageFlowContextActivator activator) { assert (name != null) : "Parameter 'name' must not be null"; assert (activator != null) : "Parameter 'activator' must not be null"; Object ret = _contexts.get(name); if (ret == null) { ret = activator.activate(); _contexts.put(name,ret); } return ret; }
[ "public", "Object", "get", "(", "String", "name", ",", "PageFlowContextActivator", "activator", ")", "{", "assert", "(", "name", "!=", "null", ")", ":", "\"Parameter 'name' must not be null\"", ";", "assert", "(", "activator", "!=", "null", ")", ":", "\"Paramete...
This method will lookup a named object and return it. The object is looked up by name. If the object doesn't exist, the activator object is called to create a new instance of the object before it is returned. @param name The name of the object to return @param activator An <code>PageFlowContextActivator</code> that will create the new object if it doesn't exist. @return The object stored by the name.
[ "This", "method", "will", "lookup", "a", "named", "object", "and", "return", "it", ".", "The", "object", "is", "looked", "up", "by", "name", ".", "If", "the", "object", "doesn", "t", "exist", "the", "activator", "object", "is", "called", "to", "create", ...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowContext.java#L121-L132
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java
DateTimeParseContext.setParsedField
int setParsedField(TemporalField field, long value, int errorPos, int successPos) { Objects.requireNonNull(field, "field"); Long old = currentParsed().fieldValues.put(field, value); return (old != null && old.longValue() != value) ? ~errorPos : successPos; }
java
int setParsedField(TemporalField field, long value, int errorPos, int successPos) { Objects.requireNonNull(field, "field"); Long old = currentParsed().fieldValues.put(field, value); return (old != null && old.longValue() != value) ? ~errorPos : successPos; }
[ "int", "setParsedField", "(", "TemporalField", "field", ",", "long", "value", ",", "int", "errorPos", ",", "int", "successPos", ")", "{", "Objects", ".", "requireNonNull", "(", "field", ",", "\"field\"", ")", ";", "Long", "old", "=", "currentParsed", "(", ...
Stores the parsed field. <p> This stores a field-value pair that has been parsed. The value stored may be out of range for the field - no checks are performed. @param field the field to set in the field-value map, not null @param value the value to set in the field-value map @param errorPos the position of the field being parsed @param successPos the position after the field being parsed @return the new position
[ "Stores", "the", "parsed", "field", ".", "<p", ">", "This", "stores", "a", "field", "-", "value", "pair", "that", "has", "been", "parsed", ".", "The", "value", "stored", "may", "be", "out", "of", "range", "for", "the", "field", "-", "no", "checks", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java#L363-L367
lucee/Lucee
core/src/main/java/lucee/runtime/text/xml/XMLCaster.java
XMLCaster.toAttr
public static Attr toAttr(Document doc, Object o) throws PageException { if (o instanceof Attr) return (Attr) o; if (o instanceof Struct && ((Struct) o).size() == 1) { Struct sct = (Struct) o; Entry<Key, Object> e = sct.entryIterator().next(); Attr attr = doc.createAttribute(e.getKey().getString()); attr.setValue(Caster.toString(e.getValue())); return attr; } throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Attribute"); }
java
public static Attr toAttr(Document doc, Object o) throws PageException { if (o instanceof Attr) return (Attr) o; if (o instanceof Struct && ((Struct) o).size() == 1) { Struct sct = (Struct) o; Entry<Key, Object> e = sct.entryIterator().next(); Attr attr = doc.createAttribute(e.getKey().getString()); attr.setValue(Caster.toString(e.getValue())); return attr; } throw new XMLException("can't cast Object of type " + Caster.toClassName(o) + " to a XML Attribute"); }
[ "public", "static", "Attr", "toAttr", "(", "Document", "doc", ",", "Object", "o", ")", "throws", "PageException", "{", "if", "(", "o", "instanceof", "Attr", ")", "return", "(", "Attr", ")", "o", ";", "if", "(", "o", "instanceof", "Struct", "&&", "(", ...
casts a value to a XML Attribute Object @param doc XML Document @param o Object to cast @return XML Comment Object @throws PageException
[ "casts", "a", "value", "to", "a", "XML", "Attribute", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L148-L159
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java
ST_Graph.createGraph
public static boolean createGraph(Connection connection, String inputTable, String spatialFieldName, double tolerance, boolean orientBySlope, boolean deleteTables) throws SQLException { if (tolerance < 0) { throw new IllegalArgumentException("Only positive tolerances are allowed."); } final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODES_SUFFIX); final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGES_SUFFIX); boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData()); if(deleteTables){ try (Statement stmt = connection.createStatement()) { StringBuilder sb = new StringBuilder("drop table if exists "); sb.append(nodesName.toString(isH2)).append(",").append(edgesName.toString(isH2)); stmt.execute(sb.toString()); } } // Check if ST_Graph has already been run on this table. else if (JDBCUtilities.tableExists(connection, nodesName.getTable()) || JDBCUtilities.tableExists(connection, edgesName.getTable())) { throw new IllegalArgumentException(ALREADY_RUN_ERROR + tableName.getTable()); } //Tables used to store intermediate data PTS_TABLE = TableLocation.parse(System.currentTimeMillis()+"_PTS", isH2).toString(); COORDS_TABLE = TableLocation.parse(System.currentTimeMillis()+"_COORDS", isH2).toString(); // Check for a primary key final int pkIndex = JDBCUtilities.getIntegerPrimaryKey(connection, tableName.getTable()); if (pkIndex == 0) { throw new IllegalStateException("Table " + tableName.getTable() + " must contain a single integer primary key."); } final DatabaseMetaData md = connection.getMetaData(); final String pkColName = JDBCUtilities.getFieldName(md, tableName.getTable(), pkIndex); // Check the geometry column type; final Object[] spatialFieldIndexAndName = getSpatialFieldIndexAndName(connection, tableName, spatialFieldName); int spatialFieldIndex = (int) spatialFieldIndexAndName[1]; spatialFieldName = (String) spatialFieldIndexAndName[0]; checkGeometryType(connection, tableName, spatialFieldIndex); final String geomCol = JDBCUtilities.getFieldName(md, tableName.getTable(), spatialFieldIndex); final Statement st = connection.createStatement(); try { firstFirstLastLast(st, tableName, pkColName, geomCol, tolerance); int srid = SFSUtilities.getSRID(connection, tableName, spatialFieldName); makeEnvelopes(st, tolerance, isH2, srid); nodesTable(st, nodesName, tolerance, isH2,srid); edgesTable(st, nodesName, edgesName, tolerance, isH2); checkForNullEdgeEndpoints(st, edgesName); if (orientBySlope) { orientBySlope(st, nodesName, edgesName); } } finally { st.execute("DROP TABLE IF EXISTS "+ PTS_TABLE+ ","+ COORDS_TABLE); st.close(); } return true; }
java
public static boolean createGraph(Connection connection, String inputTable, String spatialFieldName, double tolerance, boolean orientBySlope, boolean deleteTables) throws SQLException { if (tolerance < 0) { throw new IllegalArgumentException("Only positive tolerances are allowed."); } final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODES_SUFFIX); final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGES_SUFFIX); boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData()); if(deleteTables){ try (Statement stmt = connection.createStatement()) { StringBuilder sb = new StringBuilder("drop table if exists "); sb.append(nodesName.toString(isH2)).append(",").append(edgesName.toString(isH2)); stmt.execute(sb.toString()); } } // Check if ST_Graph has already been run on this table. else if (JDBCUtilities.tableExists(connection, nodesName.getTable()) || JDBCUtilities.tableExists(connection, edgesName.getTable())) { throw new IllegalArgumentException(ALREADY_RUN_ERROR + tableName.getTable()); } //Tables used to store intermediate data PTS_TABLE = TableLocation.parse(System.currentTimeMillis()+"_PTS", isH2).toString(); COORDS_TABLE = TableLocation.parse(System.currentTimeMillis()+"_COORDS", isH2).toString(); // Check for a primary key final int pkIndex = JDBCUtilities.getIntegerPrimaryKey(connection, tableName.getTable()); if (pkIndex == 0) { throw new IllegalStateException("Table " + tableName.getTable() + " must contain a single integer primary key."); } final DatabaseMetaData md = connection.getMetaData(); final String pkColName = JDBCUtilities.getFieldName(md, tableName.getTable(), pkIndex); // Check the geometry column type; final Object[] spatialFieldIndexAndName = getSpatialFieldIndexAndName(connection, tableName, spatialFieldName); int spatialFieldIndex = (int) spatialFieldIndexAndName[1]; spatialFieldName = (String) spatialFieldIndexAndName[0]; checkGeometryType(connection, tableName, spatialFieldIndex); final String geomCol = JDBCUtilities.getFieldName(md, tableName.getTable(), spatialFieldIndex); final Statement st = connection.createStatement(); try { firstFirstLastLast(st, tableName, pkColName, geomCol, tolerance); int srid = SFSUtilities.getSRID(connection, tableName, spatialFieldName); makeEnvelopes(st, tolerance, isH2, srid); nodesTable(st, nodesName, tolerance, isH2,srid); edgesTable(st, nodesName, edgesName, tolerance, isH2); checkForNullEdgeEndpoints(st, edgesName); if (orientBySlope) { orientBySlope(st, nodesName, edgesName); } } finally { st.execute("DROP TABLE IF EXISTS "+ PTS_TABLE+ ","+ COORDS_TABLE); st.close(); } return true; }
[ "public", "static", "boolean", "createGraph", "(", "Connection", "connection", ",", "String", "inputTable", ",", "String", "spatialFieldName", ",", "double", "tolerance", ",", "boolean", "orientBySlope", ",", "boolean", "deleteTables", ")", "throws", "SQLException", ...
Create the nodes and edges tables from the input table containing LINESTRINGs in the given column and using the given tolerance, and potentially orienting edges by slope. <p/> The tolerance value is used specify the side length of a square Envelope around each node used to snap together other nodes within the same Envelope. Note, however, that edge geometries are left untouched. Note also that coordinates within a given tolerance of each other are not necessarily snapped together. Only the first and last coordinates of a geometry are considered to be potential nodes, and only nodes within a given tolerance of each other are snapped together. The tolerance works only in metric units. <p/> The boolean orientBySlope is set to true if edges should be oriented by the z-value of their first and last coordinates (decreasing). <p/> If the input table has name 'input', then the output tables are named 'input_nodes' and 'input_edges'. @param connection Connection @param inputTable Input table @param spatialFieldName Name of column containing LINESTRINGs @param tolerance Tolerance @param orientBySlope True if edges should be oriented by the z-value of their first and last coordinates (decreasing) @param deleteTables True delete the existing tables @return true if both output tables were created @throws SQLException
[ "Create", "the", "nodes", "and", "edges", "tables", "from", "the", "input", "table", "containing", "LINESTRINGs", "in", "the", "given", "column", "and", "using", "the", "given", "tolerance", "and", "potentially", "orienting", "edges", "by", "slope", ".", "<p",...
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java#L229-L287
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.readFileColumn
public static double[] readFileColumn(String filename, int columnIdx, int sizeLimit) throws IOException, SAXException { // make sure the path exists Path path = Paths.get(filename); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(filename), "UTF-8")); return readTS(br, columnIdx, sizeLimit); }
java
public static double[] readFileColumn(String filename, int columnIdx, int sizeLimit) throws IOException, SAXException { // make sure the path exists Path path = Paths.get(filename); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(filename), "UTF-8")); return readTS(br, columnIdx, sizeLimit); }
[ "public", "static", "double", "[", "]", "readFileColumn", "(", "String", "filename", ",", "int", "columnIdx", ",", "int", "sizeLimit", ")", "throws", "IOException", ",", "SAXException", "{", "// make sure the path exists\r", "Path", "path", "=", "Paths", ".", "g...
Reads timeseries from a file. Assumes that file has a single double value on every line. Assigned timestamps are the line numbers. @param filename The file to read from. @param columnIdx The column index. @param sizeLimit The number of lines to read, 0 == all. @return data. @throws IOException if error occurs. @throws SAXException if error occurs.
[ "Reads", "timeseries", "from", "a", "file", ".", "Assumes", "that", "file", "has", "a", "single", "double", "value", "on", "every", "line", ".", "Assigned", "timestamps", "are", "the", "line", "numbers", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L54-L67
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/train/MarginalLogLikelihood.java
MarginalLogLikelihood.getFgLat
public static FactorGraph getFgLat(FactorGraph fgLatPred, VarConfig goldConfig) { // TODO: instead, have this just look at whether or not the var is in the gold config List<Var> predictedVars = VarSet.getVarsOfType(fgLatPred.getVars(), VarType.PREDICTED); VarConfig predConfig = goldConfig.getIntersection(predictedVars); FactorGraph fgLat = fgLatPred.getClamped(predConfig); assert (fgLatPred.getNumFactors() <= fgLat.getNumFactors()); return fgLat; }
java
public static FactorGraph getFgLat(FactorGraph fgLatPred, VarConfig goldConfig) { // TODO: instead, have this just look at whether or not the var is in the gold config List<Var> predictedVars = VarSet.getVarsOfType(fgLatPred.getVars(), VarType.PREDICTED); VarConfig predConfig = goldConfig.getIntersection(predictedVars); FactorGraph fgLat = fgLatPred.getClamped(predConfig); assert (fgLatPred.getNumFactors() <= fgLat.getNumFactors()); return fgLat; }
[ "public", "static", "FactorGraph", "getFgLat", "(", "FactorGraph", "fgLatPred", ",", "VarConfig", "goldConfig", ")", "{", "// TODO: instead, have this just look at whether or not the var is in the gold config", "List", "<", "Var", ">", "predictedVars", "=", "VarSet", ".", "...
Get a copy of the factor graph where the predicted variables are clamped. @param fgLatPred The original factor graph. @param goldConfig The assignment to the predicted variables. @return The clamped factor graph.
[ "Get", "a", "copy", "of", "the", "factor", "graph", "where", "the", "predicted", "variables", "are", "clamped", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/train/MarginalLogLikelihood.java#L175-L182
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.lookAtLH
public Matrix4x3f lookAtLH(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ, Matrix4x3f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setLookAtLH(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); return lookAtLHGeneric(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ, dest); }
java
public Matrix4x3f lookAtLH(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ, Matrix4x3f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return dest.setLookAtLH(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); return lookAtLHGeneric(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ, dest); }
[ "public", "Matrix4x3f", "lookAtLH", "(", "float", "eyeX", ",", "float", "eyeY", ",", "float", "eyeZ", ",", "float", "centerX", ",", "float", "centerY", ",", "float", "centerZ", ",", "float", "upX", ",", "float", "upY", ",", "float", "upZ", ",", "Matrix4x...
Apply a "lookat" transformation to this matrix for a left-handed coordinate system, that aligns <code>+z</code> with <code>center - eye</code> and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix, then the new matrix will be <code>M * L</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the lookat transformation will be applied first! <p> In order to set the matrix to a lookat transformation without post-multiplying it, use {@link #setLookAtLH(float, float, float, float, float, float, float, float, float) setLookAtLH()}. @see #lookAtLH(Vector3fc, Vector3fc, Vector3fc) @see #setLookAtLH(float, float, float, float, float, float, float, float, float) @param eyeX the x-coordinate of the eye/camera location @param eyeY the y-coordinate of the eye/camera location @param eyeZ the z-coordinate of the eye/camera location @param centerX the x-coordinate of the point to look at @param centerY the y-coordinate of the point to look at @param centerZ the z-coordinate of the point to look at @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @param dest will hold the result @return dest
[ "Apply", "a", "lookat", "transformation", "to", "this", "matrix", "for", "a", "left", "-", "handed", "coordinate", "system", "that", "aligns", "<code", ">", "+", "z<", "/", "code", ">", "with", "<code", ">", "center", "-", "eye<", "/", "code", ">", "an...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L6688-L6694
lz4/lz4-java
src/java/net/jpountz/lz4/LZ4DecompressorWithLength.java
LZ4DecompressorWithLength.getDecompressedLength
public static int getDecompressedLength(byte[] src, int srcOff) { return (src[srcOff] & 0xFF) | (src[srcOff + 1] & 0xFF) << 8 | (src[srcOff + 2] & 0xFF) << 16 | src[srcOff + 3] << 24; }
java
public static int getDecompressedLength(byte[] src, int srcOff) { return (src[srcOff] & 0xFF) | (src[srcOff + 1] & 0xFF) << 8 | (src[srcOff + 2] & 0xFF) << 16 | src[srcOff + 3] << 24; }
[ "public", "static", "int", "getDecompressedLength", "(", "byte", "[", "]", "src", ",", "int", "srcOff", ")", "{", "return", "(", "src", "[", "srcOff", "]", "&", "0xFF", ")", "|", "(", "src", "[", "srcOff", "+", "1", "]", "&", "0xFF", ")", "<<", "...
Returns the decompressed length of compressed data in <code>src[srcOff:]</code>. @param src the compressed data @param srcOff the start offset in src @return the decompressed length
[ "Returns", "the", "decompressed", "length", "of", "compressed", "data", "in", "<code", ">", "src", "[", "srcOff", ":", "]", "<", "/", "code", ">", "." ]
train
https://github.com/lz4/lz4-java/blob/c5ae694a3aa8b33ef87fd0486727a7d1e8f71367/src/java/net/jpountz/lz4/LZ4DecompressorWithLength.java#L49-L51
samskivert/pythagoras
src/main/java/pythagoras/d/Quaternion.java
Quaternion.randomize
public Quaternion randomize (Random rand) { // pick angles according to the surface area distribution return fromAngles(MathUtil.lerp(-Math.PI, +Math.PI, rand.nextFloat()), Math.asin(MathUtil.lerp(-1f, +1f, rand.nextFloat())), MathUtil.lerp(-Math.PI, +Math.PI, rand.nextFloat())); }
java
public Quaternion randomize (Random rand) { // pick angles according to the surface area distribution return fromAngles(MathUtil.lerp(-Math.PI, +Math.PI, rand.nextFloat()), Math.asin(MathUtil.lerp(-1f, +1f, rand.nextFloat())), MathUtil.lerp(-Math.PI, +Math.PI, rand.nextFloat())); }
[ "public", "Quaternion", "randomize", "(", "Random", "rand", ")", "{", "// pick angles according to the surface area distribution", "return", "fromAngles", "(", "MathUtil", ".", "lerp", "(", "-", "Math", ".", "PI", ",", "+", "Math", ".", "PI", ",", "rand", ".", ...
Sets this to a random rotation obtained from a completely uniform distribution.
[ "Sets", "this", "to", "a", "random", "rotation", "obtained", "from", "a", "completely", "uniform", "distribution", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Quaternion.java#L173-L178
jamesdbloom/mockserver
mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java
HttpResponse.withBody
public HttpResponse withBody(String body, MediaType contentType) { if (body != null) { this.body = new StringBody(body, contentType); } return this; }
java
public HttpResponse withBody(String body, MediaType contentType) { if (body != null) { this.body = new StringBody(body, contentType); } return this; }
[ "public", "HttpResponse", "withBody", "(", "String", "body", ",", "MediaType", "contentType", ")", "{", "if", "(", "body", "!=", "null", ")", "{", "this", ".", "body", "=", "new", "StringBody", "(", "body", ",", "contentType", ")", ";", "}", "return", ...
Set response body to return a string response body with the specified encoding. <b>Note:</b> The character set of the response will be forced to the specified charset, even if the Content-Type header specifies otherwise. @param body a string @param contentType media type, if charset is included this will be used for encoding string
[ "Set", "response", "body", "to", "return", "a", "string", "response", "body", "with", "the", "specified", "encoding", ".", "<b", ">", "Note", ":", "<", "/", "b", ">", "The", "character", "set", "of", "the", "response", "will", "be", "forced", "to", "th...
train
https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java#L114-L119
google/Accessibility-Test-Framework-for-Android
src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoRef.java
AccessibilityNodeInfoRef.owned
public static AccessibilityNodeInfoRef owned( AccessibilityNodeInfoCompat node) { return node != null ? new AccessibilityNodeInfoRef(node, true) : null; }
java
public static AccessibilityNodeInfoRef owned( AccessibilityNodeInfoCompat node) { return node != null ? new AccessibilityNodeInfoRef(node, true) : null; }
[ "public", "static", "AccessibilityNodeInfoRef", "owned", "(", "AccessibilityNodeInfoCompat", "node", ")", "{", "return", "node", "!=", "null", "?", "new", "AccessibilityNodeInfoRef", "(", "node", ",", "true", ")", ":", "null", ";", "}" ]
Creates a new instance of this class taking ownership of {@code node}.
[ "Creates", "a", "new", "instance", "of", "this", "class", "taking", "ownership", "of", "{" ]
train
https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoRef.java#L108-L111
alkacon/opencms-core
src/org/opencms/publish/CmsPublishEngine.java
CmsPublishEngine.sendMessage
protected void sendMessage(CmsUUID toUserId, String message, boolean hasErrors) { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { CmsUser toUser = m_driverManager.readUser(dbc, toUserId); CmsUserSettings settings = new CmsUserSettings(toUser); if (settings.getShowPublishNotification() || hasErrors) { // only show message if publish notification is enabled or the message shows an error OpenCms.getSessionManager().sendBroadcast(null, message, toUser); } } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); } finally { dbc.clear(); } }
java
protected void sendMessage(CmsUUID toUserId, String message, boolean hasErrors) { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { CmsUser toUser = m_driverManager.readUser(dbc, toUserId); CmsUserSettings settings = new CmsUserSettings(toUser); if (settings.getShowPublishNotification() || hasErrors) { // only show message if publish notification is enabled or the message shows an error OpenCms.getSessionManager().sendBroadcast(null, message, toUser); } } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), e); } finally { dbc.clear(); } }
[ "protected", "void", "sendMessage", "(", "CmsUUID", "toUserId", ",", "String", "message", ",", "boolean", "hasErrors", ")", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", ")", ";", "try", "{", "CmsUser", "toUser", "=", "m_driv...
Sends a message to the given user, if publish notification is enabled or an error is shown in the message.<p> @param toUserId the id of the user to send the message to @param message the message to send @param hasErrors flag to determine if the message to send shows an error
[ "Sends", "a", "message", "to", "the", "given", "user", "if", "publish", "notification", "is", "enabled", "or", "an", "error", "is", "shown", "in", "the", "message", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishEngine.java#L748-L764
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java
RequestAttributeSourceFilter.addRequestProperties
protected void addRequestProperties(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { if (this.remoteUserAttribute != null) { final String remoteUser = httpServletRequest.getRemoteUser(); attributes.put(this.remoteUserAttribute, list(remoteUser)); } if (this.remoteAddrAttribute != null) { final String remoteAddr = httpServletRequest.getRemoteAddr(); attributes.put(this.remoteAddrAttribute, list(remoteAddr)); } if (this.remoteHostAttribute != null) { final String remoteHost = httpServletRequest.getRemoteHost(); attributes.put(this.remoteHostAttribute, list(remoteHost)); } if (this.serverNameAttribute != null) { final String serverName = httpServletRequest.getServerName(); attributes.put(this.serverNameAttribute, list(serverName)); } if (this.serverPortAttribute != null) { final int serverPort = httpServletRequest.getServerPort(); attributes.put(this.serverPortAttribute, list(serverPort)); } }
java
protected void addRequestProperties(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { if (this.remoteUserAttribute != null) { final String remoteUser = httpServletRequest.getRemoteUser(); attributes.put(this.remoteUserAttribute, list(remoteUser)); } if (this.remoteAddrAttribute != null) { final String remoteAddr = httpServletRequest.getRemoteAddr(); attributes.put(this.remoteAddrAttribute, list(remoteAddr)); } if (this.remoteHostAttribute != null) { final String remoteHost = httpServletRequest.getRemoteHost(); attributes.put(this.remoteHostAttribute, list(remoteHost)); } if (this.serverNameAttribute != null) { final String serverName = httpServletRequest.getServerName(); attributes.put(this.serverNameAttribute, list(serverName)); } if (this.serverPortAttribute != null) { final int serverPort = httpServletRequest.getServerPort(); attributes.put(this.serverPortAttribute, list(serverPort)); } }
[ "protected", "void", "addRequestProperties", "(", "final", "HttpServletRequest", "httpServletRequest", ",", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributes", ")", "{", "if", "(", "this", ".", "remoteUserAttribute", "!=", "null", ...
Add other properties from the request to the attributes map. @param httpServletRequest Http Servlet Request @param attributes Map of attributes to add additional attributes to from the Http Request
[ "Add", "other", "properties", "from", "the", "request", "to", "the", "attributes", "map", "." ]
train
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java#L407-L428
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LREnvelope.java
LREnvelope.addSigningData
public void addSigningData(String signingMethod, String publicKeyLocation, String clearSignedMessage) { this.signingMethod = signingMethod; this.publicKeyLocation = publicKeyLocation; this.clearSignedMessage = clearSignedMessage; this.signed = true; }
java
public void addSigningData(String signingMethod, String publicKeyLocation, String clearSignedMessage) { this.signingMethod = signingMethod; this.publicKeyLocation = publicKeyLocation; this.clearSignedMessage = clearSignedMessage; this.signed = true; }
[ "public", "void", "addSigningData", "(", "String", "signingMethod", ",", "String", "publicKeyLocation", ",", "String", "clearSignedMessage", ")", "{", "this", ".", "signingMethod", "=", "signingMethod", ";", "this", ".", "publicKeyLocation", "=", "publicKeyLocation", ...
Adds signing data to the envelope @param signingMethod method used for signing this envelope @param publicKeyLocation location of the public key for the signature on this envelope @param clearSignedMessage clear signed message created for signing this envelope
[ "Adds", "signing", "data", "to", "the", "envelope" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LREnvelope.java#L183-L189
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/GroupsPoolsApi.java
GroupsPoolsApi.getPhotos
public Photos getPhotos(String groupId, List<String> tags, String userId, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page, boolean sign) throws JinxException { JinxUtils.validateParams(groupId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.groups.pools.getPhotos"); params.put("group_id", groupId); if (!JinxUtils.isNullOrEmpty(tags)) { params.put("tags", tags.get(0)); } if (!JinxUtils.isNullOrEmpty(userId)) { params.put("user_id", userId); } if (!JinxUtils.isNullOrEmpty(extras)) { params.put("extras", JinxUtils.buildCommaDelimitedList(extras)); } if (page > 0) { params.put("page", Integer.toString(page)); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } return jinx.flickrGet(params, Photos.class, sign); }
java
public Photos getPhotos(String groupId, List<String> tags, String userId, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page, boolean sign) throws JinxException { JinxUtils.validateParams(groupId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.groups.pools.getPhotos"); params.put("group_id", groupId); if (!JinxUtils.isNullOrEmpty(tags)) { params.put("tags", tags.get(0)); } if (!JinxUtils.isNullOrEmpty(userId)) { params.put("user_id", userId); } if (!JinxUtils.isNullOrEmpty(extras)) { params.put("extras", JinxUtils.buildCommaDelimitedList(extras)); } if (page > 0) { params.put("page", Integer.toString(page)); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } return jinx.flickrGet(params, Photos.class, sign); }
[ "public", "Photos", "getPhotos", "(", "String", "groupId", ",", "List", "<", "String", ">", "tags", ",", "String", "userId", ",", "EnumSet", "<", "JinxConstants", ".", "PhotoExtras", ">", "extras", ",", "int", "perPage", ",", "int", "page", ",", "boolean",...
Returns a list of pool photos for a given group, based on the permissions of the group and the user logged in (if any). <br> This method does not require authentication. Unsigned requests may not be able to retrieve photos from some groups. @param groupId (Required) The id of the group who's pool you which to get the photo list for. @param tags (Optional) A list of tags to filter the pool with. At the moment only one tag at a time is supported. The first tag in the list will be used. @param userId (Optional) The nsid of a user. Specifiying this parameter will retrieve for you only those photos that the user has contributed to the group pool. @param extras (Optional) extra information to fetch for each returned record. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return list of photos. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.groups.pools.getPhotos.html">flickr.groups.pools.getPhotos</a>
[ "Returns", "a", "list", "of", "pool", "photos", "for", "a", "given", "group", "based", "on", "the", "permissions", "of", "the", "group", "and", "the", "user", "logged", "in", "(", "if", "any", ")", ".", "<br", ">", "This", "method", "does", "not", "r...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsPoolsApi.java#L127-L148
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/StateMachine.java
StateMachine.setIf
public boolean setIf(T newState, Predicate<T> predicate) { checkState(!Thread.holdsLock(lock), "Can not set state while holding the lock"); requireNonNull(newState, "newState is null"); while (true) { // check if the current state passes the predicate T currentState = get(); // change to same state is not a change, and does not notify the notify listeners if (currentState.equals(newState)) { return false; } // do not call predicate while holding the lock if (!predicate.test(currentState)) { return false; } // if state did not change while, checking the predicate, apply the new state if (compareAndSet(currentState, newState)) { return true; } } }
java
public boolean setIf(T newState, Predicate<T> predicate) { checkState(!Thread.holdsLock(lock), "Can not set state while holding the lock"); requireNonNull(newState, "newState is null"); while (true) { // check if the current state passes the predicate T currentState = get(); // change to same state is not a change, and does not notify the notify listeners if (currentState.equals(newState)) { return false; } // do not call predicate while holding the lock if (!predicate.test(currentState)) { return false; } // if state did not change while, checking the predicate, apply the new state if (compareAndSet(currentState, newState)) { return true; } } }
[ "public", "boolean", "setIf", "(", "T", "newState", ",", "Predicate", "<", "T", ">", "predicate", ")", "{", "checkState", "(", "!", "Thread", ".", "holdsLock", "(", "lock", ")", ",", "\"Can not set state while holding the lock\"", ")", ";", "requireNonNull", "...
Sets the state if the current state satisfies the specified predicate. If the new state does not {@code .equals()} the current state, listeners and waiters will be notified. @return true if the state is set
[ "Sets", "the", "state", "if", "the", "current", "state", "satisfies", "the", "specified", "predicate", ".", "If", "the", "new", "state", "does", "not", "{", "@code", ".", "equals", "()", "}", "the", "current", "state", "listeners", "and", "waiters", "will"...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/StateMachine.java#L139-L163
eurekaclinical/javautil
src/main/java/org/arp/javautil/collections/Collections.java
Collections.putList
public static <K, V> void putList(Map<K, List<V>> map, K key, V valueElt) { if (map.containsKey(key)) { List<V> l = map.get(key); l.add(valueElt); } else { List<V> l = new ArrayList<>(); l.add(valueElt); map.put(key, l); } }
java
public static <K, V> void putList(Map<K, List<V>> map, K key, V valueElt) { if (map.containsKey(key)) { List<V> l = map.get(key); l.add(valueElt); } else { List<V> l = new ArrayList<>(); l.add(valueElt); map.put(key, l); } }
[ "public", "static", "<", "K", ",", "V", ">", "void", "putList", "(", "Map", "<", "K", ",", "List", "<", "V", ">", ">", "map", ",", "K", "key", ",", "V", "valueElt", ")", "{", "if", "(", "map", ".", "containsKey", "(", "key", ")", ")", "{", ...
Puts a value into a map of key -> list of values. If the specified key is new, it creates an {@link ArrayList} as its value. @param map a {@link Map}. @param key a key. @param valueElt a value.
[ "Puts", "a", "value", "into", "a", "map", "of", "key", "-", ">", "list", "of", "values", ".", "If", "the", "specified", "key", "is", "new", "it", "creates", "an", "{" ]
train
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/collections/Collections.java#L49-L58
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getPvPAmuletInfo
public void getPvPAmuletInfo(int[] ids, Callback<List<PvPAmulet>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getPvPAmuletInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getPvPAmuletInfo(int[] ids, Callback<List<PvPAmulet>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getPvPAmuletInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getPvPAmuletInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "PvPAmulet", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "i...
For more info on pvp amulets API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/amulets">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of amulet id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see PvPAmulet amulet info
[ "For", "more", "info", "on", "pvp", "amulets", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pvp", "/", "amulets", ">", "here<", "/", "a", ">", "<br", "/", ">...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2021-L2024
DDTH/ddth-kafka
src/main/java/com/github/ddth/kafka/internal/KafkaMsgConsumer.java
KafkaMsgConsumer._getWorker
private KafkaMsgConsumerWorker _getWorker(String topic, boolean autoCommitOffsets) { KafkaMsgConsumerWorker worker = topicWorkers.get(topic); if (worker == null) { Collection<IKafkaMessageListener> msgListeners = topicMsgListeners.get(topic); worker = new KafkaMsgConsumerWorker(this, topic, msgListeners, executorService); KafkaMsgConsumerWorker existingWorker = topicWorkers.putIfAbsent(topic, worker); if (existingWorker != null) { worker = existingWorker; } else { worker.start(); } } return worker; }
java
private KafkaMsgConsumerWorker _getWorker(String topic, boolean autoCommitOffsets) { KafkaMsgConsumerWorker worker = topicWorkers.get(topic); if (worker == null) { Collection<IKafkaMessageListener> msgListeners = topicMsgListeners.get(topic); worker = new KafkaMsgConsumerWorker(this, topic, msgListeners, executorService); KafkaMsgConsumerWorker existingWorker = topicWorkers.putIfAbsent(topic, worker); if (existingWorker != null) { worker = existingWorker; } else { worker.start(); } } return worker; }
[ "private", "KafkaMsgConsumerWorker", "_getWorker", "(", "String", "topic", ",", "boolean", "autoCommitOffsets", ")", "{", "KafkaMsgConsumerWorker", "worker", "=", "topicWorkers", ".", "get", "(", "topic", ")", ";", "if", "(", "worker", "==", "null", ")", "{", ...
Prepares a worker to consume messages from a Kafka topic. @param topic @param autoCommitOffsets @return
[ "Prepares", "a", "worker", "to", "consume", "messages", "from", "a", "Kafka", "topic", "." ]
train
https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/internal/KafkaMsgConsumer.java#L482-L495
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.getAsync
public Observable<GenericResourceInner> getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { return getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
java
public Observable<GenericResourceInner> getAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { return getWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "GenericResourceInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "resourceProviderNamespace", ",", "String", "parentResourcePath", ",", "String", "resourceType", ",", "String", "resourceName", ",", "String", "apiVe...
Gets a resource. @param resourceGroupName The name of the resource group containing the resource to get. The name is case insensitive. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath The parent resource identity. @param resourceType The resource type of the resource. @param resourceName The name of the resource to get. @param apiVersion The API version to use for the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the GenericResourceInner object
[ "Gets", "a", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1771-L1778
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java
ResourceLoader.getResourceAsProperties
public static Properties getResourceAsProperties(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException { InputStream inputStream = null; Properties props = null; try { inputStream = getResourceAsStream(requestingClass, resource); props = new Properties(); props.load(inputStream); } finally { if (inputStream != null) inputStream.close(); } return props; }
java
public static Properties getResourceAsProperties(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException { InputStream inputStream = null; Properties props = null; try { inputStream = getResourceAsStream(requestingClass, resource); props = new Properties(); props.load(inputStream); } finally { if (inputStream != null) inputStream.close(); } return props; }
[ "public", "static", "Properties", "getResourceAsProperties", "(", "Class", "<", "?", ">", "requestingClass", ",", "String", "resource", ")", "throws", "ResourceMissingException", ",", "IOException", "{", "InputStream", "inputStream", "=", "null", ";", "Properties", ...
Get the contents of a URL as a java.util.Properties object @param requestingClass the java.lang.Class object of the class that is attempting to load the resource @param resource a String describing the full or partial URL of the resource whose contents to load @return the actual contents of the resource as a Properties object @throws ResourceMissingException @throws java.io.IOException
[ "Get", "the", "contents", "of", "a", "URL", "as", "a", "java", ".", "util", ".", "Properties", "object" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java#L312-L324
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionFactory.java
SshConnectionFactory.getConnection
public static SshConnection getConnection(String host, int port, String proxy, Authentication authentication, int connectionTimeout) throws IOException { return getConnection(host, port, proxy, authentication, null, connectionTimeout); }
java
public static SshConnection getConnection(String host, int port, String proxy, Authentication authentication, int connectionTimeout) throws IOException { return getConnection(host, port, proxy, authentication, null, connectionTimeout); }
[ "public", "static", "SshConnection", "getConnection", "(", "String", "host", ",", "int", "port", ",", "String", "proxy", ",", "Authentication", "authentication", ",", "int", "connectionTimeout", ")", "throws", "IOException", "{", "return", "getConnection", "(", "h...
Creates a {@link SshConnection}. @param host the host name @param port the port @param proxy the proxy url @param authentication the credentials @param connectionTimeout the connection timeout @return a new connection. @throws IOException if so. @see SshConnection @see SshConnectionImpl
[ "Creates", "a", "{", "@link", "SshConnection", "}", "." ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionFactory.java#L95-L98
ineunetOS/knife-commons
knife-commons-utils/src/main/java/com/ineunet/knife/util/ReflectionUtils.java
ReflectionUtils.getAccessibleMethod
public static Method getAccessibleMethod(final Object obj, final String methodName, final Class<?>... parameterTypes) { Asserts.notNull(obj, "object cannot be null."); for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) { try { Method method = superClass.getDeclaredMethod(methodName, parameterTypes); method.setAccessible(true); return method; } catch (NoSuchMethodException e) {//NOSONAR // Method不在当前类定义,继续向上转型 } } return null; }
java
public static Method getAccessibleMethod(final Object obj, final String methodName, final Class<?>... parameterTypes) { Asserts.notNull(obj, "object cannot be null."); for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) { try { Method method = superClass.getDeclaredMethod(methodName, parameterTypes); method.setAccessible(true); return method; } catch (NoSuchMethodException e) {//NOSONAR // Method不在当前类定义,继续向上转型 } } return null; }
[ "public", "static", "Method", "getAccessibleMethod", "(", "final", "Object", "obj", ",", "final", "String", "methodName", ",", "final", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "Asserts", ".", "notNull", "(", "obj", ",", "\"object cannot be n...
循环向上转型, 获取对象的DeclaredMethod,并强制设置为可访问. 如向上转型到Object仍无法找到, 返回null. 用于方法需要被多次调用的情况. 先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args)
[ "循环向上转型", "获取对象的DeclaredMethod", "并强制设置为可访问", ".", "如向上转型到Object仍无法找到", "返回null", ".", "用于方法需要被多次调用的情况", ".", "先使用本函数先取得Method", "然后调用Method", ".", "invoke", "(", "Object", "obj", "Object", "...", "args", ")" ]
train
https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/ReflectionUtils.java#L143-L156
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/Filters.java
Filters.retainAll
public static <E> void retainAll(Collection<E> elems, Filter<? super E> filter) { for (Iterator<E> iter = elems.iterator(); iter.hasNext();) { E elem = iter.next(); if ( ! filter.accept(elem)) { iter.remove(); } } }
java
public static <E> void retainAll(Collection<E> elems, Filter<? super E> filter) { for (Iterator<E> iter = elems.iterator(); iter.hasNext();) { E elem = iter.next(); if ( ! filter.accept(elem)) { iter.remove(); } } }
[ "public", "static", "<", "E", ">", "void", "retainAll", "(", "Collection", "<", "E", ">", "elems", ",", "Filter", "<", "?", "super", "E", ">", "filter", ")", "{", "for", "(", "Iterator", "<", "E", ">", "iter", "=", "elems", ".", "iterator", "(", ...
Removes all elems in the given Collection that aren't accepted by the given Filter.
[ "Removes", "all", "elems", "in", "the", "given", "Collection", "that", "aren", "t", "accepted", "by", "the", "given", "Filter", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Filters.java#L268-L275
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/game/GameLoginSignUtil.java
GameLoginSignUtil.callbackResult
private static void callbackResult(String str, String pubKey, ICheckLoginSignHandler callback){ JSONObject json = null; try { json = new JSONObject(str); } catch (JSONException e) { callback.onCheckResult(null, "json parse fail:" + e.getMessage(), false); return; } String rtnCode = json.optString("rtnCode"); String errMsg = json.optString("errMsg"); String ts = json.optString("ts"); String rtnSign = json.optString("rtnSign"); if("0".equals(rtnCode)) { String nosign = "rtnCode=" + RSAUtil.urlEncode(rtnCode) + "&ts=" + RSAUtil.urlEncode(ts); boolean s = RSAUtil.doCheck(nosign, rtnSign, pubKey); callback.onCheckResult(rtnCode, "request success", s); } else { callback.onCheckResult(rtnCode, "request sign fail:" + errMsg, false); } }
java
private static void callbackResult(String str, String pubKey, ICheckLoginSignHandler callback){ JSONObject json = null; try { json = new JSONObject(str); } catch (JSONException e) { callback.onCheckResult(null, "json parse fail:" + e.getMessage(), false); return; } String rtnCode = json.optString("rtnCode"); String errMsg = json.optString("errMsg"); String ts = json.optString("ts"); String rtnSign = json.optString("rtnSign"); if("0".equals(rtnCode)) { String nosign = "rtnCode=" + RSAUtil.urlEncode(rtnCode) + "&ts=" + RSAUtil.urlEncode(ts); boolean s = RSAUtil.doCheck(nosign, rtnSign, pubKey); callback.onCheckResult(rtnCode, "request success", s); } else { callback.onCheckResult(rtnCode, "request sign fail:" + errMsg, false); } }
[ "private", "static", "void", "callbackResult", "(", "String", "str", ",", "String", "pubKey", ",", "ICheckLoginSignHandler", "callback", ")", "{", "JSONObject", "json", "=", "null", ";", "try", "{", "json", "=", "new", "JSONObject", "(", "str", ")", ";", "...
回调验签请求结果 @param str 验签请求结果字符串 @param pubKey 公钥 @param callback 回调
[ "回调验签请求结果" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/game/GameLoginSignUtil.java#L166-L188
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.addAll
public static <T> boolean addAll(List<T> self, int index, T[] items) { return self.addAll(index, Arrays.asList(items)); }
java
public static <T> boolean addAll(List<T> self, int index, T[] items) { return self.addAll(index, Arrays.asList(items)); }
[ "public", "static", "<", "T", ">", "boolean", "addAll", "(", "List", "<", "T", ">", "self", ",", "int", "index", ",", "T", "[", "]", "items", ")", "{", "return", "self", ".", "addAll", "(", "index", ",", "Arrays", ".", "asList", "(", "items", ")"...
Modifies this list by inserting all of the elements in the specified array into the list at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they occur in the array. The behavior of this operation is undefined if the specified array is modified while the operation is in progress. See also <code>plus</code> for similar functionality with copy semantics, i.e. which produces a new list after adding the additional items at the specified position but leaves the original list unchanged. @param self a list to be modified @param items array containing elements to be added to this collection @param index index at which to insert the first element from the specified array @return <tt>true</tt> if this collection changed as a result of the call @see List#addAll(int, Collection) @since 1.7.2
[ "Modifies", "this", "list", "by", "inserting", "all", "of", "the", "elements", "in", "the", "specified", "array", "into", "the", "list", "at", "the", "specified", "position", ".", "Shifts", "the", "element", "currently", "at", "that", "position", "(", "if", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L5160-L5162
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.countByCPD_T
@Override public int countByCPD_T(long CPDefinitionId, String type) { FinderPath finderPath = FINDER_PATH_COUNT_BY_CPD_T; Object[] finderArgs = new Object[] { CPDefinitionId, type }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPDEFINITIONLINK_WHERE); query.append(_FINDER_COLUMN_CPD_T_CPDEFINITIONID_2); boolean bindType = false; if (type == null) { query.append(_FINDER_COLUMN_CPD_T_TYPE_1); } else if (type.equals("")) { query.append(_FINDER_COLUMN_CPD_T_TYPE_3); } else { bindType = true; query.append(_FINDER_COLUMN_CPD_T_TYPE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CPDefinitionId); if (bindType) { qPos.add(type); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByCPD_T(long CPDefinitionId, String type) { FinderPath finderPath = FINDER_PATH_COUNT_BY_CPD_T; Object[] finderArgs = new Object[] { CPDefinitionId, type }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPDEFINITIONLINK_WHERE); query.append(_FINDER_COLUMN_CPD_T_CPDEFINITIONID_2); boolean bindType = false; if (type == null) { query.append(_FINDER_COLUMN_CPD_T_TYPE_1); } else if (type.equals("")) { query.append(_FINDER_COLUMN_CPD_T_TYPE_3); } else { bindType = true; query.append(_FINDER_COLUMN_CPD_T_TYPE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(CPDefinitionId); if (bindType) { qPos.add(type); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByCPD_T", "(", "long", "CPDefinitionId", ",", "String", "type", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_CPD_T", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "CPDefi...
Returns the number of cp definition links where CPDefinitionId = &#63; and type = &#63;. @param CPDefinitionId the cp definition ID @param type the type @return the number of matching cp definition links
[ "Returns", "the", "number", "of", "cp", "definition", "links", "where", "CPDefinitionId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L3037-L3098
alkacon/opencms-core
src/org/opencms/ui/apps/sitemanager/CmsSiteManager.java
CmsSiteManager.openEditDialog
public void openEditDialog(String siteRoot) { CmsEditSiteForm form; String caption; if (siteRoot != null) { form = new CmsEditSiteForm(m_rootCms, this, siteRoot); caption = CmsVaadinUtils.getMessageText( Messages.GUI_SITE_CONFIGURATION_EDIT_1, m_sitesTable.getContainer().getItem(siteRoot).getItemProperty(TableProperty.Title).getValue()); } else { form = new CmsEditSiteForm(m_rootCms, this); caption = CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ADD_0); } openDialog(form, caption); }
java
public void openEditDialog(String siteRoot) { CmsEditSiteForm form; String caption; if (siteRoot != null) { form = new CmsEditSiteForm(m_rootCms, this, siteRoot); caption = CmsVaadinUtils.getMessageText( Messages.GUI_SITE_CONFIGURATION_EDIT_1, m_sitesTable.getContainer().getItem(siteRoot).getItemProperty(TableProperty.Title).getValue()); } else { form = new CmsEditSiteForm(m_rootCms, this); caption = CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ADD_0); } openDialog(form, caption); }
[ "public", "void", "openEditDialog", "(", "String", "siteRoot", ")", "{", "CmsEditSiteForm", "form", ";", "String", "caption", ";", "if", "(", "siteRoot", "!=", "null", ")", "{", "form", "=", "new", "CmsEditSiteForm", "(", "m_rootCms", ",", "this", ",", "si...
Opens the edit site dialog.<p> @param siteRoot the site root of the site to edit, if <code>null</code>
[ "Opens", "the", "edit", "site", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsSiteManager.java#L303-L317
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readResources
public List<CmsResource> readResources( CmsRequestContext context, CmsResource parent, CmsResourceFilter filter, boolean readTree) throws CmsException, CmsSecurityException { List<CmsResource> result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { // check the access permissions checkPermissions(dbc, parent, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); result = m_driverManager.readResources(dbc, parent, filter, readTree); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_RESOURCES_1, context.removeSiteRoot(parent.getRootPath())), e); } finally { dbc.clear(); } return result; }
java
public List<CmsResource> readResources( CmsRequestContext context, CmsResource parent, CmsResourceFilter filter, boolean readTree) throws CmsException, CmsSecurityException { List<CmsResource> result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { // check the access permissions checkPermissions(dbc, parent, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); result = m_driverManager.readResources(dbc, parent, filter, readTree); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_RESOURCES_1, context.removeSiteRoot(parent.getRootPath())), e); } finally { dbc.clear(); } return result; }
[ "public", "List", "<", "CmsResource", ">", "readResources", "(", "CmsRequestContext", "context", ",", "CmsResource", "parent", ",", "CmsResourceFilter", "filter", ",", "boolean", "readTree", ")", "throws", "CmsException", ",", "CmsSecurityException", "{", "List", "<...
Reads all resources below the given path matching the filter criteria, including the full tree below the path only in case the <code>readTree</code> parameter is <code>true</code>.<p> @param context the current request context @param parent the parent path to read the resources from @param filter the filter @param readTree <code>true</code> to read all subresources @return a list of <code>{@link CmsResource}</code> objects matching the filter criteria @throws CmsSecurityException if the user has insufficient permission for the given resource (read is required) @throws CmsException if something goes wrong
[ "Reads", "all", "resources", "below", "the", "given", "path", "matching", "the", "filter", "criteria", "including", "the", "full", "tree", "below", "the", "path", "only", "in", "case", "the", "<code", ">", "readTree<", "/", "code", ">", "parameter", "is", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5096-L5118
haraldk/TwelveMonkeys
imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/util/IIOUtil.java
IIOUtil.lookupProviderByName
public static <T> T lookupProviderByName(final ServiceRegistry registry, final String providerClassName, Class<T> category) { try { return category.cast(registry.getServiceProviderByClass(Class.forName(providerClassName))); } catch (ClassNotFoundException ignore) { return null; } }
java
public static <T> T lookupProviderByName(final ServiceRegistry registry, final String providerClassName, Class<T> category) { try { return category.cast(registry.getServiceProviderByClass(Class.forName(providerClassName))); } catch (ClassNotFoundException ignore) { return null; } }
[ "public", "static", "<", "T", ">", "T", "lookupProviderByName", "(", "final", "ServiceRegistry", "registry", ",", "final", "String", "providerClassName", ",", "Class", "<", "T", ">", "category", ")", "{", "try", "{", "return", "category", ".", "cast", "(", ...
THIS METHOD WILL ME MOVED/RENAMED, DO NOT USE. @param registry the registry to lookup from. @param providerClassName name of the provider class. @param category provider category @return the provider instance, or {@code null}.
[ "THIS", "METHOD", "WILL", "ME", "MOVED", "/", "RENAMED", "DO", "NOT", "USE", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/util/IIOUtil.java#L180-L187
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryUtils.java
QueryUtils.appendQueryPageComments
public static void appendQueryPageComments(RequestContext requestContext, QueryPage queryPage) { QueryQuestionCommentDAO queryQuestionCommentDAO = new QueryQuestionCommentDAO(); PanelStamp activeStamp = RequestUtils.getActiveStamp(requestContext); List<QueryQuestionComment> rootComments = queryQuestionCommentDAO.listRootCommentsByQueryPageAndStampOrderByCreated(queryPage, activeStamp); Map<Long, List<QueryQuestionComment>> childComments = queryQuestionCommentDAO.listTreesByQueryPageAndStampOrderByCreated(queryPage, activeStamp); QueryUtils.appendQueryPageRootComments(requestContext, queryPage.getId(), rootComments); QueryUtils.appendQueryPageChildComments(requestContext, childComments); int commentCount = rootComments.size(); for (Object key : childComments.keySet()) { List<QueryQuestionComment> childCommentList = childComments.get(key); if (childCommentList != null) commentCount += childCommentList.size(); } requestContext.getRequest().setAttribute("queryPageCommentCount", commentCount); }
java
public static void appendQueryPageComments(RequestContext requestContext, QueryPage queryPage) { QueryQuestionCommentDAO queryQuestionCommentDAO = new QueryQuestionCommentDAO(); PanelStamp activeStamp = RequestUtils.getActiveStamp(requestContext); List<QueryQuestionComment> rootComments = queryQuestionCommentDAO.listRootCommentsByQueryPageAndStampOrderByCreated(queryPage, activeStamp); Map<Long, List<QueryQuestionComment>> childComments = queryQuestionCommentDAO.listTreesByQueryPageAndStampOrderByCreated(queryPage, activeStamp); QueryUtils.appendQueryPageRootComments(requestContext, queryPage.getId(), rootComments); QueryUtils.appendQueryPageChildComments(requestContext, childComments); int commentCount = rootComments.size(); for (Object key : childComments.keySet()) { List<QueryQuestionComment> childCommentList = childComments.get(key); if (childCommentList != null) commentCount += childCommentList.size(); } requestContext.getRequest().setAttribute("queryPageCommentCount", commentCount); }
[ "public", "static", "void", "appendQueryPageComments", "(", "RequestContext", "requestContext", ",", "QueryPage", "queryPage", ")", "{", "QueryQuestionCommentDAO", "queryQuestionCommentDAO", "=", "new", "QueryQuestionCommentDAO", "(", ")", ";", "PanelStamp", "activeStamp", ...
Loads the whole comment tree and appends it to requestContext for JSP to read. @param requestContext Smvcj request context @param queryPage query page
[ "Loads", "the", "whole", "comment", "tree", "and", "appends", "it", "to", "requestContext", "for", "JSP", "to", "read", "." ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryUtils.java#L137-L155
duracloud/duracloud
s3storageprovider/src/main/java/org/duracloud/s3task/streaming/BaseStreamingTaskRunner.java
BaseStreamingTaskRunner.setDistributionState
protected void setDistributionState(String distId, boolean enabled) { GetStreamingDistributionConfigResult result = cfClient.getStreamingDistributionConfig( new GetStreamingDistributionConfigRequest(distId)); StreamingDistributionConfig distConfig = result.getStreamingDistributionConfig(); distConfig.setEnabled(enabled); cfClient.updateStreamingDistribution( new UpdateStreamingDistributionRequest() .withStreamingDistributionConfig(distConfig) .withIfMatch(result.getETag()) .withId(distId)); }
java
protected void setDistributionState(String distId, boolean enabled) { GetStreamingDistributionConfigResult result = cfClient.getStreamingDistributionConfig( new GetStreamingDistributionConfigRequest(distId)); StreamingDistributionConfig distConfig = result.getStreamingDistributionConfig(); distConfig.setEnabled(enabled); cfClient.updateStreamingDistribution( new UpdateStreamingDistributionRequest() .withStreamingDistributionConfig(distConfig) .withIfMatch(result.getETag()) .withId(distId)); }
[ "protected", "void", "setDistributionState", "(", "String", "distId", ",", "boolean", "enabled", ")", "{", "GetStreamingDistributionConfigResult", "result", "=", "cfClient", ".", "getStreamingDistributionConfig", "(", "new", "GetStreamingDistributionConfigRequest", "(", "di...
Enables or disables an existing distribution @param distId the ID of the distribution @param enabled true to enable, false to disable
[ "Enables", "or", "disables", "an", "existing", "distribution" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/s3storageprovider/src/main/java/org/duracloud/s3task/streaming/BaseStreamingTaskRunner.java#L120-L134
apache/incubator-gobblin
gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/source/extractor/extract/google/GoogleDriveSource.java
GoogleDriveSource.initFileSystemHelper
@Override public synchronized void initFileSystemHelper(State state) throws FileBasedHelperException { if (fsHelper == null) { Credential credential = new GoogleCommon.CredentialBuilder(state.getProp(SOURCE_CONN_PRIVATE_KEY), state.getPropAsList(API_SCOPES)) .fileSystemUri(state.getProp(PRIVATE_KEY_FILESYSTEM_URI)) .proxyUrl(state.getProp(SOURCE_CONN_USE_PROXY_URL)) .port(state.getProp(SOURCE_CONN_USE_PROXY_PORT)) .serviceAccountId(state.getProp(SOURCE_CONN_USERNAME)) .build(); Drive driveClient = new Drive.Builder(credential.getTransport(), GoogleCommon.getJsonFactory(), credential) .setApplicationName(Preconditions.checkNotNull(state.getProp(APPLICATION_NAME), "ApplicationName is required")) .build(); this.fsHelper = closer.register(new GoogleDriveFsHelper(state, driveClient)); } }
java
@Override public synchronized void initFileSystemHelper(State state) throws FileBasedHelperException { if (fsHelper == null) { Credential credential = new GoogleCommon.CredentialBuilder(state.getProp(SOURCE_CONN_PRIVATE_KEY), state.getPropAsList(API_SCOPES)) .fileSystemUri(state.getProp(PRIVATE_KEY_FILESYSTEM_URI)) .proxyUrl(state.getProp(SOURCE_CONN_USE_PROXY_URL)) .port(state.getProp(SOURCE_CONN_USE_PROXY_PORT)) .serviceAccountId(state.getProp(SOURCE_CONN_USERNAME)) .build(); Drive driveClient = new Drive.Builder(credential.getTransport(), GoogleCommon.getJsonFactory(), credential) .setApplicationName(Preconditions.checkNotNull(state.getProp(APPLICATION_NAME), "ApplicationName is required")) .build(); this.fsHelper = closer.register(new GoogleDriveFsHelper(state, driveClient)); } }
[ "@", "Override", "public", "synchronized", "void", "initFileSystemHelper", "(", "State", "state", ")", "throws", "FileBasedHelperException", "{", "if", "(", "fsHelper", "==", "null", ")", "{", "Credential", "credential", "=", "new", "GoogleCommon", ".", "Credentia...
Initialize file system helper at most once for this instance. {@inheritDoc} @see org.apache.gobblin.source.extractor.filebased.FileBasedSource#initFileSystemHelper(org.apache.gobblin.configuration.State)
[ "Initialize", "file", "system", "helper", "at", "most", "once", "for", "this", "instance", ".", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/source/extractor/extract/google/GoogleDriveSource.java#L77-L94
apollographql/apollo-android
apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java
ApolloCallTracker.activeQueryCalls
@NotNull Set<ApolloQueryCall> activeQueryCalls(@NotNull OperationName operationName) { return activeCalls(activeQueryCalls, operationName); }
java
@NotNull Set<ApolloQueryCall> activeQueryCalls(@NotNull OperationName operationName) { return activeCalls(activeQueryCalls, operationName); }
[ "@", "NotNull", "Set", "<", "ApolloQueryCall", ">", "activeQueryCalls", "(", "@", "NotNull", "OperationName", "operationName", ")", "{", "return", "activeCalls", "(", "activeQueryCalls", ",", "operationName", ")", ";", "}" ]
Returns currently active {@link ApolloQueryCall} calls by operation name. @param operationName query operation name @return set of active query calls
[ "Returns", "currently", "active", "{", "@link", "ApolloQueryCall", "}", "calls", "by", "operation", "name", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java#L150-L152
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/common/NodeEntryImpl.java
NodeEntryImpl.setAttribute
public String setAttribute(final String name, final String value) { if(null!=value){ return getAttributes().put(name, value); }else{ getAttributes().remove(name); return value; } }
java
public String setAttribute(final String name, final String value) { if(null!=value){ return getAttributes().put(name, value); }else{ getAttributes().remove(name); return value; } }
[ "public", "String", "setAttribute", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "if", "(", "null", "!=", "value", ")", "{", "return", "getAttributes", "(", ")", ".", "put", "(", "name", ",", "value", ")", ";", "}", "els...
Set the value for a specific attribute @param name attribute name @param value attribute value @return value
[ "Set", "the", "value", "for", "a", "specific", "attribute" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/NodeEntryImpl.java#L411-L418
networknt/light-4j
client/src/main/java/com/networknt/client/oauth/OauthHelper.java
OauthHelper.setScope
private static void setScope(TokenRequest tokenRequest, Jwt jwt) { if(jwt.getKey() != null && !jwt.getKey().getScopes().isEmpty()) { tokenRequest.setScope(new ArrayList<String>() {{ addAll(jwt.getKey().getScopes()); }}); } }
java
private static void setScope(TokenRequest tokenRequest, Jwt jwt) { if(jwt.getKey() != null && !jwt.getKey().getScopes().isEmpty()) { tokenRequest.setScope(new ArrayList<String>() {{ addAll(jwt.getKey().getScopes()); }}); } }
[ "private", "static", "void", "setScope", "(", "TokenRequest", "tokenRequest", ",", "Jwt", "jwt", ")", "{", "if", "(", "jwt", ".", "getKey", "(", ")", "!=", "null", "&&", "!", "jwt", ".", "getKey", "(", ")", ".", "getScopes", "(", ")", ".", "isEmpty",...
if scopes in jwt.getKey() has value, use this scope otherwise remains the default scope value which already inside tokenRequest when create ClientCredentialsRequest; @param tokenRequest @param jwt
[ "if", "scopes", "in", "jwt", ".", "getKey", "()", "has", "value", "use", "this", "scope", "otherwise", "remains", "the", "default", "scope", "value", "which", "already", "inside", "tokenRequest", "when", "create", "ClientCredentialsRequest", ";" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L670-L674
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoLocationUtil.java
GeoLocationUtil.epsilonEqualsDistance
@Pure public static boolean epsilonEqualsDistance(Point3D<?, ?> p1, Point3D<?, ?> p2) { final double distance = p1.getDistance(p2); return distance >= -distancePrecision && distance <= distancePrecision; }
java
@Pure public static boolean epsilonEqualsDistance(Point3D<?, ?> p1, Point3D<?, ?> p2) { final double distance = p1.getDistance(p2); return distance >= -distancePrecision && distance <= distancePrecision; }
[ "@", "Pure", "public", "static", "boolean", "epsilonEqualsDistance", "(", "Point3D", "<", "?", ",", "?", ">", "p1", ",", "Point3D", "<", "?", ",", "?", ">", "p2", ")", "{", "final", "double", "distance", "=", "p1", ".", "getDistance", "(", "p2", ")",...
Replies if the specified points are approximatively equal. This function uses the distance precision. @param p1 the first point. @param p2 the second point. @return <code>true</code> if both points are equal, otherwise <code>false</code>
[ "Replies", "if", "the", "specified", "points", "are", "approximatively", "equal", ".", "This", "function", "uses", "the", "distance", "precision", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoLocationUtil.java#L108-L112
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ConstantInterfaceMethodInfo.java
ConstantInterfaceMethodInfo.make
static ConstantInterfaceMethodInfo make (ConstantPool cp, ConstantClassInfo parentClass, ConstantNameAndTypeInfo nameAndType) { ConstantInfo ci = new ConstantInterfaceMethodInfo(parentClass, nameAndType); return (ConstantInterfaceMethodInfo)cp.addConstant(ci); }
java
static ConstantInterfaceMethodInfo make (ConstantPool cp, ConstantClassInfo parentClass, ConstantNameAndTypeInfo nameAndType) { ConstantInfo ci = new ConstantInterfaceMethodInfo(parentClass, nameAndType); return (ConstantInterfaceMethodInfo)cp.addConstant(ci); }
[ "static", "ConstantInterfaceMethodInfo", "make", "(", "ConstantPool", "cp", ",", "ConstantClassInfo", "parentClass", ",", "ConstantNameAndTypeInfo", "nameAndType", ")", "{", "ConstantInfo", "ci", "=", "new", "ConstantInterfaceMethodInfo", "(", "parentClass", ",", "nameAnd...
Will return either a new ConstantInterfaceMethodInfo object or one already in the constant pool. If it is a new ConstantInterfaceMethodInfo, it will be inserted into the pool.
[ "Will", "return", "either", "a", "new", "ConstantInterfaceMethodInfo", "object", "or", "one", "already", "in", "the", "constant", "pool", ".", "If", "it", "is", "a", "new", "ConstantInterfaceMethodInfo", "it", "will", "be", "inserted", "into", "the", "pool", "...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ConstantInterfaceMethodInfo.java#L37-L45
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeWord2VecModel
public static void writeWord2VecModel(Word2Vec vectors, File file) { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream stream = new BufferedOutputStream(fos)) { writeWord2VecModel(vectors, stream); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void writeWord2VecModel(Word2Vec vectors, File file) { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream stream = new BufferedOutputStream(fos)) { writeWord2VecModel(vectors, stream); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "writeWord2VecModel", "(", "Word2Vec", "vectors", ",", "File", "file", ")", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "BufferedOutputStream", "stream", "=", "new", "BufferedOutp...
This method saves Word2Vec model into compressed zip file and sends it to output stream PLEASE NOTE: This method saves FULL model, including syn0 AND syn1
[ "This", "method", "saves", "Word2Vec", "model", "into", "compressed", "zip", "file", "and", "sends", "it", "to", "output", "stream", "PLEASE", "NOTE", ":", "This", "method", "saves", "FULL", "model", "including", "syn0", "AND", "syn1" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L428-L435
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryTransactionByID
public TransactionInfo queryTransactionByID(String txID, User userContext) throws ProposalException, InvalidArgumentException { return queryTransactionByID(getShuffledPeers(EnumSet.of(PeerRole.LEDGER_QUERY)), txID, userContext); }
java
public TransactionInfo queryTransactionByID(String txID, User userContext) throws ProposalException, InvalidArgumentException { return queryTransactionByID(getShuffledPeers(EnumSet.of(PeerRole.LEDGER_QUERY)), txID, userContext); }
[ "public", "TransactionInfo", "queryTransactionByID", "(", "String", "txID", ",", "User", "userContext", ")", "throws", "ProposalException", ",", "InvalidArgumentException", "{", "return", "queryTransactionByID", "(", "getShuffledPeers", "(", "EnumSet", ".", "of", "(", ...
Query this channel for a Fabric Transaction given its transactionID. The request is sent to a random peer in the channel. <STRONG>This method may not be thread safe if client context is changed!</STRONG> @param txID the ID of the transaction @param userContext the user context used. @return a {@link TransactionInfo} @throws ProposalException @throws InvalidArgumentException
[ "Query", "this", "channel", "for", "a", "Fabric", "Transaction", "given", "its", "transactionID", ".", "The", "request", "is", "sent", "to", "a", "random", "peer", "in", "the", "channel", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3180-L3182
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jAliasResolver.java
Neo4jAliasResolver.createAliasForEmbedded
public String createAliasForEmbedded(String entityAlias, List<String> propertyPathWithoutAlias, boolean optionalMatch) { return createAliasForRelationship( entityAlias, propertyPathWithoutAlias, NodeLabel.EMBEDDED.name(), optionalMatch ); }
java
public String createAliasForEmbedded(String entityAlias, List<String> propertyPathWithoutAlias, boolean optionalMatch) { return createAliasForRelationship( entityAlias, propertyPathWithoutAlias, NodeLabel.EMBEDDED.name(), optionalMatch ); }
[ "public", "String", "createAliasForEmbedded", "(", "String", "entityAlias", ",", "List", "<", "String", ">", "propertyPathWithoutAlias", ",", "boolean", "optionalMatch", ")", "{", "return", "createAliasForRelationship", "(", "entityAlias", ",", "propertyPathWithoutAlias",...
Given the path to an embedded property, it will create an alias to use in the query for the embedded containing the property. <p> The alias will be saved and can be returned using the method {@link #findAlias(String, List)}. <p> For example, using n as entity alias and [embedded, anotherEmbedded] as path to the embedded will return "_n2" as alias for "n.embedded.anotherEmbedded". <p> Note that you need to create an alias for every embedded/association in the path before this one. @param entityAlias the alias of the entity that contains the embedded @param propertyPathWithoutAlias the path to the property without the alias @param optionalMatch if true, the alias does not represent a required match in the query (It will appear in the OPTIONAL MATCH clause) @return the alias of the embedded containing the property
[ "Given", "the", "path", "to", "an", "embedded", "property", "it", "will", "create", "an", "alias", "to", "use", "in", "the", "query", "for", "the", "embedded", "containing", "the", "property", ".", "<p", ">", "The", "alias", "will", "be", "saved", "and",...
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jAliasResolver.java#L62-L64
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/URI.java
URI.setScheme
public void setScheme(String p_scheme) throws MalformedURIException { if (p_scheme == null) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_SCHEME_FROM_NULL_STRING, null)); //"Cannot set scheme from null string!"); } if (!isConformantSchemeName(p_scheme)) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_SCHEME_NOT_CONFORMANT, null)); //"The scheme is not conformant."); } m_scheme = p_scheme.toLowerCase(); }
java
public void setScheme(String p_scheme) throws MalformedURIException { if (p_scheme == null) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_SCHEME_FROM_NULL_STRING, null)); //"Cannot set scheme from null string!"); } if (!isConformantSchemeName(p_scheme)) { throw new MalformedURIException(Utils.messages.createMessage(MsgKey.ER_SCHEME_NOT_CONFORMANT, null)); //"The scheme is not conformant."); } m_scheme = p_scheme.toLowerCase(); }
[ "public", "void", "setScheme", "(", "String", "p_scheme", ")", "throws", "MalformedURIException", "{", "if", "(", "p_scheme", "==", "null", ")", "{", "throw", "new", "MalformedURIException", "(", "Utils", ".", "messages", ".", "createMessage", "(", "MsgKey", "...
Set the scheme for this URI. The scheme is converted to lowercase before it is set. @param p_scheme the scheme for this URI (cannot be null) @throws MalformedURIException if p_scheme is not a conformant scheme name
[ "Set", "the", "scheme", "for", "this", "URI", ".", "The", "scheme", "is", "converted", "to", "lowercase", "before", "it", "is", "set", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/URI.java#L1016-L1030
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java
ResourceBundlesHandlerImpl.storeBundle
private void storeBundle(String bundleId, JoinableResourceBundleContent store) { stopProcessIfNeeded(); if (bundleMustBeProcessedInLive(store.getContent().toString())) { liveProcessBundles.add(bundleId); } resourceBundleHandler.storeBundle(bundleId, store); }
java
private void storeBundle(String bundleId, JoinableResourceBundleContent store) { stopProcessIfNeeded(); if (bundleMustBeProcessedInLive(store.getContent().toString())) { liveProcessBundles.add(bundleId); } resourceBundleHandler.storeBundle(bundleId, store); }
[ "private", "void", "storeBundle", "(", "String", "bundleId", ",", "JoinableResourceBundleContent", "store", ")", "{", "stopProcessIfNeeded", "(", ")", ";", "if", "(", "bundleMustBeProcessedInLive", "(", "store", ".", "getContent", "(", ")", ".", "toString", "(", ...
Store the bundle @param bundleId the bundle Id to store @param store the bundle
[ "Store", "the", "bundle" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java#L1263-L1271
telly/MrVector
library/src/main/java/com/telly/mrvector/Utils.java
Utils.parseTintMode
@TargetApi(Build.VERSION_CODES.HONEYCOMB) static Mode parseTintMode(int value, Mode defaultMode) { switch (value) { case 3: return Mode.SRC_OVER; case 5: return Mode.SRC_IN; case 9: return Mode.SRC_ATOP; case 14: return Mode.MULTIPLY; case 15: return Mode.SCREEN; case 16: if(HONEYCOMB_PLUS) { return Mode.ADD; } default: return defaultMode; } }
java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) static Mode parseTintMode(int value, Mode defaultMode) { switch (value) { case 3: return Mode.SRC_OVER; case 5: return Mode.SRC_IN; case 9: return Mode.SRC_ATOP; case 14: return Mode.MULTIPLY; case 15: return Mode.SCREEN; case 16: if(HONEYCOMB_PLUS) { return Mode.ADD; } default: return defaultMode; } }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "static", "Mode", "parseTintMode", "(", "int", "value", ",", "Mode", "defaultMode", ")", "{", "switch", "(", "value", ")", "{", "case", "3", ":", "return", "Mode", ".", "SRC_OVE...
Parses a {@link Mode} from a tintMode attribute's enum value. @hide
[ "Parses", "a", "{", "@link", "Mode", "}", "from", "a", "tintMode", "attribute", "s", "enum", "value", "." ]
train
https://github.com/telly/MrVector/blob/846cd05ab6e57dcdc1cae28e796ac84b1d6365d5/library/src/main/java/com/telly/mrvector/Utils.java#L88-L105
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/netty/ByteBufUtil.java
ByteBufUtil.writeXid
public static void writeXid(ByteBuf buf, Xid xid) { if (xid instanceof RemoteXid) { ((RemoteXid) xid).writeTo(buf); } else { ByteBufUtil.writeSignedVInt(buf, xid.getFormatId()); writeArray(buf, xid.getGlobalTransactionId()); writeArray(buf, xid.getBranchQualifier()); } }
java
public static void writeXid(ByteBuf buf, Xid xid) { if (xid instanceof RemoteXid) { ((RemoteXid) xid).writeTo(buf); } else { ByteBufUtil.writeSignedVInt(buf, xid.getFormatId()); writeArray(buf, xid.getGlobalTransactionId()); writeArray(buf, xid.getBranchQualifier()); } }
[ "public", "static", "void", "writeXid", "(", "ByteBuf", "buf", ",", "Xid", "xid", ")", "{", "if", "(", "xid", "instanceof", "RemoteXid", ")", "{", "(", "(", "RemoteXid", ")", "xid", ")", ".", "writeTo", "(", "buf", ")", ";", "}", "else", "{", "Byte...
Writes the {@link Xid} to the {@link ByteBuf}. @param buf the buffer to write to. @param xid the {@link Xid} to encode
[ "Writes", "the", "{", "@link", "Xid", "}", "to", "the", "{", "@link", "ByteBuf", "}", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transport/netty/ByteBufUtil.java#L162-L170
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java
ImageMiscOps.insertBand
public static void insertBand( GrayF64 input, int band , InterleavedF64 output) { final int numBands = output.numBands; for (int y = 0; y < input.height; y++) { int indexIn = input.getStartIndex() + y * input.getStride(); int indexOut = output.getStartIndex() + y * output.getStride() + band; int end = indexOut + output.width*numBands - band; for (; indexOut < end; indexOut += numBands , indexIn++ ) { output.data[indexOut] = input.data[indexIn]; } } }
java
public static void insertBand( GrayF64 input, int band , InterleavedF64 output) { final int numBands = output.numBands; for (int y = 0; y < input.height; y++) { int indexIn = input.getStartIndex() + y * input.getStride(); int indexOut = output.getStartIndex() + y * output.getStride() + band; int end = indexOut + output.width*numBands - band; for (; indexOut < end; indexOut += numBands , indexIn++ ) { output.data[indexOut] = input.data[indexIn]; } } }
[ "public", "static", "void", "insertBand", "(", "GrayF64", "input", ",", "int", "band", ",", "InterleavedF64", "output", ")", "{", "final", "int", "numBands", "=", "output", ".", "numBands", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "input",...
Inserts a single band into a multi-band image overwriting the original band @param input Single band image @param band Which band the image is to be inserted into @param output The multi-band image which the input image is to be inserted into
[ "Inserts", "a", "single", "band", "into", "a", "multi", "-", "band", "image", "overwriting", "the", "original", "band" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageMiscOps.java#L2866-L2877
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.addMapDocument
public String addMapDocument(String indexName, Map bean, ClientOptions clientOptions) throws ElasticSearchException{ return addDateMapDocument( indexName, _doc, bean,clientOptions); }
java
public String addMapDocument(String indexName, Map bean, ClientOptions clientOptions) throws ElasticSearchException{ return addDateMapDocument( indexName, _doc, bean,clientOptions); }
[ "public", "String", "addMapDocument", "(", "String", "indexName", ",", "Map", "bean", ",", "ClientOptions", "clientOptions", ")", "throws", "ElasticSearchException", "{", "return", "addDateMapDocument", "(", "indexName", ",", "_doc", ",", "bean", ",", "clientOptions...
创建或者更新索引文档 For Elasticsearch 7 and 7+ @param indexName @param bean @return @throws ElasticSearchException
[ "创建或者更新索引文档", "For", "Elasticsearch", "7", "and", "7", "+" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L4415-L4417
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriPathSegment
public static void unescapeUriPathSegment(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.unescape(reader, writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding); }
java
public static void unescapeUriPathSegment(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.unescape(reader, writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding); }
[ "public", "static", "void", "unescapeUriPathSegment", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "Ill...
<p> Perform am URI path segment <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use specified <tt>encoding</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for unescaping. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", "."...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L2219-L2232
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DifferenceEvaluators.java
DifferenceEvaluators.ignorePrologDifferencesExceptDoctype
public static DifferenceEvaluator ignorePrologDifferencesExceptDoctype() { return new DifferenceEvaluator() { @Override public ComparisonResult evaluate(Comparison comparison, ComparisonResult orig) { return belongsToProlog(comparison, false) || isSequenceOfRootElement(comparison) ? ComparisonResult.EQUAL : orig; } }; }
java
public static DifferenceEvaluator ignorePrologDifferencesExceptDoctype() { return new DifferenceEvaluator() { @Override public ComparisonResult evaluate(Comparison comparison, ComparisonResult orig) { return belongsToProlog(comparison, false) || isSequenceOfRootElement(comparison) ? ComparisonResult.EQUAL : orig; } }; }
[ "public", "static", "DifferenceEvaluator", "ignorePrologDifferencesExceptDoctype", "(", ")", "{", "return", "new", "DifferenceEvaluator", "(", ")", "{", "@", "Override", "public", "ComparisonResult", "evaluate", "(", "Comparison", "comparison", ",", "ComparisonResult", ...
Ignore any differences except differences inside the doctype declaration that are part of the <a href="https://www.w3.org/TR/2008/REC-xml-20081126/#sec-prolog-dtd">XML prolog</a>. <p>Here "ignore" means return {@code ComparisonResult.EQUAL}.</p> <p>This is one of the building blocks for mimicing the behavior of XMLUnit for Java 1.x. In order to get the same behavior you need:</p> <pre> chain(Default, // so CDATA and Text are the same ignorePrologDifferencesExceptDoctype()) // so most of the prolog is ignored </pre> <p>In general different doctype declarations will be ignored because of {@link NodeFilters.Default}, so if you want to detect these differences you need to pick a different {@code NodeFilter}.</p> @since XMLUnit 2.1.0
[ "Ignore", "any", "differences", "except", "differences", "inside", "the", "doctype", "declaration", "that", "are", "part", "of", "the", "<a", "href", "=", "https", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "2008", "/", "REC", "-", "xml",...
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DifferenceEvaluators.java#L203-L212
libgdx/gdx-ai
gdx-ai/src/com/badlogic/gdx/ai/utils/ArithmeticUtils.java
ArithmeticUtils.lcmPositive
public static int lcmPositive (int a, int b) throws ArithmeticException { if (a == 0 || b == 0) return 0; int lcm = Math.abs(mulAndCheck(a / gcdPositive(a, b), b)); if (lcm == Integer.MIN_VALUE) { throw new ArithmeticException("overflow: lcm(" + a + ", " + b + ") > 2^31"); } return lcm; }
java
public static int lcmPositive (int a, int b) throws ArithmeticException { if (a == 0 || b == 0) return 0; int lcm = Math.abs(mulAndCheck(a / gcdPositive(a, b), b)); if (lcm == Integer.MIN_VALUE) { throw new ArithmeticException("overflow: lcm(" + a + ", " + b + ") > 2^31"); } return lcm; }
[ "public", "static", "int", "lcmPositive", "(", "int", "a", ",", "int", "b", ")", "throws", "ArithmeticException", "{", "if", "(", "a", "==", "0", "||", "b", "==", "0", ")", "return", "0", ";", "int", "lcm", "=", "Math", ".", "abs", "(", "mulAndChec...
Returns the least common multiple of the absolute value of two numbers, using the formula {@code lcm(a, b) = (a / gcd(a, b)) * b}. <p> Special cases: <ul> <li>The invocations {@code lcm(Integer.MIN_VALUE, n)} and {@code lcm(n, Integer.MIN_VALUE)}, where {@code abs(n)} is a power of 2, throw an {@code ArithmeticException}, because the result would be 2^31, which is too large for an {@code int} value.</li> <li>The result of {@code lcm(0, x)} and {@code lcm(x, 0)} is {@code 0} for any {@code x}. </ul> @param a a non-negative number. @param b a non-negative number. @return the least common multiple, never negative. @throws ArithmeticException if the result cannot be represented as a non-negative {@code int} value.
[ "Returns", "the", "least", "common", "multiple", "of", "the", "absolute", "value", "of", "two", "numbers", "using", "the", "formula", "{", "@code", "lcm", "(", "a", "b", ")", "=", "(", "a", "/", "gcd", "(", "a", "b", "))", "*", "b", "}", ".", "<p...
train
https://github.com/libgdx/gdx-ai/blob/2d1523a97193a45e18e11a4837c6800d08f177c5/gdx-ai/src/com/badlogic/gdx/ai/utils/ArithmeticUtils.java#L102-L110
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolableConnection.java
PoolableConnection.setClientInfo
@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { internalConn.setClientInfo(name, value); }
java
@Override public void setClientInfo(String name, String value) throws SQLClientInfoException { internalConn.setClientInfo(name, value); }
[ "@", "Override", "public", "void", "setClientInfo", "(", "String", "name", ",", "String", "value", ")", "throws", "SQLClientInfoException", "{", "internalConn", ".", "setClientInfo", "(", "name", ",", "value", ")", ";", "}" ]
Method setClientInfo. @param name @param value @throws SQLClientInfoException @see java.sql.Connection#setClientInfo(String, String)
[ "Method", "setClientInfo", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolableConnection.java#L857-L860
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/notifications/ApptentiveNotificationCenter.java
ApptentiveNotificationCenter.addObserver
public synchronized ApptentiveNotificationCenter addObserver(String notification, ApptentiveNotificationObserver observer) { addObserver(notification, observer, false); return this; }
java
public synchronized ApptentiveNotificationCenter addObserver(String notification, ApptentiveNotificationObserver observer) { addObserver(notification, observer, false); return this; }
[ "public", "synchronized", "ApptentiveNotificationCenter", "addObserver", "(", "String", "notification", ",", "ApptentiveNotificationObserver", "observer", ")", "{", "addObserver", "(", "notification", ",", "observer", ",", "false", ")", ";", "return", "this", ";", "}"...
Adds an entry to the receiver’s dispatch table with an observer using strong reference.
[ "Adds", "an", "entry", "to", "the", "receiver’s", "dispatch", "table", "with", "an", "observer", "using", "strong", "reference", "." ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/notifications/ApptentiveNotificationCenter.java#L45-L48
norbsoft/android-typeface-helper
lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java
TypefaceHelper.applyTypeface
private static void applyTypeface(ViewGroup viewGroup, TypefaceCollection typefaceCollection) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View childView = viewGroup.getChildAt(i); if (childView instanceof ViewGroup) { applyTypeface((ViewGroup) childView, typefaceCollection); } else { applyForView(childView, typefaceCollection); } } }
java
private static void applyTypeface(ViewGroup viewGroup, TypefaceCollection typefaceCollection) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View childView = viewGroup.getChildAt(i); if (childView instanceof ViewGroup) { applyTypeface((ViewGroup) childView, typefaceCollection); } else { applyForView(childView, typefaceCollection); } } }
[ "private", "static", "void", "applyTypeface", "(", "ViewGroup", "viewGroup", ",", "TypefaceCollection", "typefaceCollection", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "viewGroup", ".", "getChildCount", "(", ")", ";", "i", "++", ")", "{", ...
Apply typeface to all ViewGroup childs @param viewGroup to typeface typeface @param typefaceCollection typeface collection
[ "Apply", "typeface", "to", "all", "ViewGroup", "childs" ]
train
https://github.com/norbsoft/android-typeface-helper/blob/f9e12655f01144efa937c1172f5de7f9b29c4df7/lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java#L226-L236
JetBrains/xodus
entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java
PersistentEntityStoreImpl.deleteEntity
boolean deleteEntity(@NotNull final PersistentStoreTransaction txn, @NotNull final PersistentEntity entity) { clearProperties(txn, entity); clearBlobs(txn, entity); deleteLinks(txn, entity); final PersistentEntityId id = entity.getId(); final int entityTypeId = id.getTypeId(); final long entityLocalId = id.getLocalId(); final ByteIterable key = LongBinding.longToCompressedEntry(entityLocalId); if (config.isDebugSearchForIncomingLinksOnDelete()) { // search for incoming links final List<String> allLinkNames = getAllLinkNames(txn); for (final String entityType : txn.getEntityTypes()) { for (final String linkName : allLinkNames) { //noinspection LoopStatementThatDoesntLoop for (final Entity referrer : txn.findLinks(entityType, entity, linkName)) { throw new EntityStoreException(entity + " is about to be deleted, but it is referenced by " + referrer + ", link name: " + linkName); } } } } if (getEntitiesTable(txn, entityTypeId).delete(txn.getEnvironmentTransaction(), key)) { txn.entityDeleted(id); return true; } return false; }
java
boolean deleteEntity(@NotNull final PersistentStoreTransaction txn, @NotNull final PersistentEntity entity) { clearProperties(txn, entity); clearBlobs(txn, entity); deleteLinks(txn, entity); final PersistentEntityId id = entity.getId(); final int entityTypeId = id.getTypeId(); final long entityLocalId = id.getLocalId(); final ByteIterable key = LongBinding.longToCompressedEntry(entityLocalId); if (config.isDebugSearchForIncomingLinksOnDelete()) { // search for incoming links final List<String> allLinkNames = getAllLinkNames(txn); for (final String entityType : txn.getEntityTypes()) { for (final String linkName : allLinkNames) { //noinspection LoopStatementThatDoesntLoop for (final Entity referrer : txn.findLinks(entityType, entity, linkName)) { throw new EntityStoreException(entity + " is about to be deleted, but it is referenced by " + referrer + ", link name: " + linkName); } } } } if (getEntitiesTable(txn, entityTypeId).delete(txn.getEnvironmentTransaction(), key)) { txn.entityDeleted(id); return true; } return false; }
[ "boolean", "deleteEntity", "(", "@", "NotNull", "final", "PersistentStoreTransaction", "txn", ",", "@", "NotNull", "final", "PersistentEntity", "entity", ")", "{", "clearProperties", "(", "txn", ",", "entity", ")", ";", "clearBlobs", "(", "txn", ",", "entity", ...
Deletes specified entity clearing all its properties and deleting all its outgoing links. @param entity to delete.
[ "Deletes", "specified", "entity", "clearing", "all", "its", "properties", "and", "deleting", "all", "its", "outgoing", "links", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/entity-store/src/main/java/jetbrains/exodus/entitystore/PersistentEntityStoreImpl.java#L1510-L1536
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.delPre
public static String delPre(String regex, CharSequence content) { if (null == content || null == regex) { return StrUtil.str(content); } // Pattern pattern = Pattern.compile(regex, Pattern.DOTALL); final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL); Matcher matcher = pattern.matcher(content); if (matcher.find()) { return StrUtil.sub(content, matcher.end(), content.length()); } return StrUtil.str(content); }
java
public static String delPre(String regex, CharSequence content) { if (null == content || null == regex) { return StrUtil.str(content); } // Pattern pattern = Pattern.compile(regex, Pattern.DOTALL); final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL); Matcher matcher = pattern.matcher(content); if (matcher.find()) { return StrUtil.sub(content, matcher.end(), content.length()); } return StrUtil.str(content); }
[ "public", "static", "String", "delPre", "(", "String", "regex", ",", "CharSequence", "content", ")", "{", "if", "(", "null", "==", "content", "||", "null", "==", "regex", ")", "{", "return", "StrUtil", ".", "str", "(", "content", ")", ";", "}", "// Pat...
删除正则匹配到的内容之前的字符 如果没有找到,则返回原文 @param regex 定位正则 @param content 被查找的内容 @return 删除前缀后的新内容
[ "删除正则匹配到的内容之前的字符", "如果没有找到,则返回原文" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L341-L353
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java
Util.readOID
private static String readOID(ByteArrayInputStream bais, int oid_len) throws IOException { byte[] oid_tmp_arr = new byte[oid_len]; bais.read(oid_tmp_arr, 0, oid_len); byte[] oid_arr = new byte[oid_len + 2]; oid_arr[0] = ASN_TAG_OID; oid_arr[1] = (byte) oid_len; System.arraycopy(oid_tmp_arr, 0, oid_arr, 2, oid_len); return decodeOID(oid_arr); }
java
private static String readOID(ByteArrayInputStream bais, int oid_len) throws IOException { byte[] oid_tmp_arr = new byte[oid_len]; bais.read(oid_tmp_arr, 0, oid_len); byte[] oid_arr = new byte[oid_len + 2]; oid_arr[0] = ASN_TAG_OID; oid_arr[1] = (byte) oid_len; System.arraycopy(oid_tmp_arr, 0, oid_arr, 2, oid_len); return decodeOID(oid_arr); }
[ "private", "static", "String", "readOID", "(", "ByteArrayInputStream", "bais", ",", "int", "oid_len", ")", "throws", "IOException", "{", "byte", "[", "]", "oid_tmp_arr", "=", "new", "byte", "[", "oid_len", "]", ";", "bais", ".", "read", "(", "oid_tmp_arr", ...
/* WARNING: The stream must have read up to the OID length. This method reads and decodes the OID after the length.
[ "/", "*", "WARNING", ":", "The", "stream", "must", "have", "read", "up", "to", "the", "OID", "length", ".", "This", "method", "reads", "and", "decodes", "the", "OID", "after", "the", "length", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L674-L682
PawelAdamski/HttpClientMock
src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java
HttpClientResponseBuilder.doReturnXML
public HttpClientResponseBuilder doReturnXML(String response, Charset charset) { return doReturn(response, charset).withHeader("Content-type", APPLICATION_XML.toString()); }
java
public HttpClientResponseBuilder doReturnXML(String response, Charset charset) { return doReturn(response, charset).withHeader("Content-type", APPLICATION_XML.toString()); }
[ "public", "HttpClientResponseBuilder", "doReturnXML", "(", "String", "response", ",", "Charset", "charset", ")", "{", "return", "doReturn", "(", "response", ",", "charset", ")", ".", "withHeader", "(", "\"Content-type\"", ",", "APPLICATION_XML", ".", "toString", "...
Adds action which returns provided XML in UTF-8 and status 200. Additionally it sets "Content-type" header to "application/xml". @param response JSON to return @return response builder
[ "Adds", "action", "which", "returns", "provided", "XML", "in", "UTF", "-", "8", "and", "status", "200", ".", "Additionally", "it", "sets", "Content", "-", "type", "header", "to", "application", "/", "xml", "." ]
train
https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java#L175-L177
Azure/azure-sdk-for-java
recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultsInner.java
VaultsInner.getByResourceGroup
public VaultInner getByResourceGroup(String resourceGroupName, String vaultName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vaultName).toBlocking().single().body(); }
java
public VaultInner getByResourceGroup(String resourceGroupName, String vaultName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vaultName).toBlocking().single().body(); }
[ "public", "VaultInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "vaultName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "vaultName", ")", ".", "toBlocking", "(", ")", ".", "single", ...
Get the Vault details. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param vaultName The name of the recovery services vault. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VaultInner object if successful.
[ "Get", "the", "Vault", "details", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/v2016_06_01/implementation/VaultsInner.java#L335-L337
alkacon/opencms-core
src/org/opencms/db/CmsLoginManager.java
CmsLoginManager.isPasswordReset
public boolean isPasswordReset(CmsObject cms, CmsUser user) { if (user.isManaged() || user.isWebuser() || OpenCms.getDefaultUsers().isDefaultUser(user.getName())) { return false; } if (user.getAdditionalInfo().get(CmsUserSettings.ADDITIONAL_INFO_PASSWORD_RESET) != null) { return true; } return false; }
java
public boolean isPasswordReset(CmsObject cms, CmsUser user) { if (user.isManaged() || user.isWebuser() || OpenCms.getDefaultUsers().isDefaultUser(user.getName())) { return false; } if (user.getAdditionalInfo().get(CmsUserSettings.ADDITIONAL_INFO_PASSWORD_RESET) != null) { return true; } return false; }
[ "public", "boolean", "isPasswordReset", "(", "CmsObject", "cms", ",", "CmsUser", "user", ")", "{", "if", "(", "user", ".", "isManaged", "(", ")", "||", "user", ".", "isWebuser", "(", ")", "||", "OpenCms", ".", "getDefaultUsers", "(", ")", ".", "isDefault...
Checks if password has to be reset.<p> @param cms CmsObject @param user CmsUser @return true if password should be reset
[ "Checks", "if", "password", "has", "to", "be", "reset", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L502-L511
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.incrementBytes
public static byte [] incrementBytes(byte[] value, long amount) { byte[] val = value; if (val.length < SIZEOF_LONG) { // Hopefully this doesn't happen too often. byte [] newvalue; if (val[0] < 0) { newvalue = new byte[]{-1, -1, -1, -1, -1, -1, -1, -1}; } else { newvalue = new byte[SIZEOF_LONG]; } System.arraycopy(val, 0, newvalue, newvalue.length - val.length, val.length); val = newvalue; } else if (val.length > SIZEOF_LONG) { throw new IllegalArgumentException("Increment Bytes - value too big: " + val.length); } if (amount == 0) { return val; } if (val[0] < 0) { return binaryIncrementNeg(val, amount); } return binaryIncrementPos(val, amount); }
java
public static byte [] incrementBytes(byte[] value, long amount) { byte[] val = value; if (val.length < SIZEOF_LONG) { // Hopefully this doesn't happen too often. byte [] newvalue; if (val[0] < 0) { newvalue = new byte[]{-1, -1, -1, -1, -1, -1, -1, -1}; } else { newvalue = new byte[SIZEOF_LONG]; } System.arraycopy(val, 0, newvalue, newvalue.length - val.length, val.length); val = newvalue; } else if (val.length > SIZEOF_LONG) { throw new IllegalArgumentException("Increment Bytes - value too big: " + val.length); } if (amount == 0) { return val; } if (val[0] < 0) { return binaryIncrementNeg(val, amount); } return binaryIncrementPos(val, amount); }
[ "public", "static", "byte", "[", "]", "incrementBytes", "(", "byte", "[", "]", "value", ",", "long", "amount", ")", "{", "byte", "[", "]", "val", "=", "value", ";", "if", "(", "val", ".", "length", "<", "SIZEOF_LONG", ")", "{", "// Hopefully this doesn...
Bytewise binary increment/deincrement of long contained in byte array on given amount. @param value - array of bytes containing long (length <= SIZEOF_LONG) @param amount value will be incremented on (deincremented if negative) @return array of bytes containing incremented long (length == SIZEOF_LONG)
[ "Bytewise", "binary", "increment", "/", "deincrement", "of", "long", "contained", "in", "byte", "array", "on", "given", "amount", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L1273-L1297
centic9/commons-test
src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java
SafeCloseSmtpServer.handleTransaction
private List<SmtpMessage> handleTransaction(PrintWriter out, BufferedReader input) throws IOException { // Initialize the state machine SmtpState smtpState = SmtpState.CONNECT; SmtpRequest smtpRequest = new SmtpRequest(SmtpActionType.CONNECT, "", smtpState); // Execute the connection request SmtpResponse smtpResponse = smtpRequest.execute(); // Send initial response sendResponse(out, smtpResponse); smtpState = smtpResponse.getNextState(); List<SmtpMessage> msgList = new ArrayList<>(); SmtpMessage msg = new SmtpMessage(); while (smtpState != SmtpState.CONNECT) { String line = input.readLine(); if (line == null) { break; } // Create request from client input and current state SmtpRequest request = SmtpRequest.createRequest(line, smtpState); // Execute request and create response object SmtpResponse response = request.execute(); // Move to next internal state smtpState = response.getNextState(); // Send response to client sendResponse(out, response); // Store input in message String params = request.getParams(); msg.store(response, params); // If message reception is complete save it if (smtpState == SmtpState.QUIT) { msgList.add(msg); msg = new SmtpMessage(); } } return msgList; }
java
private List<SmtpMessage> handleTransaction(PrintWriter out, BufferedReader input) throws IOException { // Initialize the state machine SmtpState smtpState = SmtpState.CONNECT; SmtpRequest smtpRequest = new SmtpRequest(SmtpActionType.CONNECT, "", smtpState); // Execute the connection request SmtpResponse smtpResponse = smtpRequest.execute(); // Send initial response sendResponse(out, smtpResponse); smtpState = smtpResponse.getNextState(); List<SmtpMessage> msgList = new ArrayList<>(); SmtpMessage msg = new SmtpMessage(); while (smtpState != SmtpState.CONNECT) { String line = input.readLine(); if (line == null) { break; } // Create request from client input and current state SmtpRequest request = SmtpRequest.createRequest(line, smtpState); // Execute request and create response object SmtpResponse response = request.execute(); // Move to next internal state smtpState = response.getNextState(); // Send response to client sendResponse(out, response); // Store input in message String params = request.getParams(); msg.store(response, params); // If message reception is complete save it if (smtpState == SmtpState.QUIT) { msgList.add(msg); msg = new SmtpMessage(); } } return msgList; }
[ "private", "List", "<", "SmtpMessage", ">", "handleTransaction", "(", "PrintWriter", "out", ",", "BufferedReader", "input", ")", "throws", "IOException", "{", "// Initialize the state machine", "SmtpState", "smtpState", "=", "SmtpState", ".", "CONNECT", ";", "SmtpRequ...
Handle an SMTP transaction, i.e. all activity between initial connect and QUIT command. @param out output stream @param input input stream @return List of SmtpMessage
[ "Handle", "an", "SMTP", "transaction", "i", ".", "e", ".", "all", "activity", "between", "initial", "connect", "and", "QUIT", "command", "." ]
train
https://github.com/centic9/commons-test/blob/562047c198133ecb116f2472e9aeb15e866579f5/src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java#L200-L243
jMotif/GI
src/main/java/net/seninp/gi/clusterrule/DistanceComputation.java
DistanceComputation.calcDistTSAndPattern
protected double calcDistTSAndPattern(double[] ts, double[] pValue) { double INF = 10000000000000000000f; double bestDist = INF; int patternLen = pValue.length; int lastStartP = ts.length - pValue.length + 1; if (lastStartP < 1) return bestDist; Random rand = new Random(); int startP = rand.nextInt((lastStartP - 1 - 0) + 1); double[] slidingWindow = new double[patternLen]; System.arraycopy(ts, startP, slidingWindow, 0, patternLen); bestDist = eculideanDistNorm(pValue, slidingWindow); for (int i = 0; i < lastStartP; i++) { System.arraycopy(ts, i, slidingWindow, 0, patternLen); double tempDist = eculideanDistNormEAbandon(pValue, slidingWindow, bestDist); if (tempDist < bestDist) { bestDist = tempDist; } } return bestDist; }
java
protected double calcDistTSAndPattern(double[] ts, double[] pValue) { double INF = 10000000000000000000f; double bestDist = INF; int patternLen = pValue.length; int lastStartP = ts.length - pValue.length + 1; if (lastStartP < 1) return bestDist; Random rand = new Random(); int startP = rand.nextInt((lastStartP - 1 - 0) + 1); double[] slidingWindow = new double[patternLen]; System.arraycopy(ts, startP, slidingWindow, 0, patternLen); bestDist = eculideanDistNorm(pValue, slidingWindow); for (int i = 0; i < lastStartP; i++) { System.arraycopy(ts, i, slidingWindow, 0, patternLen); double tempDist = eculideanDistNormEAbandon(pValue, slidingWindow, bestDist); if (tempDist < bestDist) { bestDist = tempDist; } } return bestDist; }
[ "protected", "double", "calcDistTSAndPattern", "(", "double", "[", "]", "ts", ",", "double", "[", "]", "pValue", ")", "{", "double", "INF", "=", "10000000000000000000f", ";", "double", "bestDist", "=", "INF", ";", "int", "patternLen", "=", "pValue", ".", "...
Calculating the distance between time series and pattern. @param ts a series of points for time series. @param pValue a series of points for pattern. @return the distance value.
[ "Calculating", "the", "distance", "between", "time", "series", "and", "pattern", "." ]
train
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/clusterrule/DistanceComputation.java#L14-L42
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.fetchByUUID_G
@Override public CPDefinitionLink fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
java
@Override public CPDefinitionLink fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
[ "@", "Override", "public", "CPDefinitionLink", "fetchByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "return", "fetchByUUID_G", "(", "uuid", ",", "groupId", ",", "true", ")", ";", "}" ]
Returns the cp definition link where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching cp definition link, or <code>null</code> if a matching cp definition link could not be found
[ "Returns", "the", "cp", "definition", "link", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "c...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L701-L704
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_portability_id_status_GET
public ArrayList<OvhPortabilityStep> billingAccount_portability_id_status_GET(String billingAccount, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/portability/{id}/status"; StringBuilder sb = path(qPath, billingAccount, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
java
public ArrayList<OvhPortabilityStep> billingAccount_portability_id_status_GET(String billingAccount, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/portability/{id}/status"; StringBuilder sb = path(qPath, billingAccount, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
[ "public", "ArrayList", "<", "OvhPortabilityStep", ">", "billingAccount_portability_id_status_GET", "(", "String", "billingAccount", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/portability/{id}/status\"", ";", ...
Indicates the current status of the portability, with a list of steps REST: GET /telephony/{billingAccount}/portability/{id}/status @param billingAccount [required] The name of your billingAccount @param id [required] The ID of the portability
[ "Indicates", "the", "current", "status", "of", "the", "portability", "with", "a", "list", "of", "steps" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L404-L409
Viascom/groundwork
service-result/src/main/java/ch/viascom/groundwork/serviceresult/exception/ServiceFault.java
ServiceFault.addRequestParam
public ServiceFault addRequestParam(String key, String value) { if (requestParams == null) requestParams = new ArrayList<>(); requestParams.add(new NameValuePair(key, value)); return this; }
java
public ServiceFault addRequestParam(String key, String value) { if (requestParams == null) requestParams = new ArrayList<>(); requestParams.add(new NameValuePair(key, value)); return this; }
[ "public", "ServiceFault", "addRequestParam", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "requestParams", "==", "null", ")", "requestParams", "=", "new", "ArrayList", "<>", "(", ")", ";", "requestParams", ".", "add", "(", "new", "Nam...
Adds a name-value pair to the request parameter list. @return The fault which is used.
[ "Adds", "a", "name", "-", "value", "pair", "to", "the", "request", "parameter", "list", "." ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/service-result/src/main/java/ch/viascom/groundwork/serviceresult/exception/ServiceFault.java#L63-L70
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java
JsonFactory.fromString
public final <T> T fromString(String value, Class<T> destinationClass) throws IOException { return createJsonParser(value).parse(destinationClass); }
java
public final <T> T fromString(String value, Class<T> destinationClass) throws IOException { return createJsonParser(value).parse(destinationClass); }
[ "public", "final", "<", "T", ">", "T", "fromString", "(", "String", "value", ",", "Class", "<", "T", ">", "destinationClass", ")", "throws", "IOException", "{", "return", "createJsonParser", "(", "value", ")", ".", "parse", "(", "destinationClass", ")", ";...
Parses a string value as a JSON object, array, or value into a new instance of the given destination class using {@link JsonParser#parse(Class)}. @param value JSON string value @param destinationClass destination class that has an accessible default constructor to use to create a new instance @return new instance of the parsed destination class @since 1.4
[ "Parses", "a", "string", "value", "as", "a", "JSON", "object", "array", "or", "value", "into", "a", "new", "instance", "of", "the", "given", "destination", "class", "using", "{", "@link", "JsonParser#parse", "(", "Class", ")", "}", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/json/JsonFactory.java#L181-L183
mattprecious/telescope
telescope/src/main/java/com/mattprecious/telescope/FileProvider.java
FileProvider.attachInfo
@Override public void attachInfo(Context context, ProviderInfo info) { super.attachInfo(context, info); // Sanity check our security if (info.exported) { throw new SecurityException("Provider must not be exported"); } if (!info.grantUriPermissions) { throw new SecurityException("Provider must grant uri permissions"); } mStrategy = getPathStrategy(context, info.authority); }
java
@Override public void attachInfo(Context context, ProviderInfo info) { super.attachInfo(context, info); // Sanity check our security if (info.exported) { throw new SecurityException("Provider must not be exported"); } if (!info.grantUriPermissions) { throw new SecurityException("Provider must grant uri permissions"); } mStrategy = getPathStrategy(context, info.authority); }
[ "@", "Override", "public", "void", "attachInfo", "(", "Context", "context", ",", "ProviderInfo", "info", ")", "{", "super", ".", "attachInfo", "(", "context", ",", "info", ")", ";", "// Sanity check our security", "if", "(", "info", ".", "exported", ")", "{"...
After the FileProvider is instantiated, this method is called to provide the system with information about the provider. @param context A {@link Context} for the current component. @param info A {@link ProviderInfo} for the new provider.
[ "After", "the", "FileProvider", "is", "instantiated", "this", "method", "is", "called", "to", "provide", "the", "system", "with", "information", "about", "the", "provider", "." ]
train
https://github.com/mattprecious/telescope/blob/ce5e2710fb16ee214026fc25b091eb946fdbbb3c/telescope/src/main/java/com/mattprecious/telescope/FileProvider.java#L347-L359
StefanLiebenberg/kute
kute-core/src/main/java/slieb/kute/Kute.java
Kute.renameResource
public static RenamedPathResource renameResource(String path, Resource.Readable resource) { return new RenamedPathResource(path, resource); }
java
public static RenamedPathResource renameResource(String path, Resource.Readable resource) { return new RenamedPathResource(path, resource); }
[ "public", "static", "RenamedPathResource", "renameResource", "(", "String", "path", ",", "Resource", ".", "Readable", "resource", ")", "{", "return", "new", "RenamedPathResource", "(", "path", ",", "resource", ")", ";", "}" ]
Create a resource with alternate name @param resource Any resource. @param path The new path location for this resource. @return A resource of type A extends Resource that is a copy of the old resource, but with a new name.
[ "Create", "a", "resource", "with", "alternate", "name" ]
train
https://github.com/StefanLiebenberg/kute/blob/1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd/kute-core/src/main/java/slieb/kute/Kute.java#L176-L179
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/swap/SwapFragmentPanel.java
SwapFragmentPanel.onSwapToView
public void onSwapToView(final AjaxRequestTarget target, final Form<?> form) { if (target != null) { Animate.slideUpAndDown(edit, target); } else { LOGGER.error( "AjaxRequestTarget is null on method SwapFragmentPanel#onSwapToView(AjaxRequestTarget, Form)"); } swapFragments(); modeContext = ModeContext.VIEW_MODE; }
java
public void onSwapToView(final AjaxRequestTarget target, final Form<?> form) { if (target != null) { Animate.slideUpAndDown(edit, target); } else { LOGGER.error( "AjaxRequestTarget is null on method SwapFragmentPanel#onSwapToView(AjaxRequestTarget, Form)"); } swapFragments(); modeContext = ModeContext.VIEW_MODE; }
[ "public", "void", "onSwapToView", "(", "final", "AjaxRequestTarget", "target", ",", "final", "Form", "<", "?", ">", "form", ")", "{", "if", "(", "target", "!=", "null", ")", "{", "Animate", ".", "slideUpAndDown", "(", "edit", ",", "target", ")", ";", "...
Swaps from the edit fragment to the view fragment. @param target the target @param form the form
[ "Swaps", "from", "the", "edit", "fragment", "to", "the", "view", "fragment", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/swap/SwapFragmentPanel.java#L148-L161
sirensolutions/siren-join
src/main/java/solutions/siren/join/action/terms/collector/BytesRefTermStream.java
BytesRefTermStream.get
public static BytesRefTermStream get(IndexReader reader, IndexFieldData indexFieldData) { if (indexFieldData instanceof IndexNumericFieldData) { IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData; switch (numFieldData.getNumericType()) { case INT: return new IntegerBytesRefTermStream(reader, numFieldData); case LONG: return new LongBytesRefTermStream(reader, numFieldData); default: throw new UnsupportedOperationException("Streaming numeric type '" + numFieldData.getNumericType().name() + "' is unsupported"); } } else { return new BytesBytesRefTermStream(reader, indexFieldData); } }
java
public static BytesRefTermStream get(IndexReader reader, IndexFieldData indexFieldData) { if (indexFieldData instanceof IndexNumericFieldData) { IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData; switch (numFieldData.getNumericType()) { case INT: return new IntegerBytesRefTermStream(reader, numFieldData); case LONG: return new LongBytesRefTermStream(reader, numFieldData); default: throw new UnsupportedOperationException("Streaming numeric type '" + numFieldData.getNumericType().name() + "' is unsupported"); } } else { return new BytesBytesRefTermStream(reader, indexFieldData); } }
[ "public", "static", "BytesRefTermStream", "get", "(", "IndexReader", "reader", ",", "IndexFieldData", "indexFieldData", ")", "{", "if", "(", "indexFieldData", "instanceof", "IndexNumericFieldData", ")", "{", "IndexNumericFieldData", "numFieldData", "=", "(", "IndexNumer...
Instantiates a new reusable {@link BytesRefTermStream} based on the field type.
[ "Instantiates", "a", "new", "reusable", "{" ]
train
https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/action/terms/collector/BytesRefTermStream.java#L164-L183
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/js/tostring/JSToString.java
JSToString.objectToJSString
@Nonnull public static String objectToJSString (@Nullable final Object aObject) { return objectToJSString (aObject, JSType.AUTO_DETECT, false); }
java
@Nonnull public static String objectToJSString (@Nullable final Object aObject) { return objectToJSString (aObject, JSType.AUTO_DETECT, false); }
[ "@", "Nonnull", "public", "static", "String", "objectToJSString", "(", "@", "Nullable", "final", "Object", "aObject", ")", "{", "return", "objectToJSString", "(", "aObject", ",", "JSType", ".", "AUTO_DETECT", ",", "false", ")", ";", "}" ]
Auto-detect the type of the passed object and convert it to a JS string. If the type detection failed, an {@link IllegalArgumentException} is thrown. @param aObject The object to be converted. May be <code>null</code>. Note: works for atomic types and arrays, but <b>not</b> for collection types! @return The string representation of the passed object.
[ "Auto", "-", "detect", "the", "type", "of", "the", "passed", "object", "and", "convert", "it", "to", "a", "JS", "string", ".", "If", "the", "type", "detection", "failed", "an", "{", "@link", "IllegalArgumentException", "}", "is", "thrown", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/tostring/JSToString.java#L233-L237