repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java
ApplicationWsDelegate.removeInstance
public void removeInstance( String applicationName, String instancePath ) { """ Removes an instance. @param applicationName the application name @param instancePath the path of the instance to remove """ this.logger.finer( String.format( "Removing instance \"%s\" from application \"%s\"...", instancePath, applicationName ) ); WebResource path = this.resource .path( UrlConstants.APP ) .path( applicationName ) .path( "instances" ) .queryParam( "instance-path", instancePath ); this.wsClient.createBuilder( path ).delete(); this.logger.finer( String.format( "Instance \"%s\" has been removed from application \"%s\"", instancePath, applicationName ) ); }
java
public void removeInstance( String applicationName, String instancePath ) { this.logger.finer( String.format( "Removing instance \"%s\" from application \"%s\"...", instancePath, applicationName ) ); WebResource path = this.resource .path( UrlConstants.APP ) .path( applicationName ) .path( "instances" ) .queryParam( "instance-path", instancePath ); this.wsClient.createBuilder( path ).delete(); this.logger.finer( String.format( "Instance \"%s\" has been removed from application \"%s\"", instancePath, applicationName ) ); }
[ "public", "void", "removeInstance", "(", "String", "applicationName", ",", "String", "instancePath", ")", "{", "this", ".", "logger", ".", "finer", "(", "String", ".", "format", "(", "\"Removing instance \\\"%s\\\" from application \\\"%s\\\"...\"", ",", "instancePath", ",", "applicationName", ")", ")", ";", "WebResource", "path", "=", "this", ".", "resource", ".", "path", "(", "UrlConstants", ".", "APP", ")", ".", "path", "(", "applicationName", ")", ".", "path", "(", "\"instances\"", ")", ".", "queryParam", "(", "\"instance-path\"", ",", "instancePath", ")", ";", "this", ".", "wsClient", ".", "createBuilder", "(", "path", ")", ".", "delete", "(", ")", ";", "this", ".", "logger", ".", "finer", "(", "String", ".", "format", "(", "\"Instance \\\"%s\\\" has been removed from application \\\"%s\\\"\"", ",", "instancePath", ",", "applicationName", ")", ")", ";", "}" ]
Removes an instance. @param applicationName the application name @param instancePath the path of the instance to remove
[ "Removes", "an", "instance", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java#L258-L271
javalite/activeweb
activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java
HttpSupport.sendFile
protected HttpBuilder sendFile(File file, boolean delete) throws FileNotFoundException { """ Convenience method for downloading files. This method will force the browser to find a handler(external program) for this file (content type) and will provide a name of file to the browser. This method sets an HTTP header "Content-Disposition" based on a file name. @param file file to download. @param delete true to delete the file after processing @return builder instance. @throws FileNotFoundException thrown if file not found. """ try{ FileResponse resp = new FileResponse(file, delete); RequestContext.setControllerResponse(resp); HttpBuilder builder = new HttpBuilder(resp); builder.header("Content-Disposition", "attachment; filename=" + file.getName()); return builder; }catch(Exception e){ throw new ControllerException(e); } }
java
protected HttpBuilder sendFile(File file, boolean delete) throws FileNotFoundException { try{ FileResponse resp = new FileResponse(file, delete); RequestContext.setControllerResponse(resp); HttpBuilder builder = new HttpBuilder(resp); builder.header("Content-Disposition", "attachment; filename=" + file.getName()); return builder; }catch(Exception e){ throw new ControllerException(e); } }
[ "protected", "HttpBuilder", "sendFile", "(", "File", "file", ",", "boolean", "delete", ")", "throws", "FileNotFoundException", "{", "try", "{", "FileResponse", "resp", "=", "new", "FileResponse", "(", "file", ",", "delete", ")", ";", "RequestContext", ".", "setControllerResponse", "(", "resp", ")", ";", "HttpBuilder", "builder", "=", "new", "HttpBuilder", "(", "resp", ")", ";", "builder", ".", "header", "(", "\"Content-Disposition\"", ",", "\"attachment; filename=\"", "+", "file", ".", "getName", "(", ")", ")", ";", "return", "builder", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ControllerException", "(", "e", ")", ";", "}", "}" ]
Convenience method for downloading files. This method will force the browser to find a handler(external program) for this file (content type) and will provide a name of file to the browser. This method sets an HTTP header "Content-Disposition" based on a file name. @param file file to download. @param delete true to delete the file after processing @return builder instance. @throws FileNotFoundException thrown if file not found.
[ "Convenience", "method", "for", "downloading", "files", ".", "This", "method", "will", "force", "the", "browser", "to", "find", "a", "handler", "(", "external", "program", ")", "for", "this", "file", "(", "content", "type", ")", "and", "will", "provide", "a", "name", "of", "file", "to", "the", "browser", ".", "This", "method", "sets", "an", "HTTP", "header", "Content", "-", "Disposition", "based", "on", "a", "file", "name", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L520-L530
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java
OrganizationResourceImpl.parseDate
private static DateTime parseDate(String dateStr, DateTime defaultDate, boolean floor) { """ Parses a query param representing a date into an actual date object. """ if ("now".equals(dateStr)) { //$NON-NLS-1$ return new DateTime(); } if (dateStr.length() == 10) { DateTime parsed = ISODateTimeFormat.date().withZone(DateTimeZone.UTC).parseDateTime(dateStr); // If what we want is the floor, then just return it. But if we want the // ceiling of the date, then we need to set the right params. if (!floor) { parsed = parsed.plusDays(1).minusMillis(1); } return parsed; } if (dateStr.length() == 20) { return ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).parseDateTime(dateStr); } if (dateStr.length() == 24) { return ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC).parseDateTime(dateStr); } return defaultDate; }
java
private static DateTime parseDate(String dateStr, DateTime defaultDate, boolean floor) { if ("now".equals(dateStr)) { //$NON-NLS-1$ return new DateTime(); } if (dateStr.length() == 10) { DateTime parsed = ISODateTimeFormat.date().withZone(DateTimeZone.UTC).parseDateTime(dateStr); // If what we want is the floor, then just return it. But if we want the // ceiling of the date, then we need to set the right params. if (!floor) { parsed = parsed.plusDays(1).minusMillis(1); } return parsed; } if (dateStr.length() == 20) { return ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).parseDateTime(dateStr); } if (dateStr.length() == 24) { return ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC).parseDateTime(dateStr); } return defaultDate; }
[ "private", "static", "DateTime", "parseDate", "(", "String", "dateStr", ",", "DateTime", "defaultDate", ",", "boolean", "floor", ")", "{", "if", "(", "\"now\"", ".", "equals", "(", "dateStr", ")", ")", "{", "//$NON-NLS-1$", "return", "new", "DateTime", "(", ")", ";", "}", "if", "(", "dateStr", ".", "length", "(", ")", "==", "10", ")", "{", "DateTime", "parsed", "=", "ISODateTimeFormat", ".", "date", "(", ")", ".", "withZone", "(", "DateTimeZone", ".", "UTC", ")", ".", "parseDateTime", "(", "dateStr", ")", ";", "// If what we want is the floor, then just return it. But if we want the", "// ceiling of the date, then we need to set the right params.", "if", "(", "!", "floor", ")", "{", "parsed", "=", "parsed", ".", "plusDays", "(", "1", ")", ".", "minusMillis", "(", "1", ")", ";", "}", "return", "parsed", ";", "}", "if", "(", "dateStr", ".", "length", "(", ")", "==", "20", ")", "{", "return", "ISODateTimeFormat", ".", "dateTimeNoMillis", "(", ")", ".", "withZone", "(", "DateTimeZone", ".", "UTC", ")", ".", "parseDateTime", "(", "dateStr", ")", ";", "}", "if", "(", "dateStr", ".", "length", "(", ")", "==", "24", ")", "{", "return", "ISODateTimeFormat", ".", "dateTime", "(", ")", ".", "withZone", "(", "DateTimeZone", ".", "UTC", ")", ".", "parseDateTime", "(", "dateStr", ")", ";", "}", "return", "defaultDate", ";", "}" ]
Parses a query param representing a date into an actual date object.
[ "Parses", "a", "query", "param", "representing", "a", "date", "into", "an", "actual", "date", "object", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java#L3669-L3689
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java
HostControllerEnvironment.getFileFromProperty
private File getFileFromProperty(final String name) { """ Get a File from configuration. @param name the name of the property @return the CanonicalFile form for the given name. """ String value = hostSystemProperties.get(name); File result = (value != null) ? new File(value) : null; // AS7-1752 see if a non-existent relative path exists relative to the home dir if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) { File relative = new File(homeDir, value); if (relative.exists()) { result = relative; } } return result; }
java
private File getFileFromProperty(final String name) { String value = hostSystemProperties.get(name); File result = (value != null) ? new File(value) : null; // AS7-1752 see if a non-existent relative path exists relative to the home dir if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) { File relative = new File(homeDir, value); if (relative.exists()) { result = relative; } } return result; }
[ "private", "File", "getFileFromProperty", "(", "final", "String", "name", ")", "{", "String", "value", "=", "hostSystemProperties", ".", "get", "(", "name", ")", ";", "File", "result", "=", "(", "value", "!=", "null", ")", "?", "new", "File", "(", "value", ")", ":", "null", ";", "// AS7-1752 see if a non-existent relative path exists relative to the home dir", "if", "(", "result", "!=", "null", "&&", "homeDir", "!=", "null", "&&", "!", "result", ".", "exists", "(", ")", "&&", "!", "result", ".", "isAbsolute", "(", ")", ")", "{", "File", "relative", "=", "new", "File", "(", "homeDir", ",", "value", ")", ";", "if", "(", "relative", ".", "exists", "(", ")", ")", "{", "result", "=", "relative", ";", "}", "}", "return", "result", ";", "}" ]
Get a File from configuration. @param name the name of the property @return the CanonicalFile form for the given name.
[ "Get", "a", "File", "from", "configuration", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java#L839-L850
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.copyImage
public static BufferedImage copyImage(Image img, int imageType) { """ 将已有Image复制新的一份出来 @param img {@link Image} @param imageType {@link BufferedImage}中的常量,图像类型,例如黑白等 @return {@link BufferedImage} @see BufferedImage#TYPE_INT_RGB @see BufferedImage#TYPE_INT_ARGB @see BufferedImage#TYPE_INT_ARGB_PRE @see BufferedImage#TYPE_INT_BGR @see BufferedImage#TYPE_3BYTE_BGR @see BufferedImage#TYPE_4BYTE_ABGR @see BufferedImage#TYPE_4BYTE_ABGR_PRE @see BufferedImage#TYPE_BYTE_GRAY @see BufferedImage#TYPE_USHORT_GRAY @see BufferedImage#TYPE_BYTE_BINARY @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_USHORT_565_RGB @see BufferedImage#TYPE_USHORT_555_RGB """ final BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), imageType); final Graphics2D bGr = bimage.createGraphics(); bGr.drawImage(img, 0, 0, null); bGr.dispose(); return bimage; }
java
public static BufferedImage copyImage(Image img, int imageType) { final BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), imageType); final Graphics2D bGr = bimage.createGraphics(); bGr.drawImage(img, 0, 0, null); bGr.dispose(); return bimage; }
[ "public", "static", "BufferedImage", "copyImage", "(", "Image", "img", ",", "int", "imageType", ")", "{", "final", "BufferedImage", "bimage", "=", "new", "BufferedImage", "(", "img", ".", "getWidth", "(", "null", ")", ",", "img", ".", "getHeight", "(", "null", ")", ",", "imageType", ")", ";", "final", "Graphics2D", "bGr", "=", "bimage", ".", "createGraphics", "(", ")", ";", "bGr", ".", "drawImage", "(", "img", ",", "0", ",", "0", ",", "null", ")", ";", "bGr", ".", "dispose", "(", ")", ";", "return", "bimage", ";", "}" ]
将已有Image复制新的一份出来 @param img {@link Image} @param imageType {@link BufferedImage}中的常量,图像类型,例如黑白等 @return {@link BufferedImage} @see BufferedImage#TYPE_INT_RGB @see BufferedImage#TYPE_INT_ARGB @see BufferedImage#TYPE_INT_ARGB_PRE @see BufferedImage#TYPE_INT_BGR @see BufferedImage#TYPE_3BYTE_BGR @see BufferedImage#TYPE_4BYTE_ABGR @see BufferedImage#TYPE_4BYTE_ABGR_PRE @see BufferedImage#TYPE_BYTE_GRAY @see BufferedImage#TYPE_USHORT_GRAY @see BufferedImage#TYPE_BYTE_BINARY @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_USHORT_565_RGB @see BufferedImage#TYPE_USHORT_555_RGB
[ "将已有Image复制新的一份出来" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1213-L1220
eserating/siren4j
src/main/java/com/google/code/siren4j/util/ReflectionUtils.java
ReflectionUtils.getSetter
public static Method getSetter(Class<?> clazz, Field f) { """ Retrieve the setter for the specified class/field if it exists. @param clazz @param f @return """ Method setter = null; for (Method m : clazz.getMethods()) { if (ReflectionUtils.isSetter(m) && m.getName().equals(SETTER_PREFIX + StringUtils.capitalize(f.getName()))) { setter = m; break; } } return setter; }
java
public static Method getSetter(Class<?> clazz, Field f) { Method setter = null; for (Method m : clazz.getMethods()) { if (ReflectionUtils.isSetter(m) && m.getName().equals(SETTER_PREFIX + StringUtils.capitalize(f.getName()))) { setter = m; break; } } return setter; }
[ "public", "static", "Method", "getSetter", "(", "Class", "<", "?", ">", "clazz", ",", "Field", "f", ")", "{", "Method", "setter", "=", "null", ";", "for", "(", "Method", "m", ":", "clazz", ".", "getMethods", "(", ")", ")", "{", "if", "(", "ReflectionUtils", ".", "isSetter", "(", "m", ")", "&&", "m", ".", "getName", "(", ")", ".", "equals", "(", "SETTER_PREFIX", "+", "StringUtils", ".", "capitalize", "(", "f", ".", "getName", "(", ")", ")", ")", ")", "{", "setter", "=", "m", ";", "break", ";", "}", "}", "return", "setter", ";", "}" ]
Retrieve the setter for the specified class/field if it exists. @param clazz @param f @return
[ "Retrieve", "the", "setter", "for", "the", "specified", "class", "/", "field", "if", "it", "exists", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L194-L204
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java
BitcoinSerializer.makeAddressMessage
@Override public AddressMessage makeAddressMessage(byte[] payloadBytes, int length) throws ProtocolException { """ Make an address message from the payload. Extension point for alternative serialization format support. """ return new AddressMessage(params, payloadBytes, this, length); }
java
@Override public AddressMessage makeAddressMessage(byte[] payloadBytes, int length) throws ProtocolException { return new AddressMessage(params, payloadBytes, this, length); }
[ "@", "Override", "public", "AddressMessage", "makeAddressMessage", "(", "byte", "[", "]", "payloadBytes", ",", "int", "length", ")", "throws", "ProtocolException", "{", "return", "new", "AddressMessage", "(", "params", ",", "payloadBytes", ",", "this", ",", "length", ")", ";", "}" ]
Make an address message from the payload. Extension point for alternative serialization format support.
[ "Make", "an", "address", "message", "from", "the", "payload", ".", "Extension", "point", "for", "alternative", "serialization", "format", "support", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BitcoinSerializer.java#L254-L257
apereo/cas
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/util/OidcAuthorizationRequestSupport.java
OidcAuthorizationRequestSupport.isCasAuthenticationOldForMaxAgeAuthorizationRequest
public static boolean isCasAuthenticationOldForMaxAgeAuthorizationRequest(final WebContext context, final UserProfile profile) { """ Is cas authentication old for max age authorization request? @param context the context @param profile the profile @return true/false """ val authTime = profile.getAttribute(CasProtocolConstants.VALIDATION_CAS_MODEL_ATTRIBUTE_NAME_AUTHENTICATION_DATE); if (authTime == null) { return false; } val dt = ZonedDateTime.parse(authTime.toString()); return isCasAuthenticationOldForMaxAgeAuthorizationRequest(context, dt); }
java
public static boolean isCasAuthenticationOldForMaxAgeAuthorizationRequest(final WebContext context, final UserProfile profile) { val authTime = profile.getAttribute(CasProtocolConstants.VALIDATION_CAS_MODEL_ATTRIBUTE_NAME_AUTHENTICATION_DATE); if (authTime == null) { return false; } val dt = ZonedDateTime.parse(authTime.toString()); return isCasAuthenticationOldForMaxAgeAuthorizationRequest(context, dt); }
[ "public", "static", "boolean", "isCasAuthenticationOldForMaxAgeAuthorizationRequest", "(", "final", "WebContext", "context", ",", "final", "UserProfile", "profile", ")", "{", "val", "authTime", "=", "profile", ".", "getAttribute", "(", "CasProtocolConstants", ".", "VALIDATION_CAS_MODEL_ATTRIBUTE_NAME_AUTHENTICATION_DATE", ")", ";", "if", "(", "authTime", "==", "null", ")", "{", "return", "false", ";", "}", "val", "dt", "=", "ZonedDateTime", ".", "parse", "(", "authTime", ".", "toString", "(", ")", ")", ";", "return", "isCasAuthenticationOldForMaxAgeAuthorizationRequest", "(", "context", ",", "dt", ")", ";", "}" ]
Is cas authentication old for max age authorization request? @param context the context @param profile the profile @return true/false
[ "Is", "cas", "authentication", "old", "for", "max", "age", "authorization", "request?" ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/util/OidcAuthorizationRequestSupport.java#L173-L182
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.leftShift
public static File leftShift(File file, byte[] bytes) throws IOException { """ Write bytes to a File. @param file a File @param bytes the byte array to append to the end of the File @return the original file @throws IOException if an IOException occurs. @since 1.5.0 """ append(file, bytes); return file; }
java
public static File leftShift(File file, byte[] bytes) throws IOException { append(file, bytes); return file; }
[ "public", "static", "File", "leftShift", "(", "File", "file", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "append", "(", "file", ",", "bytes", ")", ";", "return", "file", ";", "}" ]
Write bytes to a File. @param file a File @param bytes the byte array to append to the end of the File @return the original file @throws IOException if an IOException occurs. @since 1.5.0
[ "Write", "bytes", "to", "a", "File", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L807-L810
deeplearning4j/deeplearning4j
datavec/datavec-local/src/main/java/org/datavec/local/transforms/AnalyzeLocal.java
AnalyzeLocal.analyzeQuality
public static DataQualityAnalysis analyzeQuality(final Schema schema, final RecordReader data) { """ Analyze the data quality of data - provides a report on missing values, values that don't comply with schema, etc @param schema Schema for data @param data Data to analyze @return DataQualityAnalysis object """ int nColumns = schema.numColumns(); List<QualityAnalysisState> states = null; QualityAnalysisAddFunction addFn = new QualityAnalysisAddFunction(schema); while(data.hasNext()){ states = addFn.apply(states, data.next()); } List<ColumnQuality> list = new ArrayList<>(nColumns); for (QualityAnalysisState qualityState : states) { list.add(qualityState.getColumnQuality()); } return new DataQualityAnalysis(schema, list); }
java
public static DataQualityAnalysis analyzeQuality(final Schema schema, final RecordReader data) { int nColumns = schema.numColumns(); List<QualityAnalysisState> states = null; QualityAnalysisAddFunction addFn = new QualityAnalysisAddFunction(schema); while(data.hasNext()){ states = addFn.apply(states, data.next()); } List<ColumnQuality> list = new ArrayList<>(nColumns); for (QualityAnalysisState qualityState : states) { list.add(qualityState.getColumnQuality()); } return new DataQualityAnalysis(schema, list); }
[ "public", "static", "DataQualityAnalysis", "analyzeQuality", "(", "final", "Schema", "schema", ",", "final", "RecordReader", "data", ")", "{", "int", "nColumns", "=", "schema", ".", "numColumns", "(", ")", ";", "List", "<", "QualityAnalysisState", ">", "states", "=", "null", ";", "QualityAnalysisAddFunction", "addFn", "=", "new", "QualityAnalysisAddFunction", "(", "schema", ")", ";", "while", "(", "data", ".", "hasNext", "(", ")", ")", "{", "states", "=", "addFn", ".", "apply", "(", "states", ",", "data", ".", "next", "(", ")", ")", ";", "}", "List", "<", "ColumnQuality", ">", "list", "=", "new", "ArrayList", "<>", "(", "nColumns", ")", ";", "for", "(", "QualityAnalysisState", "qualityState", ":", "states", ")", "{", "list", ".", "add", "(", "qualityState", ".", "getColumnQuality", "(", ")", ")", ";", "}", "return", "new", "DataQualityAnalysis", "(", "schema", ",", "list", ")", ";", "}" ]
Analyze the data quality of data - provides a report on missing values, values that don't comply with schema, etc @param schema Schema for data @param data Data to analyze @return DataQualityAnalysis object
[ "Analyze", "the", "data", "quality", "of", "data", "-", "provides", "a", "report", "on", "missing", "values", "values", "that", "don", "t", "comply", "with", "schema", "etc" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-local/src/main/java/org/datavec/local/transforms/AnalyzeLocal.java#L120-L134
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/stat/ImageLocalNormalization.java
ImageLocalNormalization.zeroMeanStdOne
public void zeroMeanStdOne(Kernel1D kernel, T input , double maxPixelValue , double delta , T output ) { """ /* <p>Normalizes the input image such that local weighted statics are a zero mean and with standard deviation of 1. The image border is handled by truncating the kernel and renormalizing it so that it's sum is still one.</p> <p>output[x,y] = (input[x,y]-mean[x,y])/(stdev[x,y] + delta)</p> @param kernel Separable kernel. Typically Gaussian @param input Input image @param maxPixelValue maximum value of a pixel element in the input image. -1 = compute max value. Typically this is 255 or 1. @param delta A small value used to avoid divide by zero errors. Typical 1e-4f for 32 bit and 1e-8 for 64bit @param output Storage for output """ // check preconditions and initialize data structures initialize(input, output); // avoid overflow issues by ensuring that the max pixel value is 1 T adjusted = ensureMaxValueOfOne(input, maxPixelValue); // take advantage of 2D gaussian kernels being separable if( border == null ) { GConvolveImageOps.horizontalNormalized(kernel, adjusted, output); GConvolveImageOps.verticalNormalized(kernel, output, localMean); GPixelMath.pow2(adjusted, pow2); GConvolveImageOps.horizontalNormalized(kernel, pow2, output); GConvolveImageOps.verticalNormalized(kernel, output, localPow2); } else { GConvolveImageOps.horizontal(kernel, adjusted, output, border); GConvolveImageOps.vertical(kernel, output, localMean, border); GPixelMath.pow2(adjusted, pow2); GConvolveImageOps.horizontal(kernel, pow2, output, border); GConvolveImageOps.vertical(kernel, output, localPow2, border); } // Compute the final output if( imageType == GrayF32.class ) computeOutput((GrayF32)input, (float)delta, (GrayF32)output, (GrayF32)adjusted); else computeOutput((GrayF64)input, delta, (GrayF64)output, (GrayF64)adjusted); }
java
public void zeroMeanStdOne(Kernel1D kernel, T input , double maxPixelValue , double delta , T output ) { // check preconditions and initialize data structures initialize(input, output); // avoid overflow issues by ensuring that the max pixel value is 1 T adjusted = ensureMaxValueOfOne(input, maxPixelValue); // take advantage of 2D gaussian kernels being separable if( border == null ) { GConvolveImageOps.horizontalNormalized(kernel, adjusted, output); GConvolveImageOps.verticalNormalized(kernel, output, localMean); GPixelMath.pow2(adjusted, pow2); GConvolveImageOps.horizontalNormalized(kernel, pow2, output); GConvolveImageOps.verticalNormalized(kernel, output, localPow2); } else { GConvolveImageOps.horizontal(kernel, adjusted, output, border); GConvolveImageOps.vertical(kernel, output, localMean, border); GPixelMath.pow2(adjusted, pow2); GConvolveImageOps.horizontal(kernel, pow2, output, border); GConvolveImageOps.vertical(kernel, output, localPow2, border); } // Compute the final output if( imageType == GrayF32.class ) computeOutput((GrayF32)input, (float)delta, (GrayF32)output, (GrayF32)adjusted); else computeOutput((GrayF64)input, delta, (GrayF64)output, (GrayF64)adjusted); }
[ "public", "void", "zeroMeanStdOne", "(", "Kernel1D", "kernel", ",", "T", "input", ",", "double", "maxPixelValue", ",", "double", "delta", ",", "T", "output", ")", "{", "// check preconditions and initialize data structures", "initialize", "(", "input", ",", "output", ")", ";", "// avoid overflow issues by ensuring that the max pixel value is 1", "T", "adjusted", "=", "ensureMaxValueOfOne", "(", "input", ",", "maxPixelValue", ")", ";", "// take advantage of 2D gaussian kernels being separable", "if", "(", "border", "==", "null", ")", "{", "GConvolveImageOps", ".", "horizontalNormalized", "(", "kernel", ",", "adjusted", ",", "output", ")", ";", "GConvolveImageOps", ".", "verticalNormalized", "(", "kernel", ",", "output", ",", "localMean", ")", ";", "GPixelMath", ".", "pow2", "(", "adjusted", ",", "pow2", ")", ";", "GConvolveImageOps", ".", "horizontalNormalized", "(", "kernel", ",", "pow2", ",", "output", ")", ";", "GConvolveImageOps", ".", "verticalNormalized", "(", "kernel", ",", "output", ",", "localPow2", ")", ";", "}", "else", "{", "GConvolveImageOps", ".", "horizontal", "(", "kernel", ",", "adjusted", ",", "output", ",", "border", ")", ";", "GConvolveImageOps", ".", "vertical", "(", "kernel", ",", "output", ",", "localMean", ",", "border", ")", ";", "GPixelMath", ".", "pow2", "(", "adjusted", ",", "pow2", ")", ";", "GConvolveImageOps", ".", "horizontal", "(", "kernel", ",", "pow2", ",", "output", ",", "border", ")", ";", "GConvolveImageOps", ".", "vertical", "(", "kernel", ",", "output", ",", "localPow2", ",", "border", ")", ";", "}", "// Compute the final output", "if", "(", "imageType", "==", "GrayF32", ".", "class", ")", "computeOutput", "(", "(", "GrayF32", ")", "input", ",", "(", "float", ")", "delta", ",", "(", "GrayF32", ")", "output", ",", "(", "GrayF32", ")", "adjusted", ")", ";", "else", "computeOutput", "(", "(", "GrayF64", ")", "input", ",", "delta", ",", "(", "GrayF64", ")", "output", ",", "(", "GrayF64", ")", "adjusted", ")", ";", "}" ]
/* <p>Normalizes the input image such that local weighted statics are a zero mean and with standard deviation of 1. The image border is handled by truncating the kernel and renormalizing it so that it's sum is still one.</p> <p>output[x,y] = (input[x,y]-mean[x,y])/(stdev[x,y] + delta)</p> @param kernel Separable kernel. Typically Gaussian @param input Input image @param maxPixelValue maximum value of a pixel element in the input image. -1 = compute max value. Typically this is 255 or 1. @param delta A small value used to avoid divide by zero errors. Typical 1e-4f for 32 bit and 1e-8 for 64bit @param output Storage for output
[ "/", "*", "<p", ">", "Normalizes", "the", "input", "image", "such", "that", "local", "weighted", "statics", "are", "a", "zero", "mean", "and", "with", "standard", "deviation", "of", "1", ".", "The", "image", "border", "is", "handled", "by", "truncating", "the", "kernel", "and", "renormalizing", "it", "so", "that", "it", "s", "sum", "is", "still", "one", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/stat/ImageLocalNormalization.java#L90-L117
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/QueryBuilder.java
QueryBuilder.getCachedQuery
public CachedInstanceQuery getCachedQuery(final String _key) { """ Get the constructed query. @param _key key to the Query Cache @return the query """ if (this.query == null) { try { this.query = new CachedInstanceQuery(_key, this.typeUUID) .setIncludeChildTypes(isIncludeChildTypes()) .setCompanyDependent(isCompanyDependent()); prepareQuery(); } catch (final EFapsException e) { QueryBuilder.LOG.error("Could not open InstanceQuery for uuid: {}", this.typeUUID); } } return (CachedInstanceQuery) this.query; }
java
public CachedInstanceQuery getCachedQuery(final String _key) { if (this.query == null) { try { this.query = new CachedInstanceQuery(_key, this.typeUUID) .setIncludeChildTypes(isIncludeChildTypes()) .setCompanyDependent(isCompanyDependent()); prepareQuery(); } catch (final EFapsException e) { QueryBuilder.LOG.error("Could not open InstanceQuery for uuid: {}", this.typeUUID); } } return (CachedInstanceQuery) this.query; }
[ "public", "CachedInstanceQuery", "getCachedQuery", "(", "final", "String", "_key", ")", "{", "if", "(", "this", ".", "query", "==", "null", ")", "{", "try", "{", "this", ".", "query", "=", "new", "CachedInstanceQuery", "(", "_key", ",", "this", ".", "typeUUID", ")", ".", "setIncludeChildTypes", "(", "isIncludeChildTypes", "(", ")", ")", ".", "setCompanyDependent", "(", "isCompanyDependent", "(", ")", ")", ";", "prepareQuery", "(", ")", ";", "}", "catch", "(", "final", "EFapsException", "e", ")", "{", "QueryBuilder", ".", "LOG", ".", "error", "(", "\"Could not open InstanceQuery for uuid: {}\"", ",", "this", ".", "typeUUID", ")", ";", "}", "}", "return", "(", "CachedInstanceQuery", ")", "this", ".", "query", ";", "}" ]
Get the constructed query. @param _key key to the Query Cache @return the query
[ "Get", "the", "constructed", "query", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/QueryBuilder.java#L989-L1002
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.standardDeviation
public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions) { """ Stardard deviation array reduction operation, optionally along specified dimensions @param name Output variable name @param x Input variable @param biasCorrected If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev) @param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed @return Output variable: reduced array of rank (input rank - num dimensions) """ return standardDeviation(name, x, biasCorrected, false, dimensions); }
java
public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions) { return standardDeviation(name, x, biasCorrected, false, dimensions); }
[ "public", "SDVariable", "standardDeviation", "(", "String", "name", ",", "SDVariable", "x", ",", "boolean", "biasCorrected", ",", "int", "...", "dimensions", ")", "{", "return", "standardDeviation", "(", "name", ",", "x", ",", "biasCorrected", ",", "false", ",", "dimensions", ")", ";", "}" ]
Stardard deviation array reduction operation, optionally along specified dimensions @param name Output variable name @param x Input variable @param biasCorrected If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev) @param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed @return Output variable: reduced array of rank (input rank - num dimensions)
[ "Stardard", "deviation", "array", "reduction", "operation", "optionally", "along", "specified", "dimensions" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2581-L2583
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/face/AipFace.java
AipFace.search
public JSONObject search(String image, String imageType, String groupIdList, HashMap<String, String> options) { """ 人脸搜索接口 @param image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 @param imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个 @param groupIdList - 从指定的group中进行查找 用逗号分隔,**上限20个** @param options - 可选参数对象,key: value都为string类型 options - options列表: quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** user_id 当需要对特定用户进行比对时,指定user_id进行比对。即人脸认证功能。 max_user_num 查找后返回的用户数量。返回相似度最高的几个用户,默认为1,最多返回20个。 @return JSONObject """ AipRequest request = new AipRequest(); preOperation(request); request.addBody("image", image); request.addBody("image_type", imageType); request.addBody("group_id_list", groupIdList); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.SEARCH); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject search(String image, String imageType, String groupIdList, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("image", image); request.addBody("image_type", imageType); request.addBody("group_id_list", groupIdList); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.SEARCH); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "search", "(", "String", "image", ",", "String", "imageType", ",", "String", "groupIdList", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ".", "addBody", "(", "\"image\"", ",", "image", ")", ";", "request", ".", "addBody", "(", "\"image_type\"", ",", "imageType", ")", ";", "request", ".", "addBody", "(", "\"group_id_list\"", ",", "groupIdList", ")", ";", "if", "(", "options", "!=", "null", ")", "{", "request", ".", "addBody", "(", "options", ")", ";", "}", "request", ".", "setUri", "(", "FaceConsts", ".", "SEARCH", ")", ";", "request", ".", "setBodyFormat", "(", "EBodyFormat", ".", "RAW_JSON", ")", ";", "postOperation", "(", "request", ")", ";", "return", "requestServer", "(", "request", ")", ";", "}" ]
人脸搜索接口 @param image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断 @param imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个 @param groupIdList - 从指定的group中进行查找 用逗号分隔,**上限20个** @param options - 可选参数对象,key: value都为string类型 options - options列表: quality_control 图片质量控制 **NONE**: 不进行控制 **LOW**:较低的质量要求 **NORMAL**: 一般的质量要求 **HIGH**: 较高的质量要求 **默认 NONE** liveness_control 活体检测控制 **NONE**: 不进行控制 **LOW**:较低的活体要求(高通过率 低攻击拒绝率) **NORMAL**: 一般的活体要求(平衡的攻击拒绝率, 通过率) **HIGH**: 较高的活体要求(高攻击拒绝率 低通过率) **默认NONE** user_id 当需要对特定用户进行比对时,指定user_id进行比对。即人脸认证功能。 max_user_num 查找后返回的用户数量。返回相似度最高的几个用户,默认为1,最多返回20个。 @return JSONObject
[ "人脸搜索接口" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L77-L93
atomix/atomix
cluster/src/main/java/io/atomix/cluster/AtomixClusterBuilder.java
AtomixClusterBuilder.withAddress
@Deprecated public AtomixClusterBuilder withAddress(String host, int port) { """ Sets the member host/port. <p> The constructed {@link AtomixCluster} will bind to the given host/port for intra-cluster communication. The provided host should be visible to other nodes in the cluster. @param host the host name @param port the port number @return the cluster builder @throws io.atomix.utils.net.MalformedAddressException if a valid {@link Address} cannot be constructed from the arguments @deprecated since 3.1. Use {@link #withHost(String)} and {@link #withPort(int)} instead """ return withAddress(Address.from(host, port)); }
java
@Deprecated public AtomixClusterBuilder withAddress(String host, int port) { return withAddress(Address.from(host, port)); }
[ "@", "Deprecated", "public", "AtomixClusterBuilder", "withAddress", "(", "String", "host", ",", "int", "port", ")", "{", "return", "withAddress", "(", "Address", ".", "from", "(", "host", ",", "port", ")", ")", ";", "}" ]
Sets the member host/port. <p> The constructed {@link AtomixCluster} will bind to the given host/port for intra-cluster communication. The provided host should be visible to other nodes in the cluster. @param host the host name @param port the port number @return the cluster builder @throws io.atomix.utils.net.MalformedAddressException if a valid {@link Address} cannot be constructed from the arguments @deprecated since 3.1. Use {@link #withHost(String)} and {@link #withPort(int)} instead
[ "Sets", "the", "member", "host", "/", "port", ".", "<p", ">", "The", "constructed", "{", "@link", "AtomixCluster", "}", "will", "bind", "to", "the", "given", "host", "/", "port", "for", "intra", "-", "cluster", "communication", ".", "The", "provided", "host", "should", "be", "visible", "to", "other", "nodes", "in", "the", "cluster", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/AtomixClusterBuilder.java#L160-L163
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.appendGeneratedAnnotation
protected void appendGeneratedAnnotation(JvmAnnotationTarget target, GenerationContext context, String sarlCode) { """ Add the @Generated annotation to the given target. @param target the target of the annotation. @param context the generation context. @param sarlCode the code that is the cause of the generation. """ final GeneratorConfig config = context.getGeneratorConfig(); if (config.isGenerateGeneratedAnnotation()) { addAnnotationSafe(target, Generated.class, getClass().getName()); } if (target instanceof JvmFeature) { addAnnotationSafe(target, SyntheticMember.class); } if (!Strings.isNullOrEmpty(sarlCode)) { addAnnotationSafe(target, SarlSourceCode.class, sarlCode); } }
java
protected void appendGeneratedAnnotation(JvmAnnotationTarget target, GenerationContext context, String sarlCode) { final GeneratorConfig config = context.getGeneratorConfig(); if (config.isGenerateGeneratedAnnotation()) { addAnnotationSafe(target, Generated.class, getClass().getName()); } if (target instanceof JvmFeature) { addAnnotationSafe(target, SyntheticMember.class); } if (!Strings.isNullOrEmpty(sarlCode)) { addAnnotationSafe(target, SarlSourceCode.class, sarlCode); } }
[ "protected", "void", "appendGeneratedAnnotation", "(", "JvmAnnotationTarget", "target", ",", "GenerationContext", "context", ",", "String", "sarlCode", ")", "{", "final", "GeneratorConfig", "config", "=", "context", ".", "getGeneratorConfig", "(", ")", ";", "if", "(", "config", ".", "isGenerateGeneratedAnnotation", "(", ")", ")", "{", "addAnnotationSafe", "(", "target", ",", "Generated", ".", "class", ",", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "target", "instanceof", "JvmFeature", ")", "{", "addAnnotationSafe", "(", "target", ",", "SyntheticMember", ".", "class", ")", ";", "}", "if", "(", "!", "Strings", ".", "isNullOrEmpty", "(", "sarlCode", ")", ")", "{", "addAnnotationSafe", "(", "target", ",", "SarlSourceCode", ".", "class", ",", "sarlCode", ")", ";", "}", "}" ]
Add the @Generated annotation to the given target. @param target the target of the annotation. @param context the generation context. @param sarlCode the code that is the cause of the generation.
[ "Add", "the", "@Generated", "annotation", "to", "the", "given", "target", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L2486-L2499
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.getLearnedRoutes
public GatewayRouteListResultInner getLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) { """ This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @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 GatewayRouteListResultInner object if successful. """ return getLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body(); }
java
public GatewayRouteListResultInner getLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) { return getLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body(); }
[ "public", "GatewayRouteListResultInner", "getLearnedRoutes", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "getLearnedRoutesWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @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 GatewayRouteListResultInner object if successful.
[ "This", "operation", "retrieves", "a", "list", "of", "routes", "the", "virtual", "network", "gateway", "has", "learned", "including", "routes", "learned", "from", "BGP", "peers", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2340-L2342
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.updateVnetGateway
public VnetGatewayInner updateVnetGateway(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope) { """ Update a Virtual Network gateway. Update a Virtual Network gateway. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. @param connectionEnvelope Definition of the gateway. @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 VnetGatewayInner object if successful. """ return updateVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope).toBlocking().single().body(); }
java
public VnetGatewayInner updateVnetGateway(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope) { return updateVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope).toBlocking().single().body(); }
[ "public", "VnetGatewayInner", "updateVnetGateway", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "vnetName", ",", "String", "gatewayName", ",", "VnetGatewayInner", "connectionEnvelope", ")", "{", "return", "updateVnetGatewayWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "vnetName", ",", "gatewayName", ",", "connectionEnvelope", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Update a Virtual Network gateway. Update a Virtual Network gateway. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @param vnetName Name of the Virtual Network. @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. @param connectionEnvelope Definition of the gateway. @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 VnetGatewayInner object if successful.
[ "Update", "a", "Virtual", "Network", "gateway", ".", "Update", "a", "Virtual", "Network", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3279-L3281
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getConfigProperty
@SuppressWarnings("unchecked") public ConfigProperty getConfigProperty(final String groupName, final String propertyName) { """ Returns a ConfigProperty with the specified groupName and propertyName. @param groupName the group name of the config property @param propertyName the name of the property @return a ConfigProperty object @since 1.3.0 """ final Query query = pm.newQuery(ConfigProperty.class, "groupName == :groupName && propertyName == :propertyName"); final List<ConfigProperty> result = (List<ConfigProperty>) query.execute(groupName, propertyName); return Collections.isEmpty(result) ? null : result.get(0); }
java
@SuppressWarnings("unchecked") public ConfigProperty getConfigProperty(final String groupName, final String propertyName) { final Query query = pm.newQuery(ConfigProperty.class, "groupName == :groupName && propertyName == :propertyName"); final List<ConfigProperty> result = (List<ConfigProperty>) query.execute(groupName, propertyName); return Collections.isEmpty(result) ? null : result.get(0); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "ConfigProperty", "getConfigProperty", "(", "final", "String", "groupName", ",", "final", "String", "propertyName", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "ConfigProperty", ".", "class", ",", "\"groupName == :groupName && propertyName == :propertyName\"", ")", ";", "final", "List", "<", "ConfigProperty", ">", "result", "=", "(", "List", "<", "ConfigProperty", ">", ")", "query", ".", "execute", "(", "groupName", ",", "propertyName", ")", ";", "return", "Collections", ".", "isEmpty", "(", "result", ")", "?", "null", ":", "result", ".", "get", "(", "0", ")", ";", "}" ]
Returns a ConfigProperty with the specified groupName and propertyName. @param groupName the group name of the config property @param propertyName the name of the property @return a ConfigProperty object @since 1.3.0
[ "Returns", "a", "ConfigProperty", "with", "the", "specified", "groupName", "and", "propertyName", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L712-L717
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java
SchemaTypeAdapter.readMap
private Schema readMap(JsonReader reader, Set<String> knownRecords) throws IOException { """ Constructs {@link Schema.Type#MAP MAP} type schema from the json input. @param reader The {@link JsonReader} for streaming json input tokens. @param knownRecords Set of record name already encountered during the reading. @return A {@link Schema} of type {@link Schema.Type#MAP MAP}. @throws java.io.IOException When fails to construct a valid schema from the input. """ return Schema.mapOf(readInnerSchema(reader, "keys", knownRecords), readInnerSchema(reader, "values", knownRecords)); }
java
private Schema readMap(JsonReader reader, Set<String> knownRecords) throws IOException { return Schema.mapOf(readInnerSchema(reader, "keys", knownRecords), readInnerSchema(reader, "values", knownRecords)); }
[ "private", "Schema", "readMap", "(", "JsonReader", "reader", ",", "Set", "<", "String", ">", "knownRecords", ")", "throws", "IOException", "{", "return", "Schema", ".", "mapOf", "(", "readInnerSchema", "(", "reader", ",", "\"keys\"", ",", "knownRecords", ")", ",", "readInnerSchema", "(", "reader", ",", "\"values\"", ",", "knownRecords", ")", ")", ";", "}" ]
Constructs {@link Schema.Type#MAP MAP} type schema from the json input. @param reader The {@link JsonReader} for streaming json input tokens. @param knownRecords Set of record name already encountered during the reading. @return A {@link Schema} of type {@link Schema.Type#MAP MAP}. @throws java.io.IOException When fails to construct a valid schema from the input.
[ "Constructs", "{", "@link", "Schema", ".", "Type#MAP", "MAP", "}", "type", "schema", "from", "the", "json", "input", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java#L177-L180
jayantk/jklol
src/com/jayantkrish/jklol/tensor/AbstractTensorBase.java
AbstractTensorBase.mergeDimensions
public static final DimensionSpec mergeDimensions(int[] firstDimensionNums, int[] firstDimensionSizes, int[] secondDimensionNums, int[] secondDimensionSizes) { """ Merges the given sets of dimensions, verifying that any dimensions in both sets have the same size. @param firstDimensionNums @param firstDimensionSizes @param secondDimensionNums @param secondDimensionSizes @return """ SortedSet<Integer> first = Sets.newTreeSet(Ints.asList(firstDimensionNums)); SortedSet<Integer> second = Sets.newTreeSet(Ints.asList(secondDimensionNums)); SortedSet<Integer> all = Sets.newTreeSet(first); all.addAll(second); int[] resultDims = Ints.toArray(all); int[] resultSizes = new int[resultDims.length]; for (int i = 0; i < resultDims.length; i++) { int dim = resultDims[i]; if (first.contains(dim) && second.contains(dim)) { int firstIndex = Ints.indexOf(firstDimensionNums, dim); int secondIndex = Ints.indexOf(secondDimensionNums, dim); int firstSize = firstDimensionSizes[firstIndex]; int secondSize = secondDimensionSizes[secondIndex]; Preconditions.checkArgument(firstSize == secondSize, "Dimension sizes do not match: dim %s, sizes %s and %s.", dim, firstSize, secondSize); resultSizes[i] = firstSize; } else if (first.contains(dim)) { int firstIndex = Ints.indexOf(firstDimensionNums, dim); int firstSize = firstDimensionSizes[firstIndex]; resultSizes[i] = firstSize; } else { int secondIndex = Ints.indexOf(secondDimensionNums, dim); int secondSize = secondDimensionSizes[secondIndex]; resultSizes[i] = secondSize; } } return new DimensionSpec(resultDims, resultSizes); }
java
public static final DimensionSpec mergeDimensions(int[] firstDimensionNums, int[] firstDimensionSizes, int[] secondDimensionNums, int[] secondDimensionSizes) { SortedSet<Integer> first = Sets.newTreeSet(Ints.asList(firstDimensionNums)); SortedSet<Integer> second = Sets.newTreeSet(Ints.asList(secondDimensionNums)); SortedSet<Integer> all = Sets.newTreeSet(first); all.addAll(second); int[] resultDims = Ints.toArray(all); int[] resultSizes = new int[resultDims.length]; for (int i = 0; i < resultDims.length; i++) { int dim = resultDims[i]; if (first.contains(dim) && second.contains(dim)) { int firstIndex = Ints.indexOf(firstDimensionNums, dim); int secondIndex = Ints.indexOf(secondDimensionNums, dim); int firstSize = firstDimensionSizes[firstIndex]; int secondSize = secondDimensionSizes[secondIndex]; Preconditions.checkArgument(firstSize == secondSize, "Dimension sizes do not match: dim %s, sizes %s and %s.", dim, firstSize, secondSize); resultSizes[i] = firstSize; } else if (first.contains(dim)) { int firstIndex = Ints.indexOf(firstDimensionNums, dim); int firstSize = firstDimensionSizes[firstIndex]; resultSizes[i] = firstSize; } else { int secondIndex = Ints.indexOf(secondDimensionNums, dim); int secondSize = secondDimensionSizes[secondIndex]; resultSizes[i] = secondSize; } } return new DimensionSpec(resultDims, resultSizes); }
[ "public", "static", "final", "DimensionSpec", "mergeDimensions", "(", "int", "[", "]", "firstDimensionNums", ",", "int", "[", "]", "firstDimensionSizes", ",", "int", "[", "]", "secondDimensionNums", ",", "int", "[", "]", "secondDimensionSizes", ")", "{", "SortedSet", "<", "Integer", ">", "first", "=", "Sets", ".", "newTreeSet", "(", "Ints", ".", "asList", "(", "firstDimensionNums", ")", ")", ";", "SortedSet", "<", "Integer", ">", "second", "=", "Sets", ".", "newTreeSet", "(", "Ints", ".", "asList", "(", "secondDimensionNums", ")", ")", ";", "SortedSet", "<", "Integer", ">", "all", "=", "Sets", ".", "newTreeSet", "(", "first", ")", ";", "all", ".", "addAll", "(", "second", ")", ";", "int", "[", "]", "resultDims", "=", "Ints", ".", "toArray", "(", "all", ")", ";", "int", "[", "]", "resultSizes", "=", "new", "int", "[", "resultDims", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "resultDims", ".", "length", ";", "i", "++", ")", "{", "int", "dim", "=", "resultDims", "[", "i", "]", ";", "if", "(", "first", ".", "contains", "(", "dim", ")", "&&", "second", ".", "contains", "(", "dim", ")", ")", "{", "int", "firstIndex", "=", "Ints", ".", "indexOf", "(", "firstDimensionNums", ",", "dim", ")", ";", "int", "secondIndex", "=", "Ints", ".", "indexOf", "(", "secondDimensionNums", ",", "dim", ")", ";", "int", "firstSize", "=", "firstDimensionSizes", "[", "firstIndex", "]", ";", "int", "secondSize", "=", "secondDimensionSizes", "[", "secondIndex", "]", ";", "Preconditions", ".", "checkArgument", "(", "firstSize", "==", "secondSize", ",", "\"Dimension sizes do not match: dim %s, sizes %s and %s.\"", ",", "dim", ",", "firstSize", ",", "secondSize", ")", ";", "resultSizes", "[", "i", "]", "=", "firstSize", ";", "}", "else", "if", "(", "first", ".", "contains", "(", "dim", ")", ")", "{", "int", "firstIndex", "=", "Ints", ".", "indexOf", "(", "firstDimensionNums", ",", "dim", ")", ";", "int", "firstSize", "=", "firstDimensionSizes", "[", "firstIndex", "]", ";", "resultSizes", "[", "i", "]", "=", "firstSize", ";", "}", "else", "{", "int", "secondIndex", "=", "Ints", ".", "indexOf", "(", "secondDimensionNums", ",", "dim", ")", ";", "int", "secondSize", "=", "secondDimensionSizes", "[", "secondIndex", "]", ";", "resultSizes", "[", "i", "]", "=", "secondSize", ";", "}", "}", "return", "new", "DimensionSpec", "(", "resultDims", ",", "resultSizes", ")", ";", "}" ]
Merges the given sets of dimensions, verifying that any dimensions in both sets have the same size. @param firstDimensionNums @param firstDimensionSizes @param secondDimensionNums @param secondDimensionSizes @return
[ "Merges", "the", "given", "sets", "of", "dimensions", "verifying", "that", "any", "dimensions", "in", "both", "sets", "have", "the", "same", "size", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/tensor/AbstractTensorBase.java#L94-L125
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.readSourceFileAndWriteDestFile
public static void readSourceFileAndWriteDestFile(final String srcfile, final String destFile) throws IOException { """ Writes the source file with the best performance to the destination file. @param srcfile The source file. @param destFile The destination file. @throws IOException Signals that an I/O exception has occurred. """ try (FileInputStream fis = new FileInputStream(srcfile); FileOutputStream fos = new FileOutputStream(destFile); BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream bos = new BufferedOutputStream(fos);) { final int availableLength = bis.available(); final byte[] totalBytes = new byte[availableLength]; bis.read(totalBytes, 0, availableLength); bos.write(totalBytes, 0, availableLength); } }
java
public static void readSourceFileAndWriteDestFile(final String srcfile, final String destFile) throws IOException { try (FileInputStream fis = new FileInputStream(srcfile); FileOutputStream fos = new FileOutputStream(destFile); BufferedInputStream bis = new BufferedInputStream(fis); BufferedOutputStream bos = new BufferedOutputStream(fos);) { final int availableLength = bis.available(); final byte[] totalBytes = new byte[availableLength]; bis.read(totalBytes, 0, availableLength); bos.write(totalBytes, 0, availableLength); } }
[ "public", "static", "void", "readSourceFileAndWriteDestFile", "(", "final", "String", "srcfile", ",", "final", "String", "destFile", ")", "throws", "IOException", "{", "try", "(", "FileInputStream", "fis", "=", "new", "FileInputStream", "(", "srcfile", ")", ";", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "destFile", ")", ";", "BufferedInputStream", "bis", "=", "new", "BufferedInputStream", "(", "fis", ")", ";", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "fos", ")", ";", ")", "{", "final", "int", "availableLength", "=", "bis", ".", "available", "(", ")", ";", "final", "byte", "[", "]", "totalBytes", "=", "new", "byte", "[", "availableLength", "]", ";", "bis", ".", "read", "(", "totalBytes", ",", "0", ",", "availableLength", ")", ";", "bos", ".", "write", "(", "totalBytes", ",", "0", ",", "availableLength", ")", ";", "}", "}" ]
Writes the source file with the best performance to the destination file. @param srcfile The source file. @param destFile The destination file. @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "the", "source", "file", "with", "the", "best", "performance", "to", "the", "destination", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L389-L402
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java
MethodFinder.typesEquivalent
private static boolean typesEquivalent(Type typeToMatch, GenericArrayType type, ResolutionContext ctx) { """ Computes whether a type is equivalent to a GenericArrayType. <p> This method will check that {@code typeToMatch} is either a {@link GenericArrayType} or an array and then recursively compare the component types of both arguments using {@link #typesEquivalent(Type, Type, ResolutionContext)}. @param typeToMatch the type to match against @param type the type to check, type variable resolution will be performed for this type @param ctx the resolution context to use to perform type variable resolution @return {@code true} if {@code type} is equivalent to {@code typeToMatch} after type resolution, otherwise {@code false} """ if (typeToMatch instanceof GenericArrayType) { GenericArrayType aGat = (GenericArrayType) typeToMatch; return typesEquivalent(aGat.getGenericComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); } if (typeToMatch instanceof Class) { Class<?> aClazz = (Class<?>) typeToMatch; if (aClazz.isArray()) { return typesEquivalent(aClazz.getComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); } } return false; }
java
private static boolean typesEquivalent(Type typeToMatch, GenericArrayType type, ResolutionContext ctx) { if (typeToMatch instanceof GenericArrayType) { GenericArrayType aGat = (GenericArrayType) typeToMatch; return typesEquivalent(aGat.getGenericComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); } if (typeToMatch instanceof Class) { Class<?> aClazz = (Class<?>) typeToMatch; if (aClazz.isArray()) { return typesEquivalent(aClazz.getComponentType(), ctx.resolve(type.getGenericComponentType()), ctx); } } return false; }
[ "private", "static", "boolean", "typesEquivalent", "(", "Type", "typeToMatch", ",", "GenericArrayType", "type", ",", "ResolutionContext", "ctx", ")", "{", "if", "(", "typeToMatch", "instanceof", "GenericArrayType", ")", "{", "GenericArrayType", "aGat", "=", "(", "GenericArrayType", ")", "typeToMatch", ";", "return", "typesEquivalent", "(", "aGat", ".", "getGenericComponentType", "(", ")", ",", "ctx", ".", "resolve", "(", "type", ".", "getGenericComponentType", "(", ")", ")", ",", "ctx", ")", ";", "}", "if", "(", "typeToMatch", "instanceof", "Class", ")", "{", "Class", "<", "?", ">", "aClazz", "=", "(", "Class", "<", "?", ">", ")", "typeToMatch", ";", "if", "(", "aClazz", ".", "isArray", "(", ")", ")", "{", "return", "typesEquivalent", "(", "aClazz", ".", "getComponentType", "(", ")", ",", "ctx", ".", "resolve", "(", "type", ".", "getGenericComponentType", "(", ")", ")", ",", "ctx", ")", ";", "}", "}", "return", "false", ";", "}" ]
Computes whether a type is equivalent to a GenericArrayType. <p> This method will check that {@code typeToMatch} is either a {@link GenericArrayType} or an array and then recursively compare the component types of both arguments using {@link #typesEquivalent(Type, Type, ResolutionContext)}. @param typeToMatch the type to match against @param type the type to check, type variable resolution will be performed for this type @param ctx the resolution context to use to perform type variable resolution @return {@code true} if {@code type} is equivalent to {@code typeToMatch} after type resolution, otherwise {@code false}
[ "Computes", "whether", "a", "type", "is", "equivalent", "to", "a", "GenericArrayType", ".", "<p", ">", "This", "method", "will", "check", "that", "{", "@code", "typeToMatch", "}", "is", "either", "a", "{", "@link", "GenericArrayType", "}", "or", "an", "array", "and", "then", "recursively", "compare", "the", "component", "types", "of", "both", "arguments", "using", "{", "@link", "#typesEquivalent", "(", "Type", "Type", "ResolutionContext", ")", "}", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java#L235-L251
Impetus/Kundera
src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java
HibernateClient.getFromClause
private String getFromClause(String schemaName, String tableName) { """ Gets the from clause. @param schemaName the schema name @param tableName the table name @return the from clause """ String clause = tableName; if (schemaName != null && !schemaName.isEmpty()) { clause = schemaName + "." + tableName; } return clause; }
java
private String getFromClause(String schemaName, String tableName) { String clause = tableName; if (schemaName != null && !schemaName.isEmpty()) { clause = schemaName + "." + tableName; } return clause; }
[ "private", "String", "getFromClause", "(", "String", "schemaName", ",", "String", "tableName", ")", "{", "String", "clause", "=", "tableName", ";", "if", "(", "schemaName", "!=", "null", "&&", "!", "schemaName", ".", "isEmpty", "(", ")", ")", "{", "clause", "=", "schemaName", "+", "\".\"", "+", "tableName", ";", "}", "return", "clause", ";", "}" ]
Gets the from clause. @param schemaName the schema name @param tableName the table name @return the from clause
[ "Gets", "the", "from", "clause", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L791-L799
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.getRmsd
private static double getRmsd(int focusResn, int[] focusRes1, int[] focusRes2, AFPChain afpChain, Atom[] ca1, Atom[] ca2) { """ the the RMSD for the residues defined in the two arrays @param focusResn @param focusRes1 @param focusRes2 @return """ Atom[] tmp1 = new Atom[focusResn]; Atom[] tmp2 = new Atom[focusResn]; for ( int i =0 ; i< focusResn;i++){ tmp1[i] = ca1[focusRes1[i]]; tmp2[i] = (Atom)ca2[focusRes2[i]].clone(); if (tmp1[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]); } if (tmp2[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes2[i]); } //XX //tmp2[i].setParent((Group) ca2[focusRes2[i]].getParent().clone()); } double rmsd = 99; try { rmsd = getRmsd(tmp1,tmp2); } catch (Exception e){ e.printStackTrace(); } return rmsd; }
java
private static double getRmsd(int focusResn, int[] focusRes1, int[] focusRes2, AFPChain afpChain, Atom[] ca1, Atom[] ca2){ Atom[] tmp1 = new Atom[focusResn]; Atom[] tmp2 = new Atom[focusResn]; for ( int i =0 ; i< focusResn;i++){ tmp1[i] = ca1[focusRes1[i]]; tmp2[i] = (Atom)ca2[focusRes2[i]].clone(); if (tmp1[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]); } if (tmp2[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes2[i]); } //XX //tmp2[i].setParent((Group) ca2[focusRes2[i]].getParent().clone()); } double rmsd = 99; try { rmsd = getRmsd(tmp1,tmp2); } catch (Exception e){ e.printStackTrace(); } return rmsd; }
[ "private", "static", "double", "getRmsd", "(", "int", "focusResn", ",", "int", "[", "]", "focusRes1", ",", "int", "[", "]", "focusRes2", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "{", "Atom", "[", "]", "tmp1", "=", "new", "Atom", "[", "focusResn", "]", ";", "Atom", "[", "]", "tmp2", "=", "new", "Atom", "[", "focusResn", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "focusResn", ";", "i", "++", ")", "{", "tmp1", "[", "i", "]", "=", "ca1", "[", "focusRes1", "[", "i", "]", "]", ";", "tmp2", "[", "i", "]", "=", "(", "Atom", ")", "ca2", "[", "focusRes2", "[", "i", "]", "]", ".", "clone", "(", ")", ";", "if", "(", "tmp1", "[", "i", "]", ".", "getCoords", "(", ")", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"tmp1 got null: \"", "+", "i", "+", "\" pos: \"", "+", "focusRes1", "[", "i", "]", ")", ";", "}", "if", "(", "tmp2", "[", "i", "]", ".", "getCoords", "(", ")", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"tmp1 got null: \"", "+", "i", "+", "\" pos: \"", "+", "focusRes2", "[", "i", "]", ")", ";", "}", "//XX", "//tmp2[i].setParent((Group) ca2[focusRes2[i]].getParent().clone());", "}", "double", "rmsd", "=", "99", ";", "try", "{", "rmsd", "=", "getRmsd", "(", "tmp1", ",", "tmp2", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "rmsd", ";", "}" ]
the the RMSD for the residues defined in the two arrays @param focusResn @param focusRes1 @param focusRes2 @return
[ "the", "the", "RMSD", "for", "the", "residues", "defined", "in", "the", "two", "arrays" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L666-L694
jamesagnew/hapi-fhir
hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ShExGenerator.java
ShExGenerator.simpleElement
private String simpleElement(StructureDefinition sd, ElementDefinition ed, String typ) { """ Generate a type reference and optional value set definition @param sd Containing StructureDefinition @param ed Element being defined @param typ Element type @return Type definition """ String addldef = ""; ElementDefinition.ElementDefinitionBindingComponent binding = ed.getBinding(); if(binding.hasStrength() && binding.getStrength() == Enumerations.BindingStrength.REQUIRED && "code".equals(typ)) { ValueSet vs = resolveBindingReference(sd, binding.getValueSet()); if (vs != null) { addldef = tmplt(VALUESET_DEFN_TEMPLATE).add("vsn", vsprefix(vs.getUrl())).render(); required_value_sets.add(vs); } } // TODO: check whether value sets and fixed are mutually exclusive if(ed.hasFixed()) { addldef = tmplt(FIXED_VALUE_TEMPLATE).add("val", ed.getFixed().primitiveValue()).render(); } return tmplt(SIMPLE_ELEMENT_DEFN_TEMPLATE).add("typ", typ).add("vsdef", addldef).render(); }
java
private String simpleElement(StructureDefinition sd, ElementDefinition ed, String typ) { String addldef = ""; ElementDefinition.ElementDefinitionBindingComponent binding = ed.getBinding(); if(binding.hasStrength() && binding.getStrength() == Enumerations.BindingStrength.REQUIRED && "code".equals(typ)) { ValueSet vs = resolveBindingReference(sd, binding.getValueSet()); if (vs != null) { addldef = tmplt(VALUESET_DEFN_TEMPLATE).add("vsn", vsprefix(vs.getUrl())).render(); required_value_sets.add(vs); } } // TODO: check whether value sets and fixed are mutually exclusive if(ed.hasFixed()) { addldef = tmplt(FIXED_VALUE_TEMPLATE).add("val", ed.getFixed().primitiveValue()).render(); } return tmplt(SIMPLE_ELEMENT_DEFN_TEMPLATE).add("typ", typ).add("vsdef", addldef).render(); }
[ "private", "String", "simpleElement", "(", "StructureDefinition", "sd", ",", "ElementDefinition", "ed", ",", "String", "typ", ")", "{", "String", "addldef", "=", "\"\"", ";", "ElementDefinition", ".", "ElementDefinitionBindingComponent", "binding", "=", "ed", ".", "getBinding", "(", ")", ";", "if", "(", "binding", ".", "hasStrength", "(", ")", "&&", "binding", ".", "getStrength", "(", ")", "==", "Enumerations", ".", "BindingStrength", ".", "REQUIRED", "&&", "\"code\"", ".", "equals", "(", "typ", ")", ")", "{", "ValueSet", "vs", "=", "resolveBindingReference", "(", "sd", ",", "binding", ".", "getValueSet", "(", ")", ")", ";", "if", "(", "vs", "!=", "null", ")", "{", "addldef", "=", "tmplt", "(", "VALUESET_DEFN_TEMPLATE", ")", ".", "add", "(", "\"vsn\"", ",", "vsprefix", "(", "vs", ".", "getUrl", "(", ")", ")", ")", ".", "render", "(", ")", ";", "required_value_sets", ".", "add", "(", "vs", ")", ";", "}", "}", "// TODO: check whether value sets and fixed are mutually exclusive\r", "if", "(", "ed", ".", "hasFixed", "(", ")", ")", "{", "addldef", "=", "tmplt", "(", "FIXED_VALUE_TEMPLATE", ")", ".", "add", "(", "\"val\"", ",", "ed", ".", "getFixed", "(", ")", ".", "primitiveValue", "(", ")", ")", ".", "render", "(", ")", ";", "}", "return", "tmplt", "(", "SIMPLE_ELEMENT_DEFN_TEMPLATE", ")", ".", "add", "(", "\"typ\"", ",", "typ", ")", ".", "add", "(", "\"vsdef\"", ",", "addldef", ")", ".", "render", "(", ")", ";", "}" ]
Generate a type reference and optional value set definition @param sd Containing StructureDefinition @param ed Element being defined @param typ Element type @return Type definition
[ "Generate", "a", "type", "reference", "and", "optional", "value", "set", "definition" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ShExGenerator.java#L520-L535
greese/dasein-cloud-digitalocean
src/main/java/org/dasein/cloud/digitalocean/models/rest/DigitalOceanModelFactory.java
DigitalOceanModelFactory.checkAction
public static int checkAction(@Nonnull org.dasein.cloud.digitalocean.DigitalOcean provider, String actionUrl) throws CloudException, InternalException { """ Return HTTP status code for an action request sent via HEAD method @param provider @param actionUrl @return status code @throws InternalException @throws CloudException """ if( logger.isTraceEnabled() ) { logger.trace("ENTER - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")"); } String token = (String) provider.getContext().getConfigurationValue("token"); try { return sendRequest(provider, RESTMethod.HEAD, token, getApiUrl(provider) + "v2/" + actionUrl, null).getStatusLine().getStatusCode(); } finally { if( logger.isTraceEnabled() ) { logger.trace("EXIT - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")"); } } }
java
public static int checkAction(@Nonnull org.dasein.cloud.digitalocean.DigitalOcean provider, String actionUrl) throws CloudException, InternalException { if( logger.isTraceEnabled() ) { logger.trace("ENTER - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")"); } String token = (String) provider.getContext().getConfigurationValue("token"); try { return sendRequest(provider, RESTMethod.HEAD, token, getApiUrl(provider) + "v2/" + actionUrl, null).getStatusLine().getStatusCode(); } finally { if( logger.isTraceEnabled() ) { logger.trace("EXIT - " + DigitalOceanModelFactory.class.getName() + ".checkAction(" + provider.getCloudName() + ")"); } } }
[ "public", "static", "int", "checkAction", "(", "@", "Nonnull", "org", ".", "dasein", ".", "cloud", ".", "digitalocean", ".", "DigitalOcean", "provider", ",", "String", "actionUrl", ")", "throws", "CloudException", ",", "InternalException", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"ENTER - \"", "+", "DigitalOceanModelFactory", ".", "class", ".", "getName", "(", ")", "+", "\".checkAction(\"", "+", "provider", ".", "getCloudName", "(", ")", "+", "\")\"", ")", ";", "}", "String", "token", "=", "(", "String", ")", "provider", ".", "getContext", "(", ")", ".", "getConfigurationValue", "(", "\"token\"", ")", ";", "try", "{", "return", "sendRequest", "(", "provider", ",", "RESTMethod", ".", "HEAD", ",", "token", ",", "getApiUrl", "(", "provider", ")", "+", "\"v2/\"", "+", "actionUrl", ",", "null", ")", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ";", "}", "finally", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"EXIT - \"", "+", "DigitalOceanModelFactory", ".", "class", ".", "getName", "(", ")", "+", "\".checkAction(\"", "+", "provider", ".", "getCloudName", "(", ")", "+", "\")\"", ")", ";", "}", "}", "}" ]
Return HTTP status code for an action request sent via HEAD method @param provider @param actionUrl @return status code @throws InternalException @throws CloudException
[ "Return", "HTTP", "status", "code", "for", "an", "action", "request", "sent", "via", "HEAD", "method" ]
train
https://github.com/greese/dasein-cloud-digitalocean/blob/09b74566b24d7f668379fca237524d4cc0335f77/src/main/java/org/dasein/cloud/digitalocean/models/rest/DigitalOceanModelFactory.java#L378-L392
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java
TypeUtility.getTypeArguments
public static List<TypeName> getTypeArguments(TypeElement element) { """ <p> Retrieve parametrized type of element (from its parent). </p> @param element the element @return list of typemirror or empty list """ final List<TypeName> result = new ArrayList<>(); if (element.getKind() == ElementKind.CLASS) { if (element.getSuperclass() instanceof DeclaredType) { result.addAll(convert(((DeclaredType) element.getSuperclass()).getTypeArguments())); } } else if (element.getKind() == ElementKind.INTERFACE) { List<? extends TypeMirror> interfaces = element.getInterfaces(); for (TypeMirror item : interfaces) { item.accept(new SimpleTypeVisitor7<Void, Void>() { @Override public Void visitDeclared(DeclaredType t, Void p) { result.addAll(convert(t.getTypeArguments())); return null; } }, null); } } return result; }
java
public static List<TypeName> getTypeArguments(TypeElement element) { final List<TypeName> result = new ArrayList<>(); if (element.getKind() == ElementKind.CLASS) { if (element.getSuperclass() instanceof DeclaredType) { result.addAll(convert(((DeclaredType) element.getSuperclass()).getTypeArguments())); } } else if (element.getKind() == ElementKind.INTERFACE) { List<? extends TypeMirror> interfaces = element.getInterfaces(); for (TypeMirror item : interfaces) { item.accept(new SimpleTypeVisitor7<Void, Void>() { @Override public Void visitDeclared(DeclaredType t, Void p) { result.addAll(convert(t.getTypeArguments())); return null; } }, null); } } return result; }
[ "public", "static", "List", "<", "TypeName", ">", "getTypeArguments", "(", "TypeElement", "element", ")", "{", "final", "List", "<", "TypeName", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "element", ".", "getKind", "(", ")", "==", "ElementKind", ".", "CLASS", ")", "{", "if", "(", "element", ".", "getSuperclass", "(", ")", "instanceof", "DeclaredType", ")", "{", "result", ".", "addAll", "(", "convert", "(", "(", "(", "DeclaredType", ")", "element", ".", "getSuperclass", "(", ")", ")", ".", "getTypeArguments", "(", ")", ")", ")", ";", "}", "}", "else", "if", "(", "element", ".", "getKind", "(", ")", "==", "ElementKind", ".", "INTERFACE", ")", "{", "List", "<", "?", "extends", "TypeMirror", ">", "interfaces", "=", "element", ".", "getInterfaces", "(", ")", ";", "for", "(", "TypeMirror", "item", ":", "interfaces", ")", "{", "item", ".", "accept", "(", "new", "SimpleTypeVisitor7", "<", "Void", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "visitDeclared", "(", "DeclaredType", "t", ",", "Void", "p", ")", "{", "result", ".", "addAll", "(", "convert", "(", "t", ".", "getTypeArguments", "(", ")", ")", ")", ";", "return", "null", ";", "}", "}", ",", "null", ")", ";", "}", "}", "return", "result", ";", "}" ]
<p> Retrieve parametrized type of element (from its parent). </p> @param element the element @return list of typemirror or empty list
[ "<p", ">", "Retrieve", "parametrized", "type", "of", "element", "(", "from", "its", "parent", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java#L620-L646
sagiegurari/fax4j
src/main/java/org/fax4j/spi/windows/WindowsJNIFaxClientSpi.java
WindowsJNIFaxClientSpi.winSuspendFaxJob
private void winSuspendFaxJob(String serverName,int faxJobID) { """ This function will suspend an existing fax job. @param serverName The fax server name @param faxJobID The fax job ID """ synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK) { //pre native call this.preNativeCall(); //invoke native WindowsJNIFaxClientSpi.suspendFaxJobNative(serverName,faxJobID); } }
java
private void winSuspendFaxJob(String serverName,int faxJobID) { synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK) { //pre native call this.preNativeCall(); //invoke native WindowsJNIFaxClientSpi.suspendFaxJobNative(serverName,faxJobID); } }
[ "private", "void", "winSuspendFaxJob", "(", "String", "serverName", ",", "int", "faxJobID", ")", "{", "synchronized", "(", "WindowsFaxClientSpiHelper", ".", "NATIVE_LOCK", ")", "{", "//pre native call", "this", ".", "preNativeCall", "(", ")", ";", "//invoke native", "WindowsJNIFaxClientSpi", ".", "suspendFaxJobNative", "(", "serverName", ",", "faxJobID", ")", ";", "}", "}" ]
This function will suspend an existing fax job. @param serverName The fax server name @param faxJobID The fax job ID
[ "This", "function", "will", "suspend", "an", "existing", "fax", "job", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsJNIFaxClientSpi.java#L288-L298
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsListItem.java
CmsListItem.initMoveHandle
public boolean initMoveHandle(CmsDNDHandler dndHandler, boolean addFirst) { """ Initializes the move handle with the given drag and drop handler and adds it to the list item widget.<p> This method will not work for list items that don't have a list-item-widget.<p> @param dndHandler the drag and drop handler @param addFirst if true, adds the move handle as first child @return <code>true</code> if initialization was successful """ if (m_moveHandle != null) { return true; } if (m_listItemWidget == null) { return false; } m_moveHandle = new MoveHandle(this); if (addFirst) { m_listItemWidget.addButtonToFront(m_moveHandle); } else { m_listItemWidget.addButton(m_moveHandle); } m_moveHandle.addMouseDownHandler(dndHandler); return true; }
java
public boolean initMoveHandle(CmsDNDHandler dndHandler, boolean addFirst) { if (m_moveHandle != null) { return true; } if (m_listItemWidget == null) { return false; } m_moveHandle = new MoveHandle(this); if (addFirst) { m_listItemWidget.addButtonToFront(m_moveHandle); } else { m_listItemWidget.addButton(m_moveHandle); } m_moveHandle.addMouseDownHandler(dndHandler); return true; }
[ "public", "boolean", "initMoveHandle", "(", "CmsDNDHandler", "dndHandler", ",", "boolean", "addFirst", ")", "{", "if", "(", "m_moveHandle", "!=", "null", ")", "{", "return", "true", ";", "}", "if", "(", "m_listItemWidget", "==", "null", ")", "{", "return", "false", ";", "}", "m_moveHandle", "=", "new", "MoveHandle", "(", "this", ")", ";", "if", "(", "addFirst", ")", "{", "m_listItemWidget", ".", "addButtonToFront", "(", "m_moveHandle", ")", ";", "}", "else", "{", "m_listItemWidget", ".", "addButton", "(", "m_moveHandle", ")", ";", "}", "m_moveHandle", ".", "addMouseDownHandler", "(", "dndHandler", ")", ";", "return", "true", ";", "}" ]
Initializes the move handle with the given drag and drop handler and adds it to the list item widget.<p> This method will not work for list items that don't have a list-item-widget.<p> @param dndHandler the drag and drop handler @param addFirst if true, adds the move handle as first child @return <code>true</code> if initialization was successful
[ "Initializes", "the", "move", "handle", "with", "the", "given", "drag", "and", "drop", "handler", "and", "adds", "it", "to", "the", "list", "item", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItem.java#L444-L461
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java
LocalMapStatsProvider.getReplicaAddress
private Address getReplicaAddress(int partitionId, int replicaNumber, int backupCount) { """ Gets replica address. Waits if necessary. @see #waitForReplicaAddress """ IPartition partition = partitionService.getPartition(partitionId); Address replicaAddress = partition.getReplicaAddress(replicaNumber); if (replicaAddress == null) { replicaAddress = waitForReplicaAddress(replicaNumber, partition, backupCount); } return replicaAddress; }
java
private Address getReplicaAddress(int partitionId, int replicaNumber, int backupCount) { IPartition partition = partitionService.getPartition(partitionId); Address replicaAddress = partition.getReplicaAddress(replicaNumber); if (replicaAddress == null) { replicaAddress = waitForReplicaAddress(replicaNumber, partition, backupCount); } return replicaAddress; }
[ "private", "Address", "getReplicaAddress", "(", "int", "partitionId", ",", "int", "replicaNumber", ",", "int", "backupCount", ")", "{", "IPartition", "partition", "=", "partitionService", ".", "getPartition", "(", "partitionId", ")", ";", "Address", "replicaAddress", "=", "partition", ".", "getReplicaAddress", "(", "replicaNumber", ")", ";", "if", "(", "replicaAddress", "==", "null", ")", "{", "replicaAddress", "=", "waitForReplicaAddress", "(", "replicaNumber", ",", "partition", ",", "backupCount", ")", ";", "}", "return", "replicaAddress", ";", "}" ]
Gets replica address. Waits if necessary. @see #waitForReplicaAddress
[ "Gets", "replica", "address", ".", "Waits", "if", "necessary", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java#L275-L282
apache/groovy
subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java
TemplateServlet.getTemplate
protected Template getTemplate(File file) throws ServletException { """ Gets the template created by the underlying engine parsing the request. <p> This method looks up a simple (weak) hash map for an existing template object that matches the source file. If the source file didn't change in length and its last modified stamp hasn't changed compared to a precompiled template object, this template is used. Otherwise, there is no or an invalid template object cache entry, a new one is created by the underlying template engine. This new instance is put to the cache for consecutive calls. @return The template that will produce the response text. @param file The file containing the template source. @throws ServletException If the request specified an invalid template source file """ String key = file.getAbsolutePath(); Template template = findCachedTemplate(key, file); // // Template not cached or the source file changed - compile new template! // if (template == null) { try { template = createAndStoreTemplate(key, new FileInputStream(file), file); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e); } } return template; }
java
protected Template getTemplate(File file) throws ServletException { String key = file.getAbsolutePath(); Template template = findCachedTemplate(key, file); // // Template not cached or the source file changed - compile new template! // if (template == null) { try { template = createAndStoreTemplate(key, new FileInputStream(file), file); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e); } } return template; }
[ "protected", "Template", "getTemplate", "(", "File", "file", ")", "throws", "ServletException", "{", "String", "key", "=", "file", ".", "getAbsolutePath", "(", ")", ";", "Template", "template", "=", "findCachedTemplate", "(", "key", ",", "file", ")", ";", "//", "// Template not cached or the source file changed - compile new template!", "//", "if", "(", "template", "==", "null", ")", "{", "try", "{", "template", "=", "createAndStoreTemplate", "(", "key", ",", "new", "FileInputStream", "(", "file", ")", ",", "file", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ServletException", "(", "\"Creation of template failed: \"", "+", "e", ",", "e", ")", ";", "}", "}", "return", "template", ";", "}" ]
Gets the template created by the underlying engine parsing the request. <p> This method looks up a simple (weak) hash map for an existing template object that matches the source file. If the source file didn't change in length and its last modified stamp hasn't changed compared to a precompiled template object, this template is used. Otherwise, there is no or an invalid template object cache entry, a new one is created by the underlying template engine. This new instance is put to the cache for consecutive calls. @return The template that will produce the response text. @param file The file containing the template source. @throws ServletException If the request specified an invalid template source file
[ "Gets", "the", "template", "created", "by", "the", "underlying", "engine", "parsing", "the", "request", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java#L294-L310
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java
SpoilerElement.addSpoiler
public static void addSpoiler(Message message, String lang, String hint) { """ Add a SpoilerElement with a hint in a certain language to a message. @param message Message to add the Spoiler to. @param lang language of the Spoiler hint. @param hint hint. """ message.addExtension(new SpoilerElement(lang, hint)); }
java
public static void addSpoiler(Message message, String lang, String hint) { message.addExtension(new SpoilerElement(lang, hint)); }
[ "public", "static", "void", "addSpoiler", "(", "Message", "message", ",", "String", "lang", ",", "String", "hint", ")", "{", "message", ".", "addExtension", "(", "new", "SpoilerElement", "(", "lang", ",", "hint", ")", ")", ";", "}" ]
Add a SpoilerElement with a hint in a certain language to a message. @param message Message to add the Spoiler to. @param lang language of the Spoiler hint. @param hint hint.
[ "Add", "a", "SpoilerElement", "with", "a", "hint", "in", "a", "certain", "language", "to", "a", "message", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java#L90-L92
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java
OverviewPlot.triggerSubplotSelectEvent
protected void triggerSubplotSelectEvent(PlotItem it) { """ When a subplot was selected, forward the event to listeners. @param it PlotItem selected """ // forward event to all listeners. for(ActionListener actionListener : actionListeners) { actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, it)); } }
java
protected void triggerSubplotSelectEvent(PlotItem it) { // forward event to all listeners. for(ActionListener actionListener : actionListeners) { actionListener.actionPerformed(new DetailViewSelectedEvent(this, ActionEvent.ACTION_PERFORMED, null, 0, it)); } }
[ "protected", "void", "triggerSubplotSelectEvent", "(", "PlotItem", "it", ")", "{", "// forward event to all listeners.", "for", "(", "ActionListener", "actionListener", ":", "actionListeners", ")", "{", "actionListener", ".", "actionPerformed", "(", "new", "DetailViewSelectedEvent", "(", "this", ",", "ActionEvent", ".", "ACTION_PERFORMED", ",", "null", ",", "0", ",", "it", ")", ")", ";", "}", "}" ]
When a subplot was selected, forward the event to listeners. @param it PlotItem selected
[ "When", "a", "subplot", "was", "selected", "forward", "the", "event", "to", "listeners", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/overview/OverviewPlot.java#L523-L528
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java
WarUtils.addFilter
public static void addFilter(Document doc, Element root) { """ Adds the shiro filter to a web.xml file. @param doc The xml DOM document to create the new xml elements with. @param root The xml Element node to add the filter to. """ Element filter = doc.createElement("filter"); Element filterName = doc.createElement("filter-name"); filterName.appendChild(doc.createTextNode("ShiroFilter")); filter.appendChild(filterName); Element filterClass = doc.createElement("filter-class"); filterClass.appendChild(doc .createTextNode("org.apache.shiro.web.servlet.ShiroFilter")); filter.appendChild(filterClass); addRelativeTo(root, filter, "filter", true); }
java
public static void addFilter(Document doc, Element root) { Element filter = doc.createElement("filter"); Element filterName = doc.createElement("filter-name"); filterName.appendChild(doc.createTextNode("ShiroFilter")); filter.appendChild(filterName); Element filterClass = doc.createElement("filter-class"); filterClass.appendChild(doc .createTextNode("org.apache.shiro.web.servlet.ShiroFilter")); filter.appendChild(filterClass); addRelativeTo(root, filter, "filter", true); }
[ "public", "static", "void", "addFilter", "(", "Document", "doc", ",", "Element", "root", ")", "{", "Element", "filter", "=", "doc", ".", "createElement", "(", "\"filter\"", ")", ";", "Element", "filterName", "=", "doc", ".", "createElement", "(", "\"filter-name\"", ")", ";", "filterName", ".", "appendChild", "(", "doc", ".", "createTextNode", "(", "\"ShiroFilter\"", ")", ")", ";", "filter", ".", "appendChild", "(", "filterName", ")", ";", "Element", "filterClass", "=", "doc", ".", "createElement", "(", "\"filter-class\"", ")", ";", "filterClass", ".", "appendChild", "(", "doc", ".", "createTextNode", "(", "\"org.apache.shiro.web.servlet.ShiroFilter\"", ")", ")", ";", "filter", ".", "appendChild", "(", "filterClass", ")", ";", "addRelativeTo", "(", "root", ",", "filter", ",", "\"filter\"", ",", "true", ")", ";", "}" ]
Adds the shiro filter to a web.xml file. @param doc The xml DOM document to create the new xml elements with. @param root The xml Element node to add the filter to.
[ "Adds", "the", "shiro", "filter", "to", "a", "web", ".", "xml", "file", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L313-L324
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java
FrequentlyUsedPolicy.onHit
private void onHit(Node node) { """ Moves the entry to the next higher frequency list, creating it if necessary. """ policyStats.recordHit(); int newCount = node.freq.count + 1; FrequencyNode freqN = (node.freq.next.count == newCount) ? node.freq.next : new FrequencyNode(newCount, node.freq); node.remove(); if (node.freq.isEmpty()) { node.freq.remove(); } node.freq = freqN; node.append(); }
java
private void onHit(Node node) { policyStats.recordHit(); int newCount = node.freq.count + 1; FrequencyNode freqN = (node.freq.next.count == newCount) ? node.freq.next : new FrequencyNode(newCount, node.freq); node.remove(); if (node.freq.isEmpty()) { node.freq.remove(); } node.freq = freqN; node.append(); }
[ "private", "void", "onHit", "(", "Node", "node", ")", "{", "policyStats", ".", "recordHit", "(", ")", ";", "int", "newCount", "=", "node", ".", "freq", ".", "count", "+", "1", ";", "FrequencyNode", "freqN", "=", "(", "node", ".", "freq", ".", "next", ".", "count", "==", "newCount", ")", "?", "node", ".", "freq", ".", "next", ":", "new", "FrequencyNode", "(", "newCount", ",", "node", ".", "freq", ")", ";", "node", ".", "remove", "(", ")", ";", "if", "(", "node", ".", "freq", ".", "isEmpty", "(", ")", ")", "{", "node", ".", "freq", ".", "remove", "(", ")", ";", "}", "node", ".", "freq", "=", "freqN", ";", "node", ".", "append", "(", ")", ";", "}" ]
Moves the entry to the next higher frequency list, creating it if necessary.
[ "Moves", "the", "entry", "to", "the", "next", "higher", "frequency", "list", "creating", "it", "if", "necessary", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java#L87-L100
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java
RtcpHandler.rescheduleRtcp
private void rescheduleRtcp(TxTask task, long timestamp) { """ Re-schedules a previously scheduled event. @param timestamp The time stamp (in milliseconds) of the rescheduled event """ // Cancel current execution of the task this.reportTaskFuture.cancel(true); // Re-schedule task execution long interval = resolveInterval(timestamp); try { this.reportTaskFuture = this.scheduler.schedule(task, interval, TimeUnit.MILLISECONDS); } catch (IllegalStateException e) { logger.warn("RTCP timer already canceled. Scheduled report was canceled and cannot be re-scheduled."); } }
java
private void rescheduleRtcp(TxTask task, long timestamp) { // Cancel current execution of the task this.reportTaskFuture.cancel(true); // Re-schedule task execution long interval = resolveInterval(timestamp); try { this.reportTaskFuture = this.scheduler.schedule(task, interval, TimeUnit.MILLISECONDS); } catch (IllegalStateException e) { logger.warn("RTCP timer already canceled. Scheduled report was canceled and cannot be re-scheduled."); } }
[ "private", "void", "rescheduleRtcp", "(", "TxTask", "task", ",", "long", "timestamp", ")", "{", "// Cancel current execution of the task", "this", ".", "reportTaskFuture", ".", "cancel", "(", "true", ")", ";", "// Re-schedule task execution", "long", "interval", "=", "resolveInterval", "(", "timestamp", ")", ";", "try", "{", "this", ".", "reportTaskFuture", "=", "this", ".", "scheduler", ".", "schedule", "(", "task", ",", "interval", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "logger", ".", "warn", "(", "\"RTCP timer already canceled. Scheduled report was canceled and cannot be re-scheduled.\"", ")", ";", "}", "}" ]
Re-schedules a previously scheduled event. @param timestamp The time stamp (in milliseconds) of the rescheduled event
[ "Re", "-", "schedules", "a", "previously", "scheduled", "event", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java#L255-L266
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java
ZipFileContainer.isModified
private boolean isModified(ArtifactEntry entry, File file) { """ Tell if an entry is modified relative to a file. That is if the last modified times are different. File last update times are accurate to about a second. Allow the last modified times to match if they are that close. @param entry The entry to test. @param file The file to test. @return True or false telling if the last modified times of the file and entry are different. """ long fileLastModified = FileUtils.fileLastModified(file); long entryLastModified = entry.getLastModified(); // File 100K entry 10K delta 90k true (entry is much older than the file) // File 10k entry 100k delta 90k true (file is much older than the entry) // File 10k entry 9k delta 1k false (entry is slightly older than the file) // File 9k entry 10k delta 1k false (file is slightly older than the entry) // File 9k entry 9k delta 0k false (file and entry are exactly the same age) return ( Math.abs(fileLastModified - entryLastModified) >= 1010L ); }
java
private boolean isModified(ArtifactEntry entry, File file) { long fileLastModified = FileUtils.fileLastModified(file); long entryLastModified = entry.getLastModified(); // File 100K entry 10K delta 90k true (entry is much older than the file) // File 10k entry 100k delta 90k true (file is much older than the entry) // File 10k entry 9k delta 1k false (entry is slightly older than the file) // File 9k entry 10k delta 1k false (file is slightly older than the entry) // File 9k entry 9k delta 0k false (file and entry are exactly the same age) return ( Math.abs(fileLastModified - entryLastModified) >= 1010L ); }
[ "private", "boolean", "isModified", "(", "ArtifactEntry", "entry", ",", "File", "file", ")", "{", "long", "fileLastModified", "=", "FileUtils", ".", "fileLastModified", "(", "file", ")", ";", "long", "entryLastModified", "=", "entry", ".", "getLastModified", "(", ")", ";", "// File 100K entry 10K delta 90k true (entry is much older than the file)", "// File 10k entry 100k delta 90k true (file is much older than the entry)", "// File 10k entry 9k delta 1k false (entry is slightly older than the file)", "// File 9k entry 10k delta 1k false (file is slightly older than the entry)", "// File 9k entry 9k delta 0k false (file and entry are exactly the same age)", "return", "(", "Math", ".", "abs", "(", "fileLastModified", "-", "entryLastModified", ")", ">=", "1010L", ")", ";", "}" ]
Tell if an entry is modified relative to a file. That is if the last modified times are different. File last update times are accurate to about a second. Allow the last modified times to match if they are that close. @param entry The entry to test. @param file The file to test. @return True or false telling if the last modified times of the file and entry are different.
[ "Tell", "if", "an", "entry", "is", "modified", "relative", "to", "a", "file", ".", "That", "is", "if", "the", "last", "modified", "times", "are", "different", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/internal/ZipFileContainer.java#L1621-L1632
alkacon/opencms-core
src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBCmsUsers.java
CmsUpdateDBCmsUsers.addWebusersToGroup
protected void addWebusersToGroup(CmsSetupDb dbCon, CmsUUID id) throws SQLException { """ Adds all webusers to the new previously created webusers group.<p> @param dbCon the db connection interface @param id the id of the new webusers group @throws SQLException if something goes wrong """ String sql = readQuery(QUERY_ADD_WEBUSERS_TO_GROUP); Map<String, String> replacements = new HashMap<String, String>(); replacements.put("${GROUP_ID}", id.toString()); dbCon.updateSqlStatement(sql, replacements, null); }
java
protected void addWebusersToGroup(CmsSetupDb dbCon, CmsUUID id) throws SQLException { String sql = readQuery(QUERY_ADD_WEBUSERS_TO_GROUP); Map<String, String> replacements = new HashMap<String, String>(); replacements.put("${GROUP_ID}", id.toString()); dbCon.updateSqlStatement(sql, replacements, null); }
[ "protected", "void", "addWebusersToGroup", "(", "CmsSetupDb", "dbCon", ",", "CmsUUID", "id", ")", "throws", "SQLException", "{", "String", "sql", "=", "readQuery", "(", "QUERY_ADD_WEBUSERS_TO_GROUP", ")", ";", "Map", "<", "String", ",", "String", ">", "replacements", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "replacements", ".", "put", "(", "\"${GROUP_ID}\"", ",", "id", ".", "toString", "(", ")", ")", ";", "dbCon", ".", "updateSqlStatement", "(", "sql", ",", "replacements", ",", "null", ")", ";", "}" ]
Adds all webusers to the new previously created webusers group.<p> @param dbCon the db connection interface @param id the id of the new webusers group @throws SQLException if something goes wrong
[ "Adds", "all", "webusers", "to", "the", "new", "previously", "created", "webusers", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBCmsUsers.java#L243-L249
ecclesia/kipeto
kipeto-common/src/main/java/de/ecclesia/kipeto/common/util/Streams.java
Streams.copyStream
public static void copyStream(InputStream sourceStream, OutputStream destinationStream, boolean closeStreams) throws IOException { """ Kopiert den Inhalt eines Datenstroms in einen anderen. Aus Geschwindigkeitsgründen werden die Ströme gebuffert. Diese Funktion sollte verwendet werden, falls die Datenströme noch nicht Buffered*Stream implementieren. @param sourceStream Quelldatenstrom @param destinationStream Zieldatenstrom @throws IOException """ BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(destinationStream); try { copyBufferedStream(new BufferedInputStream(sourceStream), bufferedOutputStream, closeStreams); } finally { if (!closeStreams) { bufferedOutputStream.flush(); } } }
java
public static void copyStream(InputStream sourceStream, OutputStream destinationStream, boolean closeStreams) throws IOException { BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(destinationStream); try { copyBufferedStream(new BufferedInputStream(sourceStream), bufferedOutputStream, closeStreams); } finally { if (!closeStreams) { bufferedOutputStream.flush(); } } }
[ "public", "static", "void", "copyStream", "(", "InputStream", "sourceStream", ",", "OutputStream", "destinationStream", ",", "boolean", "closeStreams", ")", "throws", "IOException", "{", "BufferedOutputStream", "bufferedOutputStream", "=", "new", "BufferedOutputStream", "(", "destinationStream", ")", ";", "try", "{", "copyBufferedStream", "(", "new", "BufferedInputStream", "(", "sourceStream", ")", ",", "bufferedOutputStream", ",", "closeStreams", ")", ";", "}", "finally", "{", "if", "(", "!", "closeStreams", ")", "{", "bufferedOutputStream", ".", "flush", "(", ")", ";", "}", "}", "}" ]
Kopiert den Inhalt eines Datenstroms in einen anderen. Aus Geschwindigkeitsgründen werden die Ströme gebuffert. Diese Funktion sollte verwendet werden, falls die Datenströme noch nicht Buffered*Stream implementieren. @param sourceStream Quelldatenstrom @param destinationStream Zieldatenstrom @throws IOException
[ "Kopiert", "den", "Inhalt", "eines", "Datenstroms", "in", "einen", "anderen", ".", "Aus", "Geschwindigkeitsgründen", "werden", "die", "Ströme", "gebuffert", ".", "Diese", "Funktion", "sollte", "verwendet", "werden", "falls", "die", "Datenströme", "noch", "nicht", "Buffered", "*", "Stream", "implementieren", "." ]
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-common/src/main/java/de/ecclesia/kipeto/common/util/Streams.java#L71-L81
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/msg/MsgChecker.java
MsgChecker.checkDataInnerRules
public void checkDataInnerRules(ValidationData data, Object bodyObj) { """ Check data inner rules. @param data the data @param bodyObj the body obj """ data.getValidationRules().stream().filter(vr -> vr.isUse()).forEach(rule -> { if (data.isListChild()) { this.checkPointListChild(data, rule, bodyObj, rule.getStandardValue()); } else { this.checkPoint(data, rule, bodyObj, rule.getStandardValue()); } }); }
java
public void checkDataInnerRules(ValidationData data, Object bodyObj) { data.getValidationRules().stream().filter(vr -> vr.isUse()).forEach(rule -> { if (data.isListChild()) { this.checkPointListChild(data, rule, bodyObj, rule.getStandardValue()); } else { this.checkPoint(data, rule, bodyObj, rule.getStandardValue()); } }); }
[ "public", "void", "checkDataInnerRules", "(", "ValidationData", "data", ",", "Object", "bodyObj", ")", "{", "data", ".", "getValidationRules", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "vr", "->", "vr", ".", "isUse", "(", ")", ")", ".", "forEach", "(", "rule", "->", "{", "if", "(", "data", ".", "isListChild", "(", ")", ")", "{", "this", ".", "checkPointListChild", "(", "data", ",", "rule", ",", "bodyObj", ",", "rule", ".", "getStandardValue", "(", ")", ")", ";", "}", "else", "{", "this", ".", "checkPoint", "(", "data", ",", "rule", ",", "bodyObj", ",", "rule", ".", "getStandardValue", "(", ")", ")", ";", "}", "}", ")", ";", "}" ]
Check data inner rules. @param data the data @param bodyObj the body obj
[ "Check", "data", "inner", "rules", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/msg/MsgChecker.java#L105-L113
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java
OAuthActivity.createOAuthActivityIntent
public static Intent createOAuthActivityIntent(final Context context, final String clientId, final String clientSecret, String redirectUrl, boolean loginViaBoxApp) { """ Create intent to launch OAuthActivity. Notes about redirect url parameter: If you already set redirect url in <a href="https://cloud.app.box.com/developers/services">box dev console</a>, you should pass in the same redirect url or use null for redirect url. If you didn't set it in box dev console, you should pass in a url. In case you don't have a redirect server you can simply use "http://localhost". @param context context @param clientId your box client id @param clientSecret your box client secret @param redirectUrl redirect url, if you already set redirect url in <a href="https://cloud.app.box.com/developers/services">box dev console</a>, leave this null or use the same url, otherwise this field is required. You can use "http://localhost" if you don't have a redirect server. @param loginViaBoxApp Whether login should be handled by the installed box android app. Set this to true only when you are sure or want to make sure user installed box android app and want to use box android app to login. @return intent to launch OAuthActivity. """ Intent intent = new Intent(context, OAuthActivity.class); intent.putExtra(BoxConstants.KEY_CLIENT_ID, clientId); intent.putExtra(BoxConstants.KEY_CLIENT_SECRET, clientSecret); if (!SdkUtils.isEmptyString(redirectUrl)) { intent.putExtra(BoxConstants.KEY_REDIRECT_URL, redirectUrl); } intent.putExtra(LOGIN_VIA_BOX_APP, loginViaBoxApp); return intent; }
java
public static Intent createOAuthActivityIntent(final Context context, final String clientId, final String clientSecret, String redirectUrl, boolean loginViaBoxApp) { Intent intent = new Intent(context, OAuthActivity.class); intent.putExtra(BoxConstants.KEY_CLIENT_ID, clientId); intent.putExtra(BoxConstants.KEY_CLIENT_SECRET, clientSecret); if (!SdkUtils.isEmptyString(redirectUrl)) { intent.putExtra(BoxConstants.KEY_REDIRECT_URL, redirectUrl); } intent.putExtra(LOGIN_VIA_BOX_APP, loginViaBoxApp); return intent; }
[ "public", "static", "Intent", "createOAuthActivityIntent", "(", "final", "Context", "context", ",", "final", "String", "clientId", ",", "final", "String", "clientSecret", ",", "String", "redirectUrl", ",", "boolean", "loginViaBoxApp", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "OAuthActivity", ".", "class", ")", ";", "intent", ".", "putExtra", "(", "BoxConstants", ".", "KEY_CLIENT_ID", ",", "clientId", ")", ";", "intent", ".", "putExtra", "(", "BoxConstants", ".", "KEY_CLIENT_SECRET", ",", "clientSecret", ")", ";", "if", "(", "!", "SdkUtils", ".", "isEmptyString", "(", "redirectUrl", ")", ")", "{", "intent", ".", "putExtra", "(", "BoxConstants", ".", "KEY_REDIRECT_URL", ",", "redirectUrl", ")", ";", "}", "intent", ".", "putExtra", "(", "LOGIN_VIA_BOX_APP", ",", "loginViaBoxApp", ")", ";", "return", "intent", ";", "}" ]
Create intent to launch OAuthActivity. Notes about redirect url parameter: If you already set redirect url in <a href="https://cloud.app.box.com/developers/services">box dev console</a>, you should pass in the same redirect url or use null for redirect url. If you didn't set it in box dev console, you should pass in a url. In case you don't have a redirect server you can simply use "http://localhost". @param context context @param clientId your box client id @param clientSecret your box client secret @param redirectUrl redirect url, if you already set redirect url in <a href="https://cloud.app.box.com/developers/services">box dev console</a>, leave this null or use the same url, otherwise this field is required. You can use "http://localhost" if you don't have a redirect server. @param loginViaBoxApp Whether login should be handled by the installed box android app. Set this to true only when you are sure or want to make sure user installed box android app and want to use box android app to login. @return intent to launch OAuthActivity.
[ "Create", "intent", "to", "launch", "OAuthActivity", ".", "Notes", "about", "redirect", "url", "parameter", ":", "If", "you", "already", "set", "redirect", "url", "in", "<a", "href", "=", "https", ":", "//", "cloud", ".", "app", ".", "box", ".", "com", "/", "developers", "/", "services", ">", "box", "dev", "console<", "/", "a", ">", "you", "should", "pass", "in", "the", "same", "redirect", "url", "or", "use", "null", "for", "redirect", "url", ".", "If", "you", "didn", "t", "set", "it", "in", "box", "dev", "console", "you", "should", "pass", "in", "a", "url", ".", "In", "case", "you", "don", "t", "have", "a", "redirect", "server", "you", "can", "simply", "use", "http", ":", "//", "localhost", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L519-L528
amsa-code/risky
ais/src/main/java/au/gov/amsa/ais/Util.java
Util.checkLatLong
public static void checkLatLong(double lat, double lon) { """ Check lat lon are withing allowable range as per 1371-4.pdf. Note that values of long=181, lat=91 have special meaning. @param lat @param lon """ checkArgument(lon <= 181.0, "longitude out of range " + lon); checkArgument(lon > -180.0, "longitude out of range " + lon); checkArgument(lat <= 91.0, "latitude out of range " + lat); checkArgument(lat > -90.0, "latitude out of range " + lat); }
java
public static void checkLatLong(double lat, double lon) { checkArgument(lon <= 181.0, "longitude out of range " + lon); checkArgument(lon > -180.0, "longitude out of range " + lon); checkArgument(lat <= 91.0, "latitude out of range " + lat); checkArgument(lat > -90.0, "latitude out of range " + lat); }
[ "public", "static", "void", "checkLatLong", "(", "double", "lat", ",", "double", "lon", ")", "{", "checkArgument", "(", "lon", "<=", "181.0", ",", "\"longitude out of range \"", "+", "lon", ")", ";", "checkArgument", "(", "lon", ">", "-", "180.0", ",", "\"longitude out of range \"", "+", "lon", ")", ";", "checkArgument", "(", "lat", "<=", "91.0", ",", "\"latitude out of range \"", "+", "lat", ")", ";", "checkArgument", "(", "lat", ">", "-", "90.0", ",", "\"latitude out of range \"", "+", "lat", ")", ";", "}" ]
Check lat lon are withing allowable range as per 1371-4.pdf. Note that values of long=181, lat=91 have special meaning. @param lat @param lon
[ "Check", "lat", "lon", "are", "withing", "allowable", "range", "as", "per", "1371", "-", "4", ".", "pdf", ".", "Note", "that", "values", "of", "long", "=", "181", "lat", "=", "91", "have", "special", "meaning", "." ]
train
https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/ais/Util.java#L197-L202
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java
CitrusAnnotations.injectAll
public static final void injectAll(final Object target, final Citrus citrusFramework, final TestContext context) { """ Injects all supported components and endpoints to target object using annotations. @param target """ injectCitrusFramework(target, citrusFramework); injectEndpoints(target, context); }
java
public static final void injectAll(final Object target, final Citrus citrusFramework, final TestContext context) { injectCitrusFramework(target, citrusFramework); injectEndpoints(target, context); }
[ "public", "static", "final", "void", "injectAll", "(", "final", "Object", "target", ",", "final", "Citrus", "citrusFramework", ",", "final", "TestContext", "context", ")", "{", "injectCitrusFramework", "(", "target", ",", "citrusFramework", ")", ";", "injectEndpoints", "(", "target", ",", "context", ")", ";", "}" ]
Injects all supported components and endpoints to target object using annotations. @param target
[ "Injects", "all", "supported", "components", "and", "endpoints", "to", "target", "object", "using", "annotations", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java#L68-L71
ansell/restlet-utils
src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java
FixedRedirectCookieAuthenticator.attemptRedirect
protected void attemptRedirect(final Request request, final Response response, final Form form) { """ Attempts to redirect the user's browser can be redirected to the URI provided in a query parameter named by {@link #getRedirectQueryName()}. Uses a configured fixed redirect URI or a default redirect URI if they are not setup. @param request The current request. @param response The current response. @param form The query parameters. """ this.log.debug("redirectQueryName: {}", this.getRedirectQueryName()); this.log.debug("query: {}", request.getResourceRef().getQueryAsForm()); //this.log.info("form: {}", form); String targetUri = request.getResourceRef().getQueryAsForm().getFirstValue(this.getRedirectQueryName(), true); this.log.debug("attemptRedirect: targetUri={}", targetUri); if(targetUri == null && form != null) { targetUri = form.getFirstValue(this.getRedirectQueryName(), true); } this.log.debug("attemptRedirect: targetUri={}", targetUri); if(targetUri != null) { response.redirectSeeOther(Reference.decode(targetUri)); return; } if(this.getFixedRedirectUri() != null) { this.log.debug("attemptRedirect: fixedRedirectUri={}", this.getFixedRedirectUri()); response.redirectSeeOther(this.getFixedRedirectUri()); return; } else { this.log.debug("attemptRedirect: fixedRedirectUri={}", FixedRedirectCookieAuthenticator.DEFAULT_FIXED_REDIRECT_URI); response.redirectSeeOther(FixedRedirectCookieAuthenticator.DEFAULT_FIXED_REDIRECT_URI); return; } }
java
protected void attemptRedirect(final Request request, final Response response, final Form form) { this.log.debug("redirectQueryName: {}", this.getRedirectQueryName()); this.log.debug("query: {}", request.getResourceRef().getQueryAsForm()); //this.log.info("form: {}", form); String targetUri = request.getResourceRef().getQueryAsForm().getFirstValue(this.getRedirectQueryName(), true); this.log.debug("attemptRedirect: targetUri={}", targetUri); if(targetUri == null && form != null) { targetUri = form.getFirstValue(this.getRedirectQueryName(), true); } this.log.debug("attemptRedirect: targetUri={}", targetUri); if(targetUri != null) { response.redirectSeeOther(Reference.decode(targetUri)); return; } if(this.getFixedRedirectUri() != null) { this.log.debug("attemptRedirect: fixedRedirectUri={}", this.getFixedRedirectUri()); response.redirectSeeOther(this.getFixedRedirectUri()); return; } else { this.log.debug("attemptRedirect: fixedRedirectUri={}", FixedRedirectCookieAuthenticator.DEFAULT_FIXED_REDIRECT_URI); response.redirectSeeOther(FixedRedirectCookieAuthenticator.DEFAULT_FIXED_REDIRECT_URI); return; } }
[ "protected", "void", "attemptRedirect", "(", "final", "Request", "request", ",", "final", "Response", "response", ",", "final", "Form", "form", ")", "{", "this", ".", "log", ".", "debug", "(", "\"redirectQueryName: {}\"", ",", "this", ".", "getRedirectQueryName", "(", ")", ")", ";", "this", ".", "log", ".", "debug", "(", "\"query: {}\"", ",", "request", ".", "getResourceRef", "(", ")", ".", "getQueryAsForm", "(", ")", ")", ";", "//this.log.info(\"form: {}\", form);", "String", "targetUri", "=", "request", ".", "getResourceRef", "(", ")", ".", "getQueryAsForm", "(", ")", ".", "getFirstValue", "(", "this", ".", "getRedirectQueryName", "(", ")", ",", "true", ")", ";", "this", ".", "log", ".", "debug", "(", "\"attemptRedirect: targetUri={}\"", ",", "targetUri", ")", ";", "if", "(", "targetUri", "==", "null", "&&", "form", "!=", "null", ")", "{", "targetUri", "=", "form", ".", "getFirstValue", "(", "this", ".", "getRedirectQueryName", "(", ")", ",", "true", ")", ";", "}", "this", ".", "log", ".", "debug", "(", "\"attemptRedirect: targetUri={}\"", ",", "targetUri", ")", ";", "if", "(", "targetUri", "!=", "null", ")", "{", "response", ".", "redirectSeeOther", "(", "Reference", ".", "decode", "(", "targetUri", ")", ")", ";", "return", ";", "}", "if", "(", "this", ".", "getFixedRedirectUri", "(", ")", "!=", "null", ")", "{", "this", ".", "log", ".", "debug", "(", "\"attemptRedirect: fixedRedirectUri={}\"", ",", "this", ".", "getFixedRedirectUri", "(", ")", ")", ";", "response", ".", "redirectSeeOther", "(", "this", ".", "getFixedRedirectUri", "(", ")", ")", ";", "return", ";", "}", "else", "{", "this", ".", "log", ".", "debug", "(", "\"attemptRedirect: fixedRedirectUri={}\"", ",", "FixedRedirectCookieAuthenticator", ".", "DEFAULT_FIXED_REDIRECT_URI", ")", ";", "response", ".", "redirectSeeOther", "(", "FixedRedirectCookieAuthenticator", ".", "DEFAULT_FIXED_REDIRECT_URI", ")", ";", "return", ";", "}", "}" ]
Attempts to redirect the user's browser can be redirected to the URI provided in a query parameter named by {@link #getRedirectQueryName()}. Uses a configured fixed redirect URI or a default redirect URI if they are not setup. @param request The current request. @param response The current response. @param form The query parameters.
[ "Attempts", "to", "redirect", "the", "user", "s", "browser", "can", "be", "redirected", "to", "the", "URI", "provided", "in", "a", "query", "parameter", "named", "by", "{", "@link", "#getRedirectQueryName", "()", "}", "." ]
train
https://github.com/ansell/restlet-utils/blob/6c39a3e91aa8295936af1dbfccd6ba27230c40a9/src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java#L188-L224
paylogic/java-fogbugz
src/main/java/org/paylogic/fogbugz/FogbugzManager.java
FogbugzManager.mapToFogbugzUrl
private String mapToFogbugzUrl(Map<String, String> params) throws UnsupportedEncodingException { """ Helper method to create API url from Map, with proper encoding. @param params Map with parameters to encode. @return String which represents API URL. """ String output = this.getFogbugzUrl(); for (String key : params.keySet()) { String value = params.get(key); if (!value.isEmpty()) { output += "&" + URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8"); } } FogbugzManager.log.info("Generated URL to send to Fogbugz: " + output); return output; }
java
private String mapToFogbugzUrl(Map<String, String> params) throws UnsupportedEncodingException { String output = this.getFogbugzUrl(); for (String key : params.keySet()) { String value = params.get(key); if (!value.isEmpty()) { output += "&" + URLEncoder.encode(key, "UTF-8") + "=" + URLEncoder.encode(value, "UTF-8"); } } FogbugzManager.log.info("Generated URL to send to Fogbugz: " + output); return output; }
[ "private", "String", "mapToFogbugzUrl", "(", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "UnsupportedEncodingException", "{", "String", "output", "=", "this", ".", "getFogbugzUrl", "(", ")", ";", "for", "(", "String", "key", ":", "params", ".", "keySet", "(", ")", ")", "{", "String", "value", "=", "params", ".", "get", "(", "key", ")", ";", "if", "(", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "output", "+=", "\"&\"", "+", "URLEncoder", ".", "encode", "(", "key", ",", "\"UTF-8\"", ")", "+", "\"=\"", "+", "URLEncoder", ".", "encode", "(", "value", ",", "\"UTF-8\"", ")", ";", "}", "}", "FogbugzManager", ".", "log", ".", "info", "(", "\"Generated URL to send to Fogbugz: \"", "+", "output", ")", ";", "return", "output", ";", "}" ]
Helper method to create API url from Map, with proper encoding. @param params Map with parameters to encode. @return String which represents API URL.
[ "Helper", "method", "to", "create", "API", "url", "from", "Map", "with", "proper", "encoding", "." ]
train
https://github.com/paylogic/java-fogbugz/blob/75651d82b2476e9ba2a0805311e18ee36882c2df/src/main/java/org/paylogic/fogbugz/FogbugzManager.java#L92-L102
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java
AtomWriter.writeFeed
public void writeFeed(List<?> entities, String requestContextURL, Map<String, Object> meta) throws ODataRenderException { """ <p> Write a list of entities (feed) to the XML stream. </p> <p> <b>Note:</b> Make sure {@link AtomWriter#startDocument()} has been previously invoked to start the XML stream document, and {@link AtomWriter#endDocument()} is invoked after to end it. </p> @param entities The list of entities to fill in the XML stream. It can not {@code null}. @param requestContextURL The 'Context URL' to write for the feed. It can not {@code null}. @param meta Additional metadata to write. @throws ODataRenderException In case it is not possible to write to the XML stream. """ writeStartFeed(requestContextURL, meta); writeBodyFeed(entities); writeEndFeed(); }
java
public void writeFeed(List<?> entities, String requestContextURL, Map<String, Object> meta) throws ODataRenderException { writeStartFeed(requestContextURL, meta); writeBodyFeed(entities); writeEndFeed(); }
[ "public", "void", "writeFeed", "(", "List", "<", "?", ">", "entities", ",", "String", "requestContextURL", ",", "Map", "<", "String", ",", "Object", ">", "meta", ")", "throws", "ODataRenderException", "{", "writeStartFeed", "(", "requestContextURL", ",", "meta", ")", ";", "writeBodyFeed", "(", "entities", ")", ";", "writeEndFeed", "(", ")", ";", "}" ]
<p> Write a list of entities (feed) to the XML stream. </p> <p> <b>Note:</b> Make sure {@link AtomWriter#startDocument()} has been previously invoked to start the XML stream document, and {@link AtomWriter#endDocument()} is invoked after to end it. </p> @param entities The list of entities to fill in the XML stream. It can not {@code null}. @param requestContextURL The 'Context URL' to write for the feed. It can not {@code null}. @param meta Additional metadata to write. @throws ODataRenderException In case it is not possible to write to the XML stream.
[ "<p", ">", "Write", "a", "list", "of", "entities", "(", "feed", ")", "to", "the", "XML", "stream", ".", "<", "/", "p", ">", "<p", ">", "<b", ">", "Note", ":", "<", "/", "b", ">", "Make", "sure", "{", "@link", "AtomWriter#startDocument", "()", "}", "has", "been", "previously", "invoked", "to", "start", "the", "XML", "stream", "document", "and", "{", "@link", "AtomWriter#endDocument", "()", "}", "is", "invoked", "after", "to", "end", "it", ".", "<", "/", "p", ">" ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java#L209-L214
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java
CmsXmlContentPropertyHelper.convertStringPropertyValue
protected static String convertStringPropertyValue(CmsObject cms, String propValue, String type, boolean toClient) { """ Converts a property value given as a string between server format and client format.<p> @param cms the current CMS context @param propValue the property value to convert @param type the type of the property @param toClient if true, convert to client format, else convert to server format @return the converted property value """ if (propValue == null) { return null; } if (toClient) { return CmsXmlContentPropertyHelper.getPropValuePaths(cms, type, propValue); } else { return CmsXmlContentPropertyHelper.getPropValueIds(cms, type, propValue); } }
java
protected static String convertStringPropertyValue(CmsObject cms, String propValue, String type, boolean toClient) { if (propValue == null) { return null; } if (toClient) { return CmsXmlContentPropertyHelper.getPropValuePaths(cms, type, propValue); } else { return CmsXmlContentPropertyHelper.getPropValueIds(cms, type, propValue); } }
[ "protected", "static", "String", "convertStringPropertyValue", "(", "CmsObject", "cms", ",", "String", "propValue", ",", "String", "type", ",", "boolean", "toClient", ")", "{", "if", "(", "propValue", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "toClient", ")", "{", "return", "CmsXmlContentPropertyHelper", ".", "getPropValuePaths", "(", "cms", ",", "type", ",", "propValue", ")", ";", "}", "else", "{", "return", "CmsXmlContentPropertyHelper", ".", "getPropValueIds", "(", "cms", ",", "type", ",", "propValue", ")", ";", "}", "}" ]
Converts a property value given as a string between server format and client format.<p> @param cms the current CMS context @param propValue the property value to convert @param type the type of the property @param toClient if true, convert to client format, else convert to server format @return the converted property value
[ "Converts", "a", "property", "value", "given", "as", "a", "string", "between", "server", "format", "and", "client", "format", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L890-L900
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.sshKey_POST
public void sshKey_POST(String key, String keyName) throws IOException { """ Add a new public SSH key REST: POST /me/sshKey @param key [required] ASCII encoded public SSH key to add @param keyName [required] name of the new public SSH key """ String qPath = "/me/sshKey"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "key", key); addBody(o, "keyName", keyName); exec(qPath, "POST", sb.toString(), o); }
java
public void sshKey_POST(String key, String keyName) throws IOException { String qPath = "/me/sshKey"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "key", key); addBody(o, "keyName", keyName); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "sshKey_POST", "(", "String", "key", ",", "String", "keyName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/sshKey\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"key\"", ",", "key", ")", ";", "addBody", "(", "o", ",", "\"keyName\"", ",", "keyName", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Add a new public SSH key REST: POST /me/sshKey @param key [required] ASCII encoded public SSH key to add @param keyName [required] name of the new public SSH key
[ "Add", "a", "new", "public", "SSH", "key" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1277-L1284
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addMVPName
private void addMVPName(Document doc, InternalQName name) throws RepositoryException { """ Adds a {@link FieldNames#MVP} field to <code>doc</code> with the resolved <code>name</code> using the internal search index namespace mapping. @param doc the lucene document. @param name the name of the multi-value property. @throws RepositoryException """ try { String propName = resolver.createJCRName(name).getAsString(); doc.add(new Field(FieldNames.MVP, propName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO)); } catch (NamespaceException e) { // will never happen, prefixes are created dynamically if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + e.getMessage()); } } }
java
private void addMVPName(Document doc, InternalQName name) throws RepositoryException { try { String propName = resolver.createJCRName(name).getAsString(); doc.add(new Field(FieldNames.MVP, propName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO)); } catch (NamespaceException e) { // will never happen, prefixes are created dynamically if (LOG.isTraceEnabled()) { LOG.trace("An exception occurred: " + e.getMessage()); } } }
[ "private", "void", "addMVPName", "(", "Document", "doc", ",", "InternalQName", "name", ")", "throws", "RepositoryException", "{", "try", "{", "String", "propName", "=", "resolver", ".", "createJCRName", "(", "name", ")", ".", "getAsString", "(", ")", ";", "doc", ".", "add", "(", "new", "Field", "(", "FieldNames", ".", "MVP", ",", "propName", ",", "Field", ".", "Store", ".", "NO", ",", "Field", ".", "Index", ".", "NOT_ANALYZED_NO_NORMS", ",", "Field", ".", "TermVector", ".", "NO", ")", ")", ";", "}", "catch", "(", "NamespaceException", "e", ")", "{", "// will never happen, prefixes are created dynamically", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "{", "LOG", ".", "trace", "(", "\"An exception occurred: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Adds a {@link FieldNames#MVP} field to <code>doc</code> with the resolved <code>name</code> using the internal search index namespace mapping. @param doc the lucene document. @param name the name of the multi-value property. @throws RepositoryException
[ "Adds", "a", "{", "@link", "FieldNames#MVP", "}", "field", "to", "<code", ">", "doc<", "/", "code", ">", "with", "the", "resolved", "<code", ">", "name<", "/", "code", ">", "using", "the", "internal", "search", "index", "namespace", "mapping", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L327-L343
james-hu/jabb-core
src/main/java/net/sf/jabb/web/action/VfsTreeAction.java
VfsTreeAction.populateTreeNodeData
protected JsTreeNodeData populateTreeNodeData(FileObject root, FileObject file) throws FileSystemException { """ Populate a node. @param root Relative root directory. @param file The file object. @return The node data structure which presents the file. @throws FileSystemException """ boolean noChild = true; FileType type = file.getType(); if (type.equals(FileType.FOLDER) || type.equals(FileType.FILE_OR_FOLDER)){ noChild = file.getChildren().length == 0; } String relativePath = root.getName().getRelativeName(file.getName()); return populateTreeNodeData(file, noChild, relativePath); }
java
protected JsTreeNodeData populateTreeNodeData(FileObject root, FileObject file) throws FileSystemException { boolean noChild = true; FileType type = file.getType(); if (type.equals(FileType.FOLDER) || type.equals(FileType.FILE_OR_FOLDER)){ noChild = file.getChildren().length == 0; } String relativePath = root.getName().getRelativeName(file.getName()); return populateTreeNodeData(file, noChild, relativePath); }
[ "protected", "JsTreeNodeData", "populateTreeNodeData", "(", "FileObject", "root", ",", "FileObject", "file", ")", "throws", "FileSystemException", "{", "boolean", "noChild", "=", "true", ";", "FileType", "type", "=", "file", ".", "getType", "(", ")", ";", "if", "(", "type", ".", "equals", "(", "FileType", ".", "FOLDER", ")", "||", "type", ".", "equals", "(", "FileType", ".", "FILE_OR_FOLDER", ")", ")", "{", "noChild", "=", "file", ".", "getChildren", "(", ")", ".", "length", "==", "0", ";", "}", "String", "relativePath", "=", "root", ".", "getName", "(", ")", ".", "getRelativeName", "(", "file", ".", "getName", "(", ")", ")", ";", "return", "populateTreeNodeData", "(", "file", ",", "noChild", ",", "relativePath", ")", ";", "}" ]
Populate a node. @param root Relative root directory. @param file The file object. @return The node data structure which presents the file. @throws FileSystemException
[ "Populate", "a", "node", "." ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/web/action/VfsTreeAction.java#L137-L145
xqbase/util
util/src/main/java/com/xqbase/util/Bytes.java
Bytes.setInt
public static void setInt(int n, byte[] b, int off, boolean littleEndian) { """ Store an <b>int</b> number into a byte array in a given byte order """ if (littleEndian) { b[off] = (byte) n; b[off + 1] = (byte) (n >>> 8); b[off + 2] = (byte) (n >>> 16); b[off + 3] = (byte) (n >>> 24); } else { b[off] = (byte) (n >>> 24); b[off + 1] = (byte) (n >>> 16); b[off + 2] = (byte) (n >>> 8); b[off + 3] = (byte) n; } }
java
public static void setInt(int n, byte[] b, int off, boolean littleEndian) { if (littleEndian) { b[off] = (byte) n; b[off + 1] = (byte) (n >>> 8); b[off + 2] = (byte) (n >>> 16); b[off + 3] = (byte) (n >>> 24); } else { b[off] = (byte) (n >>> 24); b[off + 1] = (byte) (n >>> 16); b[off + 2] = (byte) (n >>> 8); b[off + 3] = (byte) n; } }
[ "public", "static", "void", "setInt", "(", "int", "n", ",", "byte", "[", "]", "b", ",", "int", "off", ",", "boolean", "littleEndian", ")", "{", "if", "(", "littleEndian", ")", "{", "b", "[", "off", "]", "=", "(", "byte", ")", "n", ";", "b", "[", "off", "+", "1", "]", "=", "(", "byte", ")", "(", "n", ">>>", "8", ")", ";", "b", "[", "off", "+", "2", "]", "=", "(", "byte", ")", "(", "n", ">>>", "16", ")", ";", "b", "[", "off", "+", "3", "]", "=", "(", "byte", ")", "(", "n", ">>>", "24", ")", ";", "}", "else", "{", "b", "[", "off", "]", "=", "(", "byte", ")", "(", "n", ">>>", "24", ")", ";", "b", "[", "off", "+", "1", "]", "=", "(", "byte", ")", "(", "n", ">>>", "16", ")", ";", "b", "[", "off", "+", "2", "]", "=", "(", "byte", ")", "(", "n", ">>>", "8", ")", ";", "b", "[", "off", "+", "3", "]", "=", "(", "byte", ")", "n", ";", "}", "}" ]
Store an <b>int</b> number into a byte array in a given byte order
[ "Store", "an", "<b", ">", "int<", "/", "b", ">", "number", "into", "a", "byte", "array", "in", "a", "given", "byte", "order" ]
train
https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Bytes.java#L136-L148
jcuda/jcuda
JCudaJava/src/main/java/jcuda/cuDoubleComplex.java
cuDoubleComplex.cuCmul
public static cuDoubleComplex cuCmul (cuDoubleComplex x, cuDoubleComplex y) { """ Returns the product of the given complex numbers.<br /> <br /> Original comment:<br /> <br /> This implementation could suffer from intermediate overflow even though the final result would be in range. However, various implementations do not guard against this (presumably to avoid losing performance), so we don't do it either to stay competitive. @param x The first factor @param y The second factor @return The product of the given factors """ cuDoubleComplex prod; prod = cuCmplx ((cuCreal(x) * cuCreal(y)) - (cuCimag(x) * cuCimag(y)), (cuCreal(x) * cuCimag(y)) + (cuCimag(x) * cuCreal(y))); return prod; }
java
public static cuDoubleComplex cuCmul (cuDoubleComplex x, cuDoubleComplex y) { cuDoubleComplex prod; prod = cuCmplx ((cuCreal(x) * cuCreal(y)) - (cuCimag(x) * cuCimag(y)), (cuCreal(x) * cuCimag(y)) + (cuCimag(x) * cuCreal(y))); return prod; }
[ "public", "static", "cuDoubleComplex", "cuCmul", "(", "cuDoubleComplex", "x", ",", "cuDoubleComplex", "y", ")", "{", "cuDoubleComplex", "prod", ";", "prod", "=", "cuCmplx", "(", "(", "cuCreal", "(", "x", ")", "*", "cuCreal", "(", "y", ")", ")", "-", "(", "cuCimag", "(", "x", ")", "*", "cuCimag", "(", "y", ")", ")", ",", "(", "cuCreal", "(", "x", ")", "*", "cuCimag", "(", "y", ")", ")", "+", "(", "cuCimag", "(", "x", ")", "*", "cuCreal", "(", "y", ")", ")", ")", ";", "return", "prod", ";", "}" ]
Returns the product of the given complex numbers.<br /> <br /> Original comment:<br /> <br /> This implementation could suffer from intermediate overflow even though the final result would be in range. However, various implementations do not guard against this (presumably to avoid losing performance), so we don't do it either to stay competitive. @param x The first factor @param y The second factor @return The product of the given factors
[ "Returns", "the", "product", "of", "the", "given", "complex", "numbers", ".", "<br", "/", ">", "<br", "/", ">", "Original", "comment", ":", "<br", "/", ">", "<br", "/", ">", "This", "implementation", "could", "suffer", "from", "intermediate", "overflow", "even", "though", "the", "final", "result", "would", "be", "in", "range", ".", "However", "various", "implementations", "do", "not", "guard", "against", "this", "(", "presumably", "to", "avoid", "losing", "performance", ")", "so", "we", "don", "t", "do", "it", "either", "to", "stay", "competitive", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/cuDoubleComplex.java#L123-L129
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/internal/core/util/ArrayUtils.java
ArrayUtils.shuffleHead
public static <ElementT> void shuffleHead(@NonNull ElementT[] elements, int n) { """ Shuffles the first n elements of the array in-place. @param elements the array to shuffle. @param n the number of elements to shuffle; must be {@code <= elements.length}. @see <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm">Modern Fisher-Yates shuffle</a> """ shuffleHead(elements, n, ThreadLocalRandom.current()); }
java
public static <ElementT> void shuffleHead(@NonNull ElementT[] elements, int n) { shuffleHead(elements, n, ThreadLocalRandom.current()); }
[ "public", "static", "<", "ElementT", ">", "void", "shuffleHead", "(", "@", "NonNull", "ElementT", "[", "]", "elements", ",", "int", "n", ")", "{", "shuffleHead", "(", "elements", ",", "n", ",", "ThreadLocalRandom", ".", "current", "(", ")", ")", ";", "}" ]
Shuffles the first n elements of the array in-place. @param elements the array to shuffle. @param n the number of elements to shuffle; must be {@code <= elements.length}. @see <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm">Modern Fisher-Yates shuffle</a>
[ "Shuffles", "the", "first", "n", "elements", "of", "the", "array", "in", "-", "place", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/util/ArrayUtils.java#L62-L64
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/MenuFlyoutExample.java
MenuFlyoutExample.createImageMenuItem
private WMenuItem createImageMenuItem(final String resource, final String desc, final String cacheKey, final WText selectedMenuText) { """ Creates an example menu item using an image. @param resource the name of the image resource @param desc the description for the image @param cacheKey the cache key for this image @param selectedMenuText the WText to display the selected menu item. @return a menu item using an image """ WImage image = new WImage(resource, desc); image.setCacheKey(cacheKey); WDecoratedLabel label = new WDecoratedLabel(image, new WText(desc), null); WMenuItem menuItem = new WMenuItem(label, new ExampleMenuAction(selectedMenuText)); menuItem.setActionObject(desc); return menuItem; }
java
private WMenuItem createImageMenuItem(final String resource, final String desc, final String cacheKey, final WText selectedMenuText) { WImage image = new WImage(resource, desc); image.setCacheKey(cacheKey); WDecoratedLabel label = new WDecoratedLabel(image, new WText(desc), null); WMenuItem menuItem = new WMenuItem(label, new ExampleMenuAction(selectedMenuText)); menuItem.setActionObject(desc); return menuItem; }
[ "private", "WMenuItem", "createImageMenuItem", "(", "final", "String", "resource", ",", "final", "String", "desc", ",", "final", "String", "cacheKey", ",", "final", "WText", "selectedMenuText", ")", "{", "WImage", "image", "=", "new", "WImage", "(", "resource", ",", "desc", ")", ";", "image", ".", "setCacheKey", "(", "cacheKey", ")", ";", "WDecoratedLabel", "label", "=", "new", "WDecoratedLabel", "(", "image", ",", "new", "WText", "(", "desc", ")", ",", "null", ")", ";", "WMenuItem", "menuItem", "=", "new", "WMenuItem", "(", "label", ",", "new", "ExampleMenuAction", "(", "selectedMenuText", ")", ")", ";", "menuItem", ".", "setActionObject", "(", "desc", ")", ";", "return", "menuItem", ";", "}" ]
Creates an example menu item using an image. @param resource the name of the image resource @param desc the description for the image @param cacheKey the cache key for this image @param selectedMenuText the WText to display the selected menu item. @return a menu item using an image
[ "Creates", "an", "example", "menu", "item", "using", "an", "image", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/MenuFlyoutExample.java#L158-L167
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SendUsersMessageResponse.java
SendUsersMessageResponse.setResult
public void setResult(java.util.Map<String, java.util.Map<String, EndpointMessageResult>> result) { """ An object that shows the endpoints that were messaged for each user. The object provides a list of user IDs. For each user ID, it provides the endpoint IDs that were messaged. For each endpoint ID, it provides an EndpointMessageResult object. @param result An object that shows the endpoints that were messaged for each user. The object provides a list of user IDs. For each user ID, it provides the endpoint IDs that were messaged. For each endpoint ID, it provides an EndpointMessageResult object. """ this.result = result; }
java
public void setResult(java.util.Map<String, java.util.Map<String, EndpointMessageResult>> result) { this.result = result; }
[ "public", "void", "setResult", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "Map", "<", "String", ",", "EndpointMessageResult", ">", ">", "result", ")", "{", "this", ".", "result", "=", "result", ";", "}" ]
An object that shows the endpoints that were messaged for each user. The object provides a list of user IDs. For each user ID, it provides the endpoint IDs that were messaged. For each endpoint ID, it provides an EndpointMessageResult object. @param result An object that shows the endpoints that were messaged for each user. The object provides a list of user IDs. For each user ID, it provides the endpoint IDs that were messaged. For each endpoint ID, it provides an EndpointMessageResult object.
[ "An", "object", "that", "shows", "the", "endpoints", "that", "were", "messaged", "for", "each", "user", ".", "The", "object", "provides", "a", "list", "of", "user", "IDs", ".", "For", "each", "user", "ID", "it", "provides", "the", "endpoint", "IDs", "that", "were", "messaged", ".", "For", "each", "endpoint", "ID", "it", "provides", "an", "EndpointMessageResult", "object", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SendUsersMessageResponse.java#L133-L135
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.smoothCubicTo
public SVGPath smoothCubicTo(double c2x, double c2y, double x, double y) { """ Smooth Cubic Bezier line to the given coordinates. @param c2x second control point x @param c2y second control point y @param x new coordinates @param y new coordinates @return path object, for compact syntax. """ return append(PATH_SMOOTH_CUBIC_TO).append(c2x).append(c2y).append(x).append(y); }
java
public SVGPath smoothCubicTo(double c2x, double c2y, double x, double y) { return append(PATH_SMOOTH_CUBIC_TO).append(c2x).append(c2y).append(x).append(y); }
[ "public", "SVGPath", "smoothCubicTo", "(", "double", "c2x", ",", "double", "c2y", ",", "double", "x", ",", "double", "y", ")", "{", "return", "append", "(", "PATH_SMOOTH_CUBIC_TO", ")", ".", "append", "(", "c2x", ")", ".", "append", "(", "c2y", ")", ".", "append", "(", "x", ")", ".", "append", "(", "y", ")", ";", "}" ]
Smooth Cubic Bezier line to the given coordinates. @param c2x second control point x @param c2y second control point y @param x new coordinates @param y new coordinates @return path object, for compact syntax.
[ "Smooth", "Cubic", "Bezier", "line", "to", "the", "given", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L409-L411
drewnoakes/metadata-extractor
Source/com/drew/imaging/ImageMetadataReader.java
ImageMetadataReader.readMetadata
@NotNull public static Metadata readMetadata(@NotNull final InputStream inputStream, final long streamLength) throws ImageProcessingException, IOException { """ Reads metadata from an {@link InputStream} of known length. @param inputStream a stream from which the file data may be read. The stream must be positioned at the beginning of the file's data. @param streamLength the length of the stream, if known, otherwise -1. @return a populated {@link Metadata} object containing directories of tags with values and any processing errors. @throws ImageProcessingException if the file type is unknown, or for general processing errors. """ BufferedInputStream bufferedInputStream = inputStream instanceof BufferedInputStream ? (BufferedInputStream)inputStream : new BufferedInputStream(inputStream); FileType fileType = FileTypeDetector.detectFileType(bufferedInputStream); Metadata metadata = readMetadata(bufferedInputStream, streamLength, fileType); metadata.addDirectory(new FileTypeDirectory(fileType)); return metadata; }
java
@NotNull public static Metadata readMetadata(@NotNull final InputStream inputStream, final long streamLength) throws ImageProcessingException, IOException { BufferedInputStream bufferedInputStream = inputStream instanceof BufferedInputStream ? (BufferedInputStream)inputStream : new BufferedInputStream(inputStream); FileType fileType = FileTypeDetector.detectFileType(bufferedInputStream); Metadata metadata = readMetadata(bufferedInputStream, streamLength, fileType); metadata.addDirectory(new FileTypeDirectory(fileType)); return metadata; }
[ "@", "NotNull", "public", "static", "Metadata", "readMetadata", "(", "@", "NotNull", "final", "InputStream", "inputStream", ",", "final", "long", "streamLength", ")", "throws", "ImageProcessingException", ",", "IOException", "{", "BufferedInputStream", "bufferedInputStream", "=", "inputStream", "instanceof", "BufferedInputStream", "?", "(", "BufferedInputStream", ")", "inputStream", ":", "new", "BufferedInputStream", "(", "inputStream", ")", ";", "FileType", "fileType", "=", "FileTypeDetector", ".", "detectFileType", "(", "bufferedInputStream", ")", ";", "Metadata", "metadata", "=", "readMetadata", "(", "bufferedInputStream", ",", "streamLength", ",", "fileType", ")", ";", "metadata", ".", "addDirectory", "(", "new", "FileTypeDirectory", "(", "fileType", ")", ")", ";", "return", "metadata", ";", "}" ]
Reads metadata from an {@link InputStream} of known length. @param inputStream a stream from which the file data may be read. The stream must be positioned at the beginning of the file's data. @param streamLength the length of the stream, if known, otherwise -1. @return a populated {@link Metadata} object containing directories of tags with values and any processing errors. @throws ImageProcessingException if the file type is unknown, or for general processing errors.
[ "Reads", "metadata", "from", "an", "{", "@link", "InputStream", "}", "of", "known", "length", "." ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/imaging/ImageMetadataReader.java#L116-L130
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/SmapGenerator.java
SmapGenerator.addSmap
public synchronized void addSmap(String smap, String stratumName) { """ Adds the given string as an embedded SMAP with the given stratum name. @param smap the SMAP to embed @param stratumName the name of the stratum output by the compilation that produced the <tt>smap</tt> to be embedded """ embedded.add("*O " + stratumName + "\n" + smap + "*C " + stratumName + "\n"); }
java
public synchronized void addSmap(String smap, String stratumName) { embedded.add("*O " + stratumName + "\n" + smap + "*C " + stratumName + "\n"); }
[ "public", "synchronized", "void", "addSmap", "(", "String", "smap", ",", "String", "stratumName", ")", "{", "embedded", ".", "add", "(", "\"*O \"", "+", "stratumName", "+", "\"\\n\"", "+", "smap", "+", "\"*C \"", "+", "stratumName", "+", "\"\\n\"", ")", ";", "}" ]
Adds the given string as an embedded SMAP with the given stratum name. @param smap the SMAP to embed @param stratumName the name of the stratum output by the compilation that produced the <tt>smap</tt> to be embedded
[ "Adds", "the", "given", "string", "as", "an", "embedded", "SMAP", "with", "the", "given", "stratum", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/translator/utils/SmapGenerator.java#L82-L84
youngmonkeys/ezyfox-sfs2x
src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/BuddyEventHandler.java
BuddyEventHandler.notifyToHandlers
protected void notifyToHandlers(ApiZone zone, ApiBuddyImpl buddy) { """ Notify event to handlers (listeners) @param zone api zone reference @param buddy api buddy reference """ for(ServerHandlerClass handler : handlers) { notifyToHandler(handler, zone, buddy); } }
java
protected void notifyToHandlers(ApiZone zone, ApiBuddyImpl buddy) { for(ServerHandlerClass handler : handlers) { notifyToHandler(handler, zone, buddy); } }
[ "protected", "void", "notifyToHandlers", "(", "ApiZone", "zone", ",", "ApiBuddyImpl", "buddy", ")", "{", "for", "(", "ServerHandlerClass", "handler", ":", "handlers", ")", "{", "notifyToHandler", "(", "handler", ",", "zone", ",", "buddy", ")", ";", "}", "}" ]
Notify event to handlers (listeners) @param zone api zone reference @param buddy api buddy reference
[ "Notify", "event", "to", "handlers", "(", "listeners", ")" ]
train
https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/BuddyEventHandler.java#L60-L64
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/protocol/MasterProtocol.java
MasterProtocol.resetHostList
private static void resetHostList(Listener listener, Deque<HostAddress> loopAddresses) { """ Reinitialize loopAddresses with all hosts : all servers in randomize order without connected host. @param listener current listener @param loopAddresses the list to reinitialize """ //if all servers have been connected without result //add back all servers List<HostAddress> servers = new ArrayList<>(); servers.addAll(listener.getUrlParser().getHostAddresses()); Collections.shuffle(servers); loopAddresses.clear(); loopAddresses.addAll(servers); }
java
private static void resetHostList(Listener listener, Deque<HostAddress> loopAddresses) { //if all servers have been connected without result //add back all servers List<HostAddress> servers = new ArrayList<>(); servers.addAll(listener.getUrlParser().getHostAddresses()); Collections.shuffle(servers); loopAddresses.clear(); loopAddresses.addAll(servers); }
[ "private", "static", "void", "resetHostList", "(", "Listener", "listener", ",", "Deque", "<", "HostAddress", ">", "loopAddresses", ")", "{", "//if all servers have been connected without result", "//add back all servers", "List", "<", "HostAddress", ">", "servers", "=", "new", "ArrayList", "<>", "(", ")", ";", "servers", ".", "addAll", "(", "listener", ".", "getUrlParser", "(", ")", ".", "getHostAddresses", "(", ")", ")", ";", "Collections", ".", "shuffle", "(", "servers", ")", ";", "loopAddresses", ".", "clear", "(", ")", ";", "loopAddresses", ".", "addAll", "(", "servers", ")", ";", "}" ]
Reinitialize loopAddresses with all hosts : all servers in randomize order without connected host. @param listener current listener @param loopAddresses the list to reinitialize
[ "Reinitialize", "loopAddresses", "with", "all", "hosts", ":", "all", "servers", "in", "randomize", "order", "without", "connected", "host", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/MasterProtocol.java#L184-L193
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.isGeneral
public static boolean isGeneral(CharSequence value, int min, int max) { """ 验证是否为给定长度范围的英文字母 、数字和下划线 @param value 值 @param min 最小长度,负数自动识别为0 @param max 最大长度,0或负数表示不限制最大长度 @return 是否为给定长度范围的英文字母 、数字和下划线 """ String reg = "^\\w{" + min + "," + max + "}$"; if (min < 0) { min = 0; } if (max <= 0) { reg = "^\\w{" + min + ",}$"; } return isMactchRegex(reg, value); }
java
public static boolean isGeneral(CharSequence value, int min, int max) { String reg = "^\\w{" + min + "," + max + "}$"; if (min < 0) { min = 0; } if (max <= 0) { reg = "^\\w{" + min + ",}$"; } return isMactchRegex(reg, value); }
[ "public", "static", "boolean", "isGeneral", "(", "CharSequence", "value", ",", "int", "min", ",", "int", "max", ")", "{", "String", "reg", "=", "\"^\\\\w{\"", "+", "min", "+", "\",\"", "+", "max", "+", "\"}$\"", ";", "if", "(", "min", "<", "0", ")", "{", "min", "=", "0", ";", "}", "if", "(", "max", "<=", "0", ")", "{", "reg", "=", "\"^\\\\w{\"", "+", "min", "+", "\",}$\"", ";", "}", "return", "isMactchRegex", "(", "reg", ",", "value", ")", ";", "}" ]
验证是否为给定长度范围的英文字母 、数字和下划线 @param value 值 @param min 最小长度,负数自动识别为0 @param max 最大长度,0或负数表示不限制最大长度 @return 是否为给定长度范围的英文字母 、数字和下划线
[ "验证是否为给定长度范围的英文字母", "、数字和下划线" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L373-L382
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java
SimpleHadoopFilesystemConfigStore.getChildren
@Override public Collection<ConfigKeyPath> getChildren(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { """ Retrieves all the children of the given {@link ConfigKeyPath} by doing a {@code ls} on the {@link Path} specified by the {@link ConfigKeyPath}. If the {@link Path} described by the {@link ConfigKeyPath} does not exist, an empty {@link Collection} is returned. @param configKey the config key path whose children are necessary. @param version specify the configuration version in the configuration store. @return a {@link Collection} of {@link ConfigKeyPath} where each entry is a child of the given configKey. @throws VersionDoesNotExistException if the version specified cannot be found in the {@link ConfigStore}. """ Preconditions.checkNotNull(configKey, "configKey cannot be null!"); Preconditions.checkArgument(!Strings.isNullOrEmpty(version), "version cannot be null or empty!"); List<ConfigKeyPath> children = new ArrayList<>(); Path datasetDir = getDatasetDirForKey(configKey, version); try { if (!this.fs.exists(datasetDir)) { return children; } for (FileStatus fileStatus : this.fs.listStatus(datasetDir)) { if (fileStatus.isDirectory()) { children.add(configKey.createChild(fileStatus.getPath().getName())); } } return children; } catch (IOException e) { throw new RuntimeException(String.format("Error while getting children for configKey: \"%s\"", configKey), e); } }
java
@Override public Collection<ConfigKeyPath> getChildren(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { Preconditions.checkNotNull(configKey, "configKey cannot be null!"); Preconditions.checkArgument(!Strings.isNullOrEmpty(version), "version cannot be null or empty!"); List<ConfigKeyPath> children = new ArrayList<>(); Path datasetDir = getDatasetDirForKey(configKey, version); try { if (!this.fs.exists(datasetDir)) { return children; } for (FileStatus fileStatus : this.fs.listStatus(datasetDir)) { if (fileStatus.isDirectory()) { children.add(configKey.createChild(fileStatus.getPath().getName())); } } return children; } catch (IOException e) { throw new RuntimeException(String.format("Error while getting children for configKey: \"%s\"", configKey), e); } }
[ "@", "Override", "public", "Collection", "<", "ConfigKeyPath", ">", "getChildren", "(", "ConfigKeyPath", "configKey", ",", "String", "version", ")", "throws", "VersionDoesNotExistException", "{", "Preconditions", ".", "checkNotNull", "(", "configKey", ",", "\"configKey cannot be null!\"", ")", ";", "Preconditions", ".", "checkArgument", "(", "!", "Strings", ".", "isNullOrEmpty", "(", "version", ")", ",", "\"version cannot be null or empty!\"", ")", ";", "List", "<", "ConfigKeyPath", ">", "children", "=", "new", "ArrayList", "<>", "(", ")", ";", "Path", "datasetDir", "=", "getDatasetDirForKey", "(", "configKey", ",", "version", ")", ";", "try", "{", "if", "(", "!", "this", ".", "fs", ".", "exists", "(", "datasetDir", ")", ")", "{", "return", "children", ";", "}", "for", "(", "FileStatus", "fileStatus", ":", "this", ".", "fs", ".", "listStatus", "(", "datasetDir", ")", ")", "{", "if", "(", "fileStatus", ".", "isDirectory", "(", ")", ")", "{", "children", ".", "add", "(", "configKey", ".", "createChild", "(", "fileStatus", ".", "getPath", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "}", "}", "return", "children", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "String", ".", "format", "(", "\"Error while getting children for configKey: \\\"%s\\\"\"", ",", "configKey", ")", ",", "e", ")", ";", "}", "}" ]
Retrieves all the children of the given {@link ConfigKeyPath} by doing a {@code ls} on the {@link Path} specified by the {@link ConfigKeyPath}. If the {@link Path} described by the {@link ConfigKeyPath} does not exist, an empty {@link Collection} is returned. @param configKey the config key path whose children are necessary. @param version specify the configuration version in the configuration store. @return a {@link Collection} of {@link ConfigKeyPath} where each entry is a child of the given configKey. @throws VersionDoesNotExistException if the version specified cannot be found in the {@link ConfigStore}.
[ "Retrieves", "all", "the", "children", "of", "the", "given", "{", "@link", "ConfigKeyPath", "}", "by", "doing", "a", "{", "@code", "ls", "}", "on", "the", "{", "@link", "Path", "}", "specified", "by", "the", "{", "@link", "ConfigKeyPath", "}", ".", "If", "the", "{", "@link", "Path", "}", "described", "by", "the", "{", "@link", "ConfigKeyPath", "}", "does", "not", "exist", "an", "empty", "{", "@link", "Collection", "}", "is", "returned", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/store/hdfs/SimpleHadoopFilesystemConfigStore.java#L207-L230
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java
GroupHandlerImpl.preSave
private void preSave(Group group, boolean isNew) throws Exception { """ Notifying listeners before group creation. @param group the group which is used in create operation @param isNew true, if we have a deal with new group, otherwise it is false which mean update operation is in progress @throws Exception if any listener failed to handle the event """ for (GroupEventListener listener : listeners) { listener.preSave(group, isNew); } }
java
private void preSave(Group group, boolean isNew) throws Exception { for (GroupEventListener listener : listeners) { listener.preSave(group, isNew); } }
[ "private", "void", "preSave", "(", "Group", "group", ",", "boolean", "isNew", ")", "throws", "Exception", "{", "for", "(", "GroupEventListener", "listener", ":", "listeners", ")", "{", "listener", ".", "preSave", "(", "group", ",", "isNew", ")", ";", "}", "}" ]
Notifying listeners before group creation. @param group the group which is used in create operation @param isNew true, if we have a deal with new group, otherwise it is false which mean update operation is in progress @throws Exception if any listener failed to handle the event
[ "Notifying", "listeners", "before", "group", "creation", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/GroupHandlerImpl.java#L553-L559
lets-blade/blade
src/main/java/com/blade/mvc/route/RouteMatcher.java
RouteMatcher.matchesPath
private boolean matchesPath(String routePath, String pathToMatch) { """ Matching path @param routePath route path @param pathToMatch match path @return return match is success """ routePath = PathKit.VAR_REGEXP_PATTERN.matcher(routePath).replaceAll(PathKit.VAR_REPLACE); return pathToMatch.matches("(?i)" + routePath); }
java
private boolean matchesPath(String routePath, String pathToMatch) { routePath = PathKit.VAR_REGEXP_PATTERN.matcher(routePath).replaceAll(PathKit.VAR_REPLACE); return pathToMatch.matches("(?i)" + routePath); }
[ "private", "boolean", "matchesPath", "(", "String", "routePath", ",", "String", "pathToMatch", ")", "{", "routePath", "=", "PathKit", ".", "VAR_REGEXP_PATTERN", ".", "matcher", "(", "routePath", ")", ".", "replaceAll", "(", "PathKit", ".", "VAR_REPLACE", ")", ";", "return", "pathToMatch", ".", "matches", "(", "\"(?i)\"", "+", "routePath", ")", ";", "}" ]
Matching path @param routePath route path @param pathToMatch match path @return return match is success
[ "Matching", "path" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/route/RouteMatcher.java#L320-L323
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java
DojoHttpTransport.endModules
protected String endModules(HttpServletRequest request, Object arg) { """ Handles the {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#END_MODULES} layer listener event. <p> See {@link #beginModules(HttpServletRequest, Object)} @param request the http request object @param arg the set of module names. The iteration order of the set is guaranteed to be the same as the order of the preceding {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#BEFORE_FIRST_MODULE}, {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#BEFORE_SUBSEQUENT_MODULE}, and {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#AFTER_MODULE} events. @return the layer contribution """ String result = ""; //$NON-NLS-1$ if (RequestUtil.isServerExpandedLayers(request) && request.getParameter(REQUESTEDMODULESCOUNT_REQPARAM) != null) { // it's a loader generated request result = "});\r\n"; //$NON-NLS-1$ } return result; }
java
protected String endModules(HttpServletRequest request, Object arg) { String result = ""; //$NON-NLS-1$ if (RequestUtil.isServerExpandedLayers(request) && request.getParameter(REQUESTEDMODULESCOUNT_REQPARAM) != null) { // it's a loader generated request result = "});\r\n"; //$NON-NLS-1$ } return result; }
[ "protected", "String", "endModules", "(", "HttpServletRequest", "request", ",", "Object", "arg", ")", "{", "String", "result", "=", "\"\"", ";", "//$NON-NLS-1$\r", "if", "(", "RequestUtil", ".", "isServerExpandedLayers", "(", "request", ")", "&&", "request", ".", "getParameter", "(", "REQUESTEDMODULESCOUNT_REQPARAM", ")", "!=", "null", ")", "{", "// it's a loader generated request\r", "result", "=", "\"});\\r\\n\"", ";", "//$NON-NLS-1$\r", "}", "return", "result", ";", "}" ]
Handles the {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#END_MODULES} layer listener event. <p> See {@link #beginModules(HttpServletRequest, Object)} @param request the http request object @param arg the set of module names. The iteration order of the set is guaranteed to be the same as the order of the preceding {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#BEFORE_FIRST_MODULE}, {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#BEFORE_SUBSEQUENT_MODULE}, and {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#AFTER_MODULE} events. @return the layer contribution
[ "Handles", "the", "{", "@link", "com", ".", "ibm", ".", "jaggr", ".", "core", ".", "transport", ".", "IHttpTransport", ".", "LayerContributionType#END_MODULES", "}", "layer", "listener", "event", ".", "<p", ">", "See", "{", "@link", "#beginModules", "(", "HttpServletRequest", "Object", ")", "}" ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java#L390-L397
jfinal/jfinal
src/main/java/com/jfinal/captcha/CaptchaRender.java
CaptchaRender.validate
public static boolean validate(Controller controller, String userInputString) { """ 校验用户输入的验证码是否正确 @param controller 控制器 @param userInputString 用户输入的字符串 @return 验证通过返回 true, 否则返回 false """ String captchaKey = controller.getCookie(captchaName); if (validate(captchaKey, userInputString)) { controller.removeCookie(captchaName); return true; } return false; }
java
public static boolean validate(Controller controller, String userInputString) { String captchaKey = controller.getCookie(captchaName); if (validate(captchaKey, userInputString)) { controller.removeCookie(captchaName); return true; } return false; }
[ "public", "static", "boolean", "validate", "(", "Controller", "controller", ",", "String", "userInputString", ")", "{", "String", "captchaKey", "=", "controller", ".", "getCookie", "(", "captchaName", ")", ";", "if", "(", "validate", "(", "captchaKey", ",", "userInputString", ")", ")", "{", "controller", ".", "removeCookie", "(", "captchaName", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
校验用户输入的验证码是否正确 @param controller 控制器 @param userInputString 用户输入的字符串 @return 验证通过返回 true, 否则返回 false
[ "校验用户输入的验证码是否正确" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/captcha/CaptchaRender.java#L218-L225
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.matchesPattern
public static void matchesPattern(final CharSequence input, final String pattern) { """ <p>Validate that the specified argument character sequence matches the specified regular expression pattern; otherwise throwing an exception.</p> <pre>Validate.matchesPattern("hi", "[a-z]*");</pre> <p>The syntax of the pattern is the one used in the {@link Pattern} class.</p> @param input the character sequence to validate, not null @param pattern the regular expression pattern, not null @throws IllegalArgumentException if the character sequence does not match the pattern @see #matchesPattern(CharSequence, String, String, Object...) @since 3.0 """ // TODO when breaking BC, consider returning input if (input == null || !input.toString().matches(pattern)) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_MATCHES_PATTERN_EX, input, pattern)); } }
java
public static void matchesPattern(final CharSequence input, final String pattern) { // TODO when breaking BC, consider returning input if (input == null || !input.toString().matches(pattern)) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_MATCHES_PATTERN_EX, input, pattern)); } }
[ "public", "static", "void", "matchesPattern", "(", "final", "CharSequence", "input", ",", "final", "String", "pattern", ")", "{", "// TODO when breaking BC, consider returning input", "if", "(", "input", "==", "null", "||", "!", "input", ".", "toString", "(", ")", ".", "matches", "(", "pattern", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "StringUtils", ".", "simpleFormat", "(", "DEFAULT_MATCHES_PATTERN_EX", ",", "input", ",", "pattern", ")", ")", ";", "}", "}" ]
<p>Validate that the specified argument character sequence matches the specified regular expression pattern; otherwise throwing an exception.</p> <pre>Validate.matchesPattern("hi", "[a-z]*");</pre> <p>The syntax of the pattern is the one used in the {@link Pattern} class.</p> @param input the character sequence to validate, not null @param pattern the regular expression pattern, not null @throws IllegalArgumentException if the character sequence does not match the pattern @see #matchesPattern(CharSequence, String, String, Object...) @since 3.0
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "character", "sequence", "matches", "the", "specified", "regular", "expression", "pattern", ";", "otherwise", "throwing", "an", "exception", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L857-L862
haifengl/smile
core/src/main/java/smile/util/SmileUtils.java
SmileUtils.learnGaussianRadialBasis
public static GaussianRadialBasis[] learnGaussianRadialBasis(double[][] x, double[][] centers, int p) { """ Learns Gaussian RBF function and centers from data. The centers are chosen as the centroids of K-Means. The standard deviation (i.e. width) of Gaussian radial basis function is estimated by the p-nearest neighbors (among centers, not all samples) heuristic. A suggested value for p is 2. @param x the training dataset. @param centers an array to store centers on output. Its length is used as k of k-means. @param p the number of nearest neighbors of centers to estimate the width of Gaussian RBF functions. @return Gaussian RBF functions with parameter learned from data. """ if (p < 1) { throw new IllegalArgumentException("Invalid number of nearest neighbors: " + p); } int k = centers.length; KMeans kmeans = new KMeans(x, k, 10); System.arraycopy(kmeans.centroids(), 0, centers, 0, k); p = Math.min(p, k-1); double[] r = new double[k]; GaussianRadialBasis[] rbf = new GaussianRadialBasis[k]; for (int i = 0; i < k; i++) { for (int j = 0; j < k; j++) { r[j] = Math.distance(centers[i], centers[j]); } Arrays.sort(r); double r0 = 0.0; for (int j = 1; j <= p; j++) { r0 += r[j]; } r0 /= p; rbf[i] = new GaussianRadialBasis(r0); } return rbf; }
java
public static GaussianRadialBasis[] learnGaussianRadialBasis(double[][] x, double[][] centers, int p) { if (p < 1) { throw new IllegalArgumentException("Invalid number of nearest neighbors: " + p); } int k = centers.length; KMeans kmeans = new KMeans(x, k, 10); System.arraycopy(kmeans.centroids(), 0, centers, 0, k); p = Math.min(p, k-1); double[] r = new double[k]; GaussianRadialBasis[] rbf = new GaussianRadialBasis[k]; for (int i = 0; i < k; i++) { for (int j = 0; j < k; j++) { r[j] = Math.distance(centers[i], centers[j]); } Arrays.sort(r); double r0 = 0.0; for (int j = 1; j <= p; j++) { r0 += r[j]; } r0 /= p; rbf[i] = new GaussianRadialBasis(r0); } return rbf; }
[ "public", "static", "GaussianRadialBasis", "[", "]", "learnGaussianRadialBasis", "(", "double", "[", "]", "[", "]", "x", ",", "double", "[", "]", "[", "]", "centers", ",", "int", "p", ")", "{", "if", "(", "p", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid number of nearest neighbors: \"", "+", "p", ")", ";", "}", "int", "k", "=", "centers", ".", "length", ";", "KMeans", "kmeans", "=", "new", "KMeans", "(", "x", ",", "k", ",", "10", ")", ";", "System", ".", "arraycopy", "(", "kmeans", ".", "centroids", "(", ")", ",", "0", ",", "centers", ",", "0", ",", "k", ")", ";", "p", "=", "Math", ".", "min", "(", "p", ",", "k", "-", "1", ")", ";", "double", "[", "]", "r", "=", "new", "double", "[", "k", "]", ";", "GaussianRadialBasis", "[", "]", "rbf", "=", "new", "GaussianRadialBasis", "[", "k", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "k", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "k", ";", "j", "++", ")", "{", "r", "[", "j", "]", "=", "Math", ".", "distance", "(", "centers", "[", "i", "]", ",", "centers", "[", "j", "]", ")", ";", "}", "Arrays", ".", "sort", "(", "r", ")", ";", "double", "r0", "=", "0.0", ";", "for", "(", "int", "j", "=", "1", ";", "j", "<=", "p", ";", "j", "++", ")", "{", "r0", "+=", "r", "[", "j", "]", ";", "}", "r0", "/=", "p", ";", "rbf", "[", "i", "]", "=", "new", "GaussianRadialBasis", "(", "r0", ")", ";", "}", "return", "rbf", ";", "}" ]
Learns Gaussian RBF function and centers from data. The centers are chosen as the centroids of K-Means. The standard deviation (i.e. width) of Gaussian radial basis function is estimated by the p-nearest neighbors (among centers, not all samples) heuristic. A suggested value for p is 2. @param x the training dataset. @param centers an array to store centers on output. Its length is used as k of k-means. @param p the number of nearest neighbors of centers to estimate the width of Gaussian RBF functions. @return Gaussian RBF functions with parameter learned from data.
[ "Learns", "Gaussian", "RBF", "function", "and", "centers", "from", "data", ".", "The", "centers", "are", "chosen", "as", "the", "centroids", "of", "K", "-", "Means", ".", "The", "standard", "deviation", "(", "i", ".", "e", ".", "width", ")", "of", "Gaussian", "radial", "basis", "function", "is", "estimated", "by", "the", "p", "-", "nearest", "neighbors", "(", "among", "centers", "not", "all", "samples", ")", "heuristic", ".", "A", "suggested", "value", "for", "p", "is", "2", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/util/SmileUtils.java#L111-L138
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Features.java
Features.checkTypeDepth
private void checkTypeDepth(Feature feature, Class<?> current) { """ Check annotated features parent recursively. @param feature The main feature. @param current The current parent. """ for (final Class<?> type : current.getInterfaces()) { if (type.isAnnotationPresent(FeatureInterface.class)) { final Feature old; // CHECKSTYLE IGNORE LINE: InnerAssignment if ((old = typeToFeature.put(type.asSubclass(Feature.class), feature)) != null) { throw new LionEngineException(ERROR_FEATURE_EXISTS + feature.getClass() + AS + type + WITH + old.getClass()); } checkTypeDepth(feature, type); } } final Class<?> parent = current.getSuperclass(); if (parent != null) { checkTypeDepth(feature, parent); } }
java
private void checkTypeDepth(Feature feature, Class<?> current) { for (final Class<?> type : current.getInterfaces()) { if (type.isAnnotationPresent(FeatureInterface.class)) { final Feature old; // CHECKSTYLE IGNORE LINE: InnerAssignment if ((old = typeToFeature.put(type.asSubclass(Feature.class), feature)) != null) { throw new LionEngineException(ERROR_FEATURE_EXISTS + feature.getClass() + AS + type + WITH + old.getClass()); } checkTypeDepth(feature, type); } } final Class<?> parent = current.getSuperclass(); if (parent != null) { checkTypeDepth(feature, parent); } }
[ "private", "void", "checkTypeDepth", "(", "Feature", "feature", ",", "Class", "<", "?", ">", "current", ")", "{", "for", "(", "final", "Class", "<", "?", ">", "type", ":", "current", ".", "getInterfaces", "(", ")", ")", "{", "if", "(", "type", ".", "isAnnotationPresent", "(", "FeatureInterface", ".", "class", ")", ")", "{", "final", "Feature", "old", ";", "// CHECKSTYLE IGNORE LINE: InnerAssignment\r", "if", "(", "(", "old", "=", "typeToFeature", ".", "put", "(", "type", ".", "asSubclass", "(", "Feature", ".", "class", ")", ",", "feature", ")", ")", "!=", "null", ")", "{", "throw", "new", "LionEngineException", "(", "ERROR_FEATURE_EXISTS", "+", "feature", ".", "getClass", "(", ")", "+", "AS", "+", "type", "+", "WITH", "+", "old", ".", "getClass", "(", ")", ")", ";", "}", "checkTypeDepth", "(", "feature", ",", "type", ")", ";", "}", "}", "final", "Class", "<", "?", ">", "parent", "=", "current", ".", "getSuperclass", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "checkTypeDepth", "(", "feature", ",", "parent", ")", ";", "}", "}" ]
Check annotated features parent recursively. @param feature The main feature. @param current The current parent.
[ "Check", "annotated", "features", "parent", "recursively", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Features.java#L150-L175
structurizr/java
structurizr-core/src/com/structurizr/model/Model.java
Model.addPerson
@Nonnull public Person addPerson(@Nonnull String name, @Nullable String description) { """ Creates a person (with an unspecified location) and adds it to the model. @param name the name of the person (e.g. "Admin User" or "Bob the Business User") @param description a short description of the person @return the Person instance created and added to the model (or null) @throws IllegalArgumentException if a person with the same name already exists """ return addPerson(Location.Unspecified, name, description); }
java
@Nonnull public Person addPerson(@Nonnull String name, @Nullable String description) { return addPerson(Location.Unspecified, name, description); }
[ "@", "Nonnull", "public", "Person", "addPerson", "(", "@", "Nonnull", "String", "name", ",", "@", "Nullable", "String", "description", ")", "{", "return", "addPerson", "(", "Location", ".", "Unspecified", ",", "name", ",", "description", ")", ";", "}" ]
Creates a person (with an unspecified location) and adds it to the model. @param name the name of the person (e.g. "Admin User" or "Bob the Business User") @param description a short description of the person @return the Person instance created and added to the model (or null) @throws IllegalArgumentException if a person with the same name already exists
[ "Creates", "a", "person", "(", "with", "an", "unspecified", "location", ")", "and", "adds", "it", "to", "the", "model", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L95-L98
SeaCloudsEU/SeaCloudsPlatform
discoverer/src/main/java/eu/seaclouds/platform/discoverer/core/OfferingManager.java
OfferingManager.removeOffering
public boolean removeOffering(String offeringName) { """ Remove an offering @param offeringName the name of the offering to remove @return """ if(offeringName == null) throw new NullPointerException("The parameter \"cloudOfferingId\" cannot be null."); BasicDBObject query = new BasicDBObject("offering_name", offeringName); Document removedOffering = this.offeringsCollection.findOneAndDelete(query); return removedOffering != null; }
java
public boolean removeOffering(String offeringName) { if(offeringName == null) throw new NullPointerException("The parameter \"cloudOfferingId\" cannot be null."); BasicDBObject query = new BasicDBObject("offering_name", offeringName); Document removedOffering = this.offeringsCollection.findOneAndDelete(query); return removedOffering != null; }
[ "public", "boolean", "removeOffering", "(", "String", "offeringName", ")", "{", "if", "(", "offeringName", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"The parameter \\\"cloudOfferingId\\\" cannot be null.\"", ")", ";", "BasicDBObject", "query", "=", "new", "BasicDBObject", "(", "\"offering_name\"", ",", "offeringName", ")", ";", "Document", "removedOffering", "=", "this", ".", "offeringsCollection", ".", "findOneAndDelete", "(", "query", ")", ";", "return", "removedOffering", "!=", "null", ";", "}" ]
Remove an offering @param offeringName the name of the offering to remove @return
[ "Remove", "an", "offering" ]
train
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/discoverer/src/main/java/eu/seaclouds/platform/discoverer/core/OfferingManager.java#L78-L86
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java
TokenUtil.getEsAuthToken
private static EsToken getEsAuthToken(ClusterName clusterName, User user) { """ Get the authentication token of the user for the provided cluster name in its ES-Hadoop specific form. @return null if the user does not have the token, otherwise the auth token for the cluster. """ return user.getEsToken(clusterName.getName()); }
java
private static EsToken getEsAuthToken(ClusterName clusterName, User user) { return user.getEsToken(clusterName.getName()); }
[ "private", "static", "EsToken", "getEsAuthToken", "(", "ClusterName", "clusterName", ",", "User", "user", ")", "{", "return", "user", ".", "getEsToken", "(", "clusterName", ".", "getName", "(", ")", ")", ";", "}" ]
Get the authentication token of the user for the provided cluster name in its ES-Hadoop specific form. @return null if the user does not have the token, otherwise the auth token for the cluster.
[ "Get", "the", "authentication", "token", "of", "the", "user", "for", "the", "provided", "cluster", "name", "in", "its", "ES", "-", "Hadoop", "specific", "form", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/mr/security/TokenUtil.java#L213-L215
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java
XMLAssert.assertXMLEqual
public static void assertXMLEqual(String err, Document control, Document test) { """ Assert that two XML documents are similar @param err Message to be displayed on assertion failure @param control XML to be compared against @param test XML to be tested """ Diff diff = new Diff(control, test); assertXMLEqual(err, diff, true); }
java
public static void assertXMLEqual(String err, Document control, Document test) { Diff diff = new Diff(control, test); assertXMLEqual(err, diff, true); }
[ "public", "static", "void", "assertXMLEqual", "(", "String", "err", ",", "Document", "control", ",", "Document", "test", ")", "{", "Diff", "diff", "=", "new", "Diff", "(", "control", ",", "test", ")", ";", "assertXMLEqual", "(", "err", ",", "diff", ",", "true", ")", ";", "}" ]
Assert that two XML documents are similar @param err Message to be displayed on assertion failure @param control XML to be compared against @param test XML to be tested
[ "Assert", "that", "two", "XML", "documents", "are", "similar" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L242-L246
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitTupleElement
public T visitTupleElement(TupleElement elm, C context) { """ Visit a TupleElement. This method will be called for every node in the tree that is a TupleElement. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result """ visitElement(elm.getValue(), context); return null; }
java
public T visitTupleElement(TupleElement elm, C context) { visitElement(elm.getValue(), context); return null; }
[ "public", "T", "visitTupleElement", "(", "TupleElement", "elm", ",", "C", "context", ")", "{", "visitElement", "(", "elm", ".", "getValue", "(", ")", ",", "context", ")", ";", "return", "null", ";", "}" ]
Visit a TupleElement. This method will be called for every node in the tree that is a TupleElement. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "TupleElement", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "TupleElement", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L455-L458
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
ZooKeeperUtils.createSubmittedJobGraphs
public static ZooKeeperSubmittedJobGraphStore createSubmittedJobGraphs( CuratorFramework client, Configuration configuration) throws Exception { """ Creates a {@link ZooKeeperSubmittedJobGraphStore} instance. @param client The {@link CuratorFramework} ZooKeeper client to use @param configuration {@link Configuration} object @return {@link ZooKeeperSubmittedJobGraphStore} instance @throws Exception if the submitted job graph store cannot be created """ checkNotNull(configuration, "Configuration"); RetrievableStateStorageHelper<SubmittedJobGraph> stateStorage = createFileSystemStateStorage(configuration, "submittedJobGraph"); // ZooKeeper submitted jobs root dir String zooKeeperSubmittedJobsPath = configuration.getString(HighAvailabilityOptions.HA_ZOOKEEPER_JOBGRAPHS_PATH); // Ensure that the job graphs path exists client.newNamespaceAwareEnsurePath(zooKeeperSubmittedJobsPath) .ensure(client.getZookeeperClient()); // All operations will have the path as root CuratorFramework facade = client.usingNamespace(client.getNamespace() + zooKeeperSubmittedJobsPath); final String zooKeeperFullSubmittedJobsPath = client.getNamespace() + zooKeeperSubmittedJobsPath; final ZooKeeperStateHandleStore<SubmittedJobGraph> zooKeeperStateHandleStore = new ZooKeeperStateHandleStore<>(facade, stateStorage); final PathChildrenCache pathCache = new PathChildrenCache(facade, "/", false); return new ZooKeeperSubmittedJobGraphStore( zooKeeperFullSubmittedJobsPath, zooKeeperStateHandleStore, pathCache); }
java
public static ZooKeeperSubmittedJobGraphStore createSubmittedJobGraphs( CuratorFramework client, Configuration configuration) throws Exception { checkNotNull(configuration, "Configuration"); RetrievableStateStorageHelper<SubmittedJobGraph> stateStorage = createFileSystemStateStorage(configuration, "submittedJobGraph"); // ZooKeeper submitted jobs root dir String zooKeeperSubmittedJobsPath = configuration.getString(HighAvailabilityOptions.HA_ZOOKEEPER_JOBGRAPHS_PATH); // Ensure that the job graphs path exists client.newNamespaceAwareEnsurePath(zooKeeperSubmittedJobsPath) .ensure(client.getZookeeperClient()); // All operations will have the path as root CuratorFramework facade = client.usingNamespace(client.getNamespace() + zooKeeperSubmittedJobsPath); final String zooKeeperFullSubmittedJobsPath = client.getNamespace() + zooKeeperSubmittedJobsPath; final ZooKeeperStateHandleStore<SubmittedJobGraph> zooKeeperStateHandleStore = new ZooKeeperStateHandleStore<>(facade, stateStorage); final PathChildrenCache pathCache = new PathChildrenCache(facade, "/", false); return new ZooKeeperSubmittedJobGraphStore( zooKeeperFullSubmittedJobsPath, zooKeeperStateHandleStore, pathCache); }
[ "public", "static", "ZooKeeperSubmittedJobGraphStore", "createSubmittedJobGraphs", "(", "CuratorFramework", "client", ",", "Configuration", "configuration", ")", "throws", "Exception", "{", "checkNotNull", "(", "configuration", ",", "\"Configuration\"", ")", ";", "RetrievableStateStorageHelper", "<", "SubmittedJobGraph", ">", "stateStorage", "=", "createFileSystemStateStorage", "(", "configuration", ",", "\"submittedJobGraph\"", ")", ";", "// ZooKeeper submitted jobs root dir", "String", "zooKeeperSubmittedJobsPath", "=", "configuration", ".", "getString", "(", "HighAvailabilityOptions", ".", "HA_ZOOKEEPER_JOBGRAPHS_PATH", ")", ";", "// Ensure that the job graphs path exists", "client", ".", "newNamespaceAwareEnsurePath", "(", "zooKeeperSubmittedJobsPath", ")", ".", "ensure", "(", "client", ".", "getZookeeperClient", "(", ")", ")", ";", "// All operations will have the path as root", "CuratorFramework", "facade", "=", "client", ".", "usingNamespace", "(", "client", ".", "getNamespace", "(", ")", "+", "zooKeeperSubmittedJobsPath", ")", ";", "final", "String", "zooKeeperFullSubmittedJobsPath", "=", "client", ".", "getNamespace", "(", ")", "+", "zooKeeperSubmittedJobsPath", ";", "final", "ZooKeeperStateHandleStore", "<", "SubmittedJobGraph", ">", "zooKeeperStateHandleStore", "=", "new", "ZooKeeperStateHandleStore", "<>", "(", "facade", ",", "stateStorage", ")", ";", "final", "PathChildrenCache", "pathCache", "=", "new", "PathChildrenCache", "(", "facade", ",", "\"/\"", ",", "false", ")", ";", "return", "new", "ZooKeeperSubmittedJobGraphStore", "(", "zooKeeperFullSubmittedJobsPath", ",", "zooKeeperStateHandleStore", ",", "pathCache", ")", ";", "}" ]
Creates a {@link ZooKeeperSubmittedJobGraphStore} instance. @param client The {@link CuratorFramework} ZooKeeper client to use @param configuration {@link Configuration} object @return {@link ZooKeeperSubmittedJobGraphStore} instance @throws Exception if the submitted job graph store cannot be created
[ "Creates", "a", "{", "@link", "ZooKeeperSubmittedJobGraphStore", "}", "instance", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java#L237-L265
jenkinsci/jenkins
core/src/main/java/hudson/util/KeyedDataStorage.java
KeyedDataStorage.get
public @CheckForNull T get(String key) throws IOException { """ Finds the data object that matches the given key if available, or null if not found. @return Item with the specified {@code key} @throws IOException Loading error """ return get(key,false,null); }
java
public @CheckForNull T get(String key) throws IOException { return get(key,false,null); }
[ "public", "@", "CheckForNull", "T", "get", "(", "String", "key", ")", "throws", "IOException", "{", "return", "get", "(", "key", ",", "false", ",", "null", ")", ";", "}" ]
Finds the data object that matches the given key if available, or null if not found. @return Item with the specified {@code key} @throws IOException Loading error
[ "Finds", "the", "data", "object", "that", "matches", "the", "given", "key", "if", "available", "or", "null", "if", "not", "found", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/KeyedDataStorage.java#L120-L122
dbracewell/mango
src/main/java/com/davidbracewell/io/Resources.java
Resources.temporaryDirectory
public static Resource temporaryDirectory() { """ Creates a new Resource that points to a temporary directory. @return A resource which is a temporary directory on disk """ File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR); String baseName = System.currentTimeMillis() + "-"; for (int i = 0; i < 1_000_000; i++) { File tmp = new File(tempDir, baseName + i); if (tmp.mkdir()) { return new FileResource(tmp); } } throw new RuntimeException("Unable to create temp directory"); }
java
public static Resource temporaryDirectory() { File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR); String baseName = System.currentTimeMillis() + "-"; for (int i = 0; i < 1_000_000; i++) { File tmp = new File(tempDir, baseName + i); if (tmp.mkdir()) { return new FileResource(tmp); } } throw new RuntimeException("Unable to create temp directory"); }
[ "public", "static", "Resource", "temporaryDirectory", "(", ")", "{", "File", "tempDir", "=", "new", "File", "(", "SystemInfo", ".", "JAVA_IO_TMPDIR", ")", ";", "String", "baseName", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "\"-\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "1_000_000", ";", "i", "++", ")", "{", "File", "tmp", "=", "new", "File", "(", "tempDir", ",", "baseName", "+", "i", ")", ";", "if", "(", "tmp", ".", "mkdir", "(", ")", ")", "{", "return", "new", "FileResource", "(", "tmp", ")", ";", "}", "}", "throw", "new", "RuntimeException", "(", "\"Unable to create temp directory\"", ")", ";", "}" ]
Creates a new Resource that points to a temporary directory. @return A resource which is a temporary directory on disk
[ "Creates", "a", "new", "Resource", "that", "points", "to", "a", "temporary", "directory", "." ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/Resources.java#L240-L250
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/builder/standard/AbstractNumberProcessorBuilder.java
AbstractNumberProcessorBuilder.createFormatter
@SuppressWarnings("unchecked") protected Optional<NumberFormatWrapper<N>> createFormatter(final FieldAccessor field, final Configuration config) { """ 数値のフォーマッタを作成する。 <p>アノテーション{@link CsvNumberFormat}の値を元に作成します。</p> @param field フィールド情報 @param config システム設定 @return アノテーション{@link CsvNumberFormat}が付与されていない場合は、空を返す。 """ final Optional<CsvNumberFormat> formatAnno = field.getAnnotation(CsvNumberFormat.class); if(!formatAnno.isPresent()) { return Optional.empty(); } final String pattern = formatAnno.get().pattern(); if(pattern.isEmpty()) { return Optional.empty(); } final boolean lenient = formatAnno.get().lenient(); final Locale locale = Utils.getLocale(formatAnno.get().locale()); final Optional<Currency> currency = formatAnno.get().currency().isEmpty() ? Optional.empty() : Optional.of(Currency.getInstance(formatAnno.get().currency())); final RoundingMode roundingMode = formatAnno.get().rounding(); final DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); final DecimalFormat formatter = new DecimalFormat(pattern, symbols); formatter.setParseBigDecimal(true); formatter.setRoundingMode(roundingMode); currency.ifPresent(c -> formatter.setCurrency(c)); final NumberFormatWrapper<N> wrapper = new NumberFormatWrapper<>(formatter, (Class<N>)field.getType(), lenient); wrapper.setValidationMessage(formatAnno.get().message()); return Optional.of(wrapper); }
java
@SuppressWarnings("unchecked") protected Optional<NumberFormatWrapper<N>> createFormatter(final FieldAccessor field, final Configuration config) { final Optional<CsvNumberFormat> formatAnno = field.getAnnotation(CsvNumberFormat.class); if(!formatAnno.isPresent()) { return Optional.empty(); } final String pattern = formatAnno.get().pattern(); if(pattern.isEmpty()) { return Optional.empty(); } final boolean lenient = formatAnno.get().lenient(); final Locale locale = Utils.getLocale(formatAnno.get().locale()); final Optional<Currency> currency = formatAnno.get().currency().isEmpty() ? Optional.empty() : Optional.of(Currency.getInstance(formatAnno.get().currency())); final RoundingMode roundingMode = formatAnno.get().rounding(); final DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); final DecimalFormat formatter = new DecimalFormat(pattern, symbols); formatter.setParseBigDecimal(true); formatter.setRoundingMode(roundingMode); currency.ifPresent(c -> formatter.setCurrency(c)); final NumberFormatWrapper<N> wrapper = new NumberFormatWrapper<>(formatter, (Class<N>)field.getType(), lenient); wrapper.setValidationMessage(formatAnno.get().message()); return Optional.of(wrapper); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "Optional", "<", "NumberFormatWrapper", "<", "N", ">", ">", "createFormatter", "(", "final", "FieldAccessor", "field", ",", "final", "Configuration", "config", ")", "{", "final", "Optional", "<", "CsvNumberFormat", ">", "formatAnno", "=", "field", ".", "getAnnotation", "(", "CsvNumberFormat", ".", "class", ")", ";", "if", "(", "!", "formatAnno", ".", "isPresent", "(", ")", ")", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "final", "String", "pattern", "=", "formatAnno", ".", "get", "(", ")", ".", "pattern", "(", ")", ";", "if", "(", "pattern", ".", "isEmpty", "(", ")", ")", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "final", "boolean", "lenient", "=", "formatAnno", ".", "get", "(", ")", ".", "lenient", "(", ")", ";", "final", "Locale", "locale", "=", "Utils", ".", "getLocale", "(", "formatAnno", ".", "get", "(", ")", ".", "locale", "(", ")", ")", ";", "final", "Optional", "<", "Currency", ">", "currency", "=", "formatAnno", ".", "get", "(", ")", ".", "currency", "(", ")", ".", "isEmpty", "(", ")", "?", "Optional", ".", "empty", "(", ")", ":", "Optional", ".", "of", "(", "Currency", ".", "getInstance", "(", "formatAnno", ".", "get", "(", ")", ".", "currency", "(", ")", ")", ")", ";", "final", "RoundingMode", "roundingMode", "=", "formatAnno", ".", "get", "(", ")", ".", "rounding", "(", ")", ";", "final", "DecimalFormatSymbols", "symbols", "=", "DecimalFormatSymbols", ".", "getInstance", "(", "locale", ")", ";", "final", "DecimalFormat", "formatter", "=", "new", "DecimalFormat", "(", "pattern", ",", "symbols", ")", ";", "formatter", ".", "setParseBigDecimal", "(", "true", ")", ";", "formatter", ".", "setRoundingMode", "(", "roundingMode", ")", ";", "currency", ".", "ifPresent", "(", "c", "->", "formatter", ".", "setCurrency", "(", "c", ")", ")", ";", "final", "NumberFormatWrapper", "<", "N", ">", "wrapper", "=", "new", "NumberFormatWrapper", "<>", "(", "formatter", ",", "(", "Class", "<", "N", ">", ")", "field", ".", "getType", "(", ")", ",", "lenient", ")", ";", "wrapper", ".", "setValidationMessage", "(", "formatAnno", ".", "get", "(", ")", ".", "message", "(", ")", ")", ";", "return", "Optional", ".", "of", "(", "wrapper", ")", ";", "}" ]
数値のフォーマッタを作成する。 <p>アノテーション{@link CsvNumberFormat}の値を元に作成します。</p> @param field フィールド情報 @param config システム設定 @return アノテーション{@link CsvNumberFormat}が付与されていない場合は、空を返す。
[ "数値のフォーマッタを作成する。", "<p", ">", "アノテーション", "{" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/standard/AbstractNumberProcessorBuilder.java#L77-L108
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/util/JobStateToJsonConverter.java
JobStateToJsonConverter.convertAll
public void convertAll(String jobName, Writer writer) throws IOException { """ Convert all past {@link JobState}s of the given job. @param jobName job name @param writer {@link java.io.Writer} to write the json document @throws IOException """ List<? extends JobState> jobStates = this.jobStateStore.getAll(jobName); if (jobStates.isEmpty()) { LOGGER.warn(String.format("No job state found for job with name %s", jobName)); return; } try (JsonWriter jsonWriter = new JsonWriter(writer)) { jsonWriter.setIndent("\t"); writeJobStates(jsonWriter, jobStates); } }
java
public void convertAll(String jobName, Writer writer) throws IOException { List<? extends JobState> jobStates = this.jobStateStore.getAll(jobName); if (jobStates.isEmpty()) { LOGGER.warn(String.format("No job state found for job with name %s", jobName)); return; } try (JsonWriter jsonWriter = new JsonWriter(writer)) { jsonWriter.setIndent("\t"); writeJobStates(jsonWriter, jobStates); } }
[ "public", "void", "convertAll", "(", "String", "jobName", ",", "Writer", "writer", ")", "throws", "IOException", "{", "List", "<", "?", "extends", "JobState", ">", "jobStates", "=", "this", ".", "jobStateStore", ".", "getAll", "(", "jobName", ")", ";", "if", "(", "jobStates", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "warn", "(", "String", ".", "format", "(", "\"No job state found for job with name %s\"", ",", "jobName", ")", ")", ";", "return", ";", "}", "try", "(", "JsonWriter", "jsonWriter", "=", "new", "JsonWriter", "(", "writer", ")", ")", "{", "jsonWriter", ".", "setIndent", "(", "\"\\t\"", ")", ";", "writeJobStates", "(", "jsonWriter", ",", "jobStates", ")", ";", "}", "}" ]
Convert all past {@link JobState}s of the given job. @param jobName job name @param writer {@link java.io.Writer} to write the json document @throws IOException
[ "Convert", "all", "past", "{", "@link", "JobState", "}", "s", "of", "the", "given", "job", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/util/JobStateToJsonConverter.java#L117-L128
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.pullFontPathFromTheme
static String pullFontPathFromTheme(Context context, int styleAttrId, int[] attributeId) { """ Last but not least, try to pull the Font Path from the Theme, which is defined. @param context Activity Context @param styleAttrId Theme style id @param attributeId if -1 returns null. @return null if no theme or attribute defined. """ if (styleAttrId == -1 || attributeId == null) return null; final Resources.Theme theme = context.getTheme(); final TypedValue value = new TypedValue(); theme.resolveAttribute(styleAttrId, value, true); final TypedArray typedArray = theme.obtainStyledAttributes(value.resourceId, attributeId); try { String font = typedArray.getString(0); return font; } catch (Exception ignore) { // Failed for some reason. return null; } finally { typedArray.recycle(); } }
java
static String pullFontPathFromTheme(Context context, int styleAttrId, int[] attributeId) { if (styleAttrId == -1 || attributeId == null) return null; final Resources.Theme theme = context.getTheme(); final TypedValue value = new TypedValue(); theme.resolveAttribute(styleAttrId, value, true); final TypedArray typedArray = theme.obtainStyledAttributes(value.resourceId, attributeId); try { String font = typedArray.getString(0); return font; } catch (Exception ignore) { // Failed for some reason. return null; } finally { typedArray.recycle(); } }
[ "static", "String", "pullFontPathFromTheme", "(", "Context", "context", ",", "int", "styleAttrId", ",", "int", "[", "]", "attributeId", ")", "{", "if", "(", "styleAttrId", "==", "-", "1", "||", "attributeId", "==", "null", ")", "return", "null", ";", "final", "Resources", ".", "Theme", "theme", "=", "context", ".", "getTheme", "(", ")", ";", "final", "TypedValue", "value", "=", "new", "TypedValue", "(", ")", ";", "theme", ".", "resolveAttribute", "(", "styleAttrId", ",", "value", ",", "true", ")", ";", "final", "TypedArray", "typedArray", "=", "theme", ".", "obtainStyledAttributes", "(", "value", ".", "resourceId", ",", "attributeId", ")", ";", "try", "{", "String", "font", "=", "typedArray", ".", "getString", "(", "0", ")", ";", "return", "font", ";", "}", "catch", "(", "Exception", "ignore", ")", "{", "// Failed for some reason.", "return", "null", ";", "}", "finally", "{", "typedArray", ".", "recycle", "(", ")", ";", "}", "}" ]
Last but not least, try to pull the Font Path from the Theme, which is defined. @param context Activity Context @param styleAttrId Theme style id @param attributeId if -1 returns null. @return null if no theme or attribute defined.
[ "Last", "but", "not", "least", "try", "to", "pull", "the", "Font", "Path", "from", "the", "Theme", "which", "is", "defined", "." ]
train
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L252-L270
brettonw/Bag
src/main/java/com/brettonw/bag/Serializer.java
Serializer.fromBagAsType
public static <WorkingType> WorkingType fromBagAsType (Bag bag, Class type) { """ Reconstitute the given BagObject representation back to the object it represents, using a "best-effort" approach to matching the fields of the BagObject to the class being initialized. @param bag The input data to reconstruct from, either a BagObject or BagArray @param type the Class representing the type to reconstruct @return the reconstituted object, or null if the reconstitution failed. """ return (bag != null) ? (WorkingType) deserialize (type.getName (), bag) : null; }
java
public static <WorkingType> WorkingType fromBagAsType (Bag bag, Class type) { return (bag != null) ? (WorkingType) deserialize (type.getName (), bag) : null; }
[ "public", "static", "<", "WorkingType", ">", "WorkingType", "fromBagAsType", "(", "Bag", "bag", ",", "Class", "type", ")", "{", "return", "(", "bag", "!=", "null", ")", "?", "(", "WorkingType", ")", "deserialize", "(", "type", ".", "getName", "(", ")", ",", "bag", ")", ":", "null", ";", "}" ]
Reconstitute the given BagObject representation back to the object it represents, using a "best-effort" approach to matching the fields of the BagObject to the class being initialized. @param bag The input data to reconstruct from, either a BagObject or BagArray @param type the Class representing the type to reconstruct @return the reconstituted object, or null if the reconstitution failed.
[ "Reconstitute", "the", "given", "BagObject", "representation", "back", "to", "the", "object", "it", "represents", "using", "a", "best", "-", "effort", "approach", "to", "matching", "the", "fields", "of", "the", "BagObject", "to", "the", "class", "being", "initialized", "." ]
train
https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/Serializer.java#L500-L502
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java
FineUploaderBasic.addParam
@Nonnull public FineUploaderBasic addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) { """ These parameters are sent with the request to the endpoint specified in the action option. @param sKey Parameter name @param sValue Parameter value @return this """ ValueEnforcer.notEmpty (sKey, "Key"); ValueEnforcer.notNull (sValue, "Value"); m_aRequestParams.put (sKey, sValue); return this; }
java
@Nonnull public FineUploaderBasic addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) { ValueEnforcer.notEmpty (sKey, "Key"); ValueEnforcer.notNull (sValue, "Value"); m_aRequestParams.put (sKey, sValue); return this; }
[ "@", "Nonnull", "public", "FineUploaderBasic", "addParam", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sKey", ",", "@", "Nonnull", "final", "String", "sValue", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sKey", ",", "\"Key\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "sValue", ",", "\"Value\"", ")", ";", "m_aRequestParams", ".", "put", "(", "sKey", ",", "sValue", ")", ";", "return", "this", ";", "}" ]
These parameters are sent with the request to the endpoint specified in the action option. @param sKey Parameter name @param sValue Parameter value @return this
[ "These", "parameters", "are", "sent", "with", "the", "request", "to", "the", "endpoint", "specified", "in", "the", "action", "option", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload/FineUploaderBasic.java#L199-L207
openbase/jul
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java
AbstractRemoteClient.waitForData
@Override public void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { """ {@inheritDoc} @param timeout {@inheritDoc} @param timeUnit {@inheritDoc} @throws CouldNotPerformException {@inheritDoc} @throws java.lang.InterruptedException {@inheritDoc} """ try { if (isDataAvailable()) { return; } long startTime = System.currentTimeMillis(); getDataFuture().get(timeout, timeUnit); long partialTimeout = timeUnit.toMillis(timeout) - (System.currentTimeMillis() - startTime); if (partialTimeout <= 0) { throw new java.util.concurrent.TimeoutException("Data timeout is reached!"); } dataObservable.waitForValue(partialTimeout, TimeUnit.MILLISECONDS); } catch (java.util.concurrent.TimeoutException | CouldNotPerformException | ExecutionException | CancellationException ex) { if (shutdownInitiated) { throw new InterruptedException("Interrupt request because system shutdown was initiated!"); } throw new NotAvailableException("Data is not yet available!", ex); } }
java
@Override public void waitForData(long timeout, TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { try { if (isDataAvailable()) { return; } long startTime = System.currentTimeMillis(); getDataFuture().get(timeout, timeUnit); long partialTimeout = timeUnit.toMillis(timeout) - (System.currentTimeMillis() - startTime); if (partialTimeout <= 0) { throw new java.util.concurrent.TimeoutException("Data timeout is reached!"); } dataObservable.waitForValue(partialTimeout, TimeUnit.MILLISECONDS); } catch (java.util.concurrent.TimeoutException | CouldNotPerformException | ExecutionException | CancellationException ex) { if (shutdownInitiated) { throw new InterruptedException("Interrupt request because system shutdown was initiated!"); } throw new NotAvailableException("Data is not yet available!", ex); } }
[ "@", "Override", "public", "void", "waitForData", "(", "long", "timeout", ",", "TimeUnit", "timeUnit", ")", "throws", "CouldNotPerformException", ",", "InterruptedException", "{", "try", "{", "if", "(", "isDataAvailable", "(", ")", ")", "{", "return", ";", "}", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "getDataFuture", "(", ")", ".", "get", "(", "timeout", ",", "timeUnit", ")", ";", "long", "partialTimeout", "=", "timeUnit", ".", "toMillis", "(", "timeout", ")", "-", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "startTime", ")", ";", "if", "(", "partialTimeout", "<=", "0", ")", "{", "throw", "new", "java", ".", "util", ".", "concurrent", ".", "TimeoutException", "(", "\"Data timeout is reached!\"", ")", ";", "}", "dataObservable", ".", "waitForValue", "(", "partialTimeout", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "catch", "(", "java", ".", "util", ".", "concurrent", ".", "TimeoutException", "|", "CouldNotPerformException", "|", "ExecutionException", "|", "CancellationException", "ex", ")", "{", "if", "(", "shutdownInitiated", ")", "{", "throw", "new", "InterruptedException", "(", "\"Interrupt request because system shutdown was initiated!\"", ")", ";", "}", "throw", "new", "NotAvailableException", "(", "\"Data is not yet available!\"", ",", "ex", ")", ";", "}", "}" ]
{@inheritDoc} @param timeout {@inheritDoc} @param timeUnit {@inheritDoc} @throws CouldNotPerformException {@inheritDoc} @throws java.lang.InterruptedException {@inheritDoc}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L1201-L1220
cdapio/netty-http
src/main/java/io/cdap/http/internal/RequestRouter.java
RequestRouter.channelRead
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { """ If the HttpRequest is valid and handled it will be sent upstream, if it cannot be invoked the response will be written back immediately. """ try { if (exceptionRaised.get()) { return; } if (!(msg instanceof HttpRequest)) { // If there is no methodInfo, it means the request was already rejected. // What we received here is just residue of the request, which can be ignored. if (methodInfo != null) { ReferenceCountUtil.retain(msg); ctx.fireChannelRead(msg); } return; } HttpRequest request = (HttpRequest) msg; BasicHttpResponder responder = new BasicHttpResponder(ctx.channel(), sslEnabled); // Reset the methodInfo for the incoming request error handling methodInfo = null; methodInfo = prepareHandleMethod(request, responder, ctx); if (methodInfo != null) { ReferenceCountUtil.retain(msg); ctx.fireChannelRead(msg); } else { if (!responder.isResponded()) { // If not yet responded, just respond with a not found and close the connection HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.NOT_FOUND); HttpUtil.setContentLength(response, 0); HttpUtil.setKeepAlive(response, false); ctx.channel().writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } else { // If already responded, just close the connection ctx.channel().close(); } } } finally { ReferenceCountUtil.release(msg); } }
java
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { if (exceptionRaised.get()) { return; } if (!(msg instanceof HttpRequest)) { // If there is no methodInfo, it means the request was already rejected. // What we received here is just residue of the request, which can be ignored. if (methodInfo != null) { ReferenceCountUtil.retain(msg); ctx.fireChannelRead(msg); } return; } HttpRequest request = (HttpRequest) msg; BasicHttpResponder responder = new BasicHttpResponder(ctx.channel(), sslEnabled); // Reset the methodInfo for the incoming request error handling methodInfo = null; methodInfo = prepareHandleMethod(request, responder, ctx); if (methodInfo != null) { ReferenceCountUtil.retain(msg); ctx.fireChannelRead(msg); } else { if (!responder.isResponded()) { // If not yet responded, just respond with a not found and close the connection HttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.NOT_FOUND); HttpUtil.setContentLength(response, 0); HttpUtil.setKeepAlive(response, false); ctx.channel().writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); } else { // If already responded, just close the connection ctx.channel().close(); } } } finally { ReferenceCountUtil.release(msg); } }
[ "@", "Override", "public", "void", "channelRead", "(", "ChannelHandlerContext", "ctx", ",", "Object", "msg", ")", "throws", "Exception", "{", "try", "{", "if", "(", "exceptionRaised", ".", "get", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "(", "msg", "instanceof", "HttpRequest", ")", ")", "{", "// If there is no methodInfo, it means the request was already rejected.", "// What we received here is just residue of the request, which can be ignored.", "if", "(", "methodInfo", "!=", "null", ")", "{", "ReferenceCountUtil", ".", "retain", "(", "msg", ")", ";", "ctx", ".", "fireChannelRead", "(", "msg", ")", ";", "}", "return", ";", "}", "HttpRequest", "request", "=", "(", "HttpRequest", ")", "msg", ";", "BasicHttpResponder", "responder", "=", "new", "BasicHttpResponder", "(", "ctx", ".", "channel", "(", ")", ",", "sslEnabled", ")", ";", "// Reset the methodInfo for the incoming request error handling", "methodInfo", "=", "null", ";", "methodInfo", "=", "prepareHandleMethod", "(", "request", ",", "responder", ",", "ctx", ")", ";", "if", "(", "methodInfo", "!=", "null", ")", "{", "ReferenceCountUtil", ".", "retain", "(", "msg", ")", ";", "ctx", ".", "fireChannelRead", "(", "msg", ")", ";", "}", "else", "{", "if", "(", "!", "responder", ".", "isResponded", "(", ")", ")", "{", "// If not yet responded, just respond with a not found and close the connection", "HttpResponse", "response", "=", "new", "DefaultFullHttpResponse", "(", "HttpVersion", ".", "HTTP_1_1", ",", "HttpResponseStatus", ".", "NOT_FOUND", ")", ";", "HttpUtil", ".", "setContentLength", "(", "response", ",", "0", ")", ";", "HttpUtil", ".", "setKeepAlive", "(", "response", ",", "false", ")", ";", "ctx", ".", "channel", "(", ")", ".", "writeAndFlush", "(", "response", ")", ".", "addListener", "(", "ChannelFutureListener", ".", "CLOSE", ")", ";", "}", "else", "{", "// If already responded, just close the connection", "ctx", ".", "channel", "(", ")", ".", "close", "(", ")", ";", "}", "}", "}", "finally", "{", "ReferenceCountUtil", ".", "release", "(", "msg", ")", ";", "}", "}" ]
If the HttpRequest is valid and handled it will be sent upstream, if it cannot be invoked the response will be written back immediately.
[ "If", "the", "HttpRequest", "is", "valid", "and", "handled", "it", "will", "be", "sent", "upstream", "if", "it", "cannot", "be", "invoked", "the", "response", "will", "be", "written", "back", "immediately", "." ]
train
https://github.com/cdapio/netty-http/blob/02fdbb45bdd51d3dd58c0efbb2f27195d265cd0f/src/main/java/io/cdap/http/internal/RequestRouter.java#L67-L108
waldheinz/fat32-lib
src/main/java/de/waldheinz/fs/fat/ShortNameGenerator.java
ShortNameGenerator.generateShortName
public ShortName generateShortName(String longFullName) throws IllegalStateException { """ Generates a new unique 8.3 file name that is not already contained in the set specified to the constructor. @param longFullName the long file name to generate the short name for @return the generated 8.3 file name @throws IllegalStateException if no unused short name could be found """ longFullName = stripLeadingPeriods(longFullName).toUpperCase(Locale.ROOT); final String longName; final String longExt; final int dotIdx = longFullName.lastIndexOf('.'); final boolean forceSuffix; if (dotIdx == -1) { /* no dot in the name */ forceSuffix = !cleanString(longFullName); longName = tidyString(longFullName); longExt = ""; /* so no extension */ } else { /* split at the dot */ forceSuffix = !cleanString(longFullName.substring( 0, dotIdx)); longName = tidyString(longFullName.substring(0, dotIdx)); longExt = tidyString(longFullName.substring(dotIdx + 1)); } final String shortExt = (longExt.length() > 3) ? longExt.substring(0, 3) : longExt; if (forceSuffix || (longName.length() > 8) || usedNames.contains(new ShortName(longName, shortExt). asSimpleString().toLowerCase(Locale.ROOT))) { /* we have to append the "~n" suffix */ final int maxLongIdx = Math.min(longName.length(), 8); for (int i=1; i < 99999; i++) { final String serial = "~" + i; //NOI18N final int serialLen = serial.length(); final String shortName = longName.substring( 0, Math.min(maxLongIdx, 8-serialLen)) + serial; final ShortName result = new ShortName(shortName, shortExt); if (!usedNames.contains( result.asSimpleString().toLowerCase(Locale.ROOT))) { return result; } } throw new IllegalStateException( "could not generate short name for \"" + longFullName + "\""); } return new ShortName(longName, shortExt); }
java
public ShortName generateShortName(String longFullName) throws IllegalStateException { longFullName = stripLeadingPeriods(longFullName).toUpperCase(Locale.ROOT); final String longName; final String longExt; final int dotIdx = longFullName.lastIndexOf('.'); final boolean forceSuffix; if (dotIdx == -1) { /* no dot in the name */ forceSuffix = !cleanString(longFullName); longName = tidyString(longFullName); longExt = ""; /* so no extension */ } else { /* split at the dot */ forceSuffix = !cleanString(longFullName.substring( 0, dotIdx)); longName = tidyString(longFullName.substring(0, dotIdx)); longExt = tidyString(longFullName.substring(dotIdx + 1)); } final String shortExt = (longExt.length() > 3) ? longExt.substring(0, 3) : longExt; if (forceSuffix || (longName.length() > 8) || usedNames.contains(new ShortName(longName, shortExt). asSimpleString().toLowerCase(Locale.ROOT))) { /* we have to append the "~n" suffix */ final int maxLongIdx = Math.min(longName.length(), 8); for (int i=1; i < 99999; i++) { final String serial = "~" + i; //NOI18N final int serialLen = serial.length(); final String shortName = longName.substring( 0, Math.min(maxLongIdx, 8-serialLen)) + serial; final ShortName result = new ShortName(shortName, shortExt); if (!usedNames.contains( result.asSimpleString().toLowerCase(Locale.ROOT))) { return result; } } throw new IllegalStateException( "could not generate short name for \"" + longFullName + "\""); } return new ShortName(longName, shortExt); }
[ "public", "ShortName", "generateShortName", "(", "String", "longFullName", ")", "throws", "IllegalStateException", "{", "longFullName", "=", "stripLeadingPeriods", "(", "longFullName", ")", ".", "toUpperCase", "(", "Locale", ".", "ROOT", ")", ";", "final", "String", "longName", ";", "final", "String", "longExt", ";", "final", "int", "dotIdx", "=", "longFullName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "final", "boolean", "forceSuffix", ";", "if", "(", "dotIdx", "==", "-", "1", ")", "{", "/* no dot in the name */", "forceSuffix", "=", "!", "cleanString", "(", "longFullName", ")", ";", "longName", "=", "tidyString", "(", "longFullName", ")", ";", "longExt", "=", "\"\"", ";", "/* so no extension */", "}", "else", "{", "/* split at the dot */", "forceSuffix", "=", "!", "cleanString", "(", "longFullName", ".", "substring", "(", "0", ",", "dotIdx", ")", ")", ";", "longName", "=", "tidyString", "(", "longFullName", ".", "substring", "(", "0", ",", "dotIdx", ")", ")", ";", "longExt", "=", "tidyString", "(", "longFullName", ".", "substring", "(", "dotIdx", "+", "1", ")", ")", ";", "}", "final", "String", "shortExt", "=", "(", "longExt", ".", "length", "(", ")", ">", "3", ")", "?", "longExt", ".", "substring", "(", "0", ",", "3", ")", ":", "longExt", ";", "if", "(", "forceSuffix", "||", "(", "longName", ".", "length", "(", ")", ">", "8", ")", "||", "usedNames", ".", "contains", "(", "new", "ShortName", "(", "longName", ",", "shortExt", ")", ".", "asSimpleString", "(", ")", ".", "toLowerCase", "(", "Locale", ".", "ROOT", ")", ")", ")", "{", "/* we have to append the \"~n\" suffix */", "final", "int", "maxLongIdx", "=", "Math", ".", "min", "(", "longName", ".", "length", "(", ")", ",", "8", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "99999", ";", "i", "++", ")", "{", "final", "String", "serial", "=", "\"~\"", "+", "i", ";", "//NOI18N", "final", "int", "serialLen", "=", "serial", ".", "length", "(", ")", ";", "final", "String", "shortName", "=", "longName", ".", "substring", "(", "0", ",", "Math", ".", "min", "(", "maxLongIdx", ",", "8", "-", "serialLen", ")", ")", "+", "serial", ";", "final", "ShortName", "result", "=", "new", "ShortName", "(", "shortName", ",", "shortExt", ")", ";", "if", "(", "!", "usedNames", ".", "contains", "(", "result", ".", "asSimpleString", "(", ")", ".", "toLowerCase", "(", "Locale", ".", "ROOT", ")", ")", ")", "{", "return", "result", ";", "}", "}", "throw", "new", "IllegalStateException", "(", "\"could not generate short name for \\\"\"", "+", "longFullName", "+", "\"\\\"\"", ")", ";", "}", "return", "new", "ShortName", "(", "longName", ",", "shortExt", ")", ";", "}" ]
Generates a new unique 8.3 file name that is not already contained in the set specified to the constructor. @param longFullName the long file name to generate the short name for @return the generated 8.3 file name @throws IllegalStateException if no unused short name could be found
[ "Generates", "a", "new", "unique", "8", ".", "3", "file", "name", "that", "is", "not", "already", "contained", "in", "the", "set", "specified", "to", "the", "constructor", "." ]
train
https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/ShortNameGenerator.java#L116-L171
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/argparser/TaggedArgumentParser.java
TaggedArgumentParser.populateArgumentTags
public static void populateArgumentTags(final TaggedArgument taggedArg, final String longArgName, final String tagString) { """ Parse a tag string and populate a TaggedArgument with values. @param taggedArg TaggedArgument to receive tags @param longArgName name of the argument being tagged @param tagString tag string (including logical name and attributes, no option name) """ if (tagString == null) { taggedArg.setTag(null); taggedArg.setTagAttributes(Collections.emptyMap()); } else { final ParsedArgument pa = ParsedArgument.of(longArgName, tagString); taggedArg.setTag(pa.getName()); taggedArg.setTagAttributes(pa.keyValueMap()); } }
java
public static void populateArgumentTags(final TaggedArgument taggedArg, final String longArgName, final String tagString) { if (tagString == null) { taggedArg.setTag(null); taggedArg.setTagAttributes(Collections.emptyMap()); } else { final ParsedArgument pa = ParsedArgument.of(longArgName, tagString); taggedArg.setTag(pa.getName()); taggedArg.setTagAttributes(pa.keyValueMap()); } }
[ "public", "static", "void", "populateArgumentTags", "(", "final", "TaggedArgument", "taggedArg", ",", "final", "String", "longArgName", ",", "final", "String", "tagString", ")", "{", "if", "(", "tagString", "==", "null", ")", "{", "taggedArg", ".", "setTag", "(", "null", ")", ";", "taggedArg", ".", "setTagAttributes", "(", "Collections", ".", "emptyMap", "(", ")", ")", ";", "}", "else", "{", "final", "ParsedArgument", "pa", "=", "ParsedArgument", ".", "of", "(", "longArgName", ",", "tagString", ")", ";", "taggedArg", ".", "setTag", "(", "pa", ".", "getName", "(", ")", ")", ";", "taggedArg", ".", "setTagAttributes", "(", "pa", ".", "keyValueMap", "(", ")", ")", ";", "}", "}" ]
Parse a tag string and populate a TaggedArgument with values. @param taggedArg TaggedArgument to receive tags @param longArgName name of the argument being tagged @param tagString tag string (including logical name and attributes, no option name)
[ "Parse", "a", "tag", "string", "and", "populate", "a", "TaggedArgument", "with", "values", "." ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/TaggedArgumentParser.java#L231-L240
geomajas/geomajas-project-server
api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java
ManyToOneAttribute.setFloatAttribute
public void setFloatAttribute(String name, Float value) { """ Sets the specified float attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0 """ ensureValue(); Attribute attribute = new FloatAttribute(value); attribute.setEditable(isEditable(name)); getValue().getAllAttributes().put(name, attribute); }
java
public void setFloatAttribute(String name, Float value) { ensureValue(); Attribute attribute = new FloatAttribute(value); attribute.setEditable(isEditable(name)); getValue().getAllAttributes().put(name, attribute); }
[ "public", "void", "setFloatAttribute", "(", "String", "name", ",", "Float", "value", ")", "{", "ensureValue", "(", ")", ";", "Attribute", "attribute", "=", "new", "FloatAttribute", "(", "value", ")", ";", "attribute", ".", "setEditable", "(", "isEditable", "(", "name", ")", ")", ";", "getValue", "(", ")", ".", "getAllAttributes", "(", ")", ".", "put", "(", "name", ",", "attribute", ")", ";", "}" ]
Sets the specified float attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0
[ "Sets", "the", "specified", "float", "attribute", "to", "the", "specified", "value", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java#L174-L179
pavlospt/RxIAPv3
androidiap/src/main/java/com/pavlospt/androidiap/utils/Security.java
Security.verifyPurchase
public static boolean verifyPurchase(String productId, String base64PublicKey, String signedData, String signature) { """ Verifies that the data was signed with the given signature, and returns the verified purchase. The data is in JSON format and signed with a private key. @param productId the product Id used for debug validation. @param base64PublicKey the base64-encoded public key to use for verifying. @param signedData the signed JSON string (signed, not encrypted) @param signature the signature for the data, signed with the private key """ if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { if(BuildConfig.DEBUG){ //handle test purchase not having signature if(productId.equals("android.test.purchased")) { return true; } } Log.e(TAG, "Purchase verification failed: missing data."); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); }
java
public static boolean verifyPurchase(String productId, String base64PublicKey, String signedData, String signature) { if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { if(BuildConfig.DEBUG){ //handle test purchase not having signature if(productId.equals("android.test.purchased")) { return true; } } Log.e(TAG, "Purchase verification failed: missing data."); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); }
[ "public", "static", "boolean", "verifyPurchase", "(", "String", "productId", ",", "String", "base64PublicKey", ",", "String", "signedData", ",", "String", "signature", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "signedData", ")", "||", "TextUtils", ".", "isEmpty", "(", "base64PublicKey", ")", "||", "TextUtils", ".", "isEmpty", "(", "signature", ")", ")", "{", "if", "(", "BuildConfig", ".", "DEBUG", ")", "{", "//handle test purchase not having signature", "if", "(", "productId", ".", "equals", "(", "\"android.test.purchased\"", ")", ")", "{", "return", "true", ";", "}", "}", "Log", ".", "e", "(", "TAG", ",", "\"Purchase verification failed: missing data.\"", ")", ";", "return", "false", ";", "}", "PublicKey", "key", "=", "Security", ".", "generatePublicKey", "(", "base64PublicKey", ")", ";", "return", "Security", ".", "verify", "(", "key", ",", "signedData", ",", "signature", ")", ";", "}" ]
Verifies that the data was signed with the given signature, and returns the verified purchase. The data is in JSON format and signed with a private key. @param productId the product Id used for debug validation. @param base64PublicKey the base64-encoded public key to use for verifying. @param signedData the signed JSON string (signed, not encrypted) @param signature the signature for the data, signed with the private key
[ "Verifies", "that", "the", "data", "was", "signed", "with", "the", "given", "signature", "and", "returns", "the", "verified", "purchase", ".", "The", "data", "is", "in", "JSON", "format", "and", "signed", "with", "a", "private", "key", "." ]
train
https://github.com/pavlospt/RxIAPv3/blob/b7a02458ecc7529adaa25959822bd6d08cd3ebd0/androidiap/src/main/java/com/pavlospt/androidiap/utils/Security.java#L57-L73
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/globalfac/ConsecutiveSiblingsFactor.java
ConsecutiveSiblingsFactor.getLinkVar1Idx
public LinkVar getLinkVar1Idx(int parent, int child) { """ Get the link var corresponding to the specified parent and child position. @param parent The parent word position (1-indexed), or 0 to indicate the wall node. @param child The child word position (1-indexed). @return The link variable. """ if (parent == 0) { return rootVars[child-1]; } else { return childVars[parent-1][child-1]; } }
java
public LinkVar getLinkVar1Idx(int parent, int child) { if (parent == 0) { return rootVars[child-1]; } else { return childVars[parent-1][child-1]; } }
[ "public", "LinkVar", "getLinkVar1Idx", "(", "int", "parent", ",", "int", "child", ")", "{", "if", "(", "parent", "==", "0", ")", "{", "return", "rootVars", "[", "child", "-", "1", "]", ";", "}", "else", "{", "return", "childVars", "[", "parent", "-", "1", "]", "[", "child", "-", "1", "]", ";", "}", "}" ]
Get the link var corresponding to the specified parent and child position. @param parent The parent word position (1-indexed), or 0 to indicate the wall node. @param child The child word position (1-indexed). @return The link variable.
[ "Get", "the", "link", "var", "corresponding", "to", "the", "specified", "parent", "and", "child", "position", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/globalfac/ConsecutiveSiblingsFactor.java#L164-L170
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/ResponseHandler.java
ResponseHandler.bucketHasFastForwardMap
private static boolean bucketHasFastForwardMap(String bucketName, ClusterConfig clusterConfig) { """ Helper method to check if the current given bucket contains a fast forward map. @param bucketName the name of the bucket. @param clusterConfig the current cluster configuration. @return true if it has a ffwd-map, false otherwise. """ if (bucketName == null) { return false; } BucketConfig bucketConfig = clusterConfig.bucketConfig(bucketName); return bucketConfig != null && bucketConfig.hasFastForwardMap(); }
java
private static boolean bucketHasFastForwardMap(String bucketName, ClusterConfig clusterConfig) { if (bucketName == null) { return false; } BucketConfig bucketConfig = clusterConfig.bucketConfig(bucketName); return bucketConfig != null && bucketConfig.hasFastForwardMap(); }
[ "private", "static", "boolean", "bucketHasFastForwardMap", "(", "String", "bucketName", ",", "ClusterConfig", "clusterConfig", ")", "{", "if", "(", "bucketName", "==", "null", ")", "{", "return", "false", ";", "}", "BucketConfig", "bucketConfig", "=", "clusterConfig", ".", "bucketConfig", "(", "bucketName", ")", ";", "return", "bucketConfig", "!=", "null", "&&", "bucketConfig", ".", "hasFastForwardMap", "(", ")", ";", "}" ]
Helper method to check if the current given bucket contains a fast forward map. @param bucketName the name of the bucket. @param clusterConfig the current cluster configuration. @return true if it has a ffwd-map, false otherwise.
[ "Helper", "method", "to", "check", "if", "the", "current", "given", "bucket", "contains", "a", "fast", "forward", "map", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/ResponseHandler.java#L230-L236
Hygieia/Hygieia
collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/WidgetScoreAbstract.java
WidgetScoreAbstract.processWidgetScore
@Override public ScoreWeight processWidgetScore(Widget widget, ScoreComponentSettings paramSettings) { """ Process widget score @param widget widget configuration from dashboard @param paramSettings Score Settings for the widget @return """ if (!Utils.isScoreEnabled(paramSettings)) { return null; } //1. Init scores ScoreWeight scoreWidget = initWidgetScore(paramSettings); if (null == widget) { scoreWidget.setScore(paramSettings.getCriteria().getNoWidgetFound()); scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed); scoreWidget.setMessage(Constants.SCORE_ERROR_NO_WIDGET_FOUND); processWidgetScoreChildren(scoreWidget); return scoreWidget; } //Set Reference Id as Widget Id scoreWidget.setRefId(widget.getId()); //2. Calculate scores for each child category try { calculateCategoryScores(widget, paramSettings, scoreWidget.getChildren()); } catch (DataNotFoundException ex) { scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed); scoreWidget.setScore(paramSettings.getCriteria().getNoDataFound()); scoreWidget.setMessage(ex.getMessage()); processWidgetScoreChildren(scoreWidget); return scoreWidget; } catch (ThresholdException ex) { setThresholdFailureWeight(ex, scoreWidget); processWidgetScoreChildren(scoreWidget); return scoreWidget; } LOGGER.debug("scoreWidget {}", scoreWidget); LOGGER.debug("scoreWidget.getChildren {}", scoreWidget.getChildren()); //3. Calculate widget score calculateWidgetScore(scoreWidget); return scoreWidget; }
java
@Override public ScoreWeight processWidgetScore(Widget widget, ScoreComponentSettings paramSettings) { if (!Utils.isScoreEnabled(paramSettings)) { return null; } //1. Init scores ScoreWeight scoreWidget = initWidgetScore(paramSettings); if (null == widget) { scoreWidget.setScore(paramSettings.getCriteria().getNoWidgetFound()); scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed); scoreWidget.setMessage(Constants.SCORE_ERROR_NO_WIDGET_FOUND); processWidgetScoreChildren(scoreWidget); return scoreWidget; } //Set Reference Id as Widget Id scoreWidget.setRefId(widget.getId()); //2. Calculate scores for each child category try { calculateCategoryScores(widget, paramSettings, scoreWidget.getChildren()); } catch (DataNotFoundException ex) { scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed); scoreWidget.setScore(paramSettings.getCriteria().getNoDataFound()); scoreWidget.setMessage(ex.getMessage()); processWidgetScoreChildren(scoreWidget); return scoreWidget; } catch (ThresholdException ex) { setThresholdFailureWeight(ex, scoreWidget); processWidgetScoreChildren(scoreWidget); return scoreWidget; } LOGGER.debug("scoreWidget {}", scoreWidget); LOGGER.debug("scoreWidget.getChildren {}", scoreWidget.getChildren()); //3. Calculate widget score calculateWidgetScore(scoreWidget); return scoreWidget; }
[ "@", "Override", "public", "ScoreWeight", "processWidgetScore", "(", "Widget", "widget", ",", "ScoreComponentSettings", "paramSettings", ")", "{", "if", "(", "!", "Utils", ".", "isScoreEnabled", "(", "paramSettings", ")", ")", "{", "return", "null", ";", "}", "//1. Init scores", "ScoreWeight", "scoreWidget", "=", "initWidgetScore", "(", "paramSettings", ")", ";", "if", "(", "null", "==", "widget", ")", "{", "scoreWidget", ".", "setScore", "(", "paramSettings", ".", "getCriteria", "(", ")", ".", "getNoWidgetFound", "(", ")", ")", ";", "scoreWidget", ".", "setState", "(", "ScoreWeight", ".", "ProcessingState", ".", "criteria_failed", ")", ";", "scoreWidget", ".", "setMessage", "(", "Constants", ".", "SCORE_ERROR_NO_WIDGET_FOUND", ")", ";", "processWidgetScoreChildren", "(", "scoreWidget", ")", ";", "return", "scoreWidget", ";", "}", "//Set Reference Id as Widget Id", "scoreWidget", ".", "setRefId", "(", "widget", ".", "getId", "(", ")", ")", ";", "//2. Calculate scores for each child category", "try", "{", "calculateCategoryScores", "(", "widget", ",", "paramSettings", ",", "scoreWidget", ".", "getChildren", "(", ")", ")", ";", "}", "catch", "(", "DataNotFoundException", "ex", ")", "{", "scoreWidget", ".", "setState", "(", "ScoreWeight", ".", "ProcessingState", ".", "criteria_failed", ")", ";", "scoreWidget", ".", "setScore", "(", "paramSettings", ".", "getCriteria", "(", ")", ".", "getNoDataFound", "(", ")", ")", ";", "scoreWidget", ".", "setMessage", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "processWidgetScoreChildren", "(", "scoreWidget", ")", ";", "return", "scoreWidget", ";", "}", "catch", "(", "ThresholdException", "ex", ")", "{", "setThresholdFailureWeight", "(", "ex", ",", "scoreWidget", ")", ";", "processWidgetScoreChildren", "(", "scoreWidget", ")", ";", "return", "scoreWidget", ";", "}", "LOGGER", ".", "debug", "(", "\"scoreWidget {}\"", ",", "scoreWidget", ")", ";", "LOGGER", ".", "debug", "(", "\"scoreWidget.getChildren {}\"", ",", "scoreWidget", ".", "getChildren", "(", ")", ")", ";", "//3. Calculate widget score", "calculateWidgetScore", "(", "scoreWidget", ")", ";", "return", "scoreWidget", ";", "}" ]
Process widget score @param widget widget configuration from dashboard @param paramSettings Score Settings for the widget @return
[ "Process", "widget", "score" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/WidgetScoreAbstract.java#L39-L80
alibaba/transmittable-thread-local
src/main/java/com/alibaba/ttl/TtlCallable.java
TtlCallable.get
@Nullable public static <T> TtlCallable<T> get(@Nullable Callable<T> callable, boolean releaseTtlValueReferenceAfterCall) { """ Factory method, wrap input {@link Callable} to {@link TtlCallable}. <p> This method is idempotent. @param callable input {@link Callable} @param releaseTtlValueReferenceAfterCall release TTL value reference after run, avoid memory leak even if {@link TtlRunnable} is referred. @return Wrapped {@link Callable} """ return get(callable, releaseTtlValueReferenceAfterCall, false); }
java
@Nullable public static <T> TtlCallable<T> get(@Nullable Callable<T> callable, boolean releaseTtlValueReferenceAfterCall) { return get(callable, releaseTtlValueReferenceAfterCall, false); }
[ "@", "Nullable", "public", "static", "<", "T", ">", "TtlCallable", "<", "T", ">", "get", "(", "@", "Nullable", "Callable", "<", "T", ">", "callable", ",", "boolean", "releaseTtlValueReferenceAfterCall", ")", "{", "return", "get", "(", "callable", ",", "releaseTtlValueReferenceAfterCall", ",", "false", ")", ";", "}" ]
Factory method, wrap input {@link Callable} to {@link TtlCallable}. <p> This method is idempotent. @param callable input {@link Callable} @param releaseTtlValueReferenceAfterCall release TTL value reference after run, avoid memory leak even if {@link TtlRunnable} is referred. @return Wrapped {@link Callable}
[ "Factory", "method", "wrap", "input", "{", "@link", "Callable", "}", "to", "{", "@link", "TtlCallable", "}", ".", "<p", ">", "This", "method", "is", "idempotent", "." ]
train
https://github.com/alibaba/transmittable-thread-local/blob/30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9/src/main/java/com/alibaba/ttl/TtlCallable.java#L107-L110
aboutsip/pkts
pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipMessageStreamBuilder.java
SipMessageStreamBuilder.onInit
private final State onInit(final Buffer buffer) { """ While in the INIT state, we are just consuming any empty space before heading off to start parsing the initial line @param b @return """ try { while (buffer.hasReadableBytes()) { final byte b = buffer.peekByte(); if (b == SipParser.SP || b == SipParser.HTAB || b == SipParser.CR || b == SipParser.LF) { buffer.readByte(); } else { start = buffer.getReaderIndex(); return State.GET_INITIAL_LINE; } } } catch (final IOException e) { throw new RuntimeException("Unable to read from stream due to IOException", e); } return State.INIT; }
java
private final State onInit(final Buffer buffer) { try { while (buffer.hasReadableBytes()) { final byte b = buffer.peekByte(); if (b == SipParser.SP || b == SipParser.HTAB || b == SipParser.CR || b == SipParser.LF) { buffer.readByte(); } else { start = buffer.getReaderIndex(); return State.GET_INITIAL_LINE; } } } catch (final IOException e) { throw new RuntimeException("Unable to read from stream due to IOException", e); } return State.INIT; }
[ "private", "final", "State", "onInit", "(", "final", "Buffer", "buffer", ")", "{", "try", "{", "while", "(", "buffer", ".", "hasReadableBytes", "(", ")", ")", "{", "final", "byte", "b", "=", "buffer", ".", "peekByte", "(", ")", ";", "if", "(", "b", "==", "SipParser", ".", "SP", "||", "b", "==", "SipParser", ".", "HTAB", "||", "b", "==", "SipParser", ".", "CR", "||", "b", "==", "SipParser", ".", "LF", ")", "{", "buffer", ".", "readByte", "(", ")", ";", "}", "else", "{", "start", "=", "buffer", ".", "getReaderIndex", "(", ")", ";", "return", "State", ".", "GET_INITIAL_LINE", ";", "}", "}", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to read from stream due to IOException\"", ",", "e", ")", ";", "}", "return", "State", ".", "INIT", ";", "}" ]
While in the INIT state, we are just consuming any empty space before heading off to start parsing the initial line @param b @return
[ "While", "in", "the", "INIT", "state", "we", "are", "just", "consuming", "any", "empty", "space", "before", "heading", "off", "to", "start", "parsing", "the", "initial", "line" ]
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipMessageStreamBuilder.java#L241-L257
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java
WTree.processCheckExpandedCustomNodes
private void processCheckExpandedCustomNodes(final TreeItemIdNode node, final Set<String> expandedRows) { """ Iterate through nodes to check expanded nodes have their child nodes. <p> If a node is flagged as having children and has none, then load them from the tree model. </p> @param node the node to check @param expandedRows the expanded rows """ // Node has no children if (!node.hasChildren()) { return; } // Check node is expanded boolean expanded = getExpandMode() == WTree.ExpandMode.CLIENT || expandedRows.contains(node.getItemId()); if (!expanded) { return; } if (node.getChildren().isEmpty()) { // Add children from the model loadCustomNodeChildren(node); } else { // Check the expanded child nodes for (TreeItemIdNode child : node.getChildren()) { processCheckExpandedCustomNodes(child, expandedRows); } } }
java
private void processCheckExpandedCustomNodes(final TreeItemIdNode node, final Set<String> expandedRows) { // Node has no children if (!node.hasChildren()) { return; } // Check node is expanded boolean expanded = getExpandMode() == WTree.ExpandMode.CLIENT || expandedRows.contains(node.getItemId()); if (!expanded) { return; } if (node.getChildren().isEmpty()) { // Add children from the model loadCustomNodeChildren(node); } else { // Check the expanded child nodes for (TreeItemIdNode child : node.getChildren()) { processCheckExpandedCustomNodes(child, expandedRows); } } }
[ "private", "void", "processCheckExpandedCustomNodes", "(", "final", "TreeItemIdNode", "node", ",", "final", "Set", "<", "String", ">", "expandedRows", ")", "{", "// Node has no children", "if", "(", "!", "node", ".", "hasChildren", "(", ")", ")", "{", "return", ";", "}", "// Check node is expanded", "boolean", "expanded", "=", "getExpandMode", "(", ")", "==", "WTree", ".", "ExpandMode", ".", "CLIENT", "||", "expandedRows", ".", "contains", "(", "node", ".", "getItemId", "(", ")", ")", ";", "if", "(", "!", "expanded", ")", "{", "return", ";", "}", "if", "(", "node", ".", "getChildren", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "// Add children from the model", "loadCustomNodeChildren", "(", "node", ")", ";", "}", "else", "{", "// Check the expanded child nodes", "for", "(", "TreeItemIdNode", "child", ":", "node", ".", "getChildren", "(", ")", ")", "{", "processCheckExpandedCustomNodes", "(", "child", ",", "expandedRows", ")", ";", "}", "}", "}" ]
Iterate through nodes to check expanded nodes have their child nodes. <p> If a node is flagged as having children and has none, then load them from the tree model. </p> @param node the node to check @param expandedRows the expanded rows
[ "Iterate", "through", "nodes", "to", "check", "expanded", "nodes", "have", "their", "child", "nodes", ".", "<p", ">", "If", "a", "node", "is", "flagged", "as", "having", "children", "and", "has", "none", "then", "load", "them", "from", "the", "tree", "model", ".", "<", "/", "p", ">" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java#L1254-L1275
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java
AddressDivision.matchesWithMask
public boolean matchesWithMask(long lowerValue, long upperValue, long mask) { """ returns whether masking with the given mask results in a valid contiguous range for this segment, and if it does, if it matches the range obtained when masking the given values with the same mask. @param lowerValue @param upperValue @param mask @return """ if(lowerValue == upperValue) { return matchesWithMask(lowerValue, mask); } if(!isMultiple()) { //we know lowerValue and upperValue are not the same, so impossible to match those two values with a single value return false; } long thisValue = getDivisionValue(); long thisUpperValue = getUpperDivisionValue(); if(!isMaskCompatibleWithRange(thisValue, thisUpperValue, mask, getMaxValue())) { return false; } return lowerValue == (thisValue & mask) && upperValue == (thisUpperValue & mask); }
java
public boolean matchesWithMask(long lowerValue, long upperValue, long mask) { if(lowerValue == upperValue) { return matchesWithMask(lowerValue, mask); } if(!isMultiple()) { //we know lowerValue and upperValue are not the same, so impossible to match those two values with a single value return false; } long thisValue = getDivisionValue(); long thisUpperValue = getUpperDivisionValue(); if(!isMaskCompatibleWithRange(thisValue, thisUpperValue, mask, getMaxValue())) { return false; } return lowerValue == (thisValue & mask) && upperValue == (thisUpperValue & mask); }
[ "public", "boolean", "matchesWithMask", "(", "long", "lowerValue", ",", "long", "upperValue", ",", "long", "mask", ")", "{", "if", "(", "lowerValue", "==", "upperValue", ")", "{", "return", "matchesWithMask", "(", "lowerValue", ",", "mask", ")", ";", "}", "if", "(", "!", "isMultiple", "(", ")", ")", "{", "//we know lowerValue and upperValue are not the same, so impossible to match those two values with a single value", "return", "false", ";", "}", "long", "thisValue", "=", "getDivisionValue", "(", ")", ";", "long", "thisUpperValue", "=", "getUpperDivisionValue", "(", ")", ";", "if", "(", "!", "isMaskCompatibleWithRange", "(", "thisValue", ",", "thisUpperValue", ",", "mask", ",", "getMaxValue", "(", ")", ")", ")", "{", "return", "false", ";", "}", "return", "lowerValue", "==", "(", "thisValue", "&", "mask", ")", "&&", "upperValue", "==", "(", "thisUpperValue", "&", "mask", ")", ";", "}" ]
returns whether masking with the given mask results in a valid contiguous range for this segment, and if it does, if it matches the range obtained when masking the given values with the same mask. @param lowerValue @param upperValue @param mask @return
[ "returns", "whether", "masking", "with", "the", "given", "mask", "results", "in", "a", "valid", "contiguous", "range", "for", "this", "segment", "and", "if", "it", "does", "if", "it", "matches", "the", "range", "obtained", "when", "masking", "the", "given", "values", "with", "the", "same", "mask", "." ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivision.java#L266-L280
alkacon/opencms-core
src/org/opencms/jsp/search/controller/CmsSearchControllerFacetField.java
CmsSearchControllerFacetField.addFacetOptions
protected void addFacetOptions(StringBuffer query, final boolean useLimit) { """ Adds the query parts for the facet options, except the filter parts. @param query The query part that is extended with the facet options. @param useLimit Flag, if the limit option should be set. """ // mincount if (m_config.getMinCount() != null) { appendFacetOption(query, "mincount", m_config.getMinCount().toString()); } // limit if (useLimit && (m_config.getLimit() != null)) { appendFacetOption(query, "limit", m_config.getLimit().toString()); } // sort if (m_config.getSortOrder() != null) { appendFacetOption(query, "sort", m_config.getSortOrder().toString()); } // prefix if (!m_config.getPrefix().isEmpty()) { appendFacetOption(query, "prefix", m_config.getPrefix()); } }
java
protected void addFacetOptions(StringBuffer query, final boolean useLimit) { // mincount if (m_config.getMinCount() != null) { appendFacetOption(query, "mincount", m_config.getMinCount().toString()); } // limit if (useLimit && (m_config.getLimit() != null)) { appendFacetOption(query, "limit", m_config.getLimit().toString()); } // sort if (m_config.getSortOrder() != null) { appendFacetOption(query, "sort", m_config.getSortOrder().toString()); } // prefix if (!m_config.getPrefix().isEmpty()) { appendFacetOption(query, "prefix", m_config.getPrefix()); } }
[ "protected", "void", "addFacetOptions", "(", "StringBuffer", "query", ",", "final", "boolean", "useLimit", ")", "{", "// mincount", "if", "(", "m_config", ".", "getMinCount", "(", ")", "!=", "null", ")", "{", "appendFacetOption", "(", "query", ",", "\"mincount\"", ",", "m_config", ".", "getMinCount", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "// limit", "if", "(", "useLimit", "&&", "(", "m_config", ".", "getLimit", "(", ")", "!=", "null", ")", ")", "{", "appendFacetOption", "(", "query", ",", "\"limit\"", ",", "m_config", ".", "getLimit", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "// sort", "if", "(", "m_config", ".", "getSortOrder", "(", ")", "!=", "null", ")", "{", "appendFacetOption", "(", "query", ",", "\"sort\"", ",", "m_config", ".", "getSortOrder", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "// prefix", "if", "(", "!", "m_config", ".", "getPrefix", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "appendFacetOption", "(", "query", ",", "\"prefix\"", ",", "m_config", ".", "getPrefix", "(", ")", ")", ";", "}", "}" ]
Adds the query parts for the facet options, except the filter parts. @param query The query part that is extended with the facet options. @param useLimit Flag, if the limit option should be set.
[ "Adds", "the", "query", "parts", "for", "the", "facet", "options", "except", "the", "filter", "parts", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/controller/CmsSearchControllerFacetField.java#L140-L158
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java
AbstractTagLibrary.addConverter
protected final void addConverter(String name, String converterId) { """ Add a ConvertHandler for the specified converterId @see javax.faces.view.facelets.ConverterHandler @see javax.faces.application.Application#createConverter(java.lang.String) @param name name to use, "foo" would be &lt;my:foo /> @param converterId id to pass to Application instance """ _factories.put(name, new ConverterHandlerFactory(converterId)); }
java
protected final void addConverter(String name, String converterId) { _factories.put(name, new ConverterHandlerFactory(converterId)); }
[ "protected", "final", "void", "addConverter", "(", "String", "name", ",", "String", "converterId", ")", "{", "_factories", ".", "put", "(", "name", ",", "new", "ConverterHandlerFactory", "(", "converterId", ")", ")", ";", "}" ]
Add a ConvertHandler for the specified converterId @see javax.faces.view.facelets.ConverterHandler @see javax.faces.application.Application#createConverter(java.lang.String) @param name name to use, "foo" would be &lt;my:foo /> @param converterId id to pass to Application instance
[ "Add", "a", "ConvertHandler", "for", "the", "specified", "converterId" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/AbstractTagLibrary.java#L197-L200
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/FieldsInner.java
FieldsInner.listByType
public List<TypeFieldInner> listByType(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { """ Retrieve a list of fields of a given type identified by module name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param moduleName The name of module. @param typeName The name of type. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;TypeFieldInner&gt; object if successful. """ return listByTypeWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, typeName).toBlocking().single().body(); }
java
public List<TypeFieldInner> listByType(String resourceGroupName, String automationAccountName, String moduleName, String typeName) { return listByTypeWithServiceResponseAsync(resourceGroupName, automationAccountName, moduleName, typeName).toBlocking().single().body(); }
[ "public", "List", "<", "TypeFieldInner", ">", "listByType", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "moduleName", ",", "String", "typeName", ")", "{", "return", "listByTypeWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "moduleName", ",", "typeName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve a list of fields of a given type identified by module name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param moduleName The name of module. @param typeName The name of type. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;TypeFieldInner&gt; object if successful.
[ "Retrieve", "a", "list", "of", "fields", "of", "a", "given", "type", "identified", "by", "module", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/FieldsInner.java#L73-L75
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagContainer.java
CmsJspTagContainer.getElementInfo
private String getElementInfo(CmsObject cms, CmsContainerElementBean elementBean, CmsContainerPageBean page) throws Exception { """ Returns the serialized element data.<p> @param cms the current cms context @param elementBean the element to serialize @param page the container page @return the serialized element data @throws Exception if something goes wrong """ return CmsContainerpageService.getSerializedElementInfo( cms, (HttpServletRequest)pageContext.getRequest(), (HttpServletResponse)pageContext.getResponse(), elementBean, page); }
java
private String getElementInfo(CmsObject cms, CmsContainerElementBean elementBean, CmsContainerPageBean page) throws Exception { return CmsContainerpageService.getSerializedElementInfo( cms, (HttpServletRequest)pageContext.getRequest(), (HttpServletResponse)pageContext.getResponse(), elementBean, page); }
[ "private", "String", "getElementInfo", "(", "CmsObject", "cms", ",", "CmsContainerElementBean", "elementBean", ",", "CmsContainerPageBean", "page", ")", "throws", "Exception", "{", "return", "CmsContainerpageService", ".", "getSerializedElementInfo", "(", "cms", ",", "(", "HttpServletRequest", ")", "pageContext", ".", "getRequest", "(", ")", ",", "(", "HttpServletResponse", ")", "pageContext", ".", "getResponse", "(", ")", ",", "elementBean", ",", "page", ")", ";", "}" ]
Returns the serialized element data.<p> @param cms the current cms context @param elementBean the element to serialize @param page the container page @return the serialized element data @throws Exception if something goes wrong
[ "Returns", "the", "serialized", "element", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagContainer.java#L1217-L1226