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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsServicesWithRateLimiter.java
AdWordsServicesWithRateLimiter.getUtility
@Override public <T> T getUtility(AdWordsSession session, Class<T> utilityClass) { """ Gets a rate-limit-aware instance of the utility represented by the utilityClass with a reference to the session. <p>The objects returned by this method are not thread-safe. @param <T> the service type @param session your current session @param utilityClass the AdWords utility class @return the rate-limit-aware client for the utility """ T originalUtilityObject = adWordsServices.getUtility(session, utilityClass); return getProxyObject(originalUtilityObject, session, utilityClass, true); }
java
@Override public <T> T getUtility(AdWordsSession session, Class<T> utilityClass) { T originalUtilityObject = adWordsServices.getUtility(session, utilityClass); return getProxyObject(originalUtilityObject, session, utilityClass, true); }
[ "@", "Override", "public", "<", "T", ">", "T", "getUtility", "(", "AdWordsSession", "session", ",", "Class", "<", "T", ">", "utilityClass", ")", "{", "T", "originalUtilityObject", "=", "adWordsServices", ".", "getUtility", "(", "session", ",", "utilityClass", ")", ";", "return", "getProxyObject", "(", "originalUtilityObject", ",", "session", ",", "utilityClass", ",", "true", ")", ";", "}" ]
Gets a rate-limit-aware instance of the utility represented by the utilityClass with a reference to the session. <p>The objects returned by this method are not thread-safe. @param <T> the service type @param session your current session @param utilityClass the AdWords utility class @return the rate-limit-aware client for the utility
[ "Gets", "a", "rate", "-", "limit", "-", "aware", "instance", "of", "the", "utility", "represented", "by", "the", "utilityClass", "with", "a", "reference", "to", "the", "session", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsServicesWithRateLimiter.java#L61-L65
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/MCMutualAuthConfig.java
MCMutualAuthConfig.setProperty
public MCMutualAuthConfig setProperty(String name, String value) { """ Sets a property. @param name the name of the property to set @param value the value of the property to set @return the updated MCMutualAuthConfig @throws NullPointerException if name or value is {@code null} """ properties.put(name, value); return this; }
java
public MCMutualAuthConfig setProperty(String name, String value) { properties.put(name, value); return this; }
[ "public", "MCMutualAuthConfig", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "properties", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets a property. @param name the name of the property to set @param value the value of the property to set @return the updated MCMutualAuthConfig @throws NullPointerException if name or value is {@code null}
[ "Sets", "a", "property", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/MCMutualAuthConfig.java#L106-L109
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/convert/DoubleConverter.java
DoubleConverter.fixLocale
private String fixLocale(FacesContext facesContext, String value) { """ Since Double.valueOf is not Locale aware, and NumberFormatter cannot parse E values correctly, we need to make a US Locale string from our input value. E.g. '34,383e3' will be translated to '34.383e3' if Locale.DE is set in the {@link javax.faces.component.UIViewRoot#getLocale()} @param facesContext @param value @return the 'fixed' value String """ Locale loc = facesContext.getViewRoot().getLocale(); if (loc == null || loc == Locale.US) { // nothing to fix if we are already using the US Locale return value; } // TODO: DecimalFormatSymbols.getInstance exists only on JDK 1.6 // change it on JSF 2.1 //DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc); DecimalFormatSymbols dfs = new DecimalFormatSymbols(loc); char decSep = dfs.getDecimalSeparator(); // replace decimal separators which are different to '.' if (decSep != '.' && value.lastIndexOf(decSep) >= 0) { StringBuffer sbVal = new StringBuffer(); // remove all groupSeperators and change the decimalSeperator for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == decSep) { sbVal.append('.'); // we append the Locale.US decimal separator continue; } // just append all other characters as usual sbVal.append(value.charAt(i)); } value = sbVal.toString(); } // we need the formatter with the correct Locale of the user return value; }
java
private String fixLocale(FacesContext facesContext, String value) { Locale loc = facesContext.getViewRoot().getLocale(); if (loc == null || loc == Locale.US) { // nothing to fix if we are already using the US Locale return value; } // TODO: DecimalFormatSymbols.getInstance exists only on JDK 1.6 // change it on JSF 2.1 //DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc); DecimalFormatSymbols dfs = new DecimalFormatSymbols(loc); char decSep = dfs.getDecimalSeparator(); // replace decimal separators which are different to '.' if (decSep != '.' && value.lastIndexOf(decSep) >= 0) { StringBuffer sbVal = new StringBuffer(); // remove all groupSeperators and change the decimalSeperator for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == decSep) { sbVal.append('.'); // we append the Locale.US decimal separator continue; } // just append all other characters as usual sbVal.append(value.charAt(i)); } value = sbVal.toString(); } // we need the formatter with the correct Locale of the user return value; }
[ "private", "String", "fixLocale", "(", "FacesContext", "facesContext", ",", "String", "value", ")", "{", "Locale", "loc", "=", "facesContext", ".", "getViewRoot", "(", ")", ".", "getLocale", "(", ")", ";", "if", "(", "loc", "==", "null", "||", "loc", "==", "Locale", ".", "US", ")", "{", "// nothing to fix if we are already using the US Locale", "return", "value", ";", "}", "// TODO: DecimalFormatSymbols.getInstance exists only on JDK 1.6", "// change it on JSF 2.1", "//DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc);", "DecimalFormatSymbols", "dfs", "=", "new", "DecimalFormatSymbols", "(", "loc", ")", ";", "char", "decSep", "=", "dfs", ".", "getDecimalSeparator", "(", ")", ";", "// replace decimal separators which are different to '.'", "if", "(", "decSep", "!=", "'", "'", "&&", "value", ".", "lastIndexOf", "(", "decSep", ")", ">=", "0", ")", "{", "StringBuffer", "sbVal", "=", "new", "StringBuffer", "(", ")", ";", "// remove all groupSeperators and change the decimalSeperator", "for", "(", "int", "i", "=", "0", ";", "i", "<", "value", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "value", ".", "charAt", "(", "i", ")", "==", "decSep", ")", "{", "sbVal", ".", "append", "(", "'", "'", ")", ";", "// we append the Locale.US decimal separator", "continue", ";", "}", "// just append all other characters as usual", "sbVal", ".", "append", "(", "value", ".", "charAt", "(", "i", ")", ")", ";", "}", "value", "=", "sbVal", ".", "toString", "(", ")", ";", "}", "// we need the formatter with the correct Locale of the user", "return", "value", ";", "}" ]
Since Double.valueOf is not Locale aware, and NumberFormatter cannot parse E values correctly, we need to make a US Locale string from our input value. E.g. '34,383e3' will be translated to '34.383e3' if Locale.DE is set in the {@link javax.faces.component.UIViewRoot#getLocale()} @param facesContext @param value @return the 'fixed' value String
[ "Since", "Double", ".", "valueOf", "is", "not", "Locale", "aware", "and", "NumberFormatter", "cannot", "parse", "E", "values", "correctly", "we", "need", "to", "make", "a", "US", "Locale", "string", "from", "our", "input", "value", ".", "E", ".", "g", ".", "34", "383e3", "will", "be", "translated", "to", "34", ".", "383e3", "if", "Locale", ".", "DE", "is", "set", "in", "the", "{", "@link", "javax", ".", "faces", ".", "component", ".", "UIViewRoot#getLocale", "()", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/convert/DoubleConverter.java#L91-L131
jhalterman/typetools
src/main/java/net/jodah/typetools/TypeResolver.java
TypeResolver.resolveRawClass
public static Class<?> resolveRawClass(Type genericType, Class<?> subType) { """ Resolves the raw class for the {@code genericType}, using the type variable information from the {@code subType} else {@link Unknown} if the raw class cannot be resolved. @param genericType to resolve raw class for @param subType to extract type variable information from @return raw class for the {@code genericType} else {@link Unknown} if it cannot be resolved """ return resolveRawClass(genericType, subType, null); }
java
public static Class<?> resolveRawClass(Type genericType, Class<?> subType) { return resolveRawClass(genericType, subType, null); }
[ "public", "static", "Class", "<", "?", ">", "resolveRawClass", "(", "Type", "genericType", ",", "Class", "<", "?", ">", "subType", ")", "{", "return", "resolveRawClass", "(", "genericType", ",", "subType", ",", "null", ")", ";", "}" ]
Resolves the raw class for the {@code genericType}, using the type variable information from the {@code subType} else {@link Unknown} if the raw class cannot be resolved. @param genericType to resolve raw class for @param subType to extract type variable information from @return raw class for the {@code genericType} else {@link Unknown} if it cannot be resolved
[ "Resolves", "the", "raw", "class", "for", "the", "{", "@code", "genericType", "}", "using", "the", "type", "variable", "information", "from", "the", "{", "@code", "subType", "}", "else", "{", "@link", "Unknown", "}", "if", "the", "raw", "class", "cannot", "be", "resolved", "." ]
train
https://github.com/jhalterman/typetools/blob/0bd6f1f6d146a69e1e497b688a8522fa09adae87/src/main/java/net/jodah/typetools/TypeResolver.java#L372-L374
mangstadt/biweekly
src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java
ICalPropertyScribe._parseXml
protected T _parseXml(XCalElement element, ICalParameters parameters, ParseContext context) { """ <p> Unmarshals a property from an XML document (xCal). </p> <p> This method should be overridden by child classes that wish to support xCal. The default implementation of this method will find the first child element with the xCal namespace. The element's name will be used as the property's data type and its text content will be passed into the {@link #_parseText} method. If no such child element is found, then the parent element's text content will be passed into {@link #_parseText} and the data type will be null. </p> @param element the property's XML element @param parameters the parsed parameters. These parameters will be assigned to the property object once this method returns. Therefore, do not assign any parameters to the property object itself whilst inside of this method, or else they will be overwritten. @param context the context @return the unmarshalled property object @throws CannotParseException if the scribe could not parse the property's value @throws SkipMeException if the property should not be added to the final {@link ICalendar} object """ XCalValue firstValue = element.firstValue(); ICalDataType dataType = firstValue.getDataType(); String value = VObjectPropertyValues.escape(firstValue.getValue()); return _parseText(value, dataType, parameters, context); }
java
protected T _parseXml(XCalElement element, ICalParameters parameters, ParseContext context) { XCalValue firstValue = element.firstValue(); ICalDataType dataType = firstValue.getDataType(); String value = VObjectPropertyValues.escape(firstValue.getValue()); return _parseText(value, dataType, parameters, context); }
[ "protected", "T", "_parseXml", "(", "XCalElement", "element", ",", "ICalParameters", "parameters", ",", "ParseContext", "context", ")", "{", "XCalValue", "firstValue", "=", "element", ".", "firstValue", "(", ")", ";", "ICalDataType", "dataType", "=", "firstValue", ".", "getDataType", "(", ")", ";", "String", "value", "=", "VObjectPropertyValues", ".", "escape", "(", "firstValue", ".", "getValue", "(", ")", ")", ";", "return", "_parseText", "(", "value", ",", "dataType", ",", "parameters", ",", "context", ")", ";", "}" ]
<p> Unmarshals a property from an XML document (xCal). </p> <p> This method should be overridden by child classes that wish to support xCal. The default implementation of this method will find the first child element with the xCal namespace. The element's name will be used as the property's data type and its text content will be passed into the {@link #_parseText} method. If no such child element is found, then the parent element's text content will be passed into {@link #_parseText} and the data type will be null. </p> @param element the property's XML element @param parameters the parsed parameters. These parameters will be assigned to the property object once this method returns. Therefore, do not assign any parameters to the property object itself whilst inside of this method, or else they will be overwritten. @param context the context @return the unmarshalled property object @throws CannotParseException if the scribe could not parse the property's value @throws SkipMeException if the property should not be added to the final {@link ICalendar} object
[ "<p", ">", "Unmarshals", "a", "property", "from", "an", "XML", "document", "(", "xCal", ")", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "should", "be", "overridden", "by", "child", "classes", "that", "wish", "to", "support", "xCal", ".", "The", "default", "implementation", "of", "this", "method", "will", "find", "the", "first", "child", "element", "with", "the", "xCal", "namespace", ".", "The", "element", "s", "name", "will", "be", "used", "as", "the", "property", "s", "data", "type", "and", "its", "text", "content", "will", "be", "passed", "into", "the", "{" ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java#L448-L453
samskivert/pythagoras
src/main/java/pythagoras/f/Crossing.java
Crossing.crossCubic
public static int crossCubic (float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, float x, float y) { """ Returns how many times ray from point (x,y) cross cubic curve """ // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx1 && x < cx2 && x < x2) || (x > x1 && x > cx1 && x > cx2 && x > x2) || (y > y1 && y > cy1 && y > cy2 && y > y2) || (x1 == cx1 && cx1 == cx2 && cx2 == x2)) { return 0; } // DOWN if (y < y1 && y < cy1 && y < cy2 && y < y2 && x != x1 && x != x2) { if (x1 < x2) { return x1 < x && x < x2 ? 1 : 0; } return x2 < x && x < x1 ? -1 : 0; } // INSIDE CubicCurveH c = new CubicCurveH(x1, y1, cx1, cy1, cx2, cy2, x2, y2); float px = x - x1, py = y - y1; float[] res = new float[3]; int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); }
java
public static int crossCubic (float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, float x, float y) { // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx1 && x < cx2 && x < x2) || (x > x1 && x > cx1 && x > cx2 && x > x2) || (y > y1 && y > cy1 && y > cy2 && y > y2) || (x1 == cx1 && cx1 == cx2 && cx2 == x2)) { return 0; } // DOWN if (y < y1 && y < cy1 && y < cy2 && y < y2 && x != x1 && x != x2) { if (x1 < x2) { return x1 < x && x < x2 ? 1 : 0; } return x2 < x && x < x1 ? -1 : 0; } // INSIDE CubicCurveH c = new CubicCurveH(x1, y1, cx1, cy1, cx2, cy2, x2, y2); float px = x - x1, py = y - y1; float[] res = new float[3]; int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); }
[ "public", "static", "int", "crossCubic", "(", "float", "x1", ",", "float", "y1", ",", "float", "cx1", ",", "float", "cy1", ",", "float", "cx2", ",", "float", "cy2", ",", "float", "x2", ",", "float", "y2", ",", "float", "x", ",", "float", "y", ")", "{", "// LEFT/RIGHT/UP/EMPTY", "if", "(", "(", "x", "<", "x1", "&&", "x", "<", "cx1", "&&", "x", "<", "cx2", "&&", "x", "<", "x2", ")", "||", "(", "x", ">", "x1", "&&", "x", ">", "cx1", "&&", "x", ">", "cx2", "&&", "x", ">", "x2", ")", "||", "(", "y", ">", "y1", "&&", "y", ">", "cy1", "&&", "y", ">", "cy2", "&&", "y", ">", "y2", ")", "||", "(", "x1", "==", "cx1", "&&", "cx1", "==", "cx2", "&&", "cx2", "==", "x2", ")", ")", "{", "return", "0", ";", "}", "// DOWN", "if", "(", "y", "<", "y1", "&&", "y", "<", "cy1", "&&", "y", "<", "cy2", "&&", "y", "<", "y2", "&&", "x", "!=", "x1", "&&", "x", "!=", "x2", ")", "{", "if", "(", "x1", "<", "x2", ")", "{", "return", "x1", "<", "x", "&&", "x", "<", "x2", "?", "1", ":", "0", ";", "}", "return", "x2", "<", "x", "&&", "x", "<", "x1", "?", "-", "1", ":", "0", ";", "}", "// INSIDE", "CubicCurveH", "c", "=", "new", "CubicCurveH", "(", "x1", ",", "y1", ",", "cx1", ",", "cy1", ",", "cx2", ",", "cy2", ",", "x2", ",", "y2", ")", ";", "float", "px", "=", "x", "-", "x1", ",", "py", "=", "y", "-", "y1", ";", "float", "[", "]", "res", "=", "new", "float", "[", "3", "]", ";", "int", "rc", "=", "c", ".", "solvePoint", "(", "res", ",", "px", ")", ";", "return", "c", ".", "cross", "(", "res", ",", "rc", ",", "py", ",", "py", ")", ";", "}" ]
Returns how many times ray from point (x,y) cross cubic curve
[ "Returns", "how", "many", "times", "ray", "from", "point", "(", "x", "y", ")", "cross", "cubic", "curve" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L396-L419
aws/aws-sdk-java
aws-java-sdk-appstream/src/main/java/com/amazonaws/services/appstream/model/Application.java
Application.withMetadata
public Application withMetadata(java.util.Map<String, String> metadata) { """ <p> Additional attributes that describe the application. </p> @param metadata Additional attributes that describe the application. @return Returns a reference to this object so that method calls can be chained together. """ setMetadata(metadata); return this; }
java
public Application withMetadata(java.util.Map<String, String> metadata) { setMetadata(metadata); return this; }
[ "public", "Application", "withMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "metadata", ")", "{", "setMetadata", "(", "metadata", ")", ";", "return", "this", ";", "}" ]
<p> Additional attributes that describe the application. </p> @param metadata Additional attributes that describe the application. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Additional", "attributes", "that", "describe", "the", "application", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-appstream/src/main/java/com/amazonaws/services/appstream/model/Application.java#L361-L364
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java
FactoryFiducialCalibration.chessboard2
public static CalibrationDetectorChessboard2 chessboard2(@Nullable ConfigChessboard2 config , ConfigGridDimen dimen ) { """ Detector for chessboard targets. Squares can be partially outside, but inside corners must be entirely inside the image. @see DetectChessboardFiducial @param config Configuration for chessboard detector @return Square grid target detector. """ if( config == null ) config = new ConfigChessboard2(); config.checkValidity(); return new CalibrationDetectorChessboard2(config,dimen); }
java
public static CalibrationDetectorChessboard2 chessboard2(@Nullable ConfigChessboard2 config , ConfigGridDimen dimen ) { if( config == null ) config = new ConfigChessboard2(); config.checkValidity(); return new CalibrationDetectorChessboard2(config,dimen); }
[ "public", "static", "CalibrationDetectorChessboard2", "chessboard2", "(", "@", "Nullable", "ConfigChessboard2", "config", ",", "ConfigGridDimen", "dimen", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigChessboard2", "(", ")", ";", "config", ".", "checkValidity", "(", ")", ";", "return", "new", "CalibrationDetectorChessboard2", "(", "config", ",", "dimen", ")", ";", "}" ]
Detector for chessboard targets. Squares can be partially outside, but inside corners must be entirely inside the image. @see DetectChessboardFiducial @param config Configuration for chessboard detector @return Square grid target detector.
[ "Detector", "for", "chessboard", "targets", ".", "Squares", "can", "be", "partially", "outside", "but", "inside", "corners", "must", "be", "entirely", "inside", "the", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java#L78-L84
alkacon/opencms-core
src/org/opencms/db/CmsUserSettings.java
CmsUserSettings.setStartGallery
public void setStartGallery(String galleryType, String galleryUri) { """ Sets the path to the start gallery of the user or removes the entry from user settings if no path is null.<p> @param galleryType the type of the gallery @param galleryUri the gallery URI """ if (galleryUri == null) { m_startGalleriesSettings.remove(galleryType); } else { m_startGalleriesSettings.put(galleryType, galleryUri); } }
java
public void setStartGallery(String galleryType, String galleryUri) { if (galleryUri == null) { m_startGalleriesSettings.remove(galleryType); } else { m_startGalleriesSettings.put(galleryType, galleryUri); } }
[ "public", "void", "setStartGallery", "(", "String", "galleryType", ",", "String", "galleryUri", ")", "{", "if", "(", "galleryUri", "==", "null", ")", "{", "m_startGalleriesSettings", ".", "remove", "(", "galleryType", ")", ";", "}", "else", "{", "m_startGalleriesSettings", ".", "put", "(", "galleryType", ",", "galleryUri", ")", ";", "}", "}" ]
Sets the path to the start gallery of the user or removes the entry from user settings if no path is null.<p> @param galleryType the type of the gallery @param galleryUri the gallery URI
[ "Sets", "the", "path", "to", "the", "start", "gallery", "of", "the", "user", "or", "removes", "the", "entry", "from", "user", "settings", "if", "no", "path", "is", "null", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L2205-L2212
Jasig/uPortal
uPortal-persondir/src/main/java/org/apereo/portal/persondir/PortalRootPersonAttributeDao.java
PortalRootPersonAttributeDao.postProcessPerson
private IPersonAttributes postProcessPerson(IPersonAttributes person, String uidInQuery) { """ Implements support for overriding attributes by administrator choice and for intelligently selecting (if possible) values for 'username' and 'displayName' if none have been provided by other data sources. @param person The user @param uidInQuery The username specified in the PersonDirectory query, if certain @return The user, possibly with modifications """ // Verify the person has a name final String name = person.getName(); if (name == null) { logger.warn("IPerson '{}' has no name and therefore cannot be post-processed", person); return person; } // First apply specified overrides IPersonAttributes rslt = applyOverridesIfPresent(person); // default -- won't normally need to do anything /* * And secondly there are two attributes in uPortal that cause havoc if they're missing: * * - username * - displayName * * We need to do our best to provide these if the external data sources don't cover it. */ rslt = selectUsernameIfAbsent(rslt); rslt = selectDisplayNameIfAbsent(rslt); logger.debug( "Post-processing of person with name='{}' produced the following person: {}", person.getName(), rslt); return rslt; }
java
private IPersonAttributes postProcessPerson(IPersonAttributes person, String uidInQuery) { // Verify the person has a name final String name = person.getName(); if (name == null) { logger.warn("IPerson '{}' has no name and therefore cannot be post-processed", person); return person; } // First apply specified overrides IPersonAttributes rslt = applyOverridesIfPresent(person); // default -- won't normally need to do anything /* * And secondly there are two attributes in uPortal that cause havoc if they're missing: * * - username * - displayName * * We need to do our best to provide these if the external data sources don't cover it. */ rslt = selectUsernameIfAbsent(rslt); rslt = selectDisplayNameIfAbsent(rslt); logger.debug( "Post-processing of person with name='{}' produced the following person: {}", person.getName(), rslt); return rslt; }
[ "private", "IPersonAttributes", "postProcessPerson", "(", "IPersonAttributes", "person", ",", "String", "uidInQuery", ")", "{", "// Verify the person has a name", "final", "String", "name", "=", "person", ".", "getName", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "logger", ".", "warn", "(", "\"IPerson '{}' has no name and therefore cannot be post-processed\"", ",", "person", ")", ";", "return", "person", ";", "}", "// First apply specified overrides", "IPersonAttributes", "rslt", "=", "applyOverridesIfPresent", "(", "person", ")", ";", "// default -- won't normally need to do anything", "/*\n * And secondly there are two attributes in uPortal that cause havoc if they're missing:\n *\n * - username\n * - displayName\n *\n * We need to do our best to provide these if the external data sources don't cover it.\n */", "rslt", "=", "selectUsernameIfAbsent", "(", "rslt", ")", ";", "rslt", "=", "selectDisplayNameIfAbsent", "(", "rslt", ")", ";", "logger", ".", "debug", "(", "\"Post-processing of person with name='{}' produced the following person: {}\"", ",", "person", ".", "getName", "(", ")", ",", "rslt", ")", ";", "return", "rslt", ";", "}" ]
Implements support for overriding attributes by administrator choice and for intelligently selecting (if possible) values for 'username' and 'displayName' if none have been provided by other data sources. @param person The user @param uidInQuery The username specified in the PersonDirectory query, if certain @return The user, possibly with modifications
[ "Implements", "support", "for", "overriding", "attributes", "by", "administrator", "choice", "and", "for", "intelligently", "selecting", "(", "if", "possible", ")", "values", "for", "username", "and", "displayName", "if", "none", "have", "been", "provided", "by", "other", "data", "sources", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-persondir/src/main/java/org/apereo/portal/persondir/PortalRootPersonAttributeDao.java#L168-L198
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createFillableFocusRectangle
public Shape createFillableFocusRectangle(int x, int y, int w, int h) { """ Return a path for a focus rectangle. <p>This path is suitable for filling.</p> @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @return a path representing the shape. """ final int left = x; final int top = y; final int right = x + w; final int bottom = y + h; path.reset(); path.moveTo(left, top); path.lineTo(left, bottom); path.lineTo(right, bottom); path.lineTo(right, top); final float offset = 1.4f; final float left2 = left + offset; final float top2 = top + offset; final float right2 = right - offset; final float bottom2 = bottom - offset; // TODO These two lines were curveTo in Nimbus. Perhaps we should // revisit this? path.lineTo(right2, top); path.lineTo(right2, bottom2); path.lineTo(left2, bottom2); path.lineTo(left2, top2); path.lineTo(right2, top2); path.lineTo(right2, top); path.closePath(); return path; }
java
public Shape createFillableFocusRectangle(int x, int y, int w, int h) { final int left = x; final int top = y; final int right = x + w; final int bottom = y + h; path.reset(); path.moveTo(left, top); path.lineTo(left, bottom); path.lineTo(right, bottom); path.lineTo(right, top); final float offset = 1.4f; final float left2 = left + offset; final float top2 = top + offset; final float right2 = right - offset; final float bottom2 = bottom - offset; // TODO These two lines were curveTo in Nimbus. Perhaps we should // revisit this? path.lineTo(right2, top); path.lineTo(right2, bottom2); path.lineTo(left2, bottom2); path.lineTo(left2, top2); path.lineTo(right2, top2); path.lineTo(right2, top); path.closePath(); return path; }
[ "public", "Shape", "createFillableFocusRectangle", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ")", "{", "final", "int", "left", "=", "x", ";", "final", "int", "top", "=", "y", ";", "final", "int", "right", "=", "x", "+", "w", ";", "final", "int", "bottom", "=", "y", "+", "h", ";", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "left", ",", "top", ")", ";", "path", ".", "lineTo", "(", "left", ",", "bottom", ")", ";", "path", ".", "lineTo", "(", "right", ",", "bottom", ")", ";", "path", ".", "lineTo", "(", "right", ",", "top", ")", ";", "final", "float", "offset", "=", "1.4f", ";", "final", "float", "left2", "=", "left", "+", "offset", ";", "final", "float", "top2", "=", "top", "+", "offset", ";", "final", "float", "right2", "=", "right", "-", "offset", ";", "final", "float", "bottom2", "=", "bottom", "-", "offset", ";", "// TODO These two lines were curveTo in Nimbus. Perhaps we should", "// revisit this?", "path", ".", "lineTo", "(", "right2", ",", "top", ")", ";", "path", ".", "lineTo", "(", "right2", ",", "bottom2", ")", ";", "path", ".", "lineTo", "(", "left2", ",", "bottom2", ")", ";", "path", ".", "lineTo", "(", "left2", ",", "top2", ")", ";", "path", ".", "lineTo", "(", "right2", ",", "top2", ")", ";", "path", ".", "lineTo", "(", "right2", ",", "top", ")", ";", "path", ".", "closePath", "(", ")", ";", "return", "path", ";", "}" ]
Return a path for a focus rectangle. <p>This path is suitable for filling.</p> @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "focus", "rectangle", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L445-L475
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java
PathUtils.removeExtension
public static Path removeExtension(Path path, String... extensions) { """ Removes all <code>extensions</code> from <code>path</code> if they exist. <pre> PathUtils.removeExtention("file.txt", ".txt") = file PathUtils.removeExtention("file.txt.gpg", ".txt", ".gpg") = file PathUtils.removeExtention("file", ".txt") = file PathUtils.removeExtention("file.txt", ".tar.gz") = file.txt PathUtils.removeExtention("file.txt.gpg", ".txt") = file.gpg PathUtils.removeExtention("file.txt.gpg", ".gpg") = file.txt </pre> @param path in which the <code>extensions</code> need to be removed @param extensions to be removed @return a new {@link Path} without <code>extensions</code> """ String pathString = path.toString(); for (String extension : extensions) { pathString = StringUtils.remove(pathString, extension); } return new Path(pathString); }
java
public static Path removeExtension(Path path, String... extensions) { String pathString = path.toString(); for (String extension : extensions) { pathString = StringUtils.remove(pathString, extension); } return new Path(pathString); }
[ "public", "static", "Path", "removeExtension", "(", "Path", "path", ",", "String", "...", "extensions", ")", "{", "String", "pathString", "=", "path", ".", "toString", "(", ")", ";", "for", "(", "String", "extension", ":", "extensions", ")", "{", "pathString", "=", "StringUtils", ".", "remove", "(", "pathString", ",", "extension", ")", ";", "}", "return", "new", "Path", "(", "pathString", ")", ";", "}" ]
Removes all <code>extensions</code> from <code>path</code> if they exist. <pre> PathUtils.removeExtention("file.txt", ".txt") = file PathUtils.removeExtention("file.txt.gpg", ".txt", ".gpg") = file PathUtils.removeExtention("file", ".txt") = file PathUtils.removeExtention("file.txt", ".tar.gz") = file.txt PathUtils.removeExtention("file.txt.gpg", ".txt") = file.gpg PathUtils.removeExtention("file.txt.gpg", ".gpg") = file.txt </pre> @param path in which the <code>extensions</code> need to be removed @param extensions to be removed @return a new {@link Path} without <code>extensions</code>
[ "Removes", "all", "<code", ">", "extensions<", "/", "code", ">", "from", "<code", ">", "path<", "/", "code", ">", "if", "they", "exist", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java#L127-L134
Sciss/abc4j
abc/src/main/java/abc/notation/Voice.java
Voice.getKey
public KeySignature getKey() { """ Returns the key signature of this tune. @return The key signature of this tune. """ for (int i = 0, j = size(); i < j; i++) { if (elementAt(i) instanceof KeySignature) return (KeySignature) elementAt(i); } return new KeySignature(Note.C, KeySignature.MAJOR); }
java
public KeySignature getKey() { for (int i = 0, j = size(); i < j; i++) { if (elementAt(i) instanceof KeySignature) return (KeySignature) elementAt(i); } return new KeySignature(Note.C, KeySignature.MAJOR); }
[ "public", "KeySignature", "getKey", "(", ")", "{", "for", "(", "int", "i", "=", "0", ",", "j", "=", "size", "(", ")", ";", "i", "<", "j", ";", "i", "++", ")", "{", "if", "(", "elementAt", "(", "i", ")", "instanceof", "KeySignature", ")", "return", "(", "KeySignature", ")", "elementAt", "(", "i", ")", ";", "}", "return", "new", "KeySignature", "(", "Note", ".", "C", ",", "KeySignature", ".", "MAJOR", ")", ";", "}" ]
Returns the key signature of this tune. @return The key signature of this tune.
[ "Returns", "the", "key", "signature", "of", "this", "tune", "." ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/notation/Voice.java#L206-L212
alkacon/opencms-core
src/org/opencms/file/collectors/CmsSubscriptionCollector.java
CmsSubscriptionCollector.getVisitedByFilter
protected CmsVisitedByFilter getVisitedByFilter(CmsObject cms, String param) throws CmsException { """ Returns the configured visited by filter to use.<p> @param cms the current users context @param param an optional collector parameter @return the configured visited by filter to use @throws CmsException if something goes wrong """ CmsVisitedByFilter filter = new CmsVisitedByFilter(); Map<String, String> params = getParameters(param); // initialize the filter initVisitedByFilter(filter, cms, params, true); return filter; }
java
protected CmsVisitedByFilter getVisitedByFilter(CmsObject cms, String param) throws CmsException { CmsVisitedByFilter filter = new CmsVisitedByFilter(); Map<String, String> params = getParameters(param); // initialize the filter initVisitedByFilter(filter, cms, params, true); return filter; }
[ "protected", "CmsVisitedByFilter", "getVisitedByFilter", "(", "CmsObject", "cms", ",", "String", "param", ")", "throws", "CmsException", "{", "CmsVisitedByFilter", "filter", "=", "new", "CmsVisitedByFilter", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "getParameters", "(", "param", ")", ";", "// initialize the filter", "initVisitedByFilter", "(", "filter", ",", "cms", ",", "params", ",", "true", ")", ";", "return", "filter", ";", "}" ]
Returns the configured visited by filter to use.<p> @param cms the current users context @param param an optional collector parameter @return the configured visited by filter to use @throws CmsException if something goes wrong
[ "Returns", "the", "configured", "visited", "by", "filter", "to", "use", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/CmsSubscriptionCollector.java#L337-L346
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileUtil.java
FileUtil.makeShellPath
public static String makeShellPath(File file, boolean makeCanonicalPath) throws IOException { """ Convert a os-native filename to a path that works for the shell. @param file The filename to convert @param makeCanonicalPath Whether to make canonical path for the file passed @return The unix pathname @throws IOException on windows, there can be problems with the subprocess """ if (makeCanonicalPath) { return makeShellPath(file.getCanonicalPath()); } else { return makeShellPath(file.toString()); } }
java
public static String makeShellPath(File file, boolean makeCanonicalPath) throws IOException { if (makeCanonicalPath) { return makeShellPath(file.getCanonicalPath()); } else { return makeShellPath(file.toString()); } }
[ "public", "static", "String", "makeShellPath", "(", "File", "file", ",", "boolean", "makeCanonicalPath", ")", "throws", "IOException", "{", "if", "(", "makeCanonicalPath", ")", "{", "return", "makeShellPath", "(", "file", ".", "getCanonicalPath", "(", ")", ")", ";", "}", "else", "{", "return", "makeShellPath", "(", "file", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Convert a os-native filename to a path that works for the shell. @param file The filename to convert @param makeCanonicalPath Whether to make canonical path for the file passed @return The unix pathname @throws IOException on windows, there can be problems with the subprocess
[ "Convert", "a", "os", "-", "native", "filename", "to", "a", "path", "that", "works", "for", "the", "shell", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L592-L599
googleapis/google-cloud-java
google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java
WebRiskServiceV1Beta1Client.searchUris
public final SearchUrisResponse searchUris(String uri, List<ThreatType> threatTypes) { """ This method is used to check whether a URI is on a given threatList. <p>Sample code: <pre><code> try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) { String uri = ""; List&lt;ThreatType&gt; threatTypes = new ArrayList&lt;&gt;(); SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(uri, threatTypes); } </code></pre> @param uri The URI to be checked for matches. @param threatTypes Required. The ThreatLists to search in. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ SearchUrisRequest request = SearchUrisRequest.newBuilder().setUri(uri).addAllThreatTypes(threatTypes).build(); return searchUris(request); }
java
public final SearchUrisResponse searchUris(String uri, List<ThreatType> threatTypes) { SearchUrisRequest request = SearchUrisRequest.newBuilder().setUri(uri).addAllThreatTypes(threatTypes).build(); return searchUris(request); }
[ "public", "final", "SearchUrisResponse", "searchUris", "(", "String", "uri", ",", "List", "<", "ThreatType", ">", "threatTypes", ")", "{", "SearchUrisRequest", "request", "=", "SearchUrisRequest", ".", "newBuilder", "(", ")", ".", "setUri", "(", "uri", ")", ".", "addAllThreatTypes", "(", "threatTypes", ")", ".", "build", "(", ")", ";", "return", "searchUris", "(", "request", ")", ";", "}" ]
This method is used to check whether a URI is on a given threatList. <p>Sample code: <pre><code> try (WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.create()) { String uri = ""; List&lt;ThreatType&gt; threatTypes = new ArrayList&lt;&gt;(); SearchUrisResponse response = webRiskServiceV1Beta1Client.searchUris(uri, threatTypes); } </code></pre> @param uri The URI to be checked for matches. @param threatTypes Required. The ThreatLists to search in. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "This", "method", "is", "used", "to", "check", "whether", "a", "URI", "is", "on", "a", "given", "threatList", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-webrisk/src/main/java/com/google/cloud/webrisk/v1beta1/WebRiskServiceV1Beta1Client.java#L264-L269
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/sentdetect/SDContextGenerator.java
SDContextGenerator.nextSpaceIndex
private static final int nextSpaceIndex(StringBuffer sb, int seek, int lastIndex) { """ Finds the index of the nearest space after a specified index. @param sb The string buffer which contains the text being examined. @param seek The index to begin searching from. @param lastIndex The highest index of the StringBuffer sb. @return The index which contains the nearest space. """ seek++; char c; while (seek < lastIndex) { c = sb.charAt(seek); if (c == ' ' || c == '\n') { while (sb.length() > seek + 1 && sb.charAt(seek + 1) == ' ') seek++; return seek; } seek++; } return lastIndex; }
java
private static final int nextSpaceIndex(StringBuffer sb, int seek, int lastIndex) { seek++; char c; while (seek < lastIndex) { c = sb.charAt(seek); if (c == ' ' || c == '\n') { while (sb.length() > seek + 1 && sb.charAt(seek + 1) == ' ') seek++; return seek; } seek++; } return lastIndex; }
[ "private", "static", "final", "int", "nextSpaceIndex", "(", "StringBuffer", "sb", ",", "int", "seek", ",", "int", "lastIndex", ")", "{", "seek", "++", ";", "char", "c", ";", "while", "(", "seek", "<", "lastIndex", ")", "{", "c", "=", "sb", ".", "charAt", "(", "seek", ")", ";", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "while", "(", "sb", ".", "length", "(", ")", ">", "seek", "+", "1", "&&", "sb", ".", "charAt", "(", "seek", "+", "1", ")", "==", "'", "'", ")", "seek", "++", ";", "return", "seek", ";", "}", "seek", "++", ";", "}", "return", "lastIndex", ";", "}" ]
Finds the index of the nearest space after a specified index. @param sb The string buffer which contains the text being examined. @param seek The index to begin searching from. @param lastIndex The highest index of the StringBuffer sb. @return The index which contains the nearest space.
[ "Finds", "the", "index", "of", "the", "nearest", "space", "after", "a", "specified", "index", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/sentdetect/SDContextGenerator.java#L240-L253
ironjacamar/ironjacamar
web/src/main/java/org/ironjacamar/web/console/Server.java
Server.getMBeanData
public static MBeanData getMBeanData(String name) throws JMException { """ Get MBean data @param name The bean name @return The data @exception JMException Thrown if an error occurs """ MBeanServer server = getMBeanServer(); ObjectName objName = new ObjectName(name); MBeanInfo info = server.getMBeanInfo(objName); return new MBeanData(objName, info); }
java
public static MBeanData getMBeanData(String name) throws JMException { MBeanServer server = getMBeanServer(); ObjectName objName = new ObjectName(name); MBeanInfo info = server.getMBeanInfo(objName); return new MBeanData(objName, info); }
[ "public", "static", "MBeanData", "getMBeanData", "(", "String", "name", ")", "throws", "JMException", "{", "MBeanServer", "server", "=", "getMBeanServer", "(", ")", ";", "ObjectName", "objName", "=", "new", "ObjectName", "(", "name", ")", ";", "MBeanInfo", "info", "=", "server", ".", "getMBeanInfo", "(", "objName", ")", ";", "return", "new", "MBeanData", "(", "objName", ",", "info", ")", ";", "}" ]
Get MBean data @param name The bean name @return The data @exception JMException Thrown if an error occurs
[ "Get", "MBean", "data" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/console/Server.java#L152-L159
pmwmedia/tinylog
tinylog-api/src/main/java/org/tinylog/runtime/AndroidRuntime.java
AndroidRuntime.getStackTraceElementsFiller
private static StackTraceElementsFiller getStackTraceElementsFiller() { """ Gets {@link VMStack#fillStackTraceElements(Thread, StackTraceElement[])} as accessible method including the offset position of direct caller. @return Method and position if available, {@code null} if not """ try { Method method = VMStack.class.getDeclaredMethod("fillStackTraceElements", Thread.class, StackTraceElement[].class); method.setAccessible(true); StackTraceElement[] trace = new StackTraceElement[STACK_TRACE_SIZE]; method.invoke(null, Thread.currentThread(), trace); for (int i = 0; i < STACK_TRACE_SIZE; ++i) { StackTraceElement element = trace[i]; if (element != null && AndroidRuntime.class.getName().equals(element.getClassName()) && "getStackTraceElementsFiller".equals(element.getMethodName())) { return new StackTraceElementsFiller(method, i); } } return new StackTraceElementsFiller(null, -1); } catch (NoClassDefFoundError error) { return new StackTraceElementsFiller(null, -1); } catch (Exception ex) { return new StackTraceElementsFiller(null, -1); } }
java
private static StackTraceElementsFiller getStackTraceElementsFiller() { try { Method method = VMStack.class.getDeclaredMethod("fillStackTraceElements", Thread.class, StackTraceElement[].class); method.setAccessible(true); StackTraceElement[] trace = new StackTraceElement[STACK_TRACE_SIZE]; method.invoke(null, Thread.currentThread(), trace); for (int i = 0; i < STACK_TRACE_SIZE; ++i) { StackTraceElement element = trace[i]; if (element != null && AndroidRuntime.class.getName().equals(element.getClassName()) && "getStackTraceElementsFiller".equals(element.getMethodName())) { return new StackTraceElementsFiller(method, i); } } return new StackTraceElementsFiller(null, -1); } catch (NoClassDefFoundError error) { return new StackTraceElementsFiller(null, -1); } catch (Exception ex) { return new StackTraceElementsFiller(null, -1); } }
[ "private", "static", "StackTraceElementsFiller", "getStackTraceElementsFiller", "(", ")", "{", "try", "{", "Method", "method", "=", "VMStack", ".", "class", ".", "getDeclaredMethod", "(", "\"fillStackTraceElements\"", ",", "Thread", ".", "class", ",", "StackTraceElement", "[", "]", ".", "class", ")", ";", "method", ".", "setAccessible", "(", "true", ")", ";", "StackTraceElement", "[", "]", "trace", "=", "new", "StackTraceElement", "[", "STACK_TRACE_SIZE", "]", ";", "method", ".", "invoke", "(", "null", ",", "Thread", ".", "currentThread", "(", ")", ",", "trace", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "STACK_TRACE_SIZE", ";", "++", "i", ")", "{", "StackTraceElement", "element", "=", "trace", "[", "i", "]", ";", "if", "(", "element", "!=", "null", "&&", "AndroidRuntime", ".", "class", ".", "getName", "(", ")", ".", "equals", "(", "element", ".", "getClassName", "(", ")", ")", "&&", "\"getStackTraceElementsFiller\"", ".", "equals", "(", "element", ".", "getMethodName", "(", ")", ")", ")", "{", "return", "new", "StackTraceElementsFiller", "(", "method", ",", "i", ")", ";", "}", "}", "return", "new", "StackTraceElementsFiller", "(", "null", ",", "-", "1", ")", ";", "}", "catch", "(", "NoClassDefFoundError", "error", ")", "{", "return", "new", "StackTraceElementsFiller", "(", "null", ",", "-", "1", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "new", "StackTraceElementsFiller", "(", "null", ",", "-", "1", ")", ";", "}", "}" ]
Gets {@link VMStack#fillStackTraceElements(Thread, StackTraceElement[])} as accessible method including the offset position of direct caller. @return Method and position if available, {@code null} if not
[ "Gets", "{", "@link", "VMStack#fillStackTraceElements", "(", "Thread", "StackTraceElement", "[]", ")", "}", "as", "accessible", "method", "including", "the", "offset", "position", "of", "direct", "caller", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-api/src/main/java/org/tinylog/runtime/AndroidRuntime.java#L104-L123
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readResource
public CmsResource readResource(CmsRequestContext context, String resourcePath, CmsResourceFilter filter) throws CmsException { """ Reads a resource from the VFS, using the specified resource filter.<p> A resource may be of type <code>{@link CmsFile}</code> or <code>{@link CmsFolder}</code>. In case of a file, the resource will not contain the binary file content. Since reading the binary content is a cost-expensive database operation, it's recommended to work with resources if possible, and only read the file content when absolutely required. To "upgrade" a resource to a file, use <code>{@link CmsObject#readFile(CmsResource)}</code>.<p> The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code> will ignore the date release / date expired information of the resource.<p> @param context the current request context @param resourcePath the name of the resource to read (full path) @param filter the resource filter to use while reading @return the resource that was read @throws CmsException if the resource could not be read for any reason @see CmsObject#readResource(String, CmsResourceFilter) @see CmsObject#readResource(String) @see CmsObject#readFile(CmsResource) """ CmsResource result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { result = readResource(dbc, resourcePath, filter); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_RESOURCE_1, dbc.removeSiteRoot(resourcePath)), e); } finally { dbc.clear(); } return result; }
java
public CmsResource readResource(CmsRequestContext context, String resourcePath, CmsResourceFilter filter) throws CmsException { CmsResource result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { result = readResource(dbc, resourcePath, filter); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_RESOURCE_1, dbc.removeSiteRoot(resourcePath)), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsResource", "readResource", "(", "CmsRequestContext", "context", ",", "String", "resourcePath", ",", "CmsResourceFilter", "filter", ")", "throws", "CmsException", "{", "CmsResource", "result", "=", "null", ";", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "result", "=", "readResource", "(", "dbc", ",", "resourcePath", ",", "filter", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_READ_RESOURCE_1", ",", "dbc", ".", "removeSiteRoot", "(", "resourcePath", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "return", "result", ";", "}" ]
Reads a resource from the VFS, using the specified resource filter.<p> A resource may be of type <code>{@link CmsFile}</code> or <code>{@link CmsFolder}</code>. In case of a file, the resource will not contain the binary file content. Since reading the binary content is a cost-expensive database operation, it's recommended to work with resources if possible, and only read the file content when absolutely required. To "upgrade" a resource to a file, use <code>{@link CmsObject#readFile(CmsResource)}</code>.<p> The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code> will ignore the date release / date expired information of the resource.<p> @param context the current request context @param resourcePath the name of the resource to read (full path) @param filter the resource filter to use while reading @return the resource that was read @throws CmsException if the resource could not be read for any reason @see CmsObject#readResource(String, CmsResourceFilter) @see CmsObject#readResource(String) @see CmsObject#readFile(CmsResource)
[ "Reads", "a", "resource", "from", "the", "VFS", "using", "the", "specified", "resource", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5062-L5078
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.getMetadataWithChildrenIfChanged
public Maybe<DbxEntry./*@Nullable*/WithChildren> getMetadataWithChildrenIfChanged(String path, boolean includeMediaInfo, /*@Nullable*/String previousFolderHash) throws DbxException { """ Get the metadata for a given path and its children if anything has changed since the last time you got them (as determined by the value of {@link DbxEntry.WithChildren#hash} from the last result). @param path The path (starting with "/") to the file or folder (see {@link DbxPathV1}). @param previousFolderHash The value of {@link DbxEntry.WithChildren#hash} from the last time you got the metadata for this folder (and children). @return Never returns {@code null}. If the folder at the given path hasn't changed since you last retrieved it (i.e. its contents match {@code previousFolderHash}), return {@code Maybe.Nothing}. If it doesn't match {@code previousFolderHash} return either {@code Maybe.Just(null)} if there's nothing there or {@code Maybe.Just} with the metadata. """ return getMetadataWithChildrenIfChangedBase(path, includeMediaInfo, previousFolderHash, DbxEntry.WithChildren.ReaderMaybeDeleted); }
java
public Maybe<DbxEntry./*@Nullable*/WithChildren> getMetadataWithChildrenIfChanged(String path, boolean includeMediaInfo, /*@Nullable*/String previousFolderHash) throws DbxException { return getMetadataWithChildrenIfChangedBase(path, includeMediaInfo, previousFolderHash, DbxEntry.WithChildren.ReaderMaybeDeleted); }
[ "public", "Maybe", "<", "DbxEntry", ".", "/*@Nullable*/", "WithChildren", ">", "getMetadataWithChildrenIfChanged", "(", "String", "path", ",", "boolean", "includeMediaInfo", ",", "/*@Nullable*/", "String", "previousFolderHash", ")", "throws", "DbxException", "{", "return", "getMetadataWithChildrenIfChangedBase", "(", "path", ",", "includeMediaInfo", ",", "previousFolderHash", ",", "DbxEntry", ".", "WithChildren", ".", "ReaderMaybeDeleted", ")", ";", "}" ]
Get the metadata for a given path and its children if anything has changed since the last time you got them (as determined by the value of {@link DbxEntry.WithChildren#hash} from the last result). @param path The path (starting with "/") to the file or folder (see {@link DbxPathV1}). @param previousFolderHash The value of {@link DbxEntry.WithChildren#hash} from the last time you got the metadata for this folder (and children). @return Never returns {@code null}. If the folder at the given path hasn't changed since you last retrieved it (i.e. its contents match {@code previousFolderHash}), return {@code Maybe.Nothing}. If it doesn't match {@code previousFolderHash} return either {@code Maybe.Just(null)} if there's nothing there or {@code Maybe.Just} with the metadata.
[ "Get", "the", "metadata", "for", "a", "given", "path", "and", "its", "children", "if", "anything", "has", "changed", "since", "the", "last", "time", "you", "got", "them", "(", "as", "determined", "by", "the", "value", "of", "{", "@link", "DbxEntry", ".", "WithChildren#hash", "}", "from", "the", "last", "result", ")", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L264-L268
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java
Matrix.setMatrix
public void setMatrix(int[] r, int j0, int j1, Matrix X) { """ Set a submatrix. @param r Array of row indices. @param j0 Initial column index @param j1 Final column index @param X A(r(:),j0:j1) @throws ArrayIndexOutOfBoundsException Submatrix indices """ try { for (int i = 0; i < r.length; i++) { for (int j = j0; j <= j1; j++) { A[r[i]][j] = X.get(i, j - j0); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
java
public void setMatrix(int[] r, int j0, int j1, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = j0; j <= j1; j++) { A[r[i]][j] = X.get(i, j - j0); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
[ "public", "void", "setMatrix", "(", "int", "[", "]", "r", ",", "int", "j0", ",", "int", "j1", ",", "Matrix", "X", ")", "{", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "r", ".", "length", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "j0", ";", "j", "<=", "j1", ";", "j", "++", ")", "{", "A", "[", "r", "[", "i", "]", "]", "[", "j", "]", "=", "X", ".", "get", "(", "i", ",", "j", "-", "j0", ")", ";", "}", "}", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", "\"Submatrix indices\"", ")", ";", "}", "}" ]
Set a submatrix. @param r Array of row indices. @param j0 Initial column index @param j1 Final column index @param X A(r(:),j0:j1) @throws ArrayIndexOutOfBoundsException Submatrix indices
[ "Set", "a", "submatrix", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L555-L571
Hygieia/Hygieia
collectors/feature/versionone/src/main/java/com/capitalone/dashboard/util/DateUtil.java
DateUtil.isInteger
private boolean isInteger(String s, int radix) { """ Determines if string is an integer of the radix base number system provided. @param s String to be evaluated for integer type @param radix Base number system (e.g., 10 = base 10 number system) @return boolean """ Scanner sc = new Scanner(s.trim()); if (!sc.hasNextInt(radix)) return false; // we know it starts with a valid int, now make sure // there's nothing left! sc.nextInt(radix); return !sc.hasNext(); }
java
private boolean isInteger(String s, int radix) { Scanner sc = new Scanner(s.trim()); if (!sc.hasNextInt(radix)) return false; // we know it starts with a valid int, now make sure // there's nothing left! sc.nextInt(radix); return !sc.hasNext(); }
[ "private", "boolean", "isInteger", "(", "String", "s", ",", "int", "radix", ")", "{", "Scanner", "sc", "=", "new", "Scanner", "(", "s", ".", "trim", "(", ")", ")", ";", "if", "(", "!", "sc", ".", "hasNextInt", "(", "radix", ")", ")", "return", "false", ";", "// we know it starts with a valid int, now make sure", "// there's nothing left!", "sc", ".", "nextInt", "(", "radix", ")", ";", "return", "!", "sc", ".", "hasNext", "(", ")", ";", "}" ]
Determines if string is an integer of the radix base number system provided. @param s String to be evaluated for integer type @param radix Base number system (e.g., 10 = base 10 number system) @return boolean
[ "Determines", "if", "string", "is", "an", "integer", "of", "the", "radix", "base", "number", "system", "provided", "." ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/versionone/src/main/java/com/capitalone/dashboard/util/DateUtil.java#L126-L134
graknlabs/grakn
server/src/server/exception/TransactionException.java
TransactionException.regexFailure
public static TransactionException regexFailure(AttributeType attributeType, String value, String regex) { """ Thrown when trying to set a {@code value} on the {@code resource} which does not conform to it's regex """ return create(ErrorMessage.REGEX_INSTANCE_FAILURE.getMessage(regex, attributeType.label(), value)); }
java
public static TransactionException regexFailure(AttributeType attributeType, String value, String regex) { return create(ErrorMessage.REGEX_INSTANCE_FAILURE.getMessage(regex, attributeType.label(), value)); }
[ "public", "static", "TransactionException", "regexFailure", "(", "AttributeType", "attributeType", ",", "String", "value", ",", "String", "regex", ")", "{", "return", "create", "(", "ErrorMessage", ".", "REGEX_INSTANCE_FAILURE", ".", "getMessage", "(", "regex", ",", "attributeType", ".", "label", "(", ")", ",", "value", ")", ")", ";", "}" ]
Thrown when trying to set a {@code value} on the {@code resource} which does not conform to it's regex
[ "Thrown", "when", "trying", "to", "set", "a", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TransactionException.java#L180-L182
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java
SquareGridTools.orderNodeGrid
protected void orderNodeGrid(SquareGrid grid, int row, int col) { """ Given the grid coordinate, order the corners for the node at that location. Takes in handles situations where there are no neighbors. """ SquareNode node = grid.get(row,col); if(grid.rows==1 && grid.columns==1 ) { for (int i = 0; i < 4; i++) { ordered[i] = node.square.get(i); } } else if( grid.columns==1 ) { if (row == grid.rows - 1) { orderNode(node, grid.get(row - 1, col), false); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row + 1, col), false); } } else { if( col == grid.columns-1) { orderNode(node, grid.get(row, col-1), true); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row, col+1), true); } } }
java
protected void orderNodeGrid(SquareGrid grid, int row, int col) { SquareNode node = grid.get(row,col); if(grid.rows==1 && grid.columns==1 ) { for (int i = 0; i < 4; i++) { ordered[i] = node.square.get(i); } } else if( grid.columns==1 ) { if (row == grid.rows - 1) { orderNode(node, grid.get(row - 1, col), false); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row + 1, col), false); } } else { if( col == grid.columns-1) { orderNode(node, grid.get(row, col-1), true); rotateTwiceOrdered(); } else { orderNode(node, grid.get(row, col+1), true); } } }
[ "protected", "void", "orderNodeGrid", "(", "SquareGrid", "grid", ",", "int", "row", ",", "int", "col", ")", "{", "SquareNode", "node", "=", "grid", ".", "get", "(", "row", ",", "col", ")", ";", "if", "(", "grid", ".", "rows", "==", "1", "&&", "grid", ".", "columns", "==", "1", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "ordered", "[", "i", "]", "=", "node", ".", "square", ".", "get", "(", "i", ")", ";", "}", "}", "else", "if", "(", "grid", ".", "columns", "==", "1", ")", "{", "if", "(", "row", "==", "grid", ".", "rows", "-", "1", ")", "{", "orderNode", "(", "node", ",", "grid", ".", "get", "(", "row", "-", "1", ",", "col", ")", ",", "false", ")", ";", "rotateTwiceOrdered", "(", ")", ";", "}", "else", "{", "orderNode", "(", "node", ",", "grid", ".", "get", "(", "row", "+", "1", ",", "col", ")", ",", "false", ")", ";", "}", "}", "else", "{", "if", "(", "col", "==", "grid", ".", "columns", "-", "1", ")", "{", "orderNode", "(", "node", ",", "grid", ".", "get", "(", "row", ",", "col", "-", "1", ")", ",", "true", ")", ";", "rotateTwiceOrdered", "(", ")", ";", "}", "else", "{", "orderNode", "(", "node", ",", "grid", ".", "get", "(", "row", ",", "col", "+", "1", ")", ",", "true", ")", ";", "}", "}", "}" ]
Given the grid coordinate, order the corners for the node at that location. Takes in handles situations where there are no neighbors.
[ "Given", "the", "grid", "coordinate", "order", "the", "corners", "for", "the", "node", "at", "that", "location", ".", "Takes", "in", "handles", "situations", "where", "there", "are", "no", "neighbors", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGridTools.java#L223-L245
cdk/cdk
base/dict/src/main/java/org/openscience/cdk/dict/EntryReact.java
EntryReact.setParameters
public void setParameters(String nameParam, String typeParam, String value) { """ Set the parameters of the reaction. @param nameParam The parameter names of the reaction as String @param typeParam The parameter types of the reaction as String @param value The value default of the parameter """ this.parameters.put(nameParam, typeParam); this.parametersValue.add(value); }
java
public void setParameters(String nameParam, String typeParam, String value) { this.parameters.put(nameParam, typeParam); this.parametersValue.add(value); }
[ "public", "void", "setParameters", "(", "String", "nameParam", ",", "String", "typeParam", ",", "String", "value", ")", "{", "this", ".", "parameters", ".", "put", "(", "nameParam", ",", "typeParam", ")", ";", "this", ".", "parametersValue", ".", "add", "(", "value", ")", ";", "}" ]
Set the parameters of the reaction. @param nameParam The parameter names of the reaction as String @param typeParam The parameter types of the reaction as String @param value The value default of the parameter
[ "Set", "the", "parameters", "of", "the", "reaction", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/dict/src/main/java/org/openscience/cdk/dict/EntryReact.java#L108-L111
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.holdCall
public void holdCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { """ Place the specified call on hold. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) """ try { VoicecallsidanswerData holdData = new VoicecallsidanswerData(); holdData.setReasons(Util.toKVList(reasons)); holdData.setExtensions(Util.toKVList(extensions)); HoldData data = new HoldData(); data.data(holdData); ApiSuccessResponse response = this.voiceApi.hold(connId, data); throwIfNotOk("holdCall", response); } catch (ApiException e) { throw new WorkspaceApiException("holdCall failed.", e); } }
java
public void holdCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData holdData = new VoicecallsidanswerData(); holdData.setReasons(Util.toKVList(reasons)); holdData.setExtensions(Util.toKVList(extensions)); HoldData data = new HoldData(); data.data(holdData); ApiSuccessResponse response = this.voiceApi.hold(connId, data); throwIfNotOk("holdCall", response); } catch (ApiException e) { throw new WorkspaceApiException("holdCall failed.", e); } }
[ "public", "void", "holdCall", "(", "String", "connId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidanswerData", "holdData", "=", "new", "VoicecallsidanswerData", "(", ")", ";", "holdData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "holdData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "HoldData", "data", "=", "new", "HoldData", "(", ")", ";", "data", ".", "data", "(", "holdData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "hold", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"holdCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"holdCall failed.\"", ",", "e", ")", ";", "}", "}" ]
Place the specified call on hold. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Place", "the", "specified", "call", "on", "hold", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L567-L585
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/yaml/YamlShardingDataSourceFactory.java
YamlShardingDataSourceFactory.createDataSource
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { """ Create sharding data source. @param dataSourceMap data source map @param yamlFile YAML file for rule configuration of databases and tables sharding without data sources @return sharding data source @throws SQLException SQL exception @throws IOException IO exception """ YamlRootShardingConfiguration config = YamlEngine.unmarshal(yamlFile, YamlRootShardingConfiguration.class); return ShardingDataSourceFactory.createDataSource(dataSourceMap, new ShardingRuleConfigurationYamlSwapper().swap(config.getShardingRule()), config.getProps()); }
java
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { YamlRootShardingConfiguration config = YamlEngine.unmarshal(yamlFile, YamlRootShardingConfiguration.class); return ShardingDataSourceFactory.createDataSource(dataSourceMap, new ShardingRuleConfigurationYamlSwapper().swap(config.getShardingRule()), config.getProps()); }
[ "public", "static", "DataSource", "createDataSource", "(", "final", "Map", "<", "String", ",", "DataSource", ">", "dataSourceMap", ",", "final", "File", "yamlFile", ")", "throws", "SQLException", ",", "IOException", "{", "YamlRootShardingConfiguration", "config", "=", "YamlEngine", ".", "unmarshal", "(", "yamlFile", ",", "YamlRootShardingConfiguration", ".", "class", ")", ";", "return", "ShardingDataSourceFactory", ".", "createDataSource", "(", "dataSourceMap", ",", "new", "ShardingRuleConfigurationYamlSwapper", "(", ")", ".", "swap", "(", "config", ".", "getShardingRule", "(", ")", ")", ",", "config", ".", "getProps", "(", ")", ")", ";", "}" ]
Create sharding data source. @param dataSourceMap data source map @param yamlFile YAML file for rule configuration of databases and tables sharding without data sources @return sharding data source @throws SQLException SQL exception @throws IOException IO exception
[ "Create", "sharding", "data", "source", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/api/yaml/YamlShardingDataSourceFactory.java#L76-L79
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java
CitrusAnnotations.injectCitrusFramework
public static final void injectCitrusFramework(final Object testCase, final Citrus citrusFramework) { """ Inject Citrus framework instance to the test class fields with {@link CitrusFramework} annotation. @param testCase @param citrusFramework """ ReflectionUtils.doWithFields(testCase.getClass(), new ReflectionUtils.FieldCallback() { @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { log.debug(String.format("Injecting Citrus framework instance on test class field '%s'", field.getName())); ReflectionUtils.setField(field, testCase, citrusFramework); } }, new ReflectionUtils.FieldFilter() { @Override public boolean matches(Field field) { if (field.isAnnotationPresent(CitrusFramework.class) && Citrus.class.isAssignableFrom(field.getType())) { if (!field.isAccessible()) { ReflectionUtils.makeAccessible(field); } return true; } return false; } }); }
java
public static final void injectCitrusFramework(final Object testCase, final Citrus citrusFramework) { ReflectionUtils.doWithFields(testCase.getClass(), new ReflectionUtils.FieldCallback() { @Override public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException { log.debug(String.format("Injecting Citrus framework instance on test class field '%s'", field.getName())); ReflectionUtils.setField(field, testCase, citrusFramework); } }, new ReflectionUtils.FieldFilter() { @Override public boolean matches(Field field) { if (field.isAnnotationPresent(CitrusFramework.class) && Citrus.class.isAssignableFrom(field.getType())) { if (!field.isAccessible()) { ReflectionUtils.makeAccessible(field); } return true; } return false; } }); }
[ "public", "static", "final", "void", "injectCitrusFramework", "(", "final", "Object", "testCase", ",", "final", "Citrus", "citrusFramework", ")", "{", "ReflectionUtils", ".", "doWithFields", "(", "testCase", ".", "getClass", "(", ")", ",", "new", "ReflectionUtils", ".", "FieldCallback", "(", ")", "{", "@", "Override", "public", "void", "doWith", "(", "Field", "field", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"Injecting Citrus framework instance on test class field '%s'\"", ",", "field", ".", "getName", "(", ")", ")", ")", ";", "ReflectionUtils", ".", "setField", "(", "field", ",", "testCase", ",", "citrusFramework", ")", ";", "}", "}", ",", "new", "ReflectionUtils", ".", "FieldFilter", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "Field", "field", ")", "{", "if", "(", "field", ".", "isAnnotationPresent", "(", "CitrusFramework", ".", "class", ")", "&&", "Citrus", ".", "class", ".", "isAssignableFrom", "(", "field", ".", "getType", "(", ")", ")", ")", "{", "if", "(", "!", "field", ".", "isAccessible", "(", ")", ")", "{", "ReflectionUtils", ".", "makeAccessible", "(", "field", ")", ";", "}", "return", "true", ";", "}", "return", "false", ";", "}", "}", ")", ";", "}" ]
Inject Citrus framework instance to the test class fields with {@link CitrusFramework} annotation. @param testCase @param citrusFramework
[ "Inject", "Citrus", "framework", "instance", "to", "the", "test", "class", "fields", "with", "{" ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java#L125-L147
javagl/ND
nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleNeighborhoodIterables.java
IntTupleNeighborhoodIterables.mooreNeighborhoodIterable
public static Iterable<MutableIntTuple> mooreNeighborhoodIterable( IntTuple center, int radius, Order order) { """ Creates an iterable that provides iterators for iterating over the Moore neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Moore neighborhood A copy of this tuple will be stored internally. @param radius The radius of the Moore neighborhood @param order The iteration {@link Order} @return The iterable """ return mooreNeighborhoodIterable(center, radius, null, null, order); }
java
public static Iterable<MutableIntTuple> mooreNeighborhoodIterable( IntTuple center, int radius, Order order) { return mooreNeighborhoodIterable(center, radius, null, null, order); }
[ "public", "static", "Iterable", "<", "MutableIntTuple", ">", "mooreNeighborhoodIterable", "(", "IntTuple", "center", ",", "int", "radius", ",", "Order", "order", ")", "{", "return", "mooreNeighborhoodIterable", "(", "center", ",", "radius", ",", "null", ",", "null", ",", "order", ")", ";", "}" ]
Creates an iterable that provides iterators for iterating over the Moore neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Moore neighborhood A copy of this tuple will be stored internally. @param radius The radius of the Moore neighborhood @param order The iteration {@link Order} @return The iterable
[ "Creates", "an", "iterable", "that", "provides", "iterators", "for", "iterating", "over", "the", "Moore", "neighborhood", "of", "the", "given", "center", "and", "the", "given", "radius", ".", "<br", ">", "<br", ">", "Also", "see", "<a", "href", "=", "..", "/", "..", "/", "package", "-", "summary", ".", "html#Neighborhoods", ">", "Neighborhoods<", "/", "a", ">" ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleNeighborhoodIterables.java#L59-L63
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ImplementationImpl.java
ImplementationImpl.newDSet
public DSet newDSet() { """ Create a new <code>DSet</code> object. @return The new <code>DSet</code> object. @see DSet """ if ((getCurrentDatabase() == null)) { throw new DatabaseClosedException("Database is NULL, cannot create a DSet with a null database."); } return (DSet) DSetFactory.singleton.createCollectionOrMap(getCurrentPBKey()); }
java
public DSet newDSet() { if ((getCurrentDatabase() == null)) { throw new DatabaseClosedException("Database is NULL, cannot create a DSet with a null database."); } return (DSet) DSetFactory.singleton.createCollectionOrMap(getCurrentPBKey()); }
[ "public", "DSet", "newDSet", "(", ")", "{", "if", "(", "(", "getCurrentDatabase", "(", ")", "==", "null", ")", ")", "{", "throw", "new", "DatabaseClosedException", "(", "\"Database is NULL, cannot create a DSet with a null database.\"", ")", ";", "}", "return", "(", "DSet", ")", "DSetFactory", ".", "singleton", ".", "createCollectionOrMap", "(", "getCurrentPBKey", "(", ")", ")", ";", "}" ]
Create a new <code>DSet</code> object. @return The new <code>DSet</code> object. @see DSet
[ "Create", "a", "new", "<code", ">", "DSet<", "/", "code", ">", "object", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ImplementationImpl.java#L239-L246
alkacon/opencms-core
src/org/opencms/widgets/CmsHtmlWidgetOption.java
CmsHtmlWidgetOption.getButtonBar
public String getButtonBar(Map<String, String> buttonNamesLookUp, String itemSeparator) { """ Returns the specific editor button bar string generated from the configuration.<p> The lookup map can contain translations for the button names, the separator and the block names. The button bar will be automatically surrounded by block start and end items if they are not explicitly defined.<p> It may be necessary to write your own method to generate the button bar string for a specific editor widget. In this case, use the method {@link #getButtonBarShownItems()} to get the calculated list of shown button bar items.<p> @param buttonNamesLookUp the lookup map with translations for the button names, the separator and the block names or <code>null</code> @param itemSeparator the separator for the tool bar items @return the button bar string generated from the configuration """ return getButtonBar(buttonNamesLookUp, itemSeparator, true); }
java
public String getButtonBar(Map<String, String> buttonNamesLookUp, String itemSeparator) { return getButtonBar(buttonNamesLookUp, itemSeparator, true); }
[ "public", "String", "getButtonBar", "(", "Map", "<", "String", ",", "String", ">", "buttonNamesLookUp", ",", "String", "itemSeparator", ")", "{", "return", "getButtonBar", "(", "buttonNamesLookUp", ",", "itemSeparator", ",", "true", ")", ";", "}" ]
Returns the specific editor button bar string generated from the configuration.<p> The lookup map can contain translations for the button names, the separator and the block names. The button bar will be automatically surrounded by block start and end items if they are not explicitly defined.<p> It may be necessary to write your own method to generate the button bar string for a specific editor widget. In this case, use the method {@link #getButtonBarShownItems()} to get the calculated list of shown button bar items.<p> @param buttonNamesLookUp the lookup map with translations for the button names, the separator and the block names or <code>null</code> @param itemSeparator the separator for the tool bar items @return the button bar string generated from the configuration
[ "Returns", "the", "specific", "editor", "button", "bar", "string", "generated", "from", "the", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsHtmlWidgetOption.java#L539-L542
google/j2objc
jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONObject.java
JSONObject.put
public JSONObject put(String name, long value) throws JSONException { """ Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same name. @return this object. """ nameValuePairs.put(checkName(name), value); return this; }
java
public JSONObject put(String name, long value) throws JSONException { nameValuePairs.put(checkName(name), value); return this; }
[ "public", "JSONObject", "put", "(", "String", "name", ",", "long", "value", ")", "throws", "JSONException", "{", "nameValuePairs", ".", "put", "(", "checkName", "(", "name", ")", ",", "value", ")", ";", "return", "this", ";", "}" ]
Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same name. @return this object.
[ "Maps", "{", "@code", "name", "}", "to", "{", "@code", "value", "}", "clobbering", "any", "existing", "name", "/", "value", "mapping", "with", "the", "same", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONObject.java#L239-L242
spotbugs/spotbugs
spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/UnionBugs.java
UnionBugs.copyFile
private static void copyFile(File in, File out) throws IOException { """ Copy a File @param in to Copy From @param out to Copy To @throws IOException """ try (FileInputStream inStream = new FileInputStream(in); FileOutputStream outStream = new FileOutputStream(out);) { FileChannel inChannel = inStream.getChannel(); inChannel.transferTo(0, inChannel.size(), outStream.getChannel()); } }
java
private static void copyFile(File in, File out) throws IOException { try (FileInputStream inStream = new FileInputStream(in); FileOutputStream outStream = new FileOutputStream(out);) { FileChannel inChannel = inStream.getChannel(); inChannel.transferTo(0, inChannel.size(), outStream.getChannel()); } }
[ "private", "static", "void", "copyFile", "(", "File", "in", ",", "File", "out", ")", "throws", "IOException", "{", "try", "(", "FileInputStream", "inStream", "=", "new", "FileInputStream", "(", "in", ")", ";", "FileOutputStream", "outStream", "=", "new", "FileOutputStream", "(", "out", ")", ";", ")", "{", "FileChannel", "inChannel", "=", "inStream", ".", "getChannel", "(", ")", ";", "inChannel", ".", "transferTo", "(", "0", ",", "inChannel", ".", "size", "(", ")", ",", "outStream", ".", "getChannel", "(", ")", ")", ";", "}", "}" ]
Copy a File @param in to Copy From @param out to Copy To @throws IOException
[ "Copy", "a", "File" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/UnionBugs.java#L149-L155
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java
BouncyCastleCertProcessingFactory.createCredential
public X509Credential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, GSIConstants.DelegationType delegType, X509ExtensionSet extSet, String cnValue) throws GeneralSecurityException { """ Creates a new proxy credential from the specified certificate chain and a private key, using the given delegation mode. @see #createCredential(X509Certificate[], PrivateKey, int, int, GSIConstants.CertificateType, X509ExtensionSet, String) """ X509Certificate[] bcCerts = getX509CertificateObjectChain(certs); return createCredential(bcCerts, privateKey, bits, lifetime, decideProxyType(bcCerts[0], delegType), extSet, cnValue); }
java
public X509Credential createCredential(X509Certificate[] certs, PrivateKey privateKey, int bits, int lifetime, GSIConstants.DelegationType delegType, X509ExtensionSet extSet, String cnValue) throws GeneralSecurityException { X509Certificate[] bcCerts = getX509CertificateObjectChain(certs); return createCredential(bcCerts, privateKey, bits, lifetime, decideProxyType(bcCerts[0], delegType), extSet, cnValue); }
[ "public", "X509Credential", "createCredential", "(", "X509Certificate", "[", "]", "certs", ",", "PrivateKey", "privateKey", ",", "int", "bits", ",", "int", "lifetime", ",", "GSIConstants", ".", "DelegationType", "delegType", ",", "X509ExtensionSet", "extSet", ",", "String", "cnValue", ")", "throws", "GeneralSecurityException", "{", "X509Certificate", "[", "]", "bcCerts", "=", "getX509CertificateObjectChain", "(", "certs", ")", ";", "return", "createCredential", "(", "bcCerts", ",", "privateKey", ",", "bits", ",", "lifetime", ",", "decideProxyType", "(", "bcCerts", "[", "0", "]", ",", "delegType", ")", ",", "extSet", ",", "cnValue", ")", ";", "}" ]
Creates a new proxy credential from the specified certificate chain and a private key, using the given delegation mode. @see #createCredential(X509Certificate[], PrivateKey, int, int, GSIConstants.CertificateType, X509ExtensionSet, String)
[ "Creates", "a", "new", "proxy", "credential", "from", "the", "specified", "certificate", "chain", "and", "a", "private", "key", "using", "the", "given", "delegation", "mode", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java#L694-L700
FudanNLP/fnlp
fnlp-core/src/main/java/org/fnlp/nlp/corpus/fnlp/FNLPCorpus.java
FNLPCorpus.readPOS
public void readPOS(String path, String suffix, String charset) throws IOException { """ 读分词/词性的文件 文件格式为: word1/pos1 word2/pos2 ... wordn/posn @param path @param suffix @param charset @throws IOException """ List<File> files = MyFiles.getAllFiles(path, suffix);//".txt" Iterator<File> it = files.iterator(); while(it.hasNext()){ BufferedReader bfr =null; File file = it.next(); try { FileInputStream in = new FileInputStream(file); bfr = new BufferedReader(new UnicodeReader(in,charset)); } catch (FileNotFoundException e) { e.printStackTrace(); } FNLPDoc doc = new FNLPDoc(); doc.name = file.getName(); String line = null; while ((line = bfr.readLine()) != null) { line = line.trim(); if (line.matches("^$")) continue; FNLPSent sent = new FNLPSent(); sent.parseTagedLine(line); doc.add(sent); } add(doc); } }
java
public void readPOS(String path, String suffix, String charset) throws IOException { List<File> files = MyFiles.getAllFiles(path, suffix);//".txt" Iterator<File> it = files.iterator(); while(it.hasNext()){ BufferedReader bfr =null; File file = it.next(); try { FileInputStream in = new FileInputStream(file); bfr = new BufferedReader(new UnicodeReader(in,charset)); } catch (FileNotFoundException e) { e.printStackTrace(); } FNLPDoc doc = new FNLPDoc(); doc.name = file.getName(); String line = null; while ((line = bfr.readLine()) != null) { line = line.trim(); if (line.matches("^$")) continue; FNLPSent sent = new FNLPSent(); sent.parseTagedLine(line); doc.add(sent); } add(doc); } }
[ "public", "void", "readPOS", "(", "String", "path", ",", "String", "suffix", ",", "String", "charset", ")", "throws", "IOException", "{", "List", "<", "File", ">", "files", "=", "MyFiles", ".", "getAllFiles", "(", "path", ",", "suffix", ")", ";", "//\".txt\"", "Iterator", "<", "File", ">", "it", "=", "files", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "BufferedReader", "bfr", "=", "null", ";", "File", "file", "=", "it", ".", "next", "(", ")", ";", "try", "{", "FileInputStream", "in", "=", "new", "FileInputStream", "(", "file", ")", ";", "bfr", "=", "new", "BufferedReader", "(", "new", "UnicodeReader", "(", "in", ",", "charset", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "FNLPDoc", "doc", "=", "new", "FNLPDoc", "(", ")", ";", "doc", ".", "name", "=", "file", ".", "getName", "(", ")", ";", "String", "line", "=", "null", ";", "while", "(", "(", "line", "=", "bfr", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "line", "=", "line", ".", "trim", "(", ")", ";", "if", "(", "line", ".", "matches", "(", "\"^$\"", ")", ")", "continue", ";", "FNLPSent", "sent", "=", "new", "FNLPSent", "(", ")", ";", "sent", ".", "parseTagedLine", "(", "line", ")", ";", "doc", ".", "add", "(", "sent", ")", ";", "}", "add", "(", "doc", ")", ";", "}", "}" ]
读分词/词性的文件 文件格式为: word1/pos1 word2/pos2 ... wordn/posn @param path @param suffix @param charset @throws IOException
[ "读分词", "/", "词性的文件", "文件格式为:", "word1", "/", "pos1", "word2", "/", "pos2", "...", "wordn", "/", "posn" ]
train
https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-core/src/main/java/org/fnlp/nlp/corpus/fnlp/FNLPCorpus.java#L255-L282
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.rotateAround
public Matrix4f rotateAround(Quaternionfc quat, float ox, float oy, float oz, Matrix4f dest) { """ /* (non-Javadoc) @see org.joml.Matrix4fc#rotateAround(org.joml.Quaternionfc, float, float, float, org.joml.Matrix4f) """ if ((properties & PROPERTY_IDENTITY) != 0) return rotationAround(quat, ox, oy, oz); else if ((properties & PROPERTY_AFFINE) != 0) return rotateAroundAffine(quat, ox, oy, oz, dest); return rotateAroundGeneric(quat, ox, oy, oz, dest); }
java
public Matrix4f rotateAround(Quaternionfc quat, float ox, float oy, float oz, Matrix4f dest) { if ((properties & PROPERTY_IDENTITY) != 0) return rotationAround(quat, ox, oy, oz); else if ((properties & PROPERTY_AFFINE) != 0) return rotateAroundAffine(quat, ox, oy, oz, dest); return rotateAroundGeneric(quat, ox, oy, oz, dest); }
[ "public", "Matrix4f", "rotateAround", "(", "Quaternionfc", "quat", ",", "float", "ox", ",", "float", "oy", ",", "float", "oz", ",", "Matrix4f", "dest", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ")", "!=", "0", ")", "return", "rotationAround", "(", "quat", ",", "ox", ",", "oy", ",", "oz", ")", ";", "else", "if", "(", "(", "properties", "&", "PROPERTY_AFFINE", ")", "!=", "0", ")", "return", "rotateAroundAffine", "(", "quat", ",", "ox", ",", "oy", ",", "oz", ",", "dest", ")", ";", "return", "rotateAroundGeneric", "(", "quat", ",", "ox", ",", "oy", ",", "oz", ",", "dest", ")", ";", "}" ]
/* (non-Javadoc) @see org.joml.Matrix4fc#rotateAround(org.joml.Quaternionfc, float, float, float, org.joml.Matrix4f)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L11277-L11283
lotaris/rox-commons-maven-plugin
src/main/java/org/twdata/maven/mojoexecutor/MojoExecutor.java
MojoExecutor.executionEnvironment
public static ExecutionEnvironment executionEnvironment(MavenProject mavenProject, MavenSession mavenSession, BuildPluginManager pluginManager) { """ Constructs the {@link ExecutionEnvironment} instance fluently @param mavenProject The current Maven project @param mavenSession The current Maven session @param pluginManager The Build plugin manager @return The execution environment @throws NullPointerException if mavenProject, mavenSession or pluginManager are null """ return new ExecutionEnvironment(mavenProject, mavenSession, pluginManager); }
java
public static ExecutionEnvironment executionEnvironment(MavenProject mavenProject, MavenSession mavenSession, BuildPluginManager pluginManager) { return new ExecutionEnvironment(mavenProject, mavenSession, pluginManager); }
[ "public", "static", "ExecutionEnvironment", "executionEnvironment", "(", "MavenProject", "mavenProject", ",", "MavenSession", "mavenSession", ",", "BuildPluginManager", "pluginManager", ")", "{", "return", "new", "ExecutionEnvironment", "(", "mavenProject", ",", "mavenSession", ",", "pluginManager", ")", ";", "}" ]
Constructs the {@link ExecutionEnvironment} instance fluently @param mavenProject The current Maven project @param mavenSession The current Maven session @param pluginManager The Build plugin manager @return The execution environment @throws NullPointerException if mavenProject, mavenSession or pluginManager are null
[ "Constructs", "the", "{", "@link", "ExecutionEnvironment", "}", "instance", "fluently" ]
train
https://github.com/lotaris/rox-commons-maven-plugin/blob/e2602d7f1e8c2e6994c0df07cc0003828adfa2af/src/main/java/org/twdata/maven/mojoexecutor/MojoExecutor.java#L133-L135
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.iamin
public SDVariable iamin(SDVariable in, boolean keepDims, int... dimensions) { """ Index of the min absolute value: argmin(abs(in)) @see SameDiff#argmin(String, SDVariable, boolean, int...) """ return iamin(null, in, keepDims, dimensions); }
java
public SDVariable iamin(SDVariable in, boolean keepDims, int... dimensions) { return iamin(null, in, keepDims, dimensions); }
[ "public", "SDVariable", "iamin", "(", "SDVariable", "in", ",", "boolean", "keepDims", ",", "int", "...", "dimensions", ")", "{", "return", "iamin", "(", "null", ",", "in", ",", "keepDims", ",", "dimensions", ")", ";", "}" ]
Index of the min absolute value: argmin(abs(in)) @see SameDiff#argmin(String, SDVariable, boolean, int...)
[ "Index", "of", "the", "min", "absolute", "value", ":", "argmin", "(", "abs", "(", "in", "))" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1270-L1272
softindex/datakernel
core-promise/src/main/java/io/datakernel/file/AsyncFile.java
AsyncFile.writeNewFile
public static Promise<Void> writeNewFile(Executor executor, Path path, ByteBuf buf) { """ Creates new file and writes a sequence of bytes to this file from the given buffer, starting at the given file position. If file already exists, promise fails with exception. @param path the path of the file to create and write @param buf the buffer from which bytes are to be transferred byteBuffer """ return openAsync(executor, path, set(WRITE, CREATE_NEW)) .then(file -> file.write(buf) .then($ -> file.close())) .whenException($ -> buf.recycle()); }
java
public static Promise<Void> writeNewFile(Executor executor, Path path, ByteBuf buf) { return openAsync(executor, path, set(WRITE, CREATE_NEW)) .then(file -> file.write(buf) .then($ -> file.close())) .whenException($ -> buf.recycle()); }
[ "public", "static", "Promise", "<", "Void", ">", "writeNewFile", "(", "Executor", "executor", ",", "Path", "path", ",", "ByteBuf", "buf", ")", "{", "return", "openAsync", "(", "executor", ",", "path", ",", "set", "(", "WRITE", ",", "CREATE_NEW", ")", ")", ".", "then", "(", "file", "->", "file", ".", "write", "(", "buf", ")", ".", "then", "(", "$", "->", "file", ".", "close", "(", ")", ")", ")", ".", "whenException", "(", "$", "->", "buf", ".", "recycle", "(", ")", ")", ";", "}" ]
Creates new file and writes a sequence of bytes to this file from the given buffer, starting at the given file position. If file already exists, promise fails with exception. @param path the path of the file to create and write @param buf the buffer from which bytes are to be transferred byteBuffer
[ "Creates", "new", "file", "and", "writes", "a", "sequence", "of", "bytes", "to", "this", "file", "from", "the", "given", "buffer", "starting", "at", "the", "given", "file", "position", ".", "If", "file", "already", "exists", "promise", "fails", "with", "exception", "." ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L217-L222
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/AbstractStandardTransformationOperation.java
AbstractStandardTransformationOperation.getParameterOrException
protected String getParameterOrException(Map<String, String> parameters, String paramName) throws TransformationOperationException { """ Get the parameter with the given parameter name from the parameter map. If the parameters does not contain such a parameter, the function throws a TransformationOperationException. """ return getParameter(parameters, paramName, true, null); }
java
protected String getParameterOrException(Map<String, String> parameters, String paramName) throws TransformationOperationException { return getParameter(parameters, paramName, true, null); }
[ "protected", "String", "getParameterOrException", "(", "Map", "<", "String", ",", "String", ">", "parameters", ",", "String", "paramName", ")", "throws", "TransformationOperationException", "{", "return", "getParameter", "(", "parameters", ",", "paramName", ",", "true", ",", "null", ")", ";", "}" ]
Get the parameter with the given parameter name from the parameter map. If the parameters does not contain such a parameter, the function throws a TransformationOperationException.
[ "Get", "the", "parameter", "with", "the", "given", "parameter", "name", "from", "the", "parameter", "map", ".", "If", "the", "parameters", "does", "not", "contain", "such", "a", "parameter", "the", "function", "throws", "a", "TransformationOperationException", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/AbstractStandardTransformationOperation.java#L94-L97
ronmamo/reflections
src/main/java/org/reflections/vfs/Vfs.java
Vfs.findFiles
public static Iterable<File> findFiles(final Collection<URL> inUrls, final String packagePrefix, final Predicate<String> nameFilter) { """ return an iterable of all {@link org.reflections.vfs.Vfs.File} in given urls, starting with given packagePrefix and matching nameFilter """ Predicate<File> fileNamePredicate = new Predicate<File>() { public boolean apply(File file) { String path = file.getRelativePath(); if (path.startsWith(packagePrefix)) { String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length()); return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1)); } else { return false; } } }; return findFiles(inUrls, fileNamePredicate); }
java
public static Iterable<File> findFiles(final Collection<URL> inUrls, final String packagePrefix, final Predicate<String> nameFilter) { Predicate<File> fileNamePredicate = new Predicate<File>() { public boolean apply(File file) { String path = file.getRelativePath(); if (path.startsWith(packagePrefix)) { String filename = path.substring(path.indexOf(packagePrefix) + packagePrefix.length()); return !Utils.isEmpty(filename) && nameFilter.apply(filename.substring(1)); } else { return false; } } }; return findFiles(inUrls, fileNamePredicate); }
[ "public", "static", "Iterable", "<", "File", ">", "findFiles", "(", "final", "Collection", "<", "URL", ">", "inUrls", ",", "final", "String", "packagePrefix", ",", "final", "Predicate", "<", "String", ">", "nameFilter", ")", "{", "Predicate", "<", "File", ">", "fileNamePredicate", "=", "new", "Predicate", "<", "File", ">", "(", ")", "{", "public", "boolean", "apply", "(", "File", "file", ")", "{", "String", "path", "=", "file", ".", "getRelativePath", "(", ")", ";", "if", "(", "path", ".", "startsWith", "(", "packagePrefix", ")", ")", "{", "String", "filename", "=", "path", ".", "substring", "(", "path", ".", "indexOf", "(", "packagePrefix", ")", "+", "packagePrefix", ".", "length", "(", ")", ")", ";", "return", "!", "Utils", ".", "isEmpty", "(", "filename", ")", "&&", "nameFilter", ".", "apply", "(", "filename", ".", "substring", "(", "1", ")", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}", "}", ";", "return", "findFiles", "(", "inUrls", ",", "fileNamePredicate", ")", ";", "}" ]
return an iterable of all {@link org.reflections.vfs.Vfs.File} in given urls, starting with given packagePrefix and matching nameFilter
[ "return", "an", "iterable", "of", "all", "{" ]
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/vfs/Vfs.java#L123-L137
Netflix/Turbine
turbine-core/src/main/java/com/netflix/turbine/aggregator/NumberList.java
NumberList.delta
@SuppressWarnings("unchecked") public static NumberList delta(Map<String, Object> currentMap, NumberList previousMap) { """ unchecked but we know we can go from Map<String, Long> to Map<String, Object> """ return delta(currentMap, (Map)previousMap.numbers); }
java
@SuppressWarnings("unchecked") public static NumberList delta(Map<String, Object> currentMap, NumberList previousMap) { return delta(currentMap, (Map)previousMap.numbers); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "NumberList", "delta", "(", "Map", "<", "String", ",", "Object", ">", "currentMap", ",", "NumberList", "previousMap", ")", "{", "return", "delta", "(", "currentMap", ",", "(", "Map", ")", "previousMap", ".", "numbers", ")", ";", "}" ]
unchecked but we know we can go from Map<String, Long> to Map<String, Object>
[ "unchecked", "but", "we", "know", "we", "can", "go", "from", "Map<String", "Long", ">", "to", "Map<String", "Object", ">" ]
train
https://github.com/Netflix/Turbine/blob/0e924058aa4d1d526310206a51dcf82f65274d58/turbine-core/src/main/java/com/netflix/turbine/aggregator/NumberList.java#L47-L50
Jasig/spring-portlet-contrib
spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/filter/PortletFilterUtils.java
PortletFilterUtils.doFilter
public static void doFilter(PortletRequest request, PortletResponse response, FilterChain chain) throws IOException, PortletException { """ Call doFilter and use the {@link javax.portlet.PortletRequest#LIFECYCLE_PHASE} attribute to figure out what type of request/response are in use and call the appropriate doFilter method on {@link javax.portlet.filter.FilterChain} @param request a {@link javax.portlet.PortletRequest} object. @param response a {@link javax.portlet.PortletResponse} object. @param chain a {@link javax.portlet.filter.FilterChain} object. @throws java.io.IOException if any. @throws javax.portlet.PortletException if any. """ final Object phase = request.getAttribute(PortletRequest.LIFECYCLE_PHASE); if (PortletRequest.ACTION_PHASE.equals(phase)) { chain.doFilter((ActionRequest) request, (ActionResponse) response); } else if (PortletRequest.EVENT_PHASE.equals(phase)) { chain.doFilter((EventRequest) request, (EventResponse) response); } else if (PortletRequest.RENDER_PHASE.equals(phase)) { chain.doFilter((RenderRequest) request, (RenderResponse) response); } else if (PortletRequest.RESOURCE_PHASE.equals(phase)) { chain.doFilter((ResourceRequest) request, (ResourceResponse) response); } else { throw new IllegalArgumentException("Unknown Portlet Lifecycle Phase: " + phase); } }
java
public static void doFilter(PortletRequest request, PortletResponse response, FilterChain chain) throws IOException, PortletException { final Object phase = request.getAttribute(PortletRequest.LIFECYCLE_PHASE); if (PortletRequest.ACTION_PHASE.equals(phase)) { chain.doFilter((ActionRequest) request, (ActionResponse) response); } else if (PortletRequest.EVENT_PHASE.equals(phase)) { chain.doFilter((EventRequest) request, (EventResponse) response); } else if (PortletRequest.RENDER_PHASE.equals(phase)) { chain.doFilter((RenderRequest) request, (RenderResponse) response); } else if (PortletRequest.RESOURCE_PHASE.equals(phase)) { chain.doFilter((ResourceRequest) request, (ResourceResponse) response); } else { throw new IllegalArgumentException("Unknown Portlet Lifecycle Phase: " + phase); } }
[ "public", "static", "void", "doFilter", "(", "PortletRequest", "request", ",", "PortletResponse", "response", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "PortletException", "{", "final", "Object", "phase", "=", "request", ".", "getAttribute", "(", "PortletRequest", ".", "LIFECYCLE_PHASE", ")", ";", "if", "(", "PortletRequest", ".", "ACTION_PHASE", ".", "equals", "(", "phase", ")", ")", "{", "chain", ".", "doFilter", "(", "(", "ActionRequest", ")", "request", ",", "(", "ActionResponse", ")", "response", ")", ";", "}", "else", "if", "(", "PortletRequest", ".", "EVENT_PHASE", ".", "equals", "(", "phase", ")", ")", "{", "chain", ".", "doFilter", "(", "(", "EventRequest", ")", "request", ",", "(", "EventResponse", ")", "response", ")", ";", "}", "else", "if", "(", "PortletRequest", ".", "RENDER_PHASE", ".", "equals", "(", "phase", ")", ")", "{", "chain", ".", "doFilter", "(", "(", "RenderRequest", ")", "request", ",", "(", "RenderResponse", ")", "response", ")", ";", "}", "else", "if", "(", "PortletRequest", ".", "RESOURCE_PHASE", ".", "equals", "(", "phase", ")", ")", "{", "chain", ".", "doFilter", "(", "(", "ResourceRequest", ")", "request", ",", "(", "ResourceResponse", ")", "response", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unknown Portlet Lifecycle Phase: \"", "+", "phase", ")", ";", "}", "}" ]
Call doFilter and use the {@link javax.portlet.PortletRequest#LIFECYCLE_PHASE} attribute to figure out what type of request/response are in use and call the appropriate doFilter method on {@link javax.portlet.filter.FilterChain} @param request a {@link javax.portlet.PortletRequest} object. @param response a {@link javax.portlet.PortletResponse} object. @param chain a {@link javax.portlet.filter.FilterChain} object. @throws java.io.IOException if any. @throws javax.portlet.PortletException if any.
[ "Call", "doFilter", "and", "use", "the", "{", "@link", "javax", ".", "portlet", ".", "PortletRequest#LIFECYCLE_PHASE", "}", "attribute", "to", "figure", "out", "what", "type", "of", "request", "/", "response", "are", "in", "use", "and", "call", "the", "appropriate", "doFilter", "method", "on", "{", "@link", "javax", ".", "portlet", ".", "filter", ".", "FilterChain", "}" ]
train
https://github.com/Jasig/spring-portlet-contrib/blob/719240fa268ddc69900ce9775d9cad3b9c543c6b/spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/filter/PortletFilterUtils.java#L61-L81
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java
RegistriesInner.importImageAsync
public Observable<Void> importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { """ Copies an image to this container registry from the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param parameters The parameters specifying the image to copy and the source container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> importImageAsync(String resourceGroupName, String registryName, ImportImageParameters parameters) { return importImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "importImageAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "ImportImageParameters", "parameters", ")", "{", "return", "importImageWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Copies an image to this container registry from the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param parameters The parameters specifying the image to copy and the source container registry. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Copies", "an", "image", "to", "this", "container", "registry", "from", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L193-L200
negusoft/holoaccent
HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java
BitmapUtils.processTintTransformationMap
public static Bitmap processTintTransformationMap(Bitmap transformationMap, int tintColor) { """ Apply the given tint color to the transformation map. @param transformationMap A bitmap representing the transformation map. @param tintColor Tint color to be applied. @return A bitmap with the with the tint color set. """ // tint color int[] t = new int[] { Color.red(tintColor), Color.green(tintColor), Color.blue(tintColor) }; int width = transformationMap.getWidth(); int height = transformationMap.getHeight(); int[] pixels = new int[width * height]; transformationMap.getPixels(pixels, 0, width, 0, 0, width, height); float[] transformation = new float[2]; for (int i=0; i<pixels.length; i++) { int color = pixels[i]; int alpha = Color.alpha(color); transformation[0] = Color.red(color) / 255f; transformation[1] = Color.green(color) / 255f; pixels[i] = applyTransformation(t, alpha, transformation); } return Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888); }
java
public static Bitmap processTintTransformationMap(Bitmap transformationMap, int tintColor) { // tint color int[] t = new int[] { Color.red(tintColor), Color.green(tintColor), Color.blue(tintColor) }; int width = transformationMap.getWidth(); int height = transformationMap.getHeight(); int[] pixels = new int[width * height]; transformationMap.getPixels(pixels, 0, width, 0, 0, width, height); float[] transformation = new float[2]; for (int i=0; i<pixels.length; i++) { int color = pixels[i]; int alpha = Color.alpha(color); transformation[0] = Color.red(color) / 255f; transformation[1] = Color.green(color) / 255f; pixels[i] = applyTransformation(t, alpha, transformation); } return Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888); }
[ "public", "static", "Bitmap", "processTintTransformationMap", "(", "Bitmap", "transformationMap", ",", "int", "tintColor", ")", "{", "// tint color", "int", "[", "]", "t", "=", "new", "int", "[", "]", "{", "Color", ".", "red", "(", "tintColor", ")", ",", "Color", ".", "green", "(", "tintColor", ")", ",", "Color", ".", "blue", "(", "tintColor", ")", "}", ";", "int", "width", "=", "transformationMap", ".", "getWidth", "(", ")", ";", "int", "height", "=", "transformationMap", ".", "getHeight", "(", ")", ";", "int", "[", "]", "pixels", "=", "new", "int", "[", "width", "*", "height", "]", ";", "transformationMap", ".", "getPixels", "(", "pixels", ",", "0", ",", "width", ",", "0", ",", "0", ",", "width", ",", "height", ")", ";", "float", "[", "]", "transformation", "=", "new", "float", "[", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pixels", ".", "length", ";", "i", "++", ")", "{", "int", "color", "=", "pixels", "[", "i", "]", ";", "int", "alpha", "=", "Color", ".", "alpha", "(", "color", ")", ";", "transformation", "[", "0", "]", "=", "Color", ".", "red", "(", "color", ")", "/", "255f", ";", "transformation", "[", "1", "]", "=", "Color", ".", "green", "(", "color", ")", "/", "255f", ";", "pixels", "[", "i", "]", "=", "applyTransformation", "(", "t", ",", "alpha", ",", "transformation", ")", ";", "}", "return", "Bitmap", ".", "createBitmap", "(", "pixels", ",", "width", ",", "height", ",", "Bitmap", ".", "Config", ".", "ARGB_8888", ")", ";", "}" ]
Apply the given tint color to the transformation map. @param transformationMap A bitmap representing the transformation map. @param tintColor Tint color to be applied. @return A bitmap with the with the tint color set.
[ "Apply", "the", "given", "tint", "color", "to", "the", "transformation", "map", "." ]
train
https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/util/BitmapUtils.java#L160-L182
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterTokenServices.java
TwitterTokenServices.isSuccessfulResult
protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) { """ Determines whether the result was successful by looking at the response status value contained in the result. @param result May contain token secrets, so has been annotated as @Sensitive. @param endpoint @return """ if (result == null) { Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint }); return false; } String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null; String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null; if (responseStatus == null) { Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint }); return false; } if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) { Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg }); return false; } return true; }
java
protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) { if (result == null) { Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint }); return false; } String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null; String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null; if (responseStatus == null) { Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint }); return false; } if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) { Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg }); return false; } return true; }
[ "protected", "boolean", "isSuccessfulResult", "(", "@", "Sensitive", "Map", "<", "String", ",", "Object", ">", "result", ",", "String", "endpoint", ")", "{", "if", "(", "result", "==", "null", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT\"", ",", "new", "Object", "[", "]", "{", "endpoint", "}", ")", ";", "return", "false", ";", "}", "String", "responseStatus", "=", "result", ".", "containsKey", "(", "TwitterConstants", ".", "RESULT_RESPONSE_STATUS", ")", "?", "(", "String", ")", "result", ".", "get", "(", "TwitterConstants", ".", "RESULT_RESPONSE_STATUS", ")", ":", "null", ";", "String", "responseMsg", "=", "result", ".", "containsKey", "(", "TwitterConstants", ".", "RESULT_MESSAGE", ")", "?", "(", "String", ")", "result", ".", "get", "(", "TwitterConstants", ".", "RESULT_MESSAGE", ")", ":", "null", ";", "if", "(", "responseStatus", "==", "null", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"TWITTER_RESPONSE_STATUS_MISSING\"", ",", "new", "Object", "[", "]", "{", "endpoint", "}", ")", ";", "return", "false", ";", "}", "if", "(", "!", "responseStatus", ".", "equals", "(", "TwitterConstants", ".", "RESULT_SUCCESS", ")", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"TWITTER_RESPONSE_FAILURE\"", ",", "new", "Object", "[", "]", "{", "endpoint", ",", "(", "responseMsg", "==", "null", ")", "?", "\"\"", ":", "responseMsg", "}", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Determines whether the result was successful by looking at the response status value contained in the result. @param result May contain token secrets, so has been annotated as @Sensitive. @param endpoint @return
[ "Determines", "whether", "the", "result", "was", "successful", "by", "looking", "at", "the", "response", "status", "value", "contained", "in", "the", "result", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterTokenServices.java#L233-L252
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java
ImagesInner.createOrUpdate
public ImageInner createOrUpdate(String resourceGroupName, String imageName, ImageInner parameters) { """ Create or update an image. @param resourceGroupName The name of the resource group. @param imageName The name of the image. @param parameters Parameters supplied to the Create Image operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImageInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).toBlocking().last().body(); }
java
public ImageInner createOrUpdate(String resourceGroupName, String imageName, ImageInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).toBlocking().last().body(); }
[ "public", "ImageInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "imageName", ",", "ImageInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "imageName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update an image. @param resourceGroupName The name of the resource group. @param imageName The name of the image. @param parameters Parameters supplied to the Create Image operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImageInner object if successful.
[ "Create", "or", "update", "an", "image", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java#L116-L118
integration-technology/amazon-mws-orders
src/main/java/com/amazonservices/mws/client/MwsUtl.java
MwsUtl.calculateStringToSignV1
private static String calculateStringToSignV1(Map<String, String> parameters) { """ Calculate String to Sign for SignatureVersion 1 @param parameters request parameters @return String to Sign """ StringBuilder data = new StringBuilder(); Map<String, String> sorted = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); sorted.putAll(parameters); Iterator<Entry<String, String>> pairs = sorted.entrySet().iterator(); while (pairs.hasNext()) { Map.Entry<String, String> pair = pairs.next(); data.append(pair.getKey()); data.append(pair.getValue()); } return data.toString(); }
java
private static String calculateStringToSignV1(Map<String, String> parameters) { StringBuilder data = new StringBuilder(); Map<String, String> sorted = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER); sorted.putAll(parameters); Iterator<Entry<String, String>> pairs = sorted.entrySet().iterator(); while (pairs.hasNext()) { Map.Entry<String, String> pair = pairs.next(); data.append(pair.getKey()); data.append(pair.getValue()); } return data.toString(); }
[ "private", "static", "String", "calculateStringToSignV1", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "StringBuilder", "data", "=", "new", "StringBuilder", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "sorted", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", "String", ".", "CASE_INSENSITIVE_ORDER", ")", ";", "sorted", ".", "putAll", "(", "parameters", ")", ";", "Iterator", "<", "Entry", "<", "String", ",", "String", ">", ">", "pairs", "=", "sorted", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "pairs", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "String", ",", "String", ">", "pair", "=", "pairs", ".", "next", "(", ")", ";", "data", ".", "append", "(", "pair", ".", "getKey", "(", ")", ")", ";", "data", ".", "append", "(", "pair", ".", "getValue", "(", ")", ")", ";", "}", "return", "data", ".", "toString", "(", ")", ";", "}" ]
Calculate String to Sign for SignatureVersion 1 @param parameters request parameters @return String to Sign
[ "Calculate", "String", "to", "Sign", "for", "SignatureVersion", "1" ]
train
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsUtl.java#L141-L152
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculator.java
VariantAggregatedStatsCalculator.parseMappedStats
protected void parseMappedStats(Variant variant, StudyEntry file, int numAllele, String reference, String[] alternateAlleles, Map<String, String> info) { """ Looks in the info map for keys present as values in the tagMap passed in the constructor VariantAggregatedStatsCalculator(Properties tagMap), and calculates stats for each cohort described in the tagMap. @param variant @param file @param numAllele @param reference @param alternateAlleles @param info """ Map<String, Map<String, String>> cohortStats = new LinkedHashMap<>(); // cohortName -> (statsName -> statsValue): EUR->(AC->3,2) for (Map.Entry<String, String> entry : info.entrySet()) { if (reverseTagMap.containsKey(entry.getKey())) { String opencgaTag = reverseTagMap.get(entry.getKey()); String[] tagSplit = opencgaTag.split(DOT); String cohortName = tagSplit[0]; String statName = tagSplit[1]; Map<String, String> parsedValues = cohortStats.get(cohortName); if (parsedValues == null) { parsedValues = new LinkedHashMap<>(); cohortStats.put(cohortName, parsedValues); } parsedValues.put(statName, entry.getValue()); } } for (String cohortName : cohortStats.keySet()) { VariantStats vs = new VariantStats(); calculate(variant, file, numAllele, reference, alternateAlleles, cohortStats.get(cohortName), vs); file.setStats(cohortName, vs); } }
java
protected void parseMappedStats(Variant variant, StudyEntry file, int numAllele, String reference, String[] alternateAlleles, Map<String, String> info) { Map<String, Map<String, String>> cohortStats = new LinkedHashMap<>(); // cohortName -> (statsName -> statsValue): EUR->(AC->3,2) for (Map.Entry<String, String> entry : info.entrySet()) { if (reverseTagMap.containsKey(entry.getKey())) { String opencgaTag = reverseTagMap.get(entry.getKey()); String[] tagSplit = opencgaTag.split(DOT); String cohortName = tagSplit[0]; String statName = tagSplit[1]; Map<String, String> parsedValues = cohortStats.get(cohortName); if (parsedValues == null) { parsedValues = new LinkedHashMap<>(); cohortStats.put(cohortName, parsedValues); } parsedValues.put(statName, entry.getValue()); } } for (String cohortName : cohortStats.keySet()) { VariantStats vs = new VariantStats(); calculate(variant, file, numAllele, reference, alternateAlleles, cohortStats.get(cohortName), vs); file.setStats(cohortName, vs); } }
[ "protected", "void", "parseMappedStats", "(", "Variant", "variant", ",", "StudyEntry", "file", ",", "int", "numAllele", ",", "String", "reference", ",", "String", "[", "]", "alternateAlleles", ",", "Map", "<", "String", ",", "String", ">", "info", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "cohortStats", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "// cohortName -> (statsName -> statsValue): EUR->(AC->3,2)", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "info", ".", "entrySet", "(", ")", ")", "{", "if", "(", "reverseTagMap", ".", "containsKey", "(", "entry", ".", "getKey", "(", ")", ")", ")", "{", "String", "opencgaTag", "=", "reverseTagMap", ".", "get", "(", "entry", ".", "getKey", "(", ")", ")", ";", "String", "[", "]", "tagSplit", "=", "opencgaTag", ".", "split", "(", "DOT", ")", ";", "String", "cohortName", "=", "tagSplit", "[", "0", "]", ";", "String", "statName", "=", "tagSplit", "[", "1", "]", ";", "Map", "<", "String", ",", "String", ">", "parsedValues", "=", "cohortStats", ".", "get", "(", "cohortName", ")", ";", "if", "(", "parsedValues", "==", "null", ")", "{", "parsedValues", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "cohortStats", ".", "put", "(", "cohortName", ",", "parsedValues", ")", ";", "}", "parsedValues", ".", "put", "(", "statName", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "for", "(", "String", "cohortName", ":", "cohortStats", ".", "keySet", "(", ")", ")", "{", "VariantStats", "vs", "=", "new", "VariantStats", "(", ")", ";", "calculate", "(", "variant", ",", "file", ",", "numAllele", ",", "reference", ",", "alternateAlleles", ",", "cohortStats", ".", "get", "(", "cohortName", ")", ",", "vs", ")", ";", "file", ".", "setStats", "(", "cohortName", ",", "vs", ")", ";", "}", "}" ]
Looks in the info map for keys present as values in the tagMap passed in the constructor VariantAggregatedStatsCalculator(Properties tagMap), and calculates stats for each cohort described in the tagMap. @param variant @param file @param numAllele @param reference @param alternateAlleles @param info
[ "Looks", "in", "the", "info", "map", "for", "keys", "present", "as", "values", "in", "the", "tagMap", "passed", "in", "the", "constructor", "VariantAggregatedStatsCalculator", "(", "Properties", "tagMap", ")", "and", "calculates", "stats", "for", "each", "cohort", "described", "in", "the", "tagMap", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/stats/VariantAggregatedStatsCalculator.java#L160-L182
abel533/Mapper
core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java
SqlHelper.insertColumns
public static String insertColumns(Class<?> entityClass, boolean skipId, boolean notNull, boolean notEmpty) { """ insert table()列 @param entityClass @param skipId 是否从列中忽略id类型 @param notNull 是否判断!=null @param notEmpty 是否判断String类型!='' @return """ StringBuilder sql = new StringBuilder(); sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">"); //获取全部列 Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass); //当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值 for (EntityColumn column : columnSet) { if (!column.isInsertable()) { continue; } if (skipId && column.isId()) { continue; } if (notNull) { sql.append(SqlHelper.getIfNotNull(column, column.getColumn() + ",", notEmpty)); } else { sql.append(column.getColumn() + ","); } } sql.append("</trim>"); return sql.toString(); }
java
public static String insertColumns(Class<?> entityClass, boolean skipId, boolean notNull, boolean notEmpty) { StringBuilder sql = new StringBuilder(); sql.append("<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\">"); //获取全部列 Set<EntityColumn> columnSet = EntityHelper.getColumns(entityClass); //当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值 for (EntityColumn column : columnSet) { if (!column.isInsertable()) { continue; } if (skipId && column.isId()) { continue; } if (notNull) { sql.append(SqlHelper.getIfNotNull(column, column.getColumn() + ",", notEmpty)); } else { sql.append(column.getColumn() + ","); } } sql.append("</trim>"); return sql.toString(); }
[ "public", "static", "String", "insertColumns", "(", "Class", "<", "?", ">", "entityClass", ",", "boolean", "skipId", ",", "boolean", "notNull", ",", "boolean", "notEmpty", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "\"<trim prefix=\\\"(\\\" suffix=\\\")\\\" suffixOverrides=\\\",\\\">\"", ")", ";", "//获取全部列", "Set", "<", "EntityColumn", ">", "columnSet", "=", "EntityHelper", ".", "getColumns", "(", "entityClass", ")", ";", "//当某个列有主键策略时,不需要考虑他的属性是否为空,因为如果为空,一定会根据主键策略给他生成一个值", "for", "(", "EntityColumn", "column", ":", "columnSet", ")", "{", "if", "(", "!", "column", ".", "isInsertable", "(", ")", ")", "{", "continue", ";", "}", "if", "(", "skipId", "&&", "column", ".", "isId", "(", ")", ")", "{", "continue", ";", "}", "if", "(", "notNull", ")", "{", "sql", ".", "append", "(", "SqlHelper", ".", "getIfNotNull", "(", "column", ",", "column", ".", "getColumn", "(", ")", "+", "\",\"", ",", "notEmpty", ")", ")", ";", "}", "else", "{", "sql", ".", "append", "(", "column", ".", "getColumn", "(", ")", "+", "\",\"", ")", ";", "}", "}", "sql", ".", "append", "(", "\"</trim>\"", ")", ";", "return", "sql", ".", "toString", "(", ")", ";", "}" ]
insert table()列 @param entityClass @param skipId 是否从列中忽略id类型 @param notNull 是否判断!=null @param notEmpty 是否判断String类型!='' @return
[ "insert", "table", "()", "列" ]
train
https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java#L402-L423
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
PageFlowRequestProcessor.processNoCache
protected void processNoCache( HttpServletRequest request, HttpServletResponse response ) { """ Set the no-cache headers. This overrides the base Struts behavior to prevent caching even for the pages. """ // // Set the no-cache headers if: // 1) the module is configured for it, or // 2) netui-config.xml has an "always" value for <pageflow-config><prevent-cache>, or // 3) netui-config.xml has an "inDevMode" value for <pageflow-config><prevent-cache>, and we're not in // production mode. // boolean noCache = moduleConfig.getControllerConfig().getNocache(); if ( ! noCache ) { PageFlowConfig pfConfig = ConfigUtil.getConfig().getPageFlowConfig(); if ( pfConfig != null ) { PreventCache preventCache = pfConfig.getPreventCache(); if ( preventCache != null ) { switch ( preventCache.getValue() ) { case PreventCache.INT_ALWAYS: noCache = true; break; case PreventCache.INT_IN_DEV_MODE: noCache = ! _servletContainerAdapter.isInProductionMode(); break; } } } } if ( noCache ) { // // The call to PageFlowPageFilter.preventCache() will cause caching to be prevented // even when we end up forwarding to a page. Normally, no-cache headers are lost // when a server forward occurs. // ServletUtils.preventCache( response ); PageFlowUtils.setPreventCache( request ); } }
java
protected void processNoCache( HttpServletRequest request, HttpServletResponse response ) { // // Set the no-cache headers if: // 1) the module is configured for it, or // 2) netui-config.xml has an "always" value for <pageflow-config><prevent-cache>, or // 3) netui-config.xml has an "inDevMode" value for <pageflow-config><prevent-cache>, and we're not in // production mode. // boolean noCache = moduleConfig.getControllerConfig().getNocache(); if ( ! noCache ) { PageFlowConfig pfConfig = ConfigUtil.getConfig().getPageFlowConfig(); if ( pfConfig != null ) { PreventCache preventCache = pfConfig.getPreventCache(); if ( preventCache != null ) { switch ( preventCache.getValue() ) { case PreventCache.INT_ALWAYS: noCache = true; break; case PreventCache.INT_IN_DEV_MODE: noCache = ! _servletContainerAdapter.isInProductionMode(); break; } } } } if ( noCache ) { // // The call to PageFlowPageFilter.preventCache() will cause caching to be prevented // even when we end up forwarding to a page. Normally, no-cache headers are lost // when a server forward occurs. // ServletUtils.preventCache( response ); PageFlowUtils.setPreventCache( request ); } }
[ "protected", "void", "processNoCache", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "//", "// Set the no-cache headers if:", "// 1) the module is configured for it, or", "// 2) netui-config.xml has an \"always\" value for <pageflow-config><prevent-cache>, or", "// 3) netui-config.xml has an \"inDevMode\" value for <pageflow-config><prevent-cache>, and we're not in", "// production mode.", "//", "boolean", "noCache", "=", "moduleConfig", ".", "getControllerConfig", "(", ")", ".", "getNocache", "(", ")", ";", "if", "(", "!", "noCache", ")", "{", "PageFlowConfig", "pfConfig", "=", "ConfigUtil", ".", "getConfig", "(", ")", ".", "getPageFlowConfig", "(", ")", ";", "if", "(", "pfConfig", "!=", "null", ")", "{", "PreventCache", "preventCache", "=", "pfConfig", ".", "getPreventCache", "(", ")", ";", "if", "(", "preventCache", "!=", "null", ")", "{", "switch", "(", "preventCache", ".", "getValue", "(", ")", ")", "{", "case", "PreventCache", ".", "INT_ALWAYS", ":", "noCache", "=", "true", ";", "break", ";", "case", "PreventCache", ".", "INT_IN_DEV_MODE", ":", "noCache", "=", "!", "_servletContainerAdapter", ".", "isInProductionMode", "(", ")", ";", "break", ";", "}", "}", "}", "}", "if", "(", "noCache", ")", "{", "//", "// The call to PageFlowPageFilter.preventCache() will cause caching to be prevented", "// even when we end up forwarding to a page. Normally, no-cache headers are lost", "// when a server forward occurs.", "//", "ServletUtils", ".", "preventCache", "(", "response", ")", ";", "PageFlowUtils", ".", "setPreventCache", "(", "request", ")", ";", "}", "}" ]
Set the no-cache headers. This overrides the base Struts behavior to prevent caching even for the pages.
[ "Set", "the", "no", "-", "cache", "headers", ".", "This", "overrides", "the", "base", "Struts", "behavior", "to", "prevent", "caching", "even", "for", "the", "pages", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L1976-L2020
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java
GVRShader.bindShader
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview) { """ Select the specific vertex and fragment shader to use. The shader template is used to generate the sources for the vertex and fragment shader based on the vertex, material and light properties. This function may compile the shader if it does not already exist. @param context GVRContext @param rdata renderable entity with mesh and rendering options @param scene list of light sources """ String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); GVRMaterial mtl = rdata.getMaterial(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, mtl); } if (nativeShader > 0) { rdata.setShader(nativeShader, isMultiview); } return nativeShader; } }
java
public int bindShader(GVRContext context, IRenderable rdata, GVRScene scene, boolean isMultiview) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); GVRMaterial mtl = rdata.getMaterial(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, mtl); } if (nativeShader > 0) { rdata.setShader(nativeShader, isMultiview); } return nativeShader; } }
[ "public", "int", "bindShader", "(", "GVRContext", "context", ",", "IRenderable", "rdata", ",", "GVRScene", "scene", ",", "boolean", "isMultiview", ")", "{", "String", "signature", "=", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "GVRShaderManager", "shaderManager", "=", "context", ".", "getShaderManager", "(", ")", ";", "GVRMaterial", "mtl", "=", "rdata", ".", "getMaterial", "(", ")", ";", "synchronized", "(", "shaderManager", ")", "{", "int", "nativeShader", "=", "shaderManager", ".", "getShader", "(", "signature", ")", ";", "if", "(", "nativeShader", "==", "0", ")", "{", "nativeShader", "=", "addShader", "(", "shaderManager", ",", "signature", ",", "mtl", ")", ";", "}", "if", "(", "nativeShader", ">", "0", ")", "{", "rdata", ".", "setShader", "(", "nativeShader", ",", "isMultiview", ")", ";", "}", "return", "nativeShader", ";", "}", "}" ]
Select the specific vertex and fragment shader to use. The shader template is used to generate the sources for the vertex and fragment shader based on the vertex, material and light properties. This function may compile the shader if it does not already exist. @param context GVRContext @param rdata renderable entity with mesh and rendering options @param scene list of light sources
[ "Select", "the", "specific", "vertex", "and", "fragment", "shader", "to", "use", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java#L306-L325
mojohaus/build-helper-maven-plugin
src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java
ReserveListenerPortMojo.findAvailablePortNumber
private int findAvailablePortNumber( Integer portNumberStartingPoint, List<Integer> reservedPorts ) { """ Returns the first number available, starting at portNumberStartingPoint that's not already in the reservedPorts list. @param portNumberStartingPoint first port number to start from. @param reservedPorts the ports already reserved. @return first number available not in the given list, starting at the given parameter. """ assert portNumberStartingPoint != null; int candidate = portNumberStartingPoint; while ( reservedPorts.contains( candidate ) ) { candidate++; } return candidate; }
java
private int findAvailablePortNumber( Integer portNumberStartingPoint, List<Integer> reservedPorts ) { assert portNumberStartingPoint != null; int candidate = portNumberStartingPoint; while ( reservedPorts.contains( candidate ) ) { candidate++; } return candidate; }
[ "private", "int", "findAvailablePortNumber", "(", "Integer", "portNumberStartingPoint", ",", "List", "<", "Integer", ">", "reservedPorts", ")", "{", "assert", "portNumberStartingPoint", "!=", "null", ";", "int", "candidate", "=", "portNumberStartingPoint", ";", "while", "(", "reservedPorts", ".", "contains", "(", "candidate", ")", ")", "{", "candidate", "++", ";", "}", "return", "candidate", ";", "}" ]
Returns the first number available, starting at portNumberStartingPoint that's not already in the reservedPorts list. @param portNumberStartingPoint first port number to start from. @param reservedPorts the ports already reserved. @return first number available not in the given list, starting at the given parameter.
[ "Returns", "the", "first", "number", "available", "starting", "at", "portNumberStartingPoint", "that", "s", "not", "already", "in", "the", "reservedPorts", "list", "." ]
train
https://github.com/mojohaus/build-helper-maven-plugin/blob/9b5f82fb04c9824917f8b29d8e12d804e3c36cf0/src/main/java/org/codehaus/mojo/buildhelper/ReserveListenerPortMojo.java#L366-L375
GII/broccoli
broccoli-impl/src/main/java/com/hi3project/broccoli/bsdl/impl/parsing/xml/AxiomAssign.java
AxiomAssign.assignParsedElement
public boolean assignParsedElement(Multiplicity parsedMultiplicity, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException { """ /* A property: -has a min: number or "*" -has a max: number or "*" """ if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MIN()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMin(null); } else { parsedMultiplicity.setMin(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MAX()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMax(null); } else { parsedMultiplicity.setMax(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } return false; }
java
public boolean assignParsedElement(Multiplicity parsedMultiplicity, String syntaxElementName, ISyntaxElement syntaxElement) throws ModelException { if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MIN()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMin(null); } else { parsedMultiplicity.setMin(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } if (syntaxElementName.equalsIgnoreCase(XMLSyntax.MULTIPLICITY_MAX()) && syntaxElement instanceof SimpleProperty) { if (((SimpleProperty) syntaxElement).getValue().toString().equalsIgnoreCase("*")) { parsedMultiplicity.setMax(null); } else { parsedMultiplicity.setMax(Integer.parseInt(((SimpleProperty) syntaxElement).getValue().toString())); } return true; } return false; }
[ "public", "boolean", "assignParsedElement", "(", "Multiplicity", "parsedMultiplicity", ",", "String", "syntaxElementName", ",", "ISyntaxElement", "syntaxElement", ")", "throws", "ModelException", "{", "if", "(", "syntaxElementName", ".", "equalsIgnoreCase", "(", "XMLSyntax", ".", "MULTIPLICITY_MIN", "(", ")", ")", "&&", "syntaxElement", "instanceof", "SimpleProperty", ")", "{", "if", "(", "(", "(", "SimpleProperty", ")", "syntaxElement", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ".", "equalsIgnoreCase", "(", "\"*\"", ")", ")", "{", "parsedMultiplicity", ".", "setMin", "(", "null", ")", ";", "}", "else", "{", "parsedMultiplicity", ".", "setMin", "(", "Integer", ".", "parseInt", "(", "(", "(", "SimpleProperty", ")", "syntaxElement", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "return", "true", ";", "}", "if", "(", "syntaxElementName", ".", "equalsIgnoreCase", "(", "XMLSyntax", ".", "MULTIPLICITY_MAX", "(", ")", ")", "&&", "syntaxElement", "instanceof", "SimpleProperty", ")", "{", "if", "(", "(", "(", "SimpleProperty", ")", "syntaxElement", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ".", "equalsIgnoreCase", "(", "\"*\"", ")", ")", "{", "parsedMultiplicity", ".", "setMax", "(", "null", ")", ";", "}", "else", "{", "parsedMultiplicity", ".", "setMax", "(", "Integer", ".", "parseInt", "(", "(", "(", "SimpleProperty", ")", "syntaxElement", ")", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "return", "true", ";", "}", "return", "false", ";", "}" ]
/* A property: -has a min: number or "*" -has a max: number or "*"
[ "/", "*", "A", "property", ":", "-", "has", "a", "min", ":", "number", "or", "*", "-", "has", "a", "max", ":", "number", "or", "*" ]
train
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-impl/src/main/java/com/hi3project/broccoli/bsdl/impl/parsing/xml/AxiomAssign.java#L327-L345
forge/core
javaee/scaffold-faces/src/main/java/org/jboss/forge/addon/scaffold/faces/metawidget/widgetbuilder/EntityWidgetBuilder.java
EntityWidgetBuilder.addSelectItems
@Override protected void addSelectItems(HtmlSelectOneMenu select, String valueExpression, Map<String, String> attributes) { """ Overrriden to enhance the default f:selectItem widget with more suitable item labels """ // Empty option // // Note: a 'null' value (rather than an empty String') renders an <f:selectItem/> rather // than an <f:selectItem itemValue=""/>. This works out better if the HtmlSelectOneMenu has // a converter, because the empty String may not be a compatible value if (WidgetBuilderUtils.needsEmptyLookupItem(attributes)) { addSelectItem(select, null, null); } // Add the select items SelectItems selectItems = new SelectItems(); selectItems.putAttribute("value", valueExpression); // For each item to be displayed, set the label to the reverse primary key value if (attributes.containsKey(REVERSE_PRIMARY_KEY)) { selectItems.putAttribute("var", SELECT_ITEM); selectItems.putAttribute("itemValue", StaticFacesUtils.wrapExpression(SELECT_ITEM)); String displayExpression = "forgeview:display(_item)"; ((BaseStaticXmlWidget) selectItems).putAdditionalNamespaceURI("forgeview", "http://jboss.org/forge/view"); selectItems.putAttribute("itemLabel", StaticFacesUtils.wrapExpression(displayExpression)); } select.getChildren().add(selectItems); }
java
@Override protected void addSelectItems(HtmlSelectOneMenu select, String valueExpression, Map<String, String> attributes) { // Empty option // // Note: a 'null' value (rather than an empty String') renders an <f:selectItem/> rather // than an <f:selectItem itemValue=""/>. This works out better if the HtmlSelectOneMenu has // a converter, because the empty String may not be a compatible value if (WidgetBuilderUtils.needsEmptyLookupItem(attributes)) { addSelectItem(select, null, null); } // Add the select items SelectItems selectItems = new SelectItems(); selectItems.putAttribute("value", valueExpression); // For each item to be displayed, set the label to the reverse primary key value if (attributes.containsKey(REVERSE_PRIMARY_KEY)) { selectItems.putAttribute("var", SELECT_ITEM); selectItems.putAttribute("itemValue", StaticFacesUtils.wrapExpression(SELECT_ITEM)); String displayExpression = "forgeview:display(_item)"; ((BaseStaticXmlWidget) selectItems).putAdditionalNamespaceURI("forgeview", "http://jboss.org/forge/view"); selectItems.putAttribute("itemLabel", StaticFacesUtils.wrapExpression(displayExpression)); } select.getChildren().add(selectItems); }
[ "@", "Override", "protected", "void", "addSelectItems", "(", "HtmlSelectOneMenu", "select", ",", "String", "valueExpression", ",", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "// Empty option", "//", "// Note: a 'null' value (rather than an empty String') renders an <f:selectItem/> rather", "// than an <f:selectItem itemValue=\"\"/>. This works out better if the HtmlSelectOneMenu has", "// a converter, because the empty String may not be a compatible value", "if", "(", "WidgetBuilderUtils", ".", "needsEmptyLookupItem", "(", "attributes", ")", ")", "{", "addSelectItem", "(", "select", ",", "null", ",", "null", ")", ";", "}", "// Add the select items", "SelectItems", "selectItems", "=", "new", "SelectItems", "(", ")", ";", "selectItems", ".", "putAttribute", "(", "\"value\"", ",", "valueExpression", ")", ";", "// For each item to be displayed, set the label to the reverse primary key value", "if", "(", "attributes", ".", "containsKey", "(", "REVERSE_PRIMARY_KEY", ")", ")", "{", "selectItems", ".", "putAttribute", "(", "\"var\"", ",", "SELECT_ITEM", ")", ";", "selectItems", ".", "putAttribute", "(", "\"itemValue\"", ",", "StaticFacesUtils", ".", "wrapExpression", "(", "SELECT_ITEM", ")", ")", ";", "String", "displayExpression", "=", "\"forgeview:display(_item)\"", ";", "(", "(", "BaseStaticXmlWidget", ")", "selectItems", ")", ".", "putAdditionalNamespaceURI", "(", "\"forgeview\"", ",", "\"http://jboss.org/forge/view\"", ")", ";", "selectItems", ".", "putAttribute", "(", "\"itemLabel\"", ",", "StaticFacesUtils", ".", "wrapExpression", "(", "displayExpression", ")", ")", ";", "}", "select", ".", "getChildren", "(", ")", ".", "add", "(", "selectItems", ")", ";", "}" ]
Overrriden to enhance the default f:selectItem widget with more suitable item labels
[ "Overrriden", "to", "enhance", "the", "default", "f", ":", "selectItem", "widget", "with", "more", "suitable", "item", "labels" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/scaffold-faces/src/main/java/org/jboss/forge/addon/scaffold/faces/metawidget/widgetbuilder/EntityWidgetBuilder.java#L681-L712
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java
SQLiteDatabase.dumpAll
static void dumpAll(Printer printer, boolean verbose) { """ Dump detailed information about all open databases in the current process. Used by bug report. """ for (SQLiteDatabase db : getActiveDatabases()) { db.dump(printer, verbose); } }
java
static void dumpAll(Printer printer, boolean verbose) { for (SQLiteDatabase db : getActiveDatabases()) { db.dump(printer, verbose); } }
[ "static", "void", "dumpAll", "(", "Printer", "printer", ",", "boolean", "verbose", ")", "{", "for", "(", "SQLiteDatabase", "db", ":", "getActiveDatabases", "(", ")", ")", "{", "db", ".", "dump", "(", "printer", ",", "verbose", ")", ";", "}", "}" ]
Dump detailed information about all open databases in the current process. Used by bug report.
[ "Dump", "detailed", "information", "about", "all", "open", "databases", "in", "the", "current", "process", ".", "Used", "by", "bug", "report", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L2062-L2066
agmip/agmip-common-functions
src/main/java/org/agmip/functions/ExperimentHelper.java
ExperimentHelper.isSameDate
private static boolean isSameDate(String date1, String date2, String separator) { """ To check if two input date string is same date with no matter about 2nd input's separator @param date1 1st input date string with format yyyymmdd @param date2 2nd input date string with format mmdd or mm-dd @param separator The separator used in 2nd string @return comparison result """ date2 = date2.replace(separator, ""); if (date2.equals("0229")) { try { int year1 = Integer.parseInt(date1.substring(2, 4)); if (year1 % 4 != 0) { return date1.endsWith("0228"); } } catch (Exception e) { return false; } } return date1.endsWith(date2); }
java
private static boolean isSameDate(String date1, String date2, String separator) { date2 = date2.replace(separator, ""); if (date2.equals("0229")) { try { int year1 = Integer.parseInt(date1.substring(2, 4)); if (year1 % 4 != 0) { return date1.endsWith("0228"); } } catch (Exception e) { return false; } } return date1.endsWith(date2); }
[ "private", "static", "boolean", "isSameDate", "(", "String", "date1", ",", "String", "date2", ",", "String", "separator", ")", "{", "date2", "=", "date2", ".", "replace", "(", "separator", ",", "\"\"", ")", ";", "if", "(", "date2", ".", "equals", "(", "\"0229\"", ")", ")", "{", "try", "{", "int", "year1", "=", "Integer", ".", "parseInt", "(", "date1", ".", "substring", "(", "2", ",", "4", ")", ")", ";", "if", "(", "year1", "%", "4", "!=", "0", ")", "{", "return", "date1", ".", "endsWith", "(", "\"0228\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "}", "return", "date1", ".", "endsWith", "(", "date2", ")", ";", "}" ]
To check if two input date string is same date with no matter about 2nd input's separator @param date1 1st input date string with format yyyymmdd @param date2 2nd input date string with format mmdd or mm-dd @param separator The separator used in 2nd string @return comparison result
[ "To", "check", "if", "two", "input", "date", "string", "is", "same", "date", "with", "no", "matter", "about", "2nd", "input", "s", "separator" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/ExperimentHelper.java#L498-L513
structr/structr
structr-ui/src/main/java/org/structr/web/common/FileHelper.java
FileHelper.writeToFile
public static void writeToFile(final File fileNode, final byte[] data) throws FrameworkException, IOException { """ Write binary data from byte[] to a file and reference the file on disk at the given file node @param fileNode @param data @throws FrameworkException @throws IOException """ setFileProperties(fileNode); FileUtils.writeByteArrayToFile(fileNode.getFileOnDisk(), data); }
java
public static void writeToFile(final File fileNode, final byte[] data) throws FrameworkException, IOException { setFileProperties(fileNode); FileUtils.writeByteArrayToFile(fileNode.getFileOnDisk(), data); }
[ "public", "static", "void", "writeToFile", "(", "final", "File", "fileNode", ",", "final", "byte", "[", "]", "data", ")", "throws", "FrameworkException", ",", "IOException", "{", "setFileProperties", "(", "fileNode", ")", ";", "FileUtils", ".", "writeByteArrayToFile", "(", "fileNode", ".", "getFileOnDisk", "(", ")", ",", "data", ")", ";", "}" ]
Write binary data from byte[] to a file and reference the file on disk at the given file node @param fileNode @param data @throws FrameworkException @throws IOException
[ "Write", "binary", "data", "from", "byte", "[]", "to", "a", "file", "and", "reference", "the", "file", "on", "disk", "at", "the", "given", "file", "node" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L549-L555
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java
AuthorizationProcessManager.handleAuthorizationFailure
private void handleAuthorizationFailure(Response response, Throwable t, JSONObject extendedInfo) { """ Handle failure in the authorization process. All the response listeners will be updated with failure @param response response that caused to failure @param t additional info about the failure """ logger.error("authorization process failed"); if (t != null) { t.printStackTrace(); } Iterator<ResponseListener> iterator = authorizationQueue.iterator(); while(iterator.hasNext()) { ResponseListener next = iterator.next(); next.onFailure(response, t, extendedInfo); iterator.remove(); } }
java
private void handleAuthorizationFailure(Response response, Throwable t, JSONObject extendedInfo) { logger.error("authorization process failed"); if (t != null) { t.printStackTrace(); } Iterator<ResponseListener> iterator = authorizationQueue.iterator(); while(iterator.hasNext()) { ResponseListener next = iterator.next(); next.onFailure(response, t, extendedInfo); iterator.remove(); } }
[ "private", "void", "handleAuthorizationFailure", "(", "Response", "response", ",", "Throwable", "t", ",", "JSONObject", "extendedInfo", ")", "{", "logger", ".", "error", "(", "\"authorization process failed\"", ")", ";", "if", "(", "t", "!=", "null", ")", "{", "t", ".", "printStackTrace", "(", ")", ";", "}", "Iterator", "<", "ResponseListener", ">", "iterator", "=", "authorizationQueue", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "ResponseListener", "next", "=", "iterator", ".", "next", "(", ")", ";", "next", ".", "onFailure", "(", "response", ",", "t", ",", "extendedInfo", ")", ";", "iterator", ".", "remove", "(", ")", ";", "}", "}" ]
Handle failure in the authorization process. All the response listeners will be updated with failure @param response response that caused to failure @param t additional info about the failure
[ "Handle", "failure", "in", "the", "authorization", "process", ".", "All", "the", "response", "listeners", "will", "be", "updated", "with", "failure" ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L443-L457
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java
ImageHolder.decideIcon
public static Drawable decideIcon(ImageHolder imageHolder, Context ctx, int iconColor, boolean tint) { """ a small static helper which catches nulls for us @param imageHolder @param ctx @param iconColor @param tint @return """ if (imageHolder == null) { return null; } else { return imageHolder.decideIcon(ctx, iconColor, tint); } }
java
public static Drawable decideIcon(ImageHolder imageHolder, Context ctx, int iconColor, boolean tint) { if (imageHolder == null) { return null; } else { return imageHolder.decideIcon(ctx, iconColor, tint); } }
[ "public", "static", "Drawable", "decideIcon", "(", "ImageHolder", "imageHolder", ",", "Context", "ctx", ",", "int", "iconColor", ",", "boolean", "tint", ")", "{", "if", "(", "imageHolder", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "imageHolder", ".", "decideIcon", "(", "ctx", ",", "iconColor", ",", "tint", ")", ";", "}", "}" ]
a small static helper which catches nulls for us @param imageHolder @param ctx @param iconColor @param tint @return
[ "a", "small", "static", "helper", "which", "catches", "nulls", "for", "us" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ImageHolder.java#L243-L249
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java
DefaultEntityManager.invokeCallbackMethod
private static void invokeCallbackMethod(Method callbackMethod, Object listener, Object entity) { """ Invokes the given callback method on the given target object. @param callbackMethod the callback method @param listener the listener object on which to invoke the method @param entity the entity for which the callback is being invoked. """ try { callbackMethod.invoke(listener, entity); } catch (Exception exp) { String message = String.format("Failed to execute callback method %s of class %s", callbackMethod.getName(), callbackMethod.getDeclaringClass().getName()); throw new EntityManagerException(message, exp); } }
java
private static void invokeCallbackMethod(Method callbackMethod, Object listener, Object entity) { try { callbackMethod.invoke(listener, entity); } catch (Exception exp) { String message = String.format("Failed to execute callback method %s of class %s", callbackMethod.getName(), callbackMethod.getDeclaringClass().getName()); throw new EntityManagerException(message, exp); } }
[ "private", "static", "void", "invokeCallbackMethod", "(", "Method", "callbackMethod", ",", "Object", "listener", ",", "Object", "entity", ")", "{", "try", "{", "callbackMethod", ".", "invoke", "(", "listener", ",", "entity", ")", ";", "}", "catch", "(", "Exception", "exp", ")", "{", "String", "message", "=", "String", ".", "format", "(", "\"Failed to execute callback method %s of class %s\"", ",", "callbackMethod", ".", "getName", "(", ")", ",", "callbackMethod", ".", "getDeclaringClass", "(", ")", ".", "getName", "(", ")", ")", ";", "throw", "new", "EntityManagerException", "(", "message", ",", "exp", ")", ";", "}", "}" ]
Invokes the given callback method on the given target object. @param callbackMethod the callback method @param listener the listener object on which to invoke the method @param entity the entity for which the callback is being invoked.
[ "Invokes", "the", "given", "callback", "method", "on", "the", "given", "target", "object", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L518-L527
spring-projects/spring-shell
spring-shell-core/src/main/java/org/springframework/shell/jline/ExtendedDefaultParser.java
ExtendedDefaultParser.isDelimiter
public boolean isDelimiter(final CharSequence buffer, final int pos) { """ Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not escaped by any of {@link #getQuoteChars}, and is not escaped by ant of the {@link #getEscapeChars}, and returns true from {@link #isDelimiterChar}. @param buffer The complete command buffer @param pos The index of the character in the buffer @return True if the character should be a delimiter """ return !isQuoted(buffer, pos) && !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }
java
public boolean isDelimiter(final CharSequence buffer, final int pos) { return !isQuoted(buffer, pos) && !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }
[ "public", "boolean", "isDelimiter", "(", "final", "CharSequence", "buffer", ",", "final", "int", "pos", ")", "{", "return", "!", "isQuoted", "(", "buffer", ",", "pos", ")", "&&", "!", "isEscaped", "(", "buffer", ",", "pos", ")", "&&", "isDelimiterChar", "(", "buffer", ",", "pos", ")", ";", "}" ]
Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not escaped by any of {@link #getQuoteChars}, and is not escaped by ant of the {@link #getEscapeChars}, and returns true from {@link #isDelimiterChar}. @param buffer The complete command buffer @param pos The index of the character in the buffer @return True if the character should be a delimiter
[ "Returns", "true", "if", "the", "specified", "character", "is", "a", "whitespace", "parameter", ".", "Check", "to", "ensure", "that", "the", "character", "is", "not", "escaped", "by", "any", "of", "{", "@link", "#getQuoteChars", "}", "and", "is", "not", "escaped", "by", "ant", "of", "the", "{", "@link", "#getEscapeChars", "}", "and", "returns", "true", "from", "{", "@link", "#isDelimiterChar", "}", "." ]
train
https://github.com/spring-projects/spring-shell/blob/23d99f45eb8f487e31a1f080c837061313bbfafa/spring-shell-core/src/main/java/org/springframework/shell/jline/ExtendedDefaultParser.java#L158-L160
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.releaseCall
public void releaseCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { """ Release the specified call. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) """ try { VoicecallsidanswerData releaseData = new VoicecallsidanswerData(); releaseData.setReasons(Util.toKVList(reasons)); releaseData.setExtensions(Util.toKVList(extensions)); ReleaseData data = new ReleaseData(); data.data(releaseData); ApiSuccessResponse response = this.voiceApi.release(connId, data); throwIfNotOk("releaseCall", response); } catch (ApiException e) { throw new WorkspaceApiException("releaseCall failed.", e); } }
java
public void releaseCall( String connId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidanswerData releaseData = new VoicecallsidanswerData(); releaseData.setReasons(Util.toKVList(reasons)); releaseData.setExtensions(Util.toKVList(extensions)); ReleaseData data = new ReleaseData(); data.data(releaseData); ApiSuccessResponse response = this.voiceApi.release(connId, data); throwIfNotOk("releaseCall", response); } catch (ApiException e) { throw new WorkspaceApiException("releaseCall failed.", e); } }
[ "public", "void", "releaseCall", "(", "String", "connId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidanswerData", "releaseData", "=", "new", "VoicecallsidanswerData", "(", ")", ";", "releaseData", ".", "setReasons", "(", "Util", ".", "toKVList", "(", "reasons", ")", ")", ";", "releaseData", ".", "setExtensions", "(", "Util", ".", "toKVList", "(", "extensions", ")", ")", ";", "ReleaseData", "data", "=", "new", "ReleaseData", "(", ")", ";", "data", ".", "data", "(", "releaseData", ")", ";", "ApiSuccessResponse", "response", "=", "this", ".", "voiceApi", ".", "release", "(", "connId", ",", "data", ")", ";", "throwIfNotOk", "(", "\"releaseCall\"", ",", "response", ")", ";", "}", "catch", "(", "ApiException", "e", ")", "{", "throw", "new", "WorkspaceApiException", "(", "\"releaseCall failed.\"", ",", "e", ")", ";", "}", "}" ]
Release the specified call. @param connId The connection ID of the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Release", "the", "specified", "call", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L635-L654
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.addWorkplaceServer
public void addWorkplaceServer(String workplaceServer, String sslmode) { """ Adds a workplace server, this is only allowed during configuration.<p> @param workplaceServer the workplace server @param sslmode CmsSSLMode of workplace server """ if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } if (!m_workplaceServers.containsKey(workplaceServer)) { m_workplaceServers.put(workplaceServer, CmsSSLMode.getModeFromXML(sslmode)); } }
java
public void addWorkplaceServer(String workplaceServer, String sslmode) { if (m_frozen) { throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0)); } if (!m_workplaceServers.containsKey(workplaceServer)) { m_workplaceServers.put(workplaceServer, CmsSSLMode.getModeFromXML(sslmode)); } }
[ "public", "void", "addWorkplaceServer", "(", "String", "workplaceServer", ",", "String", "sslmode", ")", "{", "if", "(", "m_frozen", ")", "{", "throw", "new", "CmsRuntimeException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_CONFIG_FROZEN_0", ")", ")", ";", "}", "if", "(", "!", "m_workplaceServers", ".", "containsKey", "(", "workplaceServer", ")", ")", "{", "m_workplaceServers", ".", "put", "(", "workplaceServer", ",", "CmsSSLMode", ".", "getModeFromXML", "(", "sslmode", ")", ")", ";", "}", "}" ]
Adds a workplace server, this is only allowed during configuration.<p> @param workplaceServer the workplace server @param sslmode CmsSSLMode of workplace server
[ "Adds", "a", "workplace", "server", "this", "is", "only", "allowed", "during", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L466-L474
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/schema/columns/DataColumnsDao.java
DataColumnsDao.getDataColumn
public DataColumns getDataColumn(String tableName, String columnName) throws SQLException { """ Get DataColumn by column name and table name @param tableName table name to query for @param columnName column name to query for @return DataColumns @throws SQLException upon failure """ TableColumnKey id = new TableColumnKey(tableName, columnName); return queryForId(id); }
java
public DataColumns getDataColumn(String tableName, String columnName) throws SQLException { TableColumnKey id = new TableColumnKey(tableName, columnName); return queryForId(id); }
[ "public", "DataColumns", "getDataColumn", "(", "String", "tableName", ",", "String", "columnName", ")", "throws", "SQLException", "{", "TableColumnKey", "id", "=", "new", "TableColumnKey", "(", "tableName", ",", "columnName", ")", ";", "return", "queryForId", "(", "id", ")", ";", "}" ]
Get DataColumn by column name and table name @param tableName table name to query for @param columnName column name to query for @return DataColumns @throws SQLException upon failure
[ "Get", "DataColumn", "by", "column", "name", "and", "table", "name" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/schema/columns/DataColumnsDao.java#L204-L208
SpartaTech/sparta-spring-web-utils
src/main/java/org/sparta/springwebutils/util/ExternalEntryPointHelper.java
ExternalEntryPointHelper.getEntryPointDecoratedName
public static String getEntryPointDecoratedName(Method method, boolean scanEntryPointAnnotation) { """ Based on the input for scanning annotations, look for @ExternalEntryPoint and get the decorated name from it, if any. @param method method to check @param scanEntryPointAnnotation annotation @return String """ String decoratedName = method.getName(); if (scanEntryPointAnnotation) { // we look at the method level if (method.isAnnotationPresent(ExternalEntryPoint.class)) { final ExternalEntryPoint externalEntryPoint = method.getAnnotation(ExternalEntryPoint.class); if (StringUtils.isNotBlank(externalEntryPoint.name())) { decoratedName = externalEntryPoint.name(); } } } return decoratedName; }
java
public static String getEntryPointDecoratedName(Method method, boolean scanEntryPointAnnotation) { String decoratedName = method.getName(); if (scanEntryPointAnnotation) { // we look at the method level if (method.isAnnotationPresent(ExternalEntryPoint.class)) { final ExternalEntryPoint externalEntryPoint = method.getAnnotation(ExternalEntryPoint.class); if (StringUtils.isNotBlank(externalEntryPoint.name())) { decoratedName = externalEntryPoint.name(); } } } return decoratedName; }
[ "public", "static", "String", "getEntryPointDecoratedName", "(", "Method", "method", ",", "boolean", "scanEntryPointAnnotation", ")", "{", "String", "decoratedName", "=", "method", ".", "getName", "(", ")", ";", "if", "(", "scanEntryPointAnnotation", ")", "{", "// we look at the method level\r", "if", "(", "method", ".", "isAnnotationPresent", "(", "ExternalEntryPoint", ".", "class", ")", ")", "{", "final", "ExternalEntryPoint", "externalEntryPoint", "=", "method", ".", "getAnnotation", "(", "ExternalEntryPoint", ".", "class", ")", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "externalEntryPoint", ".", "name", "(", ")", ")", ")", "{", "decoratedName", "=", "externalEntryPoint", ".", "name", "(", ")", ";", "}", "}", "}", "return", "decoratedName", ";", "}" ]
Based on the input for scanning annotations, look for @ExternalEntryPoint and get the decorated name from it, if any. @param method method to check @param scanEntryPointAnnotation annotation @return String
[ "Based", "on", "the", "input", "for", "scanning", "annotations", "look", "for", "@ExternalEntryPoint", "and", "get", "the", "decorated", "name", "from", "it", "if", "any", "." ]
train
https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/util/ExternalEntryPointHelper.java#L125-L140
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/taglib/jsf/AbstractHtmlImageTag.java
AbstractHtmlImageTag.prepareImageUrl
protected void prepareImageUrl(FacesContext context, StringBuffer results) throws IOException { """ Prepare the image URL @param context the faces context @param results the result @throws IOException if an exception occurs """ String src = (String) getAttributes().get("src"); boolean base64 = Boolean.parseBoolean((String) getAttributes().get("base64")); prepareAttribute(results, "src", getImageUrl(context, src, base64)); }
java
protected void prepareImageUrl(FacesContext context, StringBuffer results) throws IOException { String src = (String) getAttributes().get("src"); boolean base64 = Boolean.parseBoolean((String) getAttributes().get("base64")); prepareAttribute(results, "src", getImageUrl(context, src, base64)); }
[ "protected", "void", "prepareImageUrl", "(", "FacesContext", "context", ",", "StringBuffer", "results", ")", "throws", "IOException", "{", "String", "src", "=", "(", "String", ")", "getAttributes", "(", ")", ".", "get", "(", "\"src\"", ")", ";", "boolean", "base64", "=", "Boolean", ".", "parseBoolean", "(", "(", "String", ")", "getAttributes", "(", ")", ".", "get", "(", "\"base64\"", ")", ")", ";", "prepareAttribute", "(", "results", ",", "\"src\"", ",", "getImageUrl", "(", "context", ",", "src", ",", "base64", ")", ")", ";", "}" ]
Prepare the image URL @param context the faces context @param results the result @throws IOException if an exception occurs
[ "Prepare", "the", "image", "URL" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/taglib/jsf/AbstractHtmlImageTag.java#L179-L184
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemWrapper.java
ProxiedFileSystemWrapper.getProxiedFileSystem
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri) throws IOException, InterruptedException, URISyntaxException { """ Same as @see #getProxiedFileSystem(State, AuthType, String, String, Configuration) where state properties will be copied into Configuration. @param properties @param authType @param authPath @param uri @return @throws IOException @throws InterruptedException @throws URISyntaxException """ Configuration conf = new Configuration(); JobConfigurationUtils.putStateIntoConfiguration(properties, conf); return getProxiedFileSystem(properties, authType, authPath, uri, conf); }
java
public FileSystem getProxiedFileSystem(State properties, AuthType authType, String authPath, String uri) throws IOException, InterruptedException, URISyntaxException { Configuration conf = new Configuration(); JobConfigurationUtils.putStateIntoConfiguration(properties, conf); return getProxiedFileSystem(properties, authType, authPath, uri, conf); }
[ "public", "FileSystem", "getProxiedFileSystem", "(", "State", "properties", ",", "AuthType", "authType", ",", "String", "authPath", ",", "String", "uri", ")", "throws", "IOException", ",", "InterruptedException", ",", "URISyntaxException", "{", "Configuration", "conf", "=", "new", "Configuration", "(", ")", ";", "JobConfigurationUtils", ".", "putStateIntoConfiguration", "(", "properties", ",", "conf", ")", ";", "return", "getProxiedFileSystem", "(", "properties", ",", "authType", ",", "authPath", ",", "uri", ",", "conf", ")", ";", "}" ]
Same as @see #getProxiedFileSystem(State, AuthType, String, String, Configuration) where state properties will be copied into Configuration. @param properties @param authType @param authPath @param uri @return @throws IOException @throws InterruptedException @throws URISyntaxException
[ "Same", "as", "@see", "#getProxiedFileSystem", "(", "State", "AuthType", "String", "String", "Configuration", ")", "where", "state", "properties", "will", "be", "copied", "into", "Configuration", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemWrapper.java#L83-L88
crnk-project/crnk-framework
crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/JpaModule.java
JpaModule.newServerModule
@Deprecated public static JpaModule newServerModule(EntityManagerFactory emFactory, EntityManager em, TransactionRunner transactionRunner) { """ Creates a new JpaModule for a Crnk server. All entities managed by the provided EntityManagerFactory are registered to the module and exposed as JSON API resources if not later configured otherwise. @param emFactory to retrieve the managed entities. @param em to use @param transactionRunner to use @return created module @deprecated use with JpaModuleConfig """ JpaModuleConfig config = new JpaModuleConfig(); config.exposeAllEntities(emFactory); return new JpaModule(config, emFactory, () -> em, transactionRunner); }
java
@Deprecated public static JpaModule newServerModule(EntityManagerFactory emFactory, EntityManager em, TransactionRunner transactionRunner) { JpaModuleConfig config = new JpaModuleConfig(); config.exposeAllEntities(emFactory); return new JpaModule(config, emFactory, () -> em, transactionRunner); }
[ "@", "Deprecated", "public", "static", "JpaModule", "newServerModule", "(", "EntityManagerFactory", "emFactory", ",", "EntityManager", "em", ",", "TransactionRunner", "transactionRunner", ")", "{", "JpaModuleConfig", "config", "=", "new", "JpaModuleConfig", "(", ")", ";", "config", ".", "exposeAllEntities", "(", "emFactory", ")", ";", "return", "new", "JpaModule", "(", "config", ",", "emFactory", ",", "(", ")", "->", "em", ",", "transactionRunner", ")", ";", "}" ]
Creates a new JpaModule for a Crnk server. All entities managed by the provided EntityManagerFactory are registered to the module and exposed as JSON API resources if not later configured otherwise. @param emFactory to retrieve the managed entities. @param em to use @param transactionRunner to use @return created module @deprecated use with JpaModuleConfig
[ "Creates", "a", "new", "JpaModule", "for", "a", "Crnk", "server", ".", "All", "entities", "managed", "by", "the", "provided", "EntityManagerFactory", "are", "registered", "to", "the", "module", "and", "exposed", "as", "JSON", "API", "resources", "if", "not", "later", "configured", "otherwise", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/JpaModule.java#L168-L174
HsiangLeekwok/hlklib
hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java
Utility.addColor
public static String addColor(String orgString, String replaceString, int color) { """ 在字符串中查找指定的子字符串并将其改成指定的颜色 @param orgString 原始字符串 @param replaceString 需要替换的子字符串 @param color 替换后的子字符串的颜色 @return 返回带有 html 标签的字符串 """ return orgString.replace(replaceString, "<font color=\"" + colorToHexString(color) + "\">" + replaceString + "</font>"); }
java
public static String addColor(String orgString, String replaceString, int color) { return orgString.replace(replaceString, "<font color=\"" + colorToHexString(color) + "\">" + replaceString + "</font>"); }
[ "public", "static", "String", "addColor", "(", "String", "orgString", ",", "String", "replaceString", ",", "int", "color", ")", "{", "return", "orgString", ".", "replace", "(", "replaceString", ",", "\"<font color=\\\"\"", "+", "colorToHexString", "(", "color", ")", "+", "\"\\\">\"", "+", "replaceString", "+", "\"</font>\"", ")", ";", "}" ]
在字符串中查找指定的子字符串并将其改成指定的颜色 @param orgString 原始字符串 @param replaceString 需要替换的子字符串 @param color 替换后的子字符串的颜色 @return 返回带有 html 标签的字符串
[ "在字符串中查找指定的子字符串并将其改成指定的颜色" ]
train
https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/etc/Utility.java#L127-L129
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java
RemoteLockMapImpl.getWriter
public LockEntry getWriter(Object obj) { """ returns the LockEntry for the Writer of object obj. If now writer exists, null is returned. """ PersistenceBroker broker = getBroker(); Identity oid = new Identity(obj, broker); LockEntry result = null; try { result = getWriterRemote(oid); } catch (Throwable e) { log.error(e); } return result; }
java
public LockEntry getWriter(Object obj) { PersistenceBroker broker = getBroker(); Identity oid = new Identity(obj, broker); LockEntry result = null; try { result = getWriterRemote(oid); } catch (Throwable e) { log.error(e); } return result; }
[ "public", "LockEntry", "getWriter", "(", "Object", "obj", ")", "{", "PersistenceBroker", "broker", "=", "getBroker", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "broker", ")", ";", "LockEntry", "result", "=", "null", ";", "try", "{", "result", "=", "getWriterRemote", "(", "oid", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "log", ".", "error", "(", "e", ")", ";", "}", "return", "result", ";", "}" ]
returns the LockEntry for the Writer of object obj. If now writer exists, null is returned.
[ "returns", "the", "LockEntry", "for", "the", "Writer", "of", "object", "obj", ".", "If", "now", "writer", "exists", "null", "is", "returned", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java#L64-L79
lucee/Lucee
core/src/main/java/lucee/runtime/ComponentScopeShadow.java
ComponentScopeShadow.callWithNamedValues
@Override public Object callWithNamedValues(PageContext pc, Key key, Struct args) throws PageException { """ /* public Object callWithNamedValues(PageContext pc, String key,Struct args) throws PageException { return callWithNamedValues(pc, KeyImpl.init(key), args); } """ // first check variables Object o = shadow.get(key); if (o instanceof UDFPlus) { return ((UDFPlus) o).callWithNamedValues(pc, key, args, false); } Member m = component.getMember(access, key, false, false); if (m != null) { if (m instanceof UDFPlus) return ((UDFPlus) m).callWithNamedValues(pc, key, args, false); return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, m.getValue(),access); } return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, null,access); }
java
@Override public Object callWithNamedValues(PageContext pc, Key key, Struct args) throws PageException { // first check variables Object o = shadow.get(key); if (o instanceof UDFPlus) { return ((UDFPlus) o).callWithNamedValues(pc, key, args, false); } Member m = component.getMember(access, key, false, false); if (m != null) { if (m instanceof UDFPlus) return ((UDFPlus) m).callWithNamedValues(pc, key, args, false); return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, m.getValue(),access); } return MemberUtil.callWithNamedValues(pc, this, key, args, CFTypes.TYPE_STRUCT, "struct"); // throw ComponentUtil.notFunction(component, key, null,access); }
[ "@", "Override", "public", "Object", "callWithNamedValues", "(", "PageContext", "pc", ",", "Key", "key", ",", "Struct", "args", ")", "throws", "PageException", "{", "// first check variables", "Object", "o", "=", "shadow", ".", "get", "(", "key", ")", ";", "if", "(", "o", "instanceof", "UDFPlus", ")", "{", "return", "(", "(", "UDFPlus", ")", "o", ")", ".", "callWithNamedValues", "(", "pc", ",", "key", ",", "args", ",", "false", ")", ";", "}", "Member", "m", "=", "component", ".", "getMember", "(", "access", ",", "key", ",", "false", ",", "false", ")", ";", "if", "(", "m", "!=", "null", ")", "{", "if", "(", "m", "instanceof", "UDFPlus", ")", "return", "(", "(", "UDFPlus", ")", "m", ")", ".", "callWithNamedValues", "(", "pc", ",", "key", ",", "args", ",", "false", ")", ";", "return", "MemberUtil", ".", "callWithNamedValues", "(", "pc", ",", "this", ",", "key", ",", "args", ",", "CFTypes", ".", "TYPE_STRUCT", ",", "\"struct\"", ")", ";", "// throw ComponentUtil.notFunction(component, key, m.getValue(),access);", "}", "return", "MemberUtil", ".", "callWithNamedValues", "(", "pc", ",", "this", ",", "key", ",", "args", ",", "CFTypes", ".", "TYPE_STRUCT", ",", "\"struct\"", ")", ";", "// throw ComponentUtil.notFunction(component, key, null,access);", "}" ]
/* public Object callWithNamedValues(PageContext pc, String key,Struct args) throws PageException { return callWithNamedValues(pc, KeyImpl.init(key), args); }
[ "/", "*", "public", "Object", "callWithNamedValues", "(", "PageContext", "pc", "String", "key", "Struct", "args", ")", "throws", "PageException", "{", "return", "callWithNamedValues", "(", "pc", "KeyImpl", ".", "init", "(", "key", ")", "args", ")", ";", "}" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentScopeShadow.java#L315-L331
zxing/zxing
android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
IntentIntegrator.initiateScan
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) { """ Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants like {@link #PRODUCT_CODE_TYPES} for example. @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for @param cameraId camera ID of the camera to use. A negative value means "no preference". @return the {@link AlertDialog} that was shown to the user prompting them to download the app if a prompt was needed, or null otherwise """ Intent intentScan = new Intent(BS_PACKAGE + ".SCAN"); intentScan.addCategory(Intent.CATEGORY_DEFAULT); // check which types of codes to scan for if (desiredBarcodeFormats != null) { // set the desired barcode types StringBuilder joinedByComma = new StringBuilder(); for (String format : desiredBarcodeFormats) { if (joinedByComma.length() > 0) { joinedByComma.append(','); } joinedByComma.append(format); } intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString()); } // check requested camera ID if (cameraId >= 0) { intentScan.putExtra("SCAN_CAMERA_ID", cameraId); } String targetAppPackage = findTargetAppPackage(intentScan); if (targetAppPackage == null) { return showDownloadDialog(); } intentScan.setPackage(targetAppPackage); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentScan.addFlags(FLAG_NEW_DOC); attachMoreExtras(intentScan); startActivityForResult(intentScan, REQUEST_CODE); return null; }
java
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) { Intent intentScan = new Intent(BS_PACKAGE + ".SCAN"); intentScan.addCategory(Intent.CATEGORY_DEFAULT); // check which types of codes to scan for if (desiredBarcodeFormats != null) { // set the desired barcode types StringBuilder joinedByComma = new StringBuilder(); for (String format : desiredBarcodeFormats) { if (joinedByComma.length() > 0) { joinedByComma.append(','); } joinedByComma.append(format); } intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString()); } // check requested camera ID if (cameraId >= 0) { intentScan.putExtra("SCAN_CAMERA_ID", cameraId); } String targetAppPackage = findTargetAppPackage(intentScan); if (targetAppPackage == null) { return showDownloadDialog(); } intentScan.setPackage(targetAppPackage); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentScan.addFlags(FLAG_NEW_DOC); attachMoreExtras(intentScan); startActivityForResult(intentScan, REQUEST_CODE); return null; }
[ "public", "final", "AlertDialog", "initiateScan", "(", "Collection", "<", "String", ">", "desiredBarcodeFormats", ",", "int", "cameraId", ")", "{", "Intent", "intentScan", "=", "new", "Intent", "(", "BS_PACKAGE", "+", "\".SCAN\"", ")", ";", "intentScan", ".", "addCategory", "(", "Intent", ".", "CATEGORY_DEFAULT", ")", ";", "// check which types of codes to scan for", "if", "(", "desiredBarcodeFormats", "!=", "null", ")", "{", "// set the desired barcode types", "StringBuilder", "joinedByComma", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "format", ":", "desiredBarcodeFormats", ")", "{", "if", "(", "joinedByComma", ".", "length", "(", ")", ">", "0", ")", "{", "joinedByComma", ".", "append", "(", "'", "'", ")", ";", "}", "joinedByComma", ".", "append", "(", "format", ")", ";", "}", "intentScan", ".", "putExtra", "(", "\"SCAN_FORMATS\"", ",", "joinedByComma", ".", "toString", "(", ")", ")", ";", "}", "// check requested camera ID", "if", "(", "cameraId", ">=", "0", ")", "{", "intentScan", ".", "putExtra", "(", "\"SCAN_CAMERA_ID\"", ",", "cameraId", ")", ";", "}", "String", "targetAppPackage", "=", "findTargetAppPackage", "(", "intentScan", ")", ";", "if", "(", "targetAppPackage", "==", "null", ")", "{", "return", "showDownloadDialog", "(", ")", ";", "}", "intentScan", ".", "setPackage", "(", "targetAppPackage", ")", ";", "intentScan", ".", "addFlags", "(", "Intent", ".", "FLAG_ACTIVITY_CLEAR_TOP", ")", ";", "intentScan", ".", "addFlags", "(", "FLAG_NEW_DOC", ")", ";", "attachMoreExtras", "(", "intentScan", ")", ";", "startActivityForResult", "(", "intentScan", ",", "REQUEST_CODE", ")", ";", "return", "null", ";", "}" ]
Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants like {@link #PRODUCT_CODE_TYPES} for example. @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for @param cameraId camera ID of the camera to use. A negative value means "no preference". @return the {@link AlertDialog} that was shown to the user prompting them to download the app if a prompt was needed, or null otherwise
[ "Initiates", "a", "scan", "using", "the", "specified", "camera", "only", "for", "a", "certain", "set", "of", "barcode", "types", "given", "as", "strings", "corresponding", "to", "their", "names", "in", "ZXing", "s", "{", "@code", "BarcodeFormat", "}", "class", "like", "UPC_A", ".", "You", "can", "supply", "constants", "like", "{", "@link", "#PRODUCT_CODE_TYPES", "}", "for", "example", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L299-L331
UrielCh/ovh-java-sdk
ovh-java-sdk-licensesqlserver/src/main/java/net/minidev/ovh/api/ApiOvhLicensesqlserver.java
ApiOvhLicensesqlserver.orderableVersions_GET
public ArrayList<OvhSqlServerOrderConfiguration> orderableVersions_GET(String ip) throws IOException { """ Get the orderable Sql Server versions REST: GET /license/sqlserver/orderableVersions @param ip [required] Your license Ip """ String qPath = "/license/sqlserver/orderableVersions"; StringBuilder sb = path(qPath); query(sb, "ip", ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
java
public ArrayList<OvhSqlServerOrderConfiguration> orderableVersions_GET(String ip) throws IOException { String qPath = "/license/sqlserver/orderableVersions"; StringBuilder sb = path(qPath); query(sb, "ip", ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
[ "public", "ArrayList", "<", "OvhSqlServerOrderConfiguration", ">", "orderableVersions_GET", "(", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/license/sqlserver/orderableVersions\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"ip\"", ",", "ip", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t3", ")", ";", "}" ]
Get the orderable Sql Server versions REST: GET /license/sqlserver/orderableVersions @param ip [required] Your license Ip
[ "Get", "the", "orderable", "Sql", "Server", "versions" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licensesqlserver/src/main/java/net/minidev/ovh/api/ApiOvhLicensesqlserver.java#L153-L159
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java
NotificationManager.loadArtwork
private void loadArtwork(final Context context, final String artworkUrl) { """ Load the track artwork. @param context context used by {@link com.squareup.picasso.Picasso} to load the artwork asynchronously. @param artworkUrl artwork url of the track. """ if (mLoadArtworkRunnable != null) { mMainThreadHandler.removeCallbacks(mLoadArtworkRunnable); } mLoadArtworkRunnable = new Runnable() { @Override public void run() { final Picasso picasso = Picasso.with(context); picasso.cancelRequest(mThumbnailArtworkTarget); picasso.load(artworkUrl) .centerCrop() .resize(mArtworkBitmapSize, mArtworkBitmapSize) .into(mThumbnailArtworkTarget); } }; mMainThreadHandler.postDelayed(mLoadArtworkRunnable, LOAD_ARTWORK_DELAY); }
java
private void loadArtwork(final Context context, final String artworkUrl) { if (mLoadArtworkRunnable != null) { mMainThreadHandler.removeCallbacks(mLoadArtworkRunnable); } mLoadArtworkRunnable = new Runnable() { @Override public void run() { final Picasso picasso = Picasso.with(context); picasso.cancelRequest(mThumbnailArtworkTarget); picasso.load(artworkUrl) .centerCrop() .resize(mArtworkBitmapSize, mArtworkBitmapSize) .into(mThumbnailArtworkTarget); } }; mMainThreadHandler.postDelayed(mLoadArtworkRunnable, LOAD_ARTWORK_DELAY); }
[ "private", "void", "loadArtwork", "(", "final", "Context", "context", ",", "final", "String", "artworkUrl", ")", "{", "if", "(", "mLoadArtworkRunnable", "!=", "null", ")", "{", "mMainThreadHandler", ".", "removeCallbacks", "(", "mLoadArtworkRunnable", ")", ";", "}", "mLoadArtworkRunnable", "=", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "final", "Picasso", "picasso", "=", "Picasso", ".", "with", "(", "context", ")", ";", "picasso", ".", "cancelRequest", "(", "mThumbnailArtworkTarget", ")", ";", "picasso", ".", "load", "(", "artworkUrl", ")", ".", "centerCrop", "(", ")", ".", "resize", "(", "mArtworkBitmapSize", ",", "mArtworkBitmapSize", ")", ".", "into", "(", "mThumbnailArtworkTarget", ")", ";", "}", "}", ";", "mMainThreadHandler", ".", "postDelayed", "(", "mLoadArtworkRunnable", ",", "LOAD_ARTWORK_DELAY", ")", ";", "}" ]
Load the track artwork. @param context context used by {@link com.squareup.picasso.Picasso} to load the artwork asynchronously. @param artworkUrl artwork url of the track.
[ "Load", "the", "track", "artwork", "." ]
train
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java#L398-L416
google/gson
gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java
LinkedHashTreeMap.rotateLeft
private void rotateLeft(Node<K, V> root) { """ Rotates the subtree so that its root's right child is the new root. """ Node<K, V> left = root.left; Node<K, V> pivot = root.right; Node<K, V> pivotLeft = pivot.left; Node<K, V> pivotRight = pivot.right; // move the pivot's left child to the root's right root.right = pivotLeft; if (pivotLeft != null) { pivotLeft.parent = root; } replaceInParent(root, pivot); // move the root to the pivot's left pivot.left = root; root.parent = pivot; // fix heights root.height = Math.max(left != null ? left.height : 0, pivotLeft != null ? pivotLeft.height : 0) + 1; pivot.height = Math.max(root.height, pivotRight != null ? pivotRight.height : 0) + 1; }
java
private void rotateLeft(Node<K, V> root) { Node<K, V> left = root.left; Node<K, V> pivot = root.right; Node<K, V> pivotLeft = pivot.left; Node<K, V> pivotRight = pivot.right; // move the pivot's left child to the root's right root.right = pivotLeft; if (pivotLeft != null) { pivotLeft.parent = root; } replaceInParent(root, pivot); // move the root to the pivot's left pivot.left = root; root.parent = pivot; // fix heights root.height = Math.max(left != null ? left.height : 0, pivotLeft != null ? pivotLeft.height : 0) + 1; pivot.height = Math.max(root.height, pivotRight != null ? pivotRight.height : 0) + 1; }
[ "private", "void", "rotateLeft", "(", "Node", "<", "K", ",", "V", ">", "root", ")", "{", "Node", "<", "K", ",", "V", ">", "left", "=", "root", ".", "left", ";", "Node", "<", "K", ",", "V", ">", "pivot", "=", "root", ".", "right", ";", "Node", "<", "K", ",", "V", ">", "pivotLeft", "=", "pivot", ".", "left", ";", "Node", "<", "K", ",", "V", ">", "pivotRight", "=", "pivot", ".", "right", ";", "// move the pivot's left child to the root's right", "root", ".", "right", "=", "pivotLeft", ";", "if", "(", "pivotLeft", "!=", "null", ")", "{", "pivotLeft", ".", "parent", "=", "root", ";", "}", "replaceInParent", "(", "root", ",", "pivot", ")", ";", "// move the root to the pivot's left", "pivot", ".", "left", "=", "root", ";", "root", ".", "parent", "=", "pivot", ";", "// fix heights", "root", ".", "height", "=", "Math", ".", "max", "(", "left", "!=", "null", "?", "left", ".", "height", ":", "0", ",", "pivotLeft", "!=", "null", "?", "pivotLeft", ".", "height", ":", "0", ")", "+", "1", ";", "pivot", ".", "height", "=", "Math", ".", "max", "(", "root", ".", "height", ",", "pivotRight", "!=", "null", "?", "pivotRight", ".", "height", ":", "0", ")", "+", "1", ";", "}" ]
Rotates the subtree so that its root's right child is the new root.
[ "Rotates", "the", "subtree", "so", "that", "its", "root", "s", "right", "child", "is", "the", "new", "root", "." ]
train
https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java#L401-L424
spring-projects/spring-social
spring-social-web/src/main/java/org/springframework/social/connect/web/ProviderSignInController.java
ProviderSignInController.signIn
@RequestMapping(value="/ { """ Process a sign-in form submission by commencing the process of establishing a connection to the provider on behalf of the user. For OAuth1, fetches a new request token from the provider, temporarily stores it in the session, then redirects the user to the provider's site for authentication authorization. For OAuth2, redirects the user to the provider's site for authentication authorization. @param providerId the provider ID to authorize against @param request the request @return a RedirectView to the provider's authorization page or to the application's signin page if there is an error """providerId}", method=RequestMethod.POST) public RedirectView signIn(@PathVariable String providerId, NativeWebRequest request) { try { ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(providerId); MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>(); preSignIn(connectionFactory, parameters, request); return new RedirectView(connectSupport.buildOAuthUrl(connectionFactory, request, parameters)); } catch (Exception e) { logger.error("Exception while building authorization URL: ", e); return redirect(URIBuilder.fromUri(signInUrl).queryParam("error", "provider").build().toString()); } }
java
@RequestMapping(value="/{providerId}", method=RequestMethod.POST) public RedirectView signIn(@PathVariable String providerId, NativeWebRequest request) { try { ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(providerId); MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>(); preSignIn(connectionFactory, parameters, request); return new RedirectView(connectSupport.buildOAuthUrl(connectionFactory, request, parameters)); } catch (Exception e) { logger.error("Exception while building authorization URL: ", e); return redirect(URIBuilder.fromUri(signInUrl).queryParam("error", "provider").build().toString()); } }
[ "@", "RequestMapping", "(", "value", "=", "\"/{providerId}\"", ",", "method", "=", "RequestMethod", ".", "POST", ")", "public", "RedirectView", "signIn", "(", "@", "PathVariable", "String", "providerId", ",", "NativeWebRequest", "request", ")", "{", "try", "{", "ConnectionFactory", "<", "?", ">", "connectionFactory", "=", "connectionFactoryLocator", ".", "getConnectionFactory", "(", "providerId", ")", ";", "MultiValueMap", "<", "String", ",", "String", ">", "parameters", "=", "new", "LinkedMultiValueMap", "<", "String", ",", "String", ">", "(", ")", ";", "preSignIn", "(", "connectionFactory", ",", "parameters", ",", "request", ")", ";", "return", "new", "RedirectView", "(", "connectSupport", ".", "buildOAuthUrl", "(", "connectionFactory", ",", "request", ",", "parameters", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"Exception while building authorization URL: \"", ",", "e", ")", ";", "return", "redirect", "(", "URIBuilder", ".", "fromUri", "(", "signInUrl", ")", ".", "queryParam", "(", "\"error\"", ",", "\"provider\"", ")", ".", "build", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Process a sign-in form submission by commencing the process of establishing a connection to the provider on behalf of the user. For OAuth1, fetches a new request token from the provider, temporarily stores it in the session, then redirects the user to the provider's site for authentication authorization. For OAuth2, redirects the user to the provider's site for authentication authorization. @param providerId the provider ID to authorize against @param request the request @return a RedirectView to the provider's authorization page or to the application's signin page if there is an error
[ "Process", "a", "sign", "-", "in", "form", "submission", "by", "commencing", "the", "process", "of", "establishing", "a", "connection", "to", "the", "provider", "on", "behalf", "of", "the", "user", ".", "For", "OAuth1", "fetches", "a", "new", "request", "token", "from", "the", "provider", "temporarily", "stores", "it", "in", "the", "session", "then", "redirects", "the", "user", "to", "the", "provider", "s", "site", "for", "authentication", "authorization", ".", "For", "OAuth2", "redirects", "the", "user", "to", "the", "provider", "s", "site", "for", "authentication", "authorization", "." ]
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-web/src/main/java/org/springframework/social/connect/web/ProviderSignInController.java#L174-L185
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/Configs.java
Configs.modifySelfConfig
public static void modifySelfConfig(String configAbsoluteClassPath, IConfigKey key, String value) throws IOException { """ Modify one self config. @param configAbsoluteClassPath config path. {@link #addSelfConfigs(String, OneProperties)} @param key need update config's key @param value new config value @throws IOException """ OneProperties configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { return; } configs.modifyConfig(key, value); }
java
public static void modifySelfConfig(String configAbsoluteClassPath, IConfigKey key, String value) throws IOException { OneProperties configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { return; } configs.modifyConfig(key, value); }
[ "public", "static", "void", "modifySelfConfig", "(", "String", "configAbsoluteClassPath", ",", "IConfigKey", "key", ",", "String", "value", ")", "throws", "IOException", "{", "OneProperties", "configs", "=", "otherConfigs", ".", "get", "(", "configAbsoluteClassPath", ")", ";", "if", "(", "configs", "==", "null", ")", "{", "return", ";", "}", "configs", ".", "modifyConfig", "(", "key", ",", "value", ")", ";", "}" ]
Modify one self config. @param configAbsoluteClassPath config path. {@link #addSelfConfigs(String, OneProperties)} @param key need update config's key @param value new config value @throws IOException
[ "Modify", "one", "self", "config", "." ]
train
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L486-L493
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java
InodeLockList.lockInode
public void lockInode(Inode inode, LockMode mode) { """ Locks the given inode and adds it to the lock list. This method does *not* check that the inode is still a child of the previous inode, or that the inode still exists. This method should only be called when the edge leading to the inode is locked. @param inode the inode to lock @param mode the mode to lock in """ Preconditions.checkState(mLockMode == LockMode.READ); lockInodeInternal(inode, mode); mLockMode = mode; }
java
public void lockInode(Inode inode, LockMode mode) { Preconditions.checkState(mLockMode == LockMode.READ); lockInodeInternal(inode, mode); mLockMode = mode; }
[ "public", "void", "lockInode", "(", "Inode", "inode", ",", "LockMode", "mode", ")", "{", "Preconditions", ".", "checkState", "(", "mLockMode", "==", "LockMode", ".", "READ", ")", ";", "lockInodeInternal", "(", "inode", ",", "mode", ")", ";", "mLockMode", "=", "mode", ";", "}" ]
Locks the given inode and adds it to the lock list. This method does *not* check that the inode is still a child of the previous inode, or that the inode still exists. This method should only be called when the edge leading to the inode is locked. @param inode the inode to lock @param mode the mode to lock in
[ "Locks", "the", "given", "inode", "and", "adds", "it", "to", "the", "lock", "list", ".", "This", "method", "does", "*", "not", "*", "check", "that", "the", "inode", "is", "still", "a", "child", "of", "the", "previous", "inode", "or", "that", "the", "inode", "still", "exists", ".", "This", "method", "should", "only", "be", "called", "when", "the", "edge", "leading", "to", "the", "inode", "is", "locked", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java#L78-L83
jboss/jboss-servlet-api_spec
src/main/java/javax/servlet/http/HttpServlet.java
HttpServlet.doTrace
protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { """ Called by the server (via the <code>service</code> method) to allow a servlet to handle a TRACE request. A TRACE returns the headers sent with the TRACE request to the client, so that they can be used in debugging. There's no need to override this method. @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client @throws IOException if an input or output error occurs while the servlet is handling the TRACE request @throws ServletException if the request for the TRACE cannot be handled """ int responseLength; String CRLF = "\r\n"; StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI()) .append(" ").append(req.getProtocol()); Enumeration<String> reqHeaderEnum = req.getHeaderNames(); while( reqHeaderEnum.hasMoreElements() ) { String headerName = reqHeaderEnum.nextElement(); buffer.append(CRLF).append(headerName).append(": ") .append(req.getHeader(headerName)); } buffer.append(CRLF); responseLength = buffer.length(); resp.setContentType("message/http"); resp.setContentLength(responseLength); ServletOutputStream out = resp.getOutputStream(); out.print(buffer.toString()); }
java
protected void doTrace(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int responseLength; String CRLF = "\r\n"; StringBuilder buffer = new StringBuilder("TRACE ").append(req.getRequestURI()) .append(" ").append(req.getProtocol()); Enumeration<String> reqHeaderEnum = req.getHeaderNames(); while( reqHeaderEnum.hasMoreElements() ) { String headerName = reqHeaderEnum.nextElement(); buffer.append(CRLF).append(headerName).append(": ") .append(req.getHeader(headerName)); } buffer.append(CRLF); responseLength = buffer.length(); resp.setContentType("message/http"); resp.setContentLength(responseLength); ServletOutputStream out = resp.getOutputStream(); out.print(buffer.toString()); }
[ "protected", "void", "doTrace", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "int", "responseLength", ";", "String", "CRLF", "=", "\"\\r\\n\"", ";", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "\"TRACE \"", ")", ".", "append", "(", "req", ".", "getRequestURI", "(", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "req", ".", "getProtocol", "(", ")", ")", ";", "Enumeration", "<", "String", ">", "reqHeaderEnum", "=", "req", ".", "getHeaderNames", "(", ")", ";", "while", "(", "reqHeaderEnum", ".", "hasMoreElements", "(", ")", ")", "{", "String", "headerName", "=", "reqHeaderEnum", ".", "nextElement", "(", ")", ";", "buffer", ".", "append", "(", "CRLF", ")", ".", "append", "(", "headerName", ")", ".", "append", "(", "\": \"", ")", ".", "append", "(", "req", ".", "getHeader", "(", "headerName", ")", ")", ";", "}", "buffer", ".", "append", "(", "CRLF", ")", ";", "responseLength", "=", "buffer", ".", "length", "(", ")", ";", "resp", ".", "setContentType", "(", "\"message/http\"", ")", ";", "resp", ".", "setContentLength", "(", "responseLength", ")", ";", "ServletOutputStream", "out", "=", "resp", ".", "getOutputStream", "(", ")", ";", "out", ".", "print", "(", "buffer", ".", "toString", "(", ")", ")", ";", "}" ]
Called by the server (via the <code>service</code> method) to allow a servlet to handle a TRACE request. A TRACE returns the headers sent with the TRACE request to the client, so that they can be used in debugging. There's no need to override this method. @param req the {@link HttpServletRequest} object that contains the request the client made of the servlet @param resp the {@link HttpServletResponse} object that contains the response the servlet returns to the client @throws IOException if an input or output error occurs while the servlet is handling the TRACE request @throws ServletException if the request for the TRACE cannot be handled
[ "Called", "by", "the", "server", "(", "via", "the", "<code", ">", "service<", "/", "code", ">", "method", ")", "to", "allow", "a", "servlet", "to", "handle", "a", "TRACE", "request", "." ]
train
https://github.com/jboss/jboss-servlet-api_spec/blob/5bc96f2b833c072baff6eb8ae49bc7b5e503e9b2/src/main/java/javax/servlet/http/HttpServlet.java#L622-L648
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java
StringUtilities.indexOf
public static int indexOf(final String input, final char delim, final int fromIndex) { """ Gets the first index of a character after fromIndex. Ignoring characters that have been escaped @param input The string to be searched @param delim The character to be found @param fromIndex Start searching from this index @return The index of the found character or -1 if the character wasn't found """ if (input == null) return -1; int index = input.indexOf(delim, fromIndex); if (index != 0) { while (index != -1 && index != (input.length() - 1)) { if (input.charAt(index - 1) != '\\') break; index = input.indexOf(delim, index + 1); } } return index; }
java
public static int indexOf(final String input, final char delim, final int fromIndex) { if (input == null) return -1; int index = input.indexOf(delim, fromIndex); if (index != 0) { while (index != -1 && index != (input.length() - 1)) { if (input.charAt(index - 1) != '\\') break; index = input.indexOf(delim, index + 1); } } return index; }
[ "public", "static", "int", "indexOf", "(", "final", "String", "input", ",", "final", "char", "delim", ",", "final", "int", "fromIndex", ")", "{", "if", "(", "input", "==", "null", ")", "return", "-", "1", ";", "int", "index", "=", "input", ".", "indexOf", "(", "delim", ",", "fromIndex", ")", ";", "if", "(", "index", "!=", "0", ")", "{", "while", "(", "index", "!=", "-", "1", "&&", "index", "!=", "(", "input", ".", "length", "(", ")", "-", "1", ")", ")", "{", "if", "(", "input", ".", "charAt", "(", "index", "-", "1", ")", "!=", "'", "'", ")", "break", ";", "index", "=", "input", ".", "indexOf", "(", "delim", ",", "index", "+", "1", ")", ";", "}", "}", "return", "index", ";", "}" ]
Gets the first index of a character after fromIndex. Ignoring characters that have been escaped @param input The string to be searched @param delim The character to be found @param fromIndex Start searching from this index @return The index of the found character or -1 if the character wasn't found
[ "Gets", "the", "first", "index", "of", "a", "character", "after", "fromIndex", ".", "Ignoring", "characters", "that", "have", "been", "escaped" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/StringUtilities.java#L229-L239
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java
NameUtils.getPluginName
public static String getPluginName(String descriptorName) { """ Returns the name of a plugin given the name of the *GrailsPlugin.groovy descriptor file. For example, "DbUtilsGrailsPlugin.groovy" gives "db-utils". @param descriptorName The simple name of the plugin descriptor. @return The plugin name for the descriptor, or <code>null</code> if <i>descriptorName</i> is <code>null</code>, or an empty string if <i>descriptorName</i> is an empty string. @throws IllegalArgumentException if the given descriptor name is not valid, i.e. if it doesn't end with "GrailsPlugin.groovy". """ if (descriptorName == null || descriptorName.length() == 0) { return descriptorName; } if (!descriptorName.endsWith("GrailsPlugin.groovy")) { throw new IllegalArgumentException("Plugin descriptor name is not valid: " + descriptorName); } return getScriptName(descriptorName.substring(0, descriptorName.indexOf("GrailsPlugin.groovy"))); }
java
public static String getPluginName(String descriptorName) { if (descriptorName == null || descriptorName.length() == 0) { return descriptorName; } if (!descriptorName.endsWith("GrailsPlugin.groovy")) { throw new IllegalArgumentException("Plugin descriptor name is not valid: " + descriptorName); } return getScriptName(descriptorName.substring(0, descriptorName.indexOf("GrailsPlugin.groovy"))); }
[ "public", "static", "String", "getPluginName", "(", "String", "descriptorName", ")", "{", "if", "(", "descriptorName", "==", "null", "||", "descriptorName", ".", "length", "(", ")", "==", "0", ")", "{", "return", "descriptorName", ";", "}", "if", "(", "!", "descriptorName", ".", "endsWith", "(", "\"GrailsPlugin.groovy\"", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Plugin descriptor name is not valid: \"", "+", "descriptorName", ")", ";", "}", "return", "getScriptName", "(", "descriptorName", ".", "substring", "(", "0", ",", "descriptorName", ".", "indexOf", "(", "\"GrailsPlugin.groovy\"", ")", ")", ")", ";", "}" ]
Returns the name of a plugin given the name of the *GrailsPlugin.groovy descriptor file. For example, "DbUtilsGrailsPlugin.groovy" gives "db-utils". @param descriptorName The simple name of the plugin descriptor. @return The plugin name for the descriptor, or <code>null</code> if <i>descriptorName</i> is <code>null</code>, or an empty string if <i>descriptorName</i> is an empty string. @throws IllegalArgumentException if the given descriptor name is not valid, i.e. if it doesn't end with "GrailsPlugin.groovy".
[ "Returns", "the", "name", "of", "a", "plugin", "given", "the", "name", "of", "the", "*", "GrailsPlugin", ".", "groovy", "descriptor", "file", ".", "For", "example", "DbUtilsGrailsPlugin", ".", "groovy", "gives", "db", "-", "utils", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java#L401-L411
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/ProfileNode.java
ProfileNode.getDescendingOrderedNodes
public Iterable<Entry<String, ProfileNode>> getDescendingOrderedNodes() { """ Returns a sorted enumerable of the nodes in descending order of how long they took to run. """ if( nodes == null ) return null; List<Entry<String, ProfileNode>> averageStepTimes = new LinkedList<Entry<String, ProfileNode>>(nodes.entrySet()); Collections.sort(averageStepTimes, new Comparator<Entry<String, ProfileNode>>() { public int compare(Entry<String, ProfileNode> o1, Entry<String, ProfileNode> o2) { return (int) (o1.getValue().totalMillisecs - o2.getValue().totalMillisecs); } }); return averageStepTimes; }
java
public Iterable<Entry<String, ProfileNode>> getDescendingOrderedNodes() { if( nodes == null ) return null; List<Entry<String, ProfileNode>> averageStepTimes = new LinkedList<Entry<String, ProfileNode>>(nodes.entrySet()); Collections.sort(averageStepTimes, new Comparator<Entry<String, ProfileNode>>() { public int compare(Entry<String, ProfileNode> o1, Entry<String, ProfileNode> o2) { return (int) (o1.getValue().totalMillisecs - o2.getValue().totalMillisecs); } }); return averageStepTimes; }
[ "public", "Iterable", "<", "Entry", "<", "String", ",", "ProfileNode", ">", ">", "getDescendingOrderedNodes", "(", ")", "{", "if", "(", "nodes", "==", "null", ")", "return", "null", ";", "List", "<", "Entry", "<", "String", ",", "ProfileNode", ">", ">", "averageStepTimes", "=", "new", "LinkedList", "<", "Entry", "<", "String", ",", "ProfileNode", ">", ">", "(", "nodes", ".", "entrySet", "(", ")", ")", ";", "Collections", ".", "sort", "(", "averageStepTimes", ",", "new", "Comparator", "<", "Entry", "<", "String", ",", "ProfileNode", ">", ">", "(", ")", "{", "public", "int", "compare", "(", "Entry", "<", "String", ",", "ProfileNode", ">", "o1", ",", "Entry", "<", "String", ",", "ProfileNode", ">", "o2", ")", "{", "return", "(", "int", ")", "(", "o1", ".", "getValue", "(", ")", ".", "totalMillisecs", "-", "o2", ".", "getValue", "(", ")", ".", "totalMillisecs", ")", ";", "}", "}", ")", ";", "return", "averageStepTimes", ";", "}" ]
Returns a sorted enumerable of the nodes in descending order of how long they took to run.
[ "Returns", "a", "sorted", "enumerable", "of", "the", "nodes", "in", "descending", "order", "of", "how", "long", "they", "took", "to", "run", "." ]
train
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/ProfileNode.java#L98-L111
zeromq/jeromq
src/main/java/org/zeromq/ZFrame.java
ZFrame.recvFrame
public static ZFrame recvFrame(Socket socket, int flags) { """ Receive a new frame off the socket, Returns newly-allocated frame, or null if there was no input waiting, or if the read was interrupted. @param socket Socket to read from @param flags Pass flags to 0MQ socket.recv call @return received frame, else null """ ZFrame f = new ZFrame(); byte[] data = f.recv(socket, flags); if (data == null) { return null; } return f; }
java
public static ZFrame recvFrame(Socket socket, int flags) { ZFrame f = new ZFrame(); byte[] data = f.recv(socket, flags); if (data == null) { return null; } return f; }
[ "public", "static", "ZFrame", "recvFrame", "(", "Socket", "socket", ",", "int", "flags", ")", "{", "ZFrame", "f", "=", "new", "ZFrame", "(", ")", ";", "byte", "[", "]", "data", "=", "f", ".", "recv", "(", "socket", ",", "flags", ")", ";", "if", "(", "data", "==", "null", ")", "{", "return", "null", ";", "}", "return", "f", ";", "}" ]
Receive a new frame off the socket, Returns newly-allocated frame, or null if there was no input waiting, or if the read was interrupted. @param socket Socket to read from @param flags Pass flags to 0MQ socket.recv call @return received frame, else null
[ "Receive", "a", "new", "frame", "off", "the", "socket", "Returns", "newly", "-", "allocated", "frame", "or", "null", "if", "there", "was", "no", "input", "waiting", "or", "if", "the", "read", "was", "interrupted", "." ]
train
https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZFrame.java#L342-L350
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java
UpdateBuilder.set
@Nonnull public T set(@Nonnull DocumentReference documentReference, @Nonnull Object pojo) { """ Overwrites the document referred to by this DocumentReference. If the document doesn't exist yet, it will be created. If a document already exists, it will be overwritten. @param documentReference The DocumentReference to overwrite. @param pojo The POJO that will be used to populate the document contents. @return The instance for chaining. """ return set(documentReference, pojo, SetOptions.OVERWRITE); }
java
@Nonnull public T set(@Nonnull DocumentReference documentReference, @Nonnull Object pojo) { return set(documentReference, pojo, SetOptions.OVERWRITE); }
[ "@", "Nonnull", "public", "T", "set", "(", "@", "Nonnull", "DocumentReference", "documentReference", ",", "@", "Nonnull", "Object", "pojo", ")", "{", "return", "set", "(", "documentReference", ",", "pojo", ",", "SetOptions", ".", "OVERWRITE", ")", ";", "}" ]
Overwrites the document referred to by this DocumentReference. If the document doesn't exist yet, it will be created. If a document already exists, it will be overwritten. @param documentReference The DocumentReference to overwrite. @param pojo The POJO that will be used to populate the document contents. @return The instance for chaining.
[ "Overwrites", "the", "document", "referred", "to", "by", "this", "DocumentReference", ".", "If", "the", "document", "doesn", "t", "exist", "yet", "it", "will", "be", "created", ".", "If", "a", "document", "already", "exists", "it", "will", "be", "overwritten", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/UpdateBuilder.java#L204-L207
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java
FileUtil.copyFile
public static File copyFile(String source, String target) throws IOException { """ Copies source file to target. @param source source file to copy. @param target destination to copy to. @return target as File. @throws IOException when unable to copy. """ FileChannel inputChannel = null; FileChannel outputChannel = null; try { inputChannel = new FileInputStream(source).getChannel(); outputChannel = new FileOutputStream(target).getChannel(); outputChannel.transferFrom(inputChannel, 0, inputChannel.size()); } finally { if (inputChannel != null) { inputChannel.close(); } if (outputChannel != null) { outputChannel.close(); } } return new File(target); }
java
public static File copyFile(String source, String target) throws IOException { FileChannel inputChannel = null; FileChannel outputChannel = null; try { inputChannel = new FileInputStream(source).getChannel(); outputChannel = new FileOutputStream(target).getChannel(); outputChannel.transferFrom(inputChannel, 0, inputChannel.size()); } finally { if (inputChannel != null) { inputChannel.close(); } if (outputChannel != null) { outputChannel.close(); } } return new File(target); }
[ "public", "static", "File", "copyFile", "(", "String", "source", ",", "String", "target", ")", "throws", "IOException", "{", "FileChannel", "inputChannel", "=", "null", ";", "FileChannel", "outputChannel", "=", "null", ";", "try", "{", "inputChannel", "=", "new", "FileInputStream", "(", "source", ")", ".", "getChannel", "(", ")", ";", "outputChannel", "=", "new", "FileOutputStream", "(", "target", ")", ".", "getChannel", "(", ")", ";", "outputChannel", ".", "transferFrom", "(", "inputChannel", ",", "0", ",", "inputChannel", ".", "size", "(", ")", ")", ";", "}", "finally", "{", "if", "(", "inputChannel", "!=", "null", ")", "{", "inputChannel", ".", "close", "(", ")", ";", "}", "if", "(", "outputChannel", "!=", "null", ")", "{", "outputChannel", ".", "close", "(", ")", ";", "}", "}", "return", "new", "File", "(", "target", ")", ";", "}" ]
Copies source file to target. @param source source file to copy. @param target destination to copy to. @return target as File. @throws IOException when unable to copy.
[ "Copies", "source", "file", "to", "target", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L114-L130
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/print/AdvancedPageNumberEvents.java
AdvancedPageNumberEvents.onEndPage
@Override public void onEndPage(final PdfWriter writer, final Document document) { """ we override the onEndPage method. @param writer PdfWriter @param document Document """ final int pageN = writer.getPageNumber(); final String text = pageN + " / "; final float len = bf.getWidthPoint(text, 8); cb.beginText(); cb.setFontAndSize(bf, 8); final float width = document.getPageSize().getWidth(); cb.setTextMatrix(width / 2, 30); cb.showText(text); cb.endText(); cb.addTemplate(template, width / 2 + len, 30); }
java
@Override public void onEndPage(final PdfWriter writer, final Document document) { final int pageN = writer.getPageNumber(); final String text = pageN + " / "; final float len = bf.getWidthPoint(text, 8); cb.beginText(); cb.setFontAndSize(bf, 8); final float width = document.getPageSize().getWidth(); cb.setTextMatrix(width / 2, 30); cb.showText(text); cb.endText(); cb.addTemplate(template, width / 2 + len, 30); }
[ "@", "Override", "public", "void", "onEndPage", "(", "final", "PdfWriter", "writer", ",", "final", "Document", "document", ")", "{", "final", "int", "pageN", "=", "writer", ".", "getPageNumber", "(", ")", ";", "final", "String", "text", "=", "pageN", "+", "\" / \"", ";", "final", "float", "len", "=", "bf", ".", "getWidthPoint", "(", "text", ",", "8", ")", ";", "cb", ".", "beginText", "(", ")", ";", "cb", ".", "setFontAndSize", "(", "bf", ",", "8", ")", ";", "final", "float", "width", "=", "document", ".", "getPageSize", "(", ")", ".", "getWidth", "(", ")", ";", "cb", ".", "setTextMatrix", "(", "width", "/", "2", ",", "30", ")", ";", "cb", ".", "showText", "(", "text", ")", ";", "cb", ".", "endText", "(", ")", ";", "cb", ".", "addTemplate", "(", "template", ",", "width", "/", "2", "+", "len", ",", "30", ")", ";", "}" ]
we override the onEndPage method. @param writer PdfWriter @param document Document
[ "we", "override", "the", "onEndPage", "method", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/AdvancedPageNumberEvents.java#L112-L124
mgormley/pacaya
src/main/java/edu/jhu/pacaya/hypergraph/depparse/HyperDepParser.java
HyperDepParser.insideOutsideO2AllGraMultiRoot
public static EdgeScores insideOutsideO2AllGraMultiRoot(DependencyScorer scorer, Algebra s) { """ Runs inside outside on an all-grandparents hypergraph and returns the edge marginals in the real semiring. """ return insideOutside02AllGra(scorer, s, false); }
java
public static EdgeScores insideOutsideO2AllGraMultiRoot(DependencyScorer scorer, Algebra s) { return insideOutside02AllGra(scorer, s, false); }
[ "public", "static", "EdgeScores", "insideOutsideO2AllGraMultiRoot", "(", "DependencyScorer", "scorer", ",", "Algebra", "s", ")", "{", "return", "insideOutside02AllGra", "(", "scorer", ",", "s", ",", "false", ")", ";", "}" ]
Runs inside outside on an all-grandparents hypergraph and returns the edge marginals in the real semiring.
[ "Runs", "inside", "outside", "on", "an", "all", "-", "grandparents", "hypergraph", "and", "returns", "the", "edge", "marginals", "in", "the", "real", "semiring", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/hypergraph/depparse/HyperDepParser.java#L151-L153
jhipster/jhipster
jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java
QueryService.buildReferringEntitySpecification
protected <OTHER, X extends Comparable<? super X>> Specification<ENTITY> buildReferringEntitySpecification(final RangeFilter<X> filter, final SetAttribute<ENTITY, OTHER> reference, final SingularAttribute<OTHER, X> valueField) { """ Helper function to return a specification for filtering on one-to-many or many-to-many reference. Where equality, less than, greater than and less-than-or-equal-to and greater-than-or-equal-to and null/non-null conditions are supported. Usage: <pre> Specification&lt;Employee&gt; specByEmployeeId = buildReferringEntitySpecification(criteria.getEmployeId(), Project_.employees, Employee_.id); Specification&lt;Employee&gt; specByEmployeeName = buildReferringEntitySpecification(criteria.getEmployeName(), Project_.project, Project_.name); </pre> @param filter the filter object which contains a value, which needs to match or a flag if emptiness is checked. @param reference the attribute of the static metamodel for the referring entity. @param valueField the attribute of the static metamodel of the referred entity, where the equality should be checked. @param <OTHER> The type of the referenced entity. @param <X> The type of the attribute which is filtered. @return a Specification """ return buildReferringEntitySpecification(filter, root -> root.join(reference), entity -> entity.get(valueField)); }
java
protected <OTHER, X extends Comparable<? super X>> Specification<ENTITY> buildReferringEntitySpecification(final RangeFilter<X> filter, final SetAttribute<ENTITY, OTHER> reference, final SingularAttribute<OTHER, X> valueField) { return buildReferringEntitySpecification(filter, root -> root.join(reference), entity -> entity.get(valueField)); }
[ "protected", "<", "OTHER", ",", "X", "extends", "Comparable", "<", "?", "super", "X", ">", ">", "Specification", "<", "ENTITY", ">", "buildReferringEntitySpecification", "(", "final", "RangeFilter", "<", "X", ">", "filter", ",", "final", "SetAttribute", "<", "ENTITY", ",", "OTHER", ">", "reference", ",", "final", "SingularAttribute", "<", "OTHER", ",", "X", ">", "valueField", ")", "{", "return", "buildReferringEntitySpecification", "(", "filter", ",", "root", "->", "root", ".", "join", "(", "reference", ")", ",", "entity", "->", "entity", ".", "get", "(", "valueField", ")", ")", ";", "}" ]
Helper function to return a specification for filtering on one-to-many or many-to-many reference. Where equality, less than, greater than and less-than-or-equal-to and greater-than-or-equal-to and null/non-null conditions are supported. Usage: <pre> Specification&lt;Employee&gt; specByEmployeeId = buildReferringEntitySpecification(criteria.getEmployeId(), Project_.employees, Employee_.id); Specification&lt;Employee&gt; specByEmployeeName = buildReferringEntitySpecification(criteria.getEmployeName(), Project_.project, Project_.name); </pre> @param filter the filter object which contains a value, which needs to match or a flag if emptiness is checked. @param reference the attribute of the static metamodel for the referring entity. @param valueField the attribute of the static metamodel of the referred entity, where the equality should be checked. @param <OTHER> The type of the referenced entity. @param <X> The type of the attribute which is filtered. @return a Specification
[ "Helper", "function", "to", "return", "a", "specification", "for", "filtering", "on", "one", "-", "to", "-", "many", "or", "many", "-", "to", "-", "many", "reference", ".", "Where", "equality", "less", "than", "greater", "than", "and", "less", "-", "than", "-", "or", "-", "equal", "-", "to", "and", "greater", "-", "than", "-", "or", "-", "equal", "-", "to", "and", "null", "/", "non", "-", "null", "conditions", "are", "supported", ".", "Usage", ":", "<pre", ">", "Specification&lt", ";", "Employee&gt", ";", "specByEmployeeId", "=", "buildReferringEntitySpecification", "(", "criteria", ".", "getEmployeId", "()", "Project_", ".", "employees", "Employee_", ".", "id", ")", ";", "Specification&lt", ";", "Employee&gt", ";", "specByEmployeeName", "=", "buildReferringEntitySpecification", "(", "criteria", ".", "getEmployeName", "()", "Project_", ".", "project", "Project_", ".", "name", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/jhipster/jhipster/blob/5dcf4239c7cc035e188ef02447d3c628fac5c5d9/jhipster-framework/src/main/java/io/github/jhipster/service/QueryService.java#L268-L272
belaban/JGroups
src/org/jgroups/conf/ClassConfigurator.java
ClassConfigurator.get
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException { """ Loads and returns the class from the class name @param clazzname a fully classified class name to be loaded @return a Class object that represents a class that implements java.io.Externalizable """ return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader()); }
java
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException { return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader()); }
[ "public", "static", "Class", "get", "(", "String", "clazzname", ",", "ClassLoader", "loader", ")", "throws", "ClassNotFoundException", "{", "return", "Util", ".", "loadClass", "(", "clazzname", ",", "loader", "!=", "null", "?", "loader", ":", "ClassConfigurator", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "}" ]
Loads and returns the class from the class name @param clazzname a fully classified class name to be loaded @return a Class object that represents a class that implements java.io.Externalizable
[ "Loads", "and", "returns", "the", "class", "from", "the", "class", "name" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ClassConfigurator.java#L142-L144
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java
StringFunctions.rtrim
public static Expression rtrim(String expression, String characters) { """ Returned expression results in the string with all trailing chars removed (any char in the characters string). """ return rtrim(x(expression), characters); }
java
public static Expression rtrim(String expression, String characters) { return rtrim(x(expression), characters); }
[ "public", "static", "Expression", "rtrim", "(", "String", "expression", ",", "String", "characters", ")", "{", "return", "rtrim", "(", "x", "(", "expression", ")", ",", "characters", ")", ";", "}" ]
Returned expression results in the string with all trailing chars removed (any char in the characters string).
[ "Returned", "expression", "results", "in", "the", "string", "with", "all", "trailing", "chars", "removed", "(", "any", "char", "in", "the", "characters", "string", ")", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java#L224-L226
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/IO.java
IO.readContentAsString
public static String readContentAsString(URL url, String encoding) { """ Read file content to a String @param url The url resource to read @return The String content """ try { return readContentAsString(url.openStream()); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static String readContentAsString(URL url, String encoding) { try { return readContentAsString(url.openStream()); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "String", "readContentAsString", "(", "URL", "url", ",", "String", "encoding", ")", "{", "try", "{", "return", "readContentAsString", "(", "url", ".", "openStream", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Read file content to a String @param url The url resource to read @return The String content
[ "Read", "file", "content", "to", "a", "String" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/IO.java#L36-L42
Coveros/selenified
src/main/java/com/coveros/selenified/application/Assert.java
Assert.cookieMatches
@Override public void cookieMatches(String cookieName, String expectedCookiePattern) { """ Asserts that a cookies with the provided name has a value matching the expected pattern. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param cookieName the name of the cookie @param expectedCookiePattern the expected value of the cookie """ String cookie = checkCookieMatches(cookieName, expectedCookiePattern, 0, 0); assertTrue("Cookie Value Mismatch: cookie value of '" + cookie + DOES_NOT_MATCH_PATTERN + expectedCookiePattern + "'", cookie.matches(expectedCookiePattern)); }
java
@Override public void cookieMatches(String cookieName, String expectedCookiePattern) { String cookie = checkCookieMatches(cookieName, expectedCookiePattern, 0, 0); assertTrue("Cookie Value Mismatch: cookie value of '" + cookie + DOES_NOT_MATCH_PATTERN + expectedCookiePattern + "'", cookie.matches(expectedCookiePattern)); }
[ "@", "Override", "public", "void", "cookieMatches", "(", "String", "cookieName", ",", "String", "expectedCookiePattern", ")", "{", "String", "cookie", "=", "checkCookieMatches", "(", "cookieName", ",", "expectedCookiePattern", ",", "0", ",", "0", ")", ";", "assertTrue", "(", "\"Cookie Value Mismatch: cookie value of '\"", "+", "cookie", "+", "DOES_NOT_MATCH_PATTERN", "+", "expectedCookiePattern", "+", "\"'\"", ",", "cookie", ".", "matches", "(", "expectedCookiePattern", ")", ")", ";", "}" ]
Asserts that a cookies with the provided name has a value matching the expected pattern. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param cookieName the name of the cookie @param expectedCookiePattern the expected value of the cookie
[ "Asserts", "that", "a", "cookies", "with", "the", "provided", "name", "has", "a", "value", "matching", "the", "expected", "pattern", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/Assert.java#L328-L332
windup/windup
config/api/src/main/java/org/jboss/windup/config/GraphRewrite.java
GraphRewrite.ruleEvaluationProgress
public boolean ruleEvaluationProgress(String name, int currentPosition, int total, int timeRemainingInSeconds) { """ This is optionally called by long-running rules to indicate their current progress and estimated time-remaining. """ boolean windupStopRequested = false; for (RuleLifecycleListener listener : listeners) windupStopRequested = listener.ruleEvaluationProgress(this, name, currentPosition, total, timeRemainingInSeconds); return windupStopRequested; } public boolean shouldWindupStop() { for (RuleLifecycleListener listener : listeners) if (listener.shouldWindupStop()) return true; return false; } }
java
public boolean ruleEvaluationProgress(String name, int currentPosition, int total, int timeRemainingInSeconds) { boolean windupStopRequested = false; for (RuleLifecycleListener listener : listeners) windupStopRequested = listener.ruleEvaluationProgress(this, name, currentPosition, total, timeRemainingInSeconds); return windupStopRequested; } public boolean shouldWindupStop() { for (RuleLifecycleListener listener : listeners) if (listener.shouldWindupStop()) return true; return false; } }
[ "public", "boolean", "ruleEvaluationProgress", "(", "String", "name", ",", "int", "currentPosition", ",", "int", "total", ",", "int", "timeRemainingInSeconds", ")", "{", "boolean", "windupStopRequested", "=", "false", ";", "for", "(", "RuleLifecycleListener", "listener", ":", "listeners", ")", "windupStopRequested", "=", "listener", ".", "ruleEvaluationProgress", "(", "this", ",", "name", ",", "currentPosition", ",", "total", ",", "timeRemainingInSeconds", ")", ";", "return", "windupStopRequested", ";", "}", "public", "boolean", "shouldWindupStop", "(", ")", "{", "for", "(", "RuleLifecycleListener", "listener", ":", "listeners", ")", "if", "(", "listener", ".", "shouldWindupStop", "(", ")", ")", "return", "true", ";", "return", "false", ";", "}", "}" ]
This is optionally called by long-running rules to indicate their current progress and estimated time-remaining.
[ "This", "is", "optionally", "called", "by", "long", "-", "running", "rules", "to", "indicate", "their", "current", "progress", "and", "estimated", "time", "-", "remaining", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/GraphRewrite.java#L93-L109
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/builder/SqlInfoBuilder.java
SqlInfoBuilder.buildBetweenSql
public SqlInfo buildBetweenSql(String fieldText, Object startValue, Object endValue) { """ 构建区间查询的SqlInfo信息. @param fieldText 数据库字段文本 @param startValue 参数开始值 @param endValue 参数结束值 @return 返回SqlInfo信息 """ /* 根据开始文本和结束文本判断执行是大于、小于还是区间的查询sql和参数的生成 */ if (startValue != null && endValue == null) { join.append(prefix).append(fieldText).append(ZealotConst.GTE_SUFFIX); params.add(startValue); } else if (startValue == null && endValue != null) { join.append(prefix).append(fieldText).append(ZealotConst.LTE_SUFFIX); params.add(endValue); } else { join.append(prefix).append(fieldText).append(ZealotConst.BT_AND_SUFFIX); params.add(startValue); params.add(endValue); } return sqlInfo.setJoin(join).setParams(params); }
java
public SqlInfo buildBetweenSql(String fieldText, Object startValue, Object endValue) { /* 根据开始文本和结束文本判断执行是大于、小于还是区间的查询sql和参数的生成 */ if (startValue != null && endValue == null) { join.append(prefix).append(fieldText).append(ZealotConst.GTE_SUFFIX); params.add(startValue); } else if (startValue == null && endValue != null) { join.append(prefix).append(fieldText).append(ZealotConst.LTE_SUFFIX); params.add(endValue); } else { join.append(prefix).append(fieldText).append(ZealotConst.BT_AND_SUFFIX); params.add(startValue); params.add(endValue); } return sqlInfo.setJoin(join).setParams(params); }
[ "public", "SqlInfo", "buildBetweenSql", "(", "String", "fieldText", ",", "Object", "startValue", ",", "Object", "endValue", ")", "{", "/* 根据开始文本和结束文本判断执行是大于、小于还是区间的查询sql和参数的生成 */", "if", "(", "startValue", "!=", "null", "&&", "endValue", "==", "null", ")", "{", "join", ".", "append", "(", "prefix", ")", ".", "append", "(", "fieldText", ")", ".", "append", "(", "ZealotConst", ".", "GTE_SUFFIX", ")", ";", "params", ".", "add", "(", "startValue", ")", ";", "}", "else", "if", "(", "startValue", "==", "null", "&&", "endValue", "!=", "null", ")", "{", "join", ".", "append", "(", "prefix", ")", ".", "append", "(", "fieldText", ")", ".", "append", "(", "ZealotConst", ".", "LTE_SUFFIX", ")", ";", "params", ".", "add", "(", "endValue", ")", ";", "}", "else", "{", "join", ".", "append", "(", "prefix", ")", ".", "append", "(", "fieldText", ")", ".", "append", "(", "ZealotConst", ".", "BT_AND_SUFFIX", ")", ";", "params", ".", "add", "(", "startValue", ")", ";", "params", ".", "add", "(", "endValue", ")", ";", "}", "return", "sqlInfo", ".", "setJoin", "(", "join", ")", ".", "setParams", "(", "params", ")", ";", "}" ]
构建区间查询的SqlInfo信息. @param fieldText 数据库字段文本 @param startValue 参数开始值 @param endValue 参数结束值 @return 返回SqlInfo信息
[ "构建区间查询的SqlInfo信息", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/SqlInfoBuilder.java#L111-L126
apiman/apiman
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/auth/JDBCIdentityValidator.java
JDBCIdentityValidator.createClient
private IJdbcClient createClient(IPolicyContext context, JDBCIdentitySource config) throws Throwable { """ Creates the appropriate jdbc client. @param context @param config """ IJdbcComponent jdbcComponent = context.getComponent(IJdbcComponent.class); if (config.getType() == JDBCType.datasource || config.getType() == null) { DataSource ds = lookupDatasource(config); return jdbcComponent.create(ds); } if (config.getType() == JDBCType.url) { JdbcOptionsBean options = new JdbcOptionsBean(); options.setJdbcUrl(config.getJdbcUrl()); options.setUsername(config.getUsername()); options.setPassword(config.getPassword()); options.setAutoCommit(true); return jdbcComponent.createStandalone(options); } throw new Exception("Unknown JDBC options."); //$NON-NLS-1$ }
java
private IJdbcClient createClient(IPolicyContext context, JDBCIdentitySource config) throws Throwable { IJdbcComponent jdbcComponent = context.getComponent(IJdbcComponent.class); if (config.getType() == JDBCType.datasource || config.getType() == null) { DataSource ds = lookupDatasource(config); return jdbcComponent.create(ds); } if (config.getType() == JDBCType.url) { JdbcOptionsBean options = new JdbcOptionsBean(); options.setJdbcUrl(config.getJdbcUrl()); options.setUsername(config.getUsername()); options.setPassword(config.getPassword()); options.setAutoCommit(true); return jdbcComponent.createStandalone(options); } throw new Exception("Unknown JDBC options."); //$NON-NLS-1$ }
[ "private", "IJdbcClient", "createClient", "(", "IPolicyContext", "context", ",", "JDBCIdentitySource", "config", ")", "throws", "Throwable", "{", "IJdbcComponent", "jdbcComponent", "=", "context", ".", "getComponent", "(", "IJdbcComponent", ".", "class", ")", ";", "if", "(", "config", ".", "getType", "(", ")", "==", "JDBCType", ".", "datasource", "||", "config", ".", "getType", "(", ")", "==", "null", ")", "{", "DataSource", "ds", "=", "lookupDatasource", "(", "config", ")", ";", "return", "jdbcComponent", ".", "create", "(", "ds", ")", ";", "}", "if", "(", "config", ".", "getType", "(", ")", "==", "JDBCType", ".", "url", ")", "{", "JdbcOptionsBean", "options", "=", "new", "JdbcOptionsBean", "(", ")", ";", "options", ".", "setJdbcUrl", "(", "config", ".", "getJdbcUrl", "(", ")", ")", ";", "options", ".", "setUsername", "(", "config", ".", "getUsername", "(", ")", ")", ";", "options", ".", "setPassword", "(", "config", ".", "getPassword", "(", ")", ")", ";", "options", ".", "setAutoCommit", "(", "true", ")", ";", "return", "jdbcComponent", ".", "createStandalone", "(", "options", ")", ";", "}", "throw", "new", "Exception", "(", "\"Unknown JDBC options.\"", ")", ";", "//$NON-NLS-1$", "}" ]
Creates the appropriate jdbc client. @param context @param config
[ "Creates", "the", "appropriate", "jdbc", "client", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/auth/JDBCIdentityValidator.java#L113-L129
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
UnsafeRow.pointTo
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) { """ Update this UnsafeRow to point to different backing data. @param baseObject the base object @param baseOffset the offset within the base object @param sizeInBytes the size of this row's backing data, in bytes """ assert numFields >= 0 : "numFields (" + numFields + ") should >= 0"; assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8"; this.baseObject = baseObject; this.baseOffset = baseOffset; this.sizeInBytes = sizeInBytes; }
java
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) { assert numFields >= 0 : "numFields (" + numFields + ") should >= 0"; assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8"; this.baseObject = baseObject; this.baseOffset = baseOffset; this.sizeInBytes = sizeInBytes; }
[ "public", "void", "pointTo", "(", "Object", "baseObject", ",", "long", "baseOffset", ",", "int", "sizeInBytes", ")", "{", "assert", "numFields", ">=", "0", ":", "\"numFields (\"", "+", "numFields", "+", "\") should >= 0\"", ";", "assert", "sizeInBytes", "%", "8", "==", "0", ":", "\"sizeInBytes (\"", "+", "sizeInBytes", "+", "\") should be a multiple of 8\"", ";", "this", ".", "baseObject", "=", "baseObject", ";", "this", ".", "baseOffset", "=", "baseOffset", ";", "this", ".", "sizeInBytes", "=", "sizeInBytes", ";", "}" ]
Update this UnsafeRow to point to different backing data. @param baseObject the base object @param baseOffset the offset within the base object @param sizeInBytes the size of this row's backing data, in bytes
[ "Update", "this", "UnsafeRow", "to", "point", "to", "different", "backing", "data", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L166-L172
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java
LongTermRetentionBackupsInner.listByServerAsync
public Observable<Page<LongTermRetentionBackupInner>> listByServerAsync(final String locationName, final String longTermRetentionServerName) { """ Lists the long term retention backups for a given server. @param locationName The location of the database @param longTermRetentionServerName the String value @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;LongTermRetentionBackupInner&gt; object """ return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName) .map(new Func1<ServiceResponse<Page<LongTermRetentionBackupInner>>, Page<LongTermRetentionBackupInner>>() { @Override public Page<LongTermRetentionBackupInner> call(ServiceResponse<Page<LongTermRetentionBackupInner>> response) { return response.body(); } }); }
java
public Observable<Page<LongTermRetentionBackupInner>> listByServerAsync(final String locationName, final String longTermRetentionServerName) { return listByServerWithServiceResponseAsync(locationName, longTermRetentionServerName) .map(new Func1<ServiceResponse<Page<LongTermRetentionBackupInner>>, Page<LongTermRetentionBackupInner>>() { @Override public Page<LongTermRetentionBackupInner> call(ServiceResponse<Page<LongTermRetentionBackupInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", "listByServerAsync", "(", "final", "String", "locationName", ",", "final", "String", "longTermRetentionServerName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "locationName", ",", "longTermRetentionServerName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", ",", "Page", "<", "LongTermRetentionBackupInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "LongTermRetentionBackupInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the long term retention backups for a given server. @param locationName The location of the database @param longTermRetentionServerName the String value @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;LongTermRetentionBackupInner&gt; object
[ "Lists", "the", "long", "term", "retention", "backups", "for", "a", "given", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java#L933-L941
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java
ResponseBuilder.getResponse
public <T extends AbstractJsonMapping> T getResponse(Class<T> clazz, Map<String, String> properties) throws RottenTomatoesException { """ Get the wrapper for the passed properties Will retry up to retry limit @param <T> @param clazz @param properties @return @throws RottenTomatoesException """ String url = ApiBuilder.create(properties); try { T wrapper = clazz.cast(MAPPER.readValue(getContent(url), clazz)); int retry = 1; while (!wrapper.isValid() && "Account Over Queries Per Second Limit".equalsIgnoreCase(wrapper.getError()) && retry <= retryLimit) { LOG.trace("Account over queries limit, waiting for {}ms.", retryDelay * retry); sleeper(retry++); wrapper = MAPPER.readValue(getContent(url), clazz); } if (wrapper.isValid()) { return wrapper; } else { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, wrapper.getError(), url); } } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to map response", url, ex); } }
java
public <T extends AbstractJsonMapping> T getResponse(Class<T> clazz, Map<String, String> properties) throws RottenTomatoesException { String url = ApiBuilder.create(properties); try { T wrapper = clazz.cast(MAPPER.readValue(getContent(url), clazz)); int retry = 1; while (!wrapper.isValid() && "Account Over Queries Per Second Limit".equalsIgnoreCase(wrapper.getError()) && retry <= retryLimit) { LOG.trace("Account over queries limit, waiting for {}ms.", retryDelay * retry); sleeper(retry++); wrapper = MAPPER.readValue(getContent(url), clazz); } if (wrapper.isValid()) { return wrapper; } else { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, wrapper.getError(), url); } } catch (IOException ex) { throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to map response", url, ex); } }
[ "public", "<", "T", "extends", "AbstractJsonMapping", ">", "T", "getResponse", "(", "Class", "<", "T", ">", "clazz", ",", "Map", "<", "String", ",", "String", ">", "properties", ")", "throws", "RottenTomatoesException", "{", "String", "url", "=", "ApiBuilder", ".", "create", "(", "properties", ")", ";", "try", "{", "T", "wrapper", "=", "clazz", ".", "cast", "(", "MAPPER", ".", "readValue", "(", "getContent", "(", "url", ")", ",", "clazz", ")", ")", ";", "int", "retry", "=", "1", ";", "while", "(", "!", "wrapper", ".", "isValid", "(", ")", "&&", "\"Account Over Queries Per Second Limit\"", ".", "equalsIgnoreCase", "(", "wrapper", ".", "getError", "(", ")", ")", "&&", "retry", "<=", "retryLimit", ")", "{", "LOG", ".", "trace", "(", "\"Account over queries limit, waiting for {}ms.\"", ",", "retryDelay", "*", "retry", ")", ";", "sleeper", "(", "retry", "++", ")", ";", "wrapper", "=", "MAPPER", ".", "readValue", "(", "getContent", "(", "url", ")", ",", "clazz", ")", ";", "}", "if", "(", "wrapper", ".", "isValid", "(", ")", ")", "{", "return", "wrapper", ";", "}", "else", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "wrapper", ".", "getError", "(", ")", ",", "url", ")", ";", "}", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "RottenTomatoesException", "(", "ApiExceptionType", ".", "MAPPING_FAILED", ",", "\"Failed to map response\"", ",", "url", ",", "ex", ")", ";", "}", "}" ]
Get the wrapper for the passed properties Will retry up to retry limit @param <T> @param clazz @param properties @return @throws RottenTomatoesException
[ "Get", "the", "wrapper", "for", "the", "passed", "properties" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ResponseBuilder.java#L107-L127