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
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Stage.java
Stage.allocateAddress
private Address allocateAddress(final Definition definition, final Address maybeAddress) { """ Answers an Address for an Actor. If maybeAddress is allocated answer it; otherwise answer a newly allocated Address. (INTERNAL ONLY) @param definition the Definition of the newly created Actor @param maybeAddress the possible Address @return Address """ final Address address = maybeAddress != null ? maybeAddress : world.addressFactory().uniqueWith(definition.actorName()); return address; }
java
private Address allocateAddress(final Definition definition, final Address maybeAddress) { final Address address = maybeAddress != null ? maybeAddress : world.addressFactory().uniqueWith(definition.actorName()); return address; }
[ "private", "Address", "allocateAddress", "(", "final", "Definition", "definition", ",", "final", "Address", "maybeAddress", ")", "{", "final", "Address", "address", "=", "maybeAddress", "!=", "null", "?", "maybeAddress", ":", "world", ".", "addressFactory", "(", ")", ".", "uniqueWith", "(", "definition", ".", "actorName", "(", ")", ")", ";", "return", "address", ";", "}" ]
Answers an Address for an Actor. If maybeAddress is allocated answer it; otherwise answer a newly allocated Address. (INTERNAL ONLY) @param definition the Definition of the newly created Actor @param maybeAddress the possible Address @return Address
[ "Answers", "an", "Address", "for", "an", "Actor", ".", "If", "maybeAddress", "is", "allocated", "answer", "it", ";", "otherwise", "answer", "a", "newly", "allocated", "Address", ".", "(", "INTERNAL", "ONLY", ")" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L559-L563
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java
LatLongUtils.longitudeDistance
public static double longitudeDistance(int meters, double latitude) { """ Calculates the amount of degrees of longitude for a given distance in meters. @param meters distance in meters @param latitude the latitude at which the calculation should be performed @return longitude degrees """ return (meters * 360) / (2 * Math.PI * EQUATORIAL_RADIUS * Math.cos(Math.toRadians(latitude))); }
java
public static double longitudeDistance(int meters, double latitude) { return (meters * 360) / (2 * Math.PI * EQUATORIAL_RADIUS * Math.cos(Math.toRadians(latitude))); }
[ "public", "static", "double", "longitudeDistance", "(", "int", "meters", ",", "double", "latitude", ")", "{", "return", "(", "meters", "*", "360", ")", "/", "(", "2", "*", "Math", ".", "PI", "*", "EQUATORIAL_RADIUS", "*", "Math", ".", "cos", "(", "Math", ".", "toRadians", "(", "latitude", ")", ")", ")", ";", "}" ]
Calculates the amount of degrees of longitude for a given distance in meters. @param meters distance in meters @param latitude the latitude at which the calculation should be performed @return longitude degrees
[ "Calculates", "the", "amount", "of", "degrees", "of", "longitude", "for", "a", "given", "distance", "in", "meters", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java#L211-L213
alkacon/opencms-core
src/org/opencms/staticexport/CmsStaticExportManager.java
CmsStaticExportManager.writeResource
protected void writeResource( HttpServletRequest req, String exportPath, String rfsName, CmsResource resource, byte[] content) throws CmsException { """ Writes a resource to the given export path with the given rfs name and the given content.<p> @param req the current request @param exportPath the path to export the resource @param rfsName the rfs name @param resource the resource @param content the content @throws CmsException if something goes wrong """ String exportFileName = CmsFileUtil.normalizePath(exportPath + rfsName); // make sure all required parent folder exist createExportFolder(exportPath, rfsName); // generate export file instance and output stream File exportFile = new File(exportFileName); // write new exported file content try { FileOutputStream exportStream = new FileOutputStream(exportFile); exportStream.write(content); exportStream.close(); // log export success if (LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.LOG_STATIC_EXPORTED_2, resource.getRootPath(), exportFileName)); } } catch (Throwable t) { throw new CmsStaticExportException( Messages.get().container(Messages.ERR_OUTPUT_STREAM_1, exportFileName), t); } // update the file with the modification date from the server if (req != null) { Long dateLastModified = (Long)req.getAttribute(CmsRequestUtil.HEADER_OPENCMS_EXPORT); if ((dateLastModified != null) && (dateLastModified.longValue() != -1)) { exportFile.setLastModified((dateLastModified.longValue() / 1000) * 1000); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_SET_LAST_MODIFIED_2, exportFile.getName(), new Long((dateLastModified.longValue() / 1000) * 1000))); } } } else { // otherwise take the last modification date form the OpenCms resource exportFile.setLastModified((resource.getDateLastModified() / 1000) * 1000); } }
java
protected void writeResource( HttpServletRequest req, String exportPath, String rfsName, CmsResource resource, byte[] content) throws CmsException { String exportFileName = CmsFileUtil.normalizePath(exportPath + rfsName); // make sure all required parent folder exist createExportFolder(exportPath, rfsName); // generate export file instance and output stream File exportFile = new File(exportFileName); // write new exported file content try { FileOutputStream exportStream = new FileOutputStream(exportFile); exportStream.write(content); exportStream.close(); // log export success if (LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.LOG_STATIC_EXPORTED_2, resource.getRootPath(), exportFileName)); } } catch (Throwable t) { throw new CmsStaticExportException( Messages.get().container(Messages.ERR_OUTPUT_STREAM_1, exportFileName), t); } // update the file with the modification date from the server if (req != null) { Long dateLastModified = (Long)req.getAttribute(CmsRequestUtil.HEADER_OPENCMS_EXPORT); if ((dateLastModified != null) && (dateLastModified.longValue() != -1)) { exportFile.setLastModified((dateLastModified.longValue() / 1000) * 1000); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_SET_LAST_MODIFIED_2, exportFile.getName(), new Long((dateLastModified.longValue() / 1000) * 1000))); } } } else { // otherwise take the last modification date form the OpenCms resource exportFile.setLastModified((resource.getDateLastModified() / 1000) * 1000); } }
[ "protected", "void", "writeResource", "(", "HttpServletRequest", "req", ",", "String", "exportPath", ",", "String", "rfsName", ",", "CmsResource", "resource", ",", "byte", "[", "]", "content", ")", "throws", "CmsException", "{", "String", "exportFileName", "=", "CmsFileUtil", ".", "normalizePath", "(", "exportPath", "+", "rfsName", ")", ";", "// make sure all required parent folder exist", "createExportFolder", "(", "exportPath", ",", "rfsName", ")", ";", "// generate export file instance and output stream", "File", "exportFile", "=", "new", "File", "(", "exportFileName", ")", ";", "// write new exported file content", "try", "{", "FileOutputStream", "exportStream", "=", "new", "FileOutputStream", "(", "exportFile", ")", ";", "exportStream", ".", "write", "(", "content", ")", ";", "exportStream", ".", "close", "(", ")", ";", "// log export success", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_STATIC_EXPORTED_2", ",", "resource", ".", "getRootPath", "(", ")", ",", "exportFileName", ")", ")", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "throw", "new", "CmsStaticExportException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_OUTPUT_STREAM_1", ",", "exportFileName", ")", ",", "t", ")", ";", "}", "// update the file with the modification date from the server", "if", "(", "req", "!=", "null", ")", "{", "Long", "dateLastModified", "=", "(", "Long", ")", "req", ".", "getAttribute", "(", "CmsRequestUtil", ".", "HEADER_OPENCMS_EXPORT", ")", ";", "if", "(", "(", "dateLastModified", "!=", "null", ")", "&&", "(", "dateLastModified", ".", "longValue", "(", ")", "!=", "-", "1", ")", ")", "{", "exportFile", ".", "setLastModified", "(", "(", "dateLastModified", ".", "longValue", "(", ")", "/", "1000", ")", "*", "1000", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_SET_LAST_MODIFIED_2", ",", "exportFile", ".", "getName", "(", ")", ",", "new", "Long", "(", "(", "dateLastModified", ".", "longValue", "(", ")", "/", "1000", ")", "*", "1000", ")", ")", ")", ";", "}", "}", "}", "else", "{", "// otherwise take the last modification date form the OpenCms resource", "exportFile", ".", "setLastModified", "(", "(", "resource", ".", "getDateLastModified", "(", ")", "/", "1000", ")", "*", "1000", ")", ";", "}", "}" ]
Writes a resource to the given export path with the given rfs name and the given content.<p> @param req the current request @param exportPath the path to export the resource @param rfsName the rfs name @param resource the resource @param content the content @throws CmsException if something goes wrong
[ "Writes", "a", "resource", "to", "the", "given", "export", "path", "with", "the", "given", "rfs", "name", "and", "the", "given", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L2911-L2962
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traj/math/RadiusGyrationTensor2D.java
RadiusGyrationTensor2D.getRadiusOfGyrationTensor
public static Array2DRowRealMatrix getRadiusOfGyrationTensor(Trajectory t) { """ Calculates the radius of gyration tensor according to formula (6.3) in ELEMENTS OF THE RANDOM WALK by Rudnick and Gaspari @return Radius of gyration tensor """ double meanx =0; double meany =0; for(int i = 0; i < t.size(); i++){ meanx+= t.get(i).x; meany+= t.get(i).y; } meanx = meanx/t.size(); meany = meany/t.size(); double e11 = 0; double e12 = 0; double e21 = 0; double e22 = 0; for(int i = 0; i < t.size(); i++){ e11 += Math.pow(t.get(i).x-meanx,2); e12 += (t.get(i).x-meanx)*(t.get(i).y-meany); e22 += Math.pow(t.get(i).y-meany,2); } e11 = e11 / t.size(); e12 = e12 / t.size(); e21 = e12; e22 = e22 / t.size(); int rows = 2; int columns = 2; Array2DRowRealMatrix gyr = new Array2DRowRealMatrix(rows, columns); gyr.addToEntry(0, 0, e11); gyr.addToEntry(0, 1, e12); gyr.addToEntry(1, 0, e21); gyr.addToEntry(1, 1, e22); return gyr; }
java
public static Array2DRowRealMatrix getRadiusOfGyrationTensor(Trajectory t){ double meanx =0; double meany =0; for(int i = 0; i < t.size(); i++){ meanx+= t.get(i).x; meany+= t.get(i).y; } meanx = meanx/t.size(); meany = meany/t.size(); double e11 = 0; double e12 = 0; double e21 = 0; double e22 = 0; for(int i = 0; i < t.size(); i++){ e11 += Math.pow(t.get(i).x-meanx,2); e12 += (t.get(i).x-meanx)*(t.get(i).y-meany); e22 += Math.pow(t.get(i).y-meany,2); } e11 = e11 / t.size(); e12 = e12 / t.size(); e21 = e12; e22 = e22 / t.size(); int rows = 2; int columns = 2; Array2DRowRealMatrix gyr = new Array2DRowRealMatrix(rows, columns); gyr.addToEntry(0, 0, e11); gyr.addToEntry(0, 1, e12); gyr.addToEntry(1, 0, e21); gyr.addToEntry(1, 1, e22); return gyr; }
[ "public", "static", "Array2DRowRealMatrix", "getRadiusOfGyrationTensor", "(", "Trajectory", "t", ")", "{", "double", "meanx", "=", "0", ";", "double", "meany", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "t", ".", "size", "(", ")", ";", "i", "++", ")", "{", "meanx", "+=", "t", ".", "get", "(", "i", ")", ".", "x", ";", "meany", "+=", "t", ".", "get", "(", "i", ")", ".", "y", ";", "}", "meanx", "=", "meanx", "/", "t", ".", "size", "(", ")", ";", "meany", "=", "meany", "/", "t", ".", "size", "(", ")", ";", "double", "e11", "=", "0", ";", "double", "e12", "=", "0", ";", "double", "e21", "=", "0", ";", "double", "e22", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "t", ".", "size", "(", ")", ";", "i", "++", ")", "{", "e11", "+=", "Math", ".", "pow", "(", "t", ".", "get", "(", "i", ")", ".", "x", "-", "meanx", ",", "2", ")", ";", "e12", "+=", "(", "t", ".", "get", "(", "i", ")", ".", "x", "-", "meanx", ")", "*", "(", "t", ".", "get", "(", "i", ")", ".", "y", "-", "meany", ")", ";", "e22", "+=", "Math", ".", "pow", "(", "t", ".", "get", "(", "i", ")", ".", "y", "-", "meany", ",", "2", ")", ";", "}", "e11", "=", "e11", "/", "t", ".", "size", "(", ")", ";", "e12", "=", "e12", "/", "t", ".", "size", "(", ")", ";", "e21", "=", "e12", ";", "e22", "=", "e22", "/", "t", ".", "size", "(", ")", ";", "int", "rows", "=", "2", ";", "int", "columns", "=", "2", ";", "Array2DRowRealMatrix", "gyr", "=", "new", "Array2DRowRealMatrix", "(", "rows", ",", "columns", ")", ";", "gyr", ".", "addToEntry", "(", "0", ",", "0", ",", "e11", ")", ";", "gyr", ".", "addToEntry", "(", "0", ",", "1", ",", "e12", ")", ";", "gyr", ".", "addToEntry", "(", "1", ",", "0", ",", "e21", ")", ";", "gyr", ".", "addToEntry", "(", "1", ",", "1", ",", "e22", ")", ";", "return", "gyr", ";", "}" ]
Calculates the radius of gyration tensor according to formula (6.3) in ELEMENTS OF THE RANDOM WALK by Rudnick and Gaspari @return Radius of gyration tensor
[ "Calculates", "the", "radius", "of", "gyration", "tensor", "according", "to", "formula", "(", "6", ".", "3", ")", "in" ]
train
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traj/math/RadiusGyrationTensor2D.java#L56-L90
JOML-CI/JOML
src/org/joml/Vector3i.java
Vector3i.set
public Vector3i set(int index, ByteBuffer buffer) { """ Read this vector from the supplied {@link ByteBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given ByteBuffer. @param index the absolute position into the ByteBuffer @param buffer values will be read in <code>x, y, z</code> order @return this """ MemUtil.INSTANCE.get(this, index, buffer); return this; }
java
public Vector3i set(int index, ByteBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
[ "public", "Vector3i", "set", "(", "int", "index", ",", "ByteBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "get", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "this", ";", "}" ]
Read this vector from the supplied {@link ByteBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given ByteBuffer. @param index the absolute position into the ByteBuffer @param buffer values will be read in <code>x, y, z</code> order @return this
[ "Read", "this", "vector", "from", "the", "supplied", "{", "@link", "ByteBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", ".", "<p", ">", "This", "method", "will", "not", "increment", "the", "position", "of", "the", "given", "ByteBuffer", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3i.java#L326-L329
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.getInstance
public static final DateIntervalFormat getInstance(String skeleton, ULocale locale) { """ Construct a DateIntervalFormat from skeleton and a given locale. <P> In this factory method, the date interval pattern information is load from resource files. Users are encouraged to created date interval formatter this way and to use the pre-defined skeleton macros. <P> There are pre-defined skeletons in DateFormat, such as MONTH_DAY, YEAR_MONTH_WEEKDAY_DAY etc. Those skeletons have pre-defined interval patterns in resource files. Users are encouraged to use them. For example: DateIntervalFormat.getInstance(DateFormat.MONTH_DAY, false, loc); The given Locale provides the interval patterns. For example, for en_GB, if skeleton is YEAR_ABBR_MONTH_WEEKDAY_DAY, which is "yMMMEEEd", the interval patterns defined in resource file to above skeleton are: "EEE, d MMM, yyyy - EEE, d MMM, yyyy" for year differs, "EEE, d MMM - EEE, d MMM, yyyy" for month differs, "EEE, d - EEE, d MMM, yyyy" for day differs, @param skeleton the skeleton on which interval format based. @param locale the given locale @return a date time interval formatter. """ DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale); return new DateIntervalFormat(skeleton, locale, new SimpleDateFormat(generator.getBestPattern(skeleton), locale)); }
java
public static final DateIntervalFormat getInstance(String skeleton, ULocale locale) { DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale); return new DateIntervalFormat(skeleton, locale, new SimpleDateFormat(generator.getBestPattern(skeleton), locale)); }
[ "public", "static", "final", "DateIntervalFormat", "getInstance", "(", "String", "skeleton", ",", "ULocale", "locale", ")", "{", "DateTimePatternGenerator", "generator", "=", "DateTimePatternGenerator", ".", "getInstance", "(", "locale", ")", ";", "return", "new", "DateIntervalFormat", "(", "skeleton", ",", "locale", ",", "new", "SimpleDateFormat", "(", "generator", ".", "getBestPattern", "(", "skeleton", ")", ",", "locale", ")", ")", ";", "}" ]
Construct a DateIntervalFormat from skeleton and a given locale. <P> In this factory method, the date interval pattern information is load from resource files. Users are encouraged to created date interval formatter this way and to use the pre-defined skeleton macros. <P> There are pre-defined skeletons in DateFormat, such as MONTH_DAY, YEAR_MONTH_WEEKDAY_DAY etc. Those skeletons have pre-defined interval patterns in resource files. Users are encouraged to use them. For example: DateIntervalFormat.getInstance(DateFormat.MONTH_DAY, false, loc); The given Locale provides the interval patterns. For example, for en_GB, if skeleton is YEAR_ABBR_MONTH_WEEKDAY_DAY, which is "yMMMEEEd", the interval patterns defined in resource file to above skeleton are: "EEE, d MMM, yyyy - EEE, d MMM, yyyy" for year differs, "EEE, d MMM - EEE, d MMM, yyyy" for month differs, "EEE, d - EEE, d MMM, yyyy" for day differs, @param skeleton the skeleton on which interval format based. @param locale the given locale @return a date time interval formatter.
[ "Construct", "a", "DateIntervalFormat", "from", "skeleton", "and", "a", "given", "locale", ".", "<P", ">", "In", "this", "factory", "method", "the", "date", "interval", "pattern", "information", "is", "load", "from", "resource", "files", ".", "Users", "are", "encouraged", "to", "created", "date", "interval", "formatter", "this", "way", "and", "to", "use", "the", "pre", "-", "defined", "skeleton", "macros", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L467-L472
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeComplex
public static boolean writeComplex(Output out, Object complex) { """ Writes a complex type object out @param out Output writer @param complex Complex datatype object @return boolean true if object was successfully serialized, false otherwise """ log.trace("writeComplex"); if (writeListType(out, complex)) { return true; } else if (writeArrayType(out, complex)) { return true; } else if (writeXMLType(out, complex)) { return true; } else if (writeCustomType(out, complex)) { return true; } else if (writeObjectType(out, complex)) { return true; } else { return false; } }
java
public static boolean writeComplex(Output out, Object complex) { log.trace("writeComplex"); if (writeListType(out, complex)) { return true; } else if (writeArrayType(out, complex)) { return true; } else if (writeXMLType(out, complex)) { return true; } else if (writeCustomType(out, complex)) { return true; } else if (writeObjectType(out, complex)) { return true; } else { return false; } }
[ "public", "static", "boolean", "writeComplex", "(", "Output", "out", ",", "Object", "complex", ")", "{", "log", ".", "trace", "(", "\"writeComplex\"", ")", ";", "if", "(", "writeListType", "(", "out", ",", "complex", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "writeArrayType", "(", "out", ",", "complex", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "writeXMLType", "(", "out", ",", "complex", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "writeCustomType", "(", "out", ",", "complex", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "writeObjectType", "(", "out", ",", "complex", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Writes a complex type object out @param out Output writer @param complex Complex datatype object @return boolean true if object was successfully serialized, false otherwise
[ "Writes", "a", "complex", "type", "object", "out" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L174-L189
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/util/Components.java
Components.getDocumentation
public static URL getDocumentation(Class<?> comp, Locale loc) { """ Get the documentation as URL reference; @param comp The class to get the 'Documentation' tag from @param loc The locale @return the URL of the documentation file, null if no documentation is available. """ Documentation doc = (Documentation) comp.getAnnotation(Documentation.class); if (doc != null) { String v = doc.value(); try { // try full URL first (external reference) URL url = new URL(v); return url; } catch (MalformedURLException E) { // local resource bundled with the class String name = v.substring(0, v.lastIndexOf('.')); String ext = v.substring(v.lastIndexOf('.')); String lang = loc.getLanguage(); URL f = comp.getResource(name + "_" + lang + ext); if (f != null) { return f; } f = comp.getResource(v); if (f != null) { return f; } } } return null; }
java
public static URL getDocumentation(Class<?> comp, Locale loc) { Documentation doc = (Documentation) comp.getAnnotation(Documentation.class); if (doc != null) { String v = doc.value(); try { // try full URL first (external reference) URL url = new URL(v); return url; } catch (MalformedURLException E) { // local resource bundled with the class String name = v.substring(0, v.lastIndexOf('.')); String ext = v.substring(v.lastIndexOf('.')); String lang = loc.getLanguage(); URL f = comp.getResource(name + "_" + lang + ext); if (f != null) { return f; } f = comp.getResource(v); if (f != null) { return f; } } } return null; }
[ "public", "static", "URL", "getDocumentation", "(", "Class", "<", "?", ">", "comp", ",", "Locale", "loc", ")", "{", "Documentation", "doc", "=", "(", "Documentation", ")", "comp", ".", "getAnnotation", "(", "Documentation", ".", "class", ")", ";", "if", "(", "doc", "!=", "null", ")", "{", "String", "v", "=", "doc", ".", "value", "(", ")", ";", "try", "{", "// try full URL first (external reference)", "URL", "url", "=", "new", "URL", "(", "v", ")", ";", "return", "url", ";", "}", "catch", "(", "MalformedURLException", "E", ")", "{", "// local resource bundled with the class", "String", "name", "=", "v", ".", "substring", "(", "0", ",", "v", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "String", "ext", "=", "v", ".", "substring", "(", "v", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "String", "lang", "=", "loc", ".", "getLanguage", "(", ")", ";", "URL", "f", "=", "comp", ".", "getResource", "(", "name", "+", "\"_\"", "+", "lang", "+", "ext", ")", ";", "if", "(", "f", "!=", "null", ")", "{", "return", "f", ";", "}", "f", "=", "comp", ".", "getResource", "(", "v", ")", ";", "if", "(", "f", "!=", "null", ")", "{", "return", "f", ";", "}", "}", "}", "return", "null", ";", "}" ]
Get the documentation as URL reference; @param comp The class to get the 'Documentation' tag from @param loc The locale @return the URL of the documentation file, null if no documentation is available.
[ "Get", "the", "documentation", "as", "URL", "reference", ";" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Components.java#L393-L419
LearnLib/automatalib
util/src/main/java/net/automatalib/util/graphs/Graphs.java
Graphs.findSCCs
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> sccListener) { """ Find all strongly-connected components in a graph. When a new SCC is found, the {@link SCCListener#foundSCC(java.util.Collection)} method is invoked. The listener object may hence not be null. <p> Tarjan's algorithm is used for realizing the SCC search. @param graph the graph @param sccListener the SCC listener @see TarjanSCCVisitor @see SCCs """ SCCs.findSCCs(graph, sccListener); }
java
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> sccListener) { SCCs.findSCCs(graph, sccListener); }
[ "public", "static", "<", "N", ",", "E", ">", "void", "findSCCs", "(", "Graph", "<", "N", ",", "E", ">", "graph", ",", "SCCListener", "<", "N", ">", "sccListener", ")", "{", "SCCs", ".", "findSCCs", "(", "graph", ",", "sccListener", ")", ";", "}" ]
Find all strongly-connected components in a graph. When a new SCC is found, the {@link SCCListener#foundSCC(java.util.Collection)} method is invoked. The listener object may hence not be null. <p> Tarjan's algorithm is used for realizing the SCC search. @param graph the graph @param sccListener the SCC listener @see TarjanSCCVisitor @see SCCs
[ "Find", "all", "strongly", "-", "connected", "components", "in", "a", "graph", ".", "When", "a", "new", "SCC", "is", "found", "the", "{", "@link", "SCCListener#foundSCC", "(", "java", ".", "util", ".", "Collection", ")", "}", "method", "is", "invoked", ".", "The", "listener", "object", "may", "hence", "not", "be", "null", ".", "<p", ">", "Tarjan", "s", "algorithm", "is", "used", "for", "realizing", "the", "SCC", "search", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/graphs/Graphs.java#L189-L191
dhemery/victor
src/main/java/com/dhemery/victor/frank/frankly/MessageResponseParser.java
MessageResponseParser.deserialize
@Override public MessageResponse deserialize(JsonElement element, Type alsoIgnored, JsonDeserializationContext ignored) { """ Create a {@code MessageResponse} object from a serialized JSON representation. """ List<String> results = new ArrayList<String>(); String reason = ""; String details = ""; JsonObject body = element.getAsJsonObject(); boolean succeeded = body.get("outcome").getAsString().equals("SUCCESS"); if (succeeded) { if (body.get("results") != null) { for (JsonElement result : body.get("results").getAsJsonArray()) { if(result.isJsonNull()) results.add(null); else if(result.isJsonObject()) results.add(result.toString()); else results.add(result.getAsString()); } } } else { reason = body.get("reason").getAsString(); details = body.get("details").getAsString(); } return new MessageResponse(succeeded, results, reason, details); }
java
@Override public MessageResponse deserialize(JsonElement element, Type alsoIgnored, JsonDeserializationContext ignored) { List<String> results = new ArrayList<String>(); String reason = ""; String details = ""; JsonObject body = element.getAsJsonObject(); boolean succeeded = body.get("outcome").getAsString().equals("SUCCESS"); if (succeeded) { if (body.get("results") != null) { for (JsonElement result : body.get("results").getAsJsonArray()) { if(result.isJsonNull()) results.add(null); else if(result.isJsonObject()) results.add(result.toString()); else results.add(result.getAsString()); } } } else { reason = body.get("reason").getAsString(); details = body.get("details").getAsString(); } return new MessageResponse(succeeded, results, reason, details); }
[ "@", "Override", "public", "MessageResponse", "deserialize", "(", "JsonElement", "element", ",", "Type", "alsoIgnored", ",", "JsonDeserializationContext", "ignored", ")", "{", "List", "<", "String", ">", "results", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "reason", "=", "\"\"", ";", "String", "details", "=", "\"\"", ";", "JsonObject", "body", "=", "element", ".", "getAsJsonObject", "(", ")", ";", "boolean", "succeeded", "=", "body", ".", "get", "(", "\"outcome\"", ")", ".", "getAsString", "(", ")", ".", "equals", "(", "\"SUCCESS\"", ")", ";", "if", "(", "succeeded", ")", "{", "if", "(", "body", ".", "get", "(", "\"results\"", ")", "!=", "null", ")", "{", "for", "(", "JsonElement", "result", ":", "body", ".", "get", "(", "\"results\"", ")", ".", "getAsJsonArray", "(", ")", ")", "{", "if", "(", "result", ".", "isJsonNull", "(", ")", ")", "results", ".", "add", "(", "null", ")", ";", "else", "if", "(", "result", ".", "isJsonObject", "(", ")", ")", "results", ".", "add", "(", "result", ".", "toString", "(", ")", ")", ";", "else", "results", ".", "add", "(", "result", ".", "getAsString", "(", ")", ")", ";", "}", "}", "}", "else", "{", "reason", "=", "body", ".", "get", "(", "\"reason\"", ")", ".", "getAsString", "(", ")", ";", "details", "=", "body", ".", "get", "(", "\"details\"", ")", ".", "getAsString", "(", ")", ";", "}", "return", "new", "MessageResponse", "(", "succeeded", ",", "results", ",", "reason", ",", "details", ")", ";", "}" ]
Create a {@code MessageResponse} object from a serialized JSON representation.
[ "Create", "a", "{" ]
train
https://github.com/dhemery/victor/blob/52fa85737f01965cc2b15bf62d9b86b5ad6a974b/src/main/java/com/dhemery/victor/frank/frankly/MessageResponseParser.java#L21-L43
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java
DeleteHandler.deleteTypeVertex
protected void deleteTypeVertex(AtlasVertex instanceVertex, DataTypes.TypeCategory typeCategory, boolean force) throws AtlasException { """ Deletes a type vertex - can be entity(class type) or just vertex(struct/trait type) @param instanceVertex @param typeCategory @throws AtlasException """ switch (typeCategory) { case STRUCT: case TRAIT: deleteTypeVertex(instanceVertex, force); break; case CLASS: deleteEntities(Collections.singletonList(instanceVertex)); break; default: throw new IllegalStateException("Type category " + typeCategory + " not handled"); } }
java
protected void deleteTypeVertex(AtlasVertex instanceVertex, DataTypes.TypeCategory typeCategory, boolean force) throws AtlasException { switch (typeCategory) { case STRUCT: case TRAIT: deleteTypeVertex(instanceVertex, force); break; case CLASS: deleteEntities(Collections.singletonList(instanceVertex)); break; default: throw new IllegalStateException("Type category " + typeCategory + " not handled"); } }
[ "protected", "void", "deleteTypeVertex", "(", "AtlasVertex", "instanceVertex", ",", "DataTypes", ".", "TypeCategory", "typeCategory", ",", "boolean", "force", ")", "throws", "AtlasException", "{", "switch", "(", "typeCategory", ")", "{", "case", "STRUCT", ":", "case", "TRAIT", ":", "deleteTypeVertex", "(", "instanceVertex", ",", "force", ")", ";", "break", ";", "case", "CLASS", ":", "deleteEntities", "(", "Collections", ".", "singletonList", "(", "instanceVertex", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Type category \"", "+", "typeCategory", "+", "\" not handled\"", ")", ";", "}", "}" ]
Deletes a type vertex - can be entity(class type) or just vertex(struct/trait type) @param instanceVertex @param typeCategory @throws AtlasException
[ "Deletes", "a", "type", "vertex", "-", "can", "be", "entity", "(", "class", "type", ")", "or", "just", "vertex", "(", "struct", "/", "trait", "type", ")" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/DeleteHandler.java#L116-L130
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/scheduler/SourcePartitionedScheduler.java
SourcePartitionedScheduler.newSourcePartitionedSchedulerAsStageScheduler
public static StageScheduler newSourcePartitionedSchedulerAsStageScheduler( SqlStageExecution stage, PlanNodeId partitionedNode, SplitSource splitSource, SplitPlacementPolicy splitPlacementPolicy, int splitBatchSize) { """ Obtains an instance of {@code SourcePartitionedScheduler} suitable for use as a stage scheduler. <p> This returns an ungrouped {@code SourcePartitionedScheduler} that requires minimal management from the caller, which is ideal for use as a stage scheduler. """ SourcePartitionedScheduler sourcePartitionedScheduler = new SourcePartitionedScheduler(stage, partitionedNode, splitSource, splitPlacementPolicy, splitBatchSize, false); sourcePartitionedScheduler.startLifespan(Lifespan.taskWide(), NOT_PARTITIONED); return new StageScheduler() { @Override public ScheduleResult schedule() { ScheduleResult scheduleResult = sourcePartitionedScheduler.schedule(); sourcePartitionedScheduler.drainCompletelyScheduledLifespans(); return scheduleResult; } @Override public void close() { sourcePartitionedScheduler.close(); } }; }
java
public static StageScheduler newSourcePartitionedSchedulerAsStageScheduler( SqlStageExecution stage, PlanNodeId partitionedNode, SplitSource splitSource, SplitPlacementPolicy splitPlacementPolicy, int splitBatchSize) { SourcePartitionedScheduler sourcePartitionedScheduler = new SourcePartitionedScheduler(stage, partitionedNode, splitSource, splitPlacementPolicy, splitBatchSize, false); sourcePartitionedScheduler.startLifespan(Lifespan.taskWide(), NOT_PARTITIONED); return new StageScheduler() { @Override public ScheduleResult schedule() { ScheduleResult scheduleResult = sourcePartitionedScheduler.schedule(); sourcePartitionedScheduler.drainCompletelyScheduledLifespans(); return scheduleResult; } @Override public void close() { sourcePartitionedScheduler.close(); } }; }
[ "public", "static", "StageScheduler", "newSourcePartitionedSchedulerAsStageScheduler", "(", "SqlStageExecution", "stage", ",", "PlanNodeId", "partitionedNode", ",", "SplitSource", "splitSource", ",", "SplitPlacementPolicy", "splitPlacementPolicy", ",", "int", "splitBatchSize", ")", "{", "SourcePartitionedScheduler", "sourcePartitionedScheduler", "=", "new", "SourcePartitionedScheduler", "(", "stage", ",", "partitionedNode", ",", "splitSource", ",", "splitPlacementPolicy", ",", "splitBatchSize", ",", "false", ")", ";", "sourcePartitionedScheduler", ".", "startLifespan", "(", "Lifespan", ".", "taskWide", "(", ")", ",", "NOT_PARTITIONED", ")", ";", "return", "new", "StageScheduler", "(", ")", "{", "@", "Override", "public", "ScheduleResult", "schedule", "(", ")", "{", "ScheduleResult", "scheduleResult", "=", "sourcePartitionedScheduler", ".", "schedule", "(", ")", ";", "sourcePartitionedScheduler", ".", "drainCompletelyScheduledLifespans", "(", ")", ";", "return", "scheduleResult", ";", "}", "@", "Override", "public", "void", "close", "(", ")", "{", "sourcePartitionedScheduler", ".", "close", "(", ")", ";", "}", "}", ";", "}" ]
Obtains an instance of {@code SourcePartitionedScheduler} suitable for use as a stage scheduler. <p> This returns an ungrouped {@code SourcePartitionedScheduler} that requires minimal management from the caller, which is ideal for use as a stage scheduler.
[ "Obtains", "an", "instance", "of", "{" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/scheduler/SourcePartitionedScheduler.java#L129-L154
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.booleanFormat
public CRestBuilder booleanFormat(String trueFormat, String falseFormat) { """ Overrides the default boolean format for serialization (default are "true" and "false"). @param trueFormat format for TRUE @param falseFormat format for FALSE @return current builder @see CRestConfig#CREST_BOOLEAN_TRUE @see CRestConfig#CREST_BOOLEAN_FALSE @see CRestConfig#getBooleanTrue() @see CRestConfig#getBooleanFalse() """ return property(CREST_BOOLEAN_TRUE, trueFormat).property(CREST_BOOLEAN_FALSE, falseFormat); }
java
public CRestBuilder booleanFormat(String trueFormat, String falseFormat) { return property(CREST_BOOLEAN_TRUE, trueFormat).property(CREST_BOOLEAN_FALSE, falseFormat); }
[ "public", "CRestBuilder", "booleanFormat", "(", "String", "trueFormat", ",", "String", "falseFormat", ")", "{", "return", "property", "(", "CREST_BOOLEAN_TRUE", ",", "trueFormat", ")", ".", "property", "(", "CREST_BOOLEAN_FALSE", ",", "falseFormat", ")", ";", "}" ]
Overrides the default boolean format for serialization (default are "true" and "false"). @param trueFormat format for TRUE @param falseFormat format for FALSE @return current builder @see CRestConfig#CREST_BOOLEAN_TRUE @see CRestConfig#CREST_BOOLEAN_FALSE @see CRestConfig#getBooleanTrue() @see CRestConfig#getBooleanFalse()
[ "Overrides", "the", "default", "boolean", "format", "for", "serialization", "(", "default", "are", "true", "and", "false", ")", "." ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L338-L340
alkacon/opencms-core
src/org/opencms/loader/CmsPointerLoader.java
CmsPointerLoader.appendLinkParams
private static String appendLinkParams(String pointerLink, HttpServletRequest req) { """ Internal helper that is used by <code>{@link #load(CmsObject, CmsResource, HttpServletRequest, HttpServletResponse)}</code> and <code>{@link #export(CmsObject, CmsResource, HttpServletRequest, HttpServletResponse)}</code> to handle conditional request parameter support for links to pointer resources. <p> @param pointerLink the link to append request parameters to @param req the original request to the pointer @return the pointer with the parameters """ String result = pointerLink; if (isRequestParamSupportEnabled()) { Map<String, String[]> params = req.getParameterMap(); if (params.size() > 0) { result = CmsRequestUtil.appendParameters(result, params, false); } } return result; }
java
private static String appendLinkParams(String pointerLink, HttpServletRequest req) { String result = pointerLink; if (isRequestParamSupportEnabled()) { Map<String, String[]> params = req.getParameterMap(); if (params.size() > 0) { result = CmsRequestUtil.appendParameters(result, params, false); } } return result; }
[ "private", "static", "String", "appendLinkParams", "(", "String", "pointerLink", ",", "HttpServletRequest", "req", ")", "{", "String", "result", "=", "pointerLink", ";", "if", "(", "isRequestParamSupportEnabled", "(", ")", ")", "{", "Map", "<", "String", ",", "String", "[", "]", ">", "params", "=", "req", ".", "getParameterMap", "(", ")", ";", "if", "(", "params", ".", "size", "(", ")", ">", "0", ")", "{", "result", "=", "CmsRequestUtil", ".", "appendParameters", "(", "result", ",", "params", ",", "false", ")", ";", "}", "}", "return", "result", ";", "}" ]
Internal helper that is used by <code>{@link #load(CmsObject, CmsResource, HttpServletRequest, HttpServletResponse)}</code> and <code>{@link #export(CmsObject, CmsResource, HttpServletRequest, HttpServletResponse)}</code> to handle conditional request parameter support for links to pointer resources. <p> @param pointerLink the link to append request parameters to @param req the original request to the pointer @return the pointer with the parameters
[ "Internal", "helper", "that", "is", "used", "by", "<code", ">", "{", "@link", "#load", "(", "CmsObject", "CmsResource", "HttpServletRequest", "HttpServletResponse", ")", "}", "<", "/", "code", ">", "and", "<code", ">", "{", "@link", "#export", "(", "CmsObject", "CmsResource", "HttpServletRequest", "HttpServletResponse", ")", "}", "<", "/", "code", ">", "to", "handle", "conditional", "request", "parameter", "support", "for", "links", "to", "pointer", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsPointerLoader.java#L127-L137
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.getVarNameForFieldAndFunction
public String getVarNameForFieldAndFunction(DifferentialFunction function, String fieldName) { """ Get the variable name to use for resolving a given field for a given function during import time. This method is u sed during {@link DifferentialFunction#resolvePropertiesFromSameDiffBeforeExecution()} @param function the function to get the variable name for @param fieldName the field name to resolve for @return the resolve variable name if any """ return fieldVariableResolutionMapping.get(function.getOwnName(), fieldName); }
java
public String getVarNameForFieldAndFunction(DifferentialFunction function, String fieldName) { return fieldVariableResolutionMapping.get(function.getOwnName(), fieldName); }
[ "public", "String", "getVarNameForFieldAndFunction", "(", "DifferentialFunction", "function", ",", "String", "fieldName", ")", "{", "return", "fieldVariableResolutionMapping", ".", "get", "(", "function", ".", "getOwnName", "(", ")", ",", "fieldName", ")", ";", "}" ]
Get the variable name to use for resolving a given field for a given function during import time. This method is u sed during {@link DifferentialFunction#resolvePropertiesFromSameDiffBeforeExecution()} @param function the function to get the variable name for @param fieldName the field name to resolve for @return the resolve variable name if any
[ "Get", "the", "variable", "name", "to", "use", "for", "resolving", "a", "given", "field", "for", "a", "given", "function", "during", "import", "time", ".", "This", "method", "is", "u", "sed", "during", "{", "@link", "DifferentialFunction#resolvePropertiesFromSameDiffBeforeExecution", "()", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1047-L1049
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.setAppLaunchCount
public static void setAppLaunchCount(Context context, long appLaunchCount) { """ Modify internal value. <p/> If you use this method, you might need to have a good understanding of this class code. @param context Context @param appLaunchCount Launch count of This application. """ SharedPreferences prefs = getSharedPreferences(context); SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appLaunchCount); prefsEditor.commit(); }
java
public static void setAppLaunchCount(Context context, long appLaunchCount) { SharedPreferences prefs = getSharedPreferences(context); SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, appLaunchCount); prefsEditor.commit(); }
[ "public", "static", "void", "setAppLaunchCount", "(", "Context", "context", ",", "long", "appLaunchCount", ")", "{", "SharedPreferences", "prefs", "=", "getSharedPreferences", "(", "context", ")", ";", "SharedPreferences", ".", "Editor", "prefsEditor", "=", "prefs", ".", "edit", "(", ")", ";", "prefsEditor", ".", "putLong", "(", "PREF_KEY_APP_LAUNCH_COUNT", ",", "appLaunchCount", ")", ";", "prefsEditor", ".", "commit", "(", ")", ";", "}" ]
Modify internal value. <p/> If you use this method, you might need to have a good understanding of this class code. @param context Context @param appLaunchCount Launch count of This application.
[ "Modify", "internal", "value", ".", "<p", "/", ">", "If", "you", "use", "this", "method", "you", "might", "need", "to", "have", "a", "good", "understanding", "of", "this", "class", "code", "." ]
train
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L307-L314
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/RandomUtils.java
RandomUtils.getRandom
public static String getRandom(char[] sourceChar, int length) { """ 得到固定长度的随机字符串,字符串由sourceChar中字符混合组成 @param sourceChar 源字符数组 @param length 长度 @return <ul> <li>若sourceChar为null或长度为0,返回null</li> <li>若length小于0,返回null</li> </ul> """ if (sourceChar == null || sourceChar.length == 0 || length < 0) { return null; } StringBuilder str = new StringBuilder(length); Random random = new Random(); for (int i = 0; i < length; i++) { str.append(sourceChar[random.nextInt(sourceChar.length)]); } return str.toString(); }
java
public static String getRandom(char[] sourceChar, int length) { if (sourceChar == null || sourceChar.length == 0 || length < 0) { return null; } StringBuilder str = new StringBuilder(length); Random random = new Random(); for (int i = 0; i < length; i++) { str.append(sourceChar[random.nextInt(sourceChar.length)]); } return str.toString(); }
[ "public", "static", "String", "getRandom", "(", "char", "[", "]", "sourceChar", ",", "int", "length", ")", "{", "if", "(", "sourceChar", "==", "null", "||", "sourceChar", ".", "length", "==", "0", "||", "length", "<", "0", ")", "{", "return", "null", ";", "}", "StringBuilder", "str", "=", "new", "StringBuilder", "(", "length", ")", ";", "Random", "random", "=", "new", "Random", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "str", ".", "append", "(", "sourceChar", "[", "random", ".", "nextInt", "(", "sourceChar", ".", "length", ")", "]", ")", ";", "}", "return", "str", ".", "toString", "(", ")", ";", "}" ]
得到固定长度的随机字符串,字符串由sourceChar中字符混合组成 @param sourceChar 源字符数组 @param length 长度 @return <ul> <li>若sourceChar为null或长度为0,返回null</li> <li>若length小于0,返回null</li> </ul>
[ "得到固定长度的随机字符串,字符串由sourceChar中字符混合组成" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/RandomUtils.java#L83-L93
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java
LollipopDrawablesCompat.createFromXmlInner
public static Drawable createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme) throws XmlPullParserException, IOException { """ Create a drawable from inside an XML document using an optional {@link Resources.Theme}. Called on a parser positioned at a tag in an XML document, tries to create a Drawable from that tag. Returns {@code null} if the tag is not a valid drawable. """ Drawable drawable = null; final String name = parser.getName(); try { Class<? extends Drawable> clazz = CLASS_MAP.get(name); if (clazz != null) { drawable = clazz.newInstance(); } else if (name.indexOf('.') > 0) { drawable = (Drawable) Class.forName(name).newInstance(); } } catch (Exception e) { throw new XmlPullParserException("Error while inflating drawable resource", parser, e); } if (drawable == null) { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { return Drawable.createFromXmlInner(r, parser, attrs, theme); } else { return Drawable.createFromXmlInner(r, parser, attrs); } } IMPL.inflate(drawable, r, parser, attrs, theme); return drawable; }
java
public static Drawable createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme) throws XmlPullParserException, IOException { Drawable drawable = null; final String name = parser.getName(); try { Class<? extends Drawable> clazz = CLASS_MAP.get(name); if (clazz != null) { drawable = clazz.newInstance(); } else if (name.indexOf('.') > 0) { drawable = (Drawable) Class.forName(name).newInstance(); } } catch (Exception e) { throw new XmlPullParserException("Error while inflating drawable resource", parser, e); } if (drawable == null) { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { return Drawable.createFromXmlInner(r, parser, attrs, theme); } else { return Drawable.createFromXmlInner(r, parser, attrs); } } IMPL.inflate(drawable, r, parser, attrs, theme); return drawable; }
[ "public", "static", "Drawable", "createFromXmlInner", "(", "Resources", "r", ",", "XmlPullParser", "parser", ",", "AttributeSet", "attrs", ",", "Resources", ".", "Theme", "theme", ")", "throws", "XmlPullParserException", ",", "IOException", "{", "Drawable", "drawable", "=", "null", ";", "final", "String", "name", "=", "parser", ".", "getName", "(", ")", ";", "try", "{", "Class", "<", "?", "extends", "Drawable", ">", "clazz", "=", "CLASS_MAP", ".", "get", "(", "name", ")", ";", "if", "(", "clazz", "!=", "null", ")", "{", "drawable", "=", "clazz", ".", "newInstance", "(", ")", ";", "}", "else", "if", "(", "name", ".", "indexOf", "(", "'", "'", ")", ">", "0", ")", "{", "drawable", "=", "(", "Drawable", ")", "Class", ".", "forName", "(", "name", ")", ".", "newInstance", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "XmlPullParserException", "(", "\"Error while inflating drawable resource\"", ",", "parser", ",", "e", ")", ";", "}", "if", "(", "drawable", "==", "null", ")", "{", "if", "(", "Carbon", ".", "IS_LOLLIPOP_OR_HIGHER", ")", "{", "return", "Drawable", ".", "createFromXmlInner", "(", "r", ",", "parser", ",", "attrs", ",", "theme", ")", ";", "}", "else", "{", "return", "Drawable", ".", "createFromXmlInner", "(", "r", ",", "parser", ",", "attrs", ")", ";", "}", "}", "IMPL", ".", "inflate", "(", "drawable", ",", "r", ",", "parser", ",", "attrs", ",", "theme", ")", ";", "return", "drawable", ";", "}" ]
Create a drawable from inside an XML document using an optional {@link Resources.Theme}. Called on a parser positioned at a tag in an XML document, tries to create a Drawable from that tag. Returns {@code null} if the tag is not a valid drawable.
[ "Create", "a", "drawable", "from", "inside", "an", "XML", "document", "using", "an", "optional", "{" ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java#L135-L157
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java
AbstractCommandExtension.analyzeElVars
protected void analyzeElVars(final T descriptor, final DescriptorContext context) { """ Analyze query string for el variables and creates el descriptor. @param descriptor repository method descriptor @param context repository method context """ descriptor.el = ElAnalyzer.analyzeQuery(context.generics, descriptor.command); }
java
protected void analyzeElVars(final T descriptor, final DescriptorContext context) { descriptor.el = ElAnalyzer.analyzeQuery(context.generics, descriptor.command); }
[ "protected", "void", "analyzeElVars", "(", "final", "T", "descriptor", ",", "final", "DescriptorContext", "context", ")", "{", "descriptor", ".", "el", "=", "ElAnalyzer", ".", "analyzeQuery", "(", "context", ".", "generics", ",", "descriptor", ".", "command", ")", ";", "}" ]
Analyze query string for el variables and creates el descriptor. @param descriptor repository method descriptor @param context repository method context
[ "Analyze", "query", "string", "for", "el", "variables", "and", "creates", "el", "descriptor", "." ]
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java#L50-L52
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/api/Configuration.java
Configuration.getLong
public long getLong(String key, long defaultValue) { """ Gets the long value for <code>key</code> or <code>defaultValue</code> if not found. @param key key to get value for @param defaultValue default value if key not found @return value or <code>defaultValue</code> if not found """ if (containsKey(key)) { return Long.parseLong(get(key)); } else { return defaultValue; } }
java
public long getLong(String key, long defaultValue) { if (containsKey(key)) { return Long.parseLong(get(key)); } else { return defaultValue; } }
[ "public", "long", "getLong", "(", "String", "key", ",", "long", "defaultValue", ")", "{", "if", "(", "containsKey", "(", "key", ")", ")", "{", "return", "Long", ".", "parseLong", "(", "get", "(", "key", ")", ")", ";", "}", "else", "{", "return", "defaultValue", ";", "}", "}" ]
Gets the long value for <code>key</code> or <code>defaultValue</code> if not found. @param key key to get value for @param defaultValue default value if key not found @return value or <code>defaultValue</code> if not found
[ "Gets", "the", "long", "value", "for", "<code", ">", "key<", "/", "code", ">", "or", "<code", ">", "defaultValue<", "/", "code", ">", "if", "not", "found", "." ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/api/Configuration.java#L228-L234
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java
EigenPowerMethod_DDRM.computeShiftDirect
public boolean computeShiftDirect(DMatrixRMaj A , double alpha) { """ Computes the most dominant eigen vector of A using a shifted matrix. The shifted matrix is defined as <b>B = A - &alpha;I</b> and can converge faster if &alpha; is chosen wisely. In general it is easier to choose a value for &alpha; that will converge faster with the shift-invert strategy than this one. @param A The matrix. @param alpha Shifting factor. @return If it converged or not. """ SpecializedOps_DDRM.addIdentity(A,B,-alpha); return computeDirect(B); }
java
public boolean computeShiftDirect(DMatrixRMaj A , double alpha) { SpecializedOps_DDRM.addIdentity(A,B,-alpha); return computeDirect(B); }
[ "public", "boolean", "computeShiftDirect", "(", "DMatrixRMaj", "A", ",", "double", "alpha", ")", "{", "SpecializedOps_DDRM", ".", "addIdentity", "(", "A", ",", "B", ",", "-", "alpha", ")", ";", "return", "computeDirect", "(", "B", ")", ";", "}" ]
Computes the most dominant eigen vector of A using a shifted matrix. The shifted matrix is defined as <b>B = A - &alpha;I</b> and can converge faster if &alpha; is chosen wisely. In general it is easier to choose a value for &alpha; that will converge faster with the shift-invert strategy than this one. @param A The matrix. @param alpha Shifting factor. @return If it converged or not.
[ "Computes", "the", "most", "dominant", "eigen", "vector", "of", "A", "using", "a", "shifted", "matrix", ".", "The", "shifted", "matrix", "is", "defined", "as", "<b", ">", "B", "=", "A", "-", "&alpha", ";", "I<", "/", "b", ">", "and", "can", "converge", "faster", "if", "&alpha", ";", "is", "chosen", "wisely", ".", "In", "general", "it", "is", "easier", "to", "choose", "a", "value", "for", "&alpha", ";", "that", "will", "converge", "faster", "with", "the", "shift", "-", "invert", "strategy", "than", "this", "one", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenPowerMethod_DDRM.java#L180-L184
DDTH/ddth-kafka
src/main/java/com/github/ddth/kafka/KafkaClient.java
KafkaClient.seekToEnd
public boolean seekToEnd(String consumerGroupId, String topic) { """ Seeks to the end of all assigned partitions of a topic. @param consumerGroupId @param topic @return {@code true} if the consumer has subscribed to the specified topic, {@code false} otherwise. @since 1.2.0 """ KafkaMsgConsumer consumer = getKafkaConsumer(consumerGroupId, false); return consumer.seekToEnd(topic); }
java
public boolean seekToEnd(String consumerGroupId, String topic) { KafkaMsgConsumer consumer = getKafkaConsumer(consumerGroupId, false); return consumer.seekToEnd(topic); }
[ "public", "boolean", "seekToEnd", "(", "String", "consumerGroupId", ",", "String", "topic", ")", "{", "KafkaMsgConsumer", "consumer", "=", "getKafkaConsumer", "(", "consumerGroupId", ",", "false", ")", ";", "return", "consumer", ".", "seekToEnd", "(", "topic", ")", ";", "}" ]
Seeks to the end of all assigned partitions of a topic. @param consumerGroupId @param topic @return {@code true} if the consumer has subscribed to the specified topic, {@code false} otherwise. @since 1.2.0
[ "Seeks", "to", "the", "end", "of", "all", "assigned", "partitions", "of", "a", "topic", "." ]
train
https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L448-L451
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.getDisplayName
public String getDisplayName(int field, int style, Locale locale) { """ Returns the string representation of the calendar <code>field</code> value in the given <code>style</code> and <code>locale</code>. If no string representation is applicable, <code>null</code> is returned. This method calls {@link Calendar#get(int) get(field)} to get the calendar <code>field</code> value if the string representation is applicable to the given calendar <code>field</code>. <p>For example, if this <code>Calendar</code> is a <code>GregorianCalendar</code> and its date is 2005-01-01, then the string representation of the {@link #MONTH} field would be "January" in the long style in an English locale or "Jan" in the short style. However, no string representation would be available for the {@link #DAY_OF_MONTH} field, and this method would return <code>null</code>. <p>The default implementation supports the calendar fields for which a {@link DateFormatSymbols} has names in the given <code>locale</code>. @param field the calendar field for which the string representation is returned @param style the style applied to the string representation; one of {@link #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE}, {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}. @param locale the locale for the string representation (any calendar types specified by {@code locale} are ignored) @return the string representation of the given {@code field} in the given {@code style}, or {@code null} if no string representation is applicable. @exception IllegalArgumentException if {@code field} or {@code style} is invalid, or if this {@code Calendar} is non-lenient and any of the calendar fields have invalid values @exception NullPointerException if {@code locale} is null @since 1.6 """ if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale); String[] strings = getFieldStrings(field, style, symbols); if (strings != null) { int fieldValue = get(field); if (fieldValue < strings.length) { return strings[fieldValue]; } } return null; }
java
public String getDisplayName(int field, int style, Locale locale) { if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale); String[] strings = getFieldStrings(field, style, symbols); if (strings != null) { int fieldValue = get(field); if (fieldValue < strings.length) { return strings[fieldValue]; } } return null; }
[ "public", "String", "getDisplayName", "(", "int", "field", ",", "int", "style", ",", "Locale", "locale", ")", "{", "if", "(", "!", "checkDisplayNameParams", "(", "field", ",", "style", ",", "ALL_STYLES", ",", "LONG", ",", "locale", ",", "ERA_MASK", "|", "MONTH_MASK", "|", "DAY_OF_WEEK_MASK", "|", "AM_PM_MASK", ")", ")", "{", "return", "null", ";", "}", "DateFormatSymbols", "symbols", "=", "DateFormatSymbols", ".", "getInstance", "(", "locale", ")", ";", "String", "[", "]", "strings", "=", "getFieldStrings", "(", "field", ",", "style", ",", "symbols", ")", ";", "if", "(", "strings", "!=", "null", ")", "{", "int", "fieldValue", "=", "get", "(", "field", ")", ";", "if", "(", "fieldValue", "<", "strings", ".", "length", ")", "{", "return", "strings", "[", "fieldValue", "]", ";", "}", "}", "return", "null", ";", "}" ]
Returns the string representation of the calendar <code>field</code> value in the given <code>style</code> and <code>locale</code>. If no string representation is applicable, <code>null</code> is returned. This method calls {@link Calendar#get(int) get(field)} to get the calendar <code>field</code> value if the string representation is applicable to the given calendar <code>field</code>. <p>For example, if this <code>Calendar</code> is a <code>GregorianCalendar</code> and its date is 2005-01-01, then the string representation of the {@link #MONTH} field would be "January" in the long style in an English locale or "Jan" in the short style. However, no string representation would be available for the {@link #DAY_OF_MONTH} field, and this method would return <code>null</code>. <p>The default implementation supports the calendar fields for which a {@link DateFormatSymbols} has names in the given <code>locale</code>. @param field the calendar field for which the string representation is returned @param style the style applied to the string representation; one of {@link #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE}, {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}. @param locale the locale for the string representation (any calendar types specified by {@code locale} are ignored) @return the string representation of the given {@code field} in the given {@code style}, or {@code null} if no string representation is applicable. @exception IllegalArgumentException if {@code field} or {@code style} is invalid, or if this {@code Calendar} is non-lenient and any of the calendar fields have invalid values @exception NullPointerException if {@code locale} is null @since 1.6
[ "Returns", "the", "string", "representation", "of", "the", "calendar", "<code", ">", "field<", "/", "code", ">", "value", "in", "the", "given", "<code", ">", "style<", "/", "code", ">", "and", "<code", ">", "locale<", "/", "code", ">", ".", "If", "no", "string", "representation", "is", "applicable", "<code", ">", "null<", "/", "code", ">", "is", "returned", ".", "This", "method", "calls", "{", "@link", "Calendar#get", "(", "int", ")", "get", "(", "field", ")", "}", "to", "get", "the", "calendar", "<code", ">", "field<", "/", "code", ">", "value", "if", "the", "string", "representation", "is", "applicable", "to", "the", "given", "calendar", "<code", ">", "field<", "/", "code", ">", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L2055-L2070
banq/jdonframework
JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java
PageIteratorSolver.queryMultiObject
public List queryMultiObject(Collection queryParams, String sqlquery) throws Exception { """ query multi object from database delgate to JdbCQueryTemp's queryMultiObject method @param queryParams @param sqlquery @return @throws Exception """ JdbcTemp jdbcTemp = new JdbcTemp(dataSource); return jdbcTemp.queryMultiObject(queryParams, sqlquery); }
java
public List queryMultiObject(Collection queryParams, String sqlquery) throws Exception { JdbcTemp jdbcTemp = new JdbcTemp(dataSource); return jdbcTemp.queryMultiObject(queryParams, sqlquery); }
[ "public", "List", "queryMultiObject", "(", "Collection", "queryParams", ",", "String", "sqlquery", ")", "throws", "Exception", "{", "JdbcTemp", "jdbcTemp", "=", "new", "JdbcTemp", "(", "dataSource", ")", ";", "return", "jdbcTemp", ".", "queryMultiObject", "(", "queryParams", ",", "sqlquery", ")", ";", "}" ]
query multi object from database delgate to JdbCQueryTemp's queryMultiObject method @param queryParams @param sqlquery @return @throws Exception
[ "query", "multi", "object", "from", "database", "delgate", "to", "JdbCQueryTemp", "s", "queryMultiObject", "method" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L148-L151
nohana/Amalgam
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
CursorUtils.getInt
public static int getInt(Cursor cursor, String columnName) { """ Read the int data for the column. @see android.database.Cursor#getInt(int). @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return the int value. """ if (cursor == null) { return -1; } return cursor.getInt(cursor.getColumnIndex(columnName)); }
java
public static int getInt(Cursor cursor, String columnName) { if (cursor == null) { return -1; } return cursor.getInt(cursor.getColumnIndex(columnName)); }
[ "public", "static", "int", "getInt", "(", "Cursor", "cursor", ",", "String", "columnName", ")", "{", "if", "(", "cursor", "==", "null", ")", "{", "return", "-", "1", ";", "}", "return", "cursor", ".", "getInt", "(", "cursor", ".", "getColumnIndex", "(", "columnName", ")", ")", ";", "}" ]
Read the int data for the column. @see android.database.Cursor#getInt(int). @see android.database.Cursor#getColumnIndex(String). @param cursor the cursor. @param columnName the column name. @return the int value.
[ "Read", "the", "int", "data", "for", "the", "column", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L64-L70
voldemort/voldemort
src/java/voldemort/utils/RebalanceUtils.java
RebalanceUtils.dumpClusterToFile
public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) { """ Prints a cluster xml to a file. @param outputDirName @param fileName @param cluster """ if(outputDirName != null) { File outputDir = new File(outputDirName); if(!outputDir.exists()) { Utils.mkdirs(outputDir); } try { FileUtils.writeStringToFile(new File(outputDirName, fileName), new ClusterMapper().writeCluster(cluster)); } catch(IOException e) { logger.error("IOException during dumpClusterToFile: " + e); } } }
java
public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) { if(outputDirName != null) { File outputDir = new File(outputDirName); if(!outputDir.exists()) { Utils.mkdirs(outputDir); } try { FileUtils.writeStringToFile(new File(outputDirName, fileName), new ClusterMapper().writeCluster(cluster)); } catch(IOException e) { logger.error("IOException during dumpClusterToFile: " + e); } } }
[ "public", "static", "void", "dumpClusterToFile", "(", "String", "outputDirName", ",", "String", "fileName", ",", "Cluster", "cluster", ")", "{", "if", "(", "outputDirName", "!=", "null", ")", "{", "File", "outputDir", "=", "new", "File", "(", "outputDirName", ")", ";", "if", "(", "!", "outputDir", ".", "exists", "(", ")", ")", "{", "Utils", ".", "mkdirs", "(", "outputDir", ")", ";", "}", "try", "{", "FileUtils", ".", "writeStringToFile", "(", "new", "File", "(", "outputDirName", ",", "fileName", ")", ",", "new", "ClusterMapper", "(", ")", ".", "writeCluster", "(", "cluster", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"IOException during dumpClusterToFile: \"", "+", "e", ")", ";", "}", "}", "}" ]
Prints a cluster xml to a file. @param outputDirName @param fileName @param cluster
[ "Prints", "a", "cluster", "xml", "to", "a", "file", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L545-L560
infinispan/infinispan
jcache/commons/src/main/java/org/infinispan/jcache/RIMBeanServerRegistrationUtility.java
RIMBeanServerRegistrationUtility.isRegistered
static <K, V> boolean isRegistered(AbstractJCache<K, V> cache, ObjectNameType objectNameType) { """ Checks whether an ObjectName is already registered. @throws javax.cache.CacheException - all exceptions are wrapped in CacheException """ Set<ObjectName> registeredObjectNames; MBeanServer mBeanServer = cache.getMBeanServer(); if (mBeanServer != null) { ObjectName objectName = calculateObjectName(cache, objectNameType); registeredObjectNames = SecurityActions.queryNames(objectName, null, mBeanServer); return !registeredObjectNames.isEmpty(); } else { return false; } }
java
static <K, V> boolean isRegistered(AbstractJCache<K, V> cache, ObjectNameType objectNameType) { Set<ObjectName> registeredObjectNames; MBeanServer mBeanServer = cache.getMBeanServer(); if (mBeanServer != null) { ObjectName objectName = calculateObjectName(cache, objectNameType); registeredObjectNames = SecurityActions.queryNames(objectName, null, mBeanServer); return !registeredObjectNames.isEmpty(); } else { return false; } }
[ "static", "<", "K", ",", "V", ">", "boolean", "isRegistered", "(", "AbstractJCache", "<", "K", ",", "V", ">", "cache", ",", "ObjectNameType", "objectNameType", ")", "{", "Set", "<", "ObjectName", ">", "registeredObjectNames", ";", "MBeanServer", "mBeanServer", "=", "cache", ".", "getMBeanServer", "(", ")", ";", "if", "(", "mBeanServer", "!=", "null", ")", "{", "ObjectName", "objectName", "=", "calculateObjectName", "(", "cache", ",", "objectNameType", ")", ";", "registeredObjectNames", "=", "SecurityActions", ".", "queryNames", "(", "objectName", ",", "null", ",", "mBeanServer", ")", ";", "return", "!", "registeredObjectNames", ".", "isEmpty", "(", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Checks whether an ObjectName is already registered. @throws javax.cache.CacheException - all exceptions are wrapped in CacheException
[ "Checks", "whether", "an", "ObjectName", "is", "already", "registered", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/jcache/commons/src/main/java/org/infinispan/jcache/RIMBeanServerRegistrationUtility.java#L82-L94
amzn/ion-java
src/com/amazon/ion/impl/IonCharacterReader.java
IonCharacterReader.unreadImpl
private void unreadImpl(int c, boolean updateCounts ) throws IOException { """ Performs ths actual unread operation. @param c the character to unread. @param updateCounts Whether or not we actually update the line number. """ if ( c != -1 ) { if ( updateCounts ) { if ( c == '\n' ) { m_line--; m_column = popColumn(); } else { m_column--; } m_consumed--; } super.unread( c ); } }
java
private void unreadImpl(int c, boolean updateCounts ) throws IOException { if ( c != -1 ) { if ( updateCounts ) { if ( c == '\n' ) { m_line--; m_column = popColumn(); } else { m_column--; } m_consumed--; } super.unread( c ); } }
[ "private", "void", "unreadImpl", "(", "int", "c", ",", "boolean", "updateCounts", ")", "throws", "IOException", "{", "if", "(", "c", "!=", "-", "1", ")", "{", "if", "(", "updateCounts", ")", "{", "if", "(", "c", "==", "'", "'", ")", "{", "m_line", "--", ";", "m_column", "=", "popColumn", "(", ")", ";", "}", "else", "{", "m_column", "--", ";", "}", "m_consumed", "--", ";", "}", "super", ".", "unread", "(", "c", ")", ";", "}", "}" ]
Performs ths actual unread operation. @param c the character to unread. @param updateCounts Whether or not we actually update the line number.
[ "Performs", "ths", "actual", "unread", "operation", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonCharacterReader.java#L269-L282
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/OrmElf.java
OrmElf.getColumnFromProperty
public static String getColumnFromProperty(Class<?> clazz, String propertyName) { """ Gets the column name defined for the given property for the given type. @param clazz The type. @param propertyName The object property name. @return The database column name. """ return Introspector.getIntrospected(clazz).getColumnNameForProperty(propertyName); }
java
public static String getColumnFromProperty(Class<?> clazz, String propertyName) { return Introspector.getIntrospected(clazz).getColumnNameForProperty(propertyName); }
[ "public", "static", "String", "getColumnFromProperty", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ")", "{", "return", "Introspector", ".", "getIntrospected", "(", "clazz", ")", ".", "getColumnNameForProperty", "(", "propertyName", ")", ";", "}" ]
Gets the column name defined for the given property for the given type. @param clazz The type. @param propertyName The object property name. @return The database column name.
[ "Gets", "the", "column", "name", "defined", "for", "the", "given", "property", "for", "the", "given", "type", "." ]
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L305-L308
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java
MKeyArea.compareKeys
public int compareKeys(int iAreaDesc, String strSeekSign, FieldTable table, KeyAreaInfo keyArea) { """ Compare these two keys and return the compare result. @param areaDesc The area that the key to compare is in. @param strSeekSign The seek sign. @param table The table. @param keyArea The table's key area. @return The compare result (-1, 0, or 1). """ int compareValue = super.compareKeys(iAreaDesc, strSeekSign, table, keyArea); if (compareValue != 0) return compareValue; if (keyArea.getUniqueKeyCode() == Constants.UNIQUE) return compareValue; // Found a matching record if ((strSeekSign == null) || (strSeekSign.equals("=="))) { // looking for an exact match! KeyAreaInfo keyArea2 = table.getRecord().getKeyArea(Constants.MAIN_KEY_AREA); if (keyArea == keyArea2) return compareValue; // Error? Primary key has to be unique compareValue = keyArea2.compareKeys(iAreaDesc); } return compareValue; }
java
public int compareKeys(int iAreaDesc, String strSeekSign, FieldTable table, KeyAreaInfo keyArea) { int compareValue = super.compareKeys(iAreaDesc, strSeekSign, table, keyArea); if (compareValue != 0) return compareValue; if (keyArea.getUniqueKeyCode() == Constants.UNIQUE) return compareValue; // Found a matching record if ((strSeekSign == null) || (strSeekSign.equals("=="))) { // looking for an exact match! KeyAreaInfo keyArea2 = table.getRecord().getKeyArea(Constants.MAIN_KEY_AREA); if (keyArea == keyArea2) return compareValue; // Error? Primary key has to be unique compareValue = keyArea2.compareKeys(iAreaDesc); } return compareValue; }
[ "public", "int", "compareKeys", "(", "int", "iAreaDesc", ",", "String", "strSeekSign", ",", "FieldTable", "table", ",", "KeyAreaInfo", "keyArea", ")", "{", "int", "compareValue", "=", "super", ".", "compareKeys", "(", "iAreaDesc", ",", "strSeekSign", ",", "table", ",", "keyArea", ")", ";", "if", "(", "compareValue", "!=", "0", ")", "return", "compareValue", ";", "if", "(", "keyArea", ".", "getUniqueKeyCode", "(", ")", "==", "Constants", ".", "UNIQUE", ")", "return", "compareValue", ";", "// Found a matching record", "if", "(", "(", "strSeekSign", "==", "null", ")", "||", "(", "strSeekSign", ".", "equals", "(", "\"==\"", ")", ")", ")", "{", "// looking for an exact match!", "KeyAreaInfo", "keyArea2", "=", "table", ".", "getRecord", "(", ")", ".", "getKeyArea", "(", "Constants", ".", "MAIN_KEY_AREA", ")", ";", "if", "(", "keyArea", "==", "keyArea2", ")", "return", "compareValue", ";", "// Error? Primary key has to be unique", "compareValue", "=", "keyArea2", ".", "compareKeys", "(", "iAreaDesc", ")", ";", "}", "return", "compareValue", ";", "}" ]
Compare these two keys and return the compare result. @param areaDesc The area that the key to compare is in. @param strSeekSign The seek sign. @param table The table. @param keyArea The table's key area. @return The compare result (-1, 0, or 1).
[ "Compare", "these", "two", "keys", "and", "return", "the", "compare", "result", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java#L111-L126
alkacon/opencms-core
src/org/opencms/gwt/shared/property/CmsClientTemplateBean.java
CmsClientTemplateBean.getNullTemplate
public static CmsClientTemplateBean getNullTemplate() { """ Returns a dummy template object which represents an empty selection.<p> @return a dummy template object """ String imagePath = "/system/workplace/resources/commons/notemplate.png"; CmsClientTemplateBean result = new CmsClientTemplateBean("No template", "", "", imagePath); result.setShowWeakText(true); return result; }
java
public static CmsClientTemplateBean getNullTemplate() { String imagePath = "/system/workplace/resources/commons/notemplate.png"; CmsClientTemplateBean result = new CmsClientTemplateBean("No template", "", "", imagePath); result.setShowWeakText(true); return result; }
[ "public", "static", "CmsClientTemplateBean", "getNullTemplate", "(", ")", "{", "String", "imagePath", "=", "\"/system/workplace/resources/commons/notemplate.png\"", ";", "CmsClientTemplateBean", "result", "=", "new", "CmsClientTemplateBean", "(", "\"No template\"", ",", "\"\"", ",", "\"\"", ",", "imagePath", ")", ";", "result", ".", "setShowWeakText", "(", "true", ")", ";", "return", "result", ";", "}" ]
Returns a dummy template object which represents an empty selection.<p> @return a dummy template object
[ "Returns", "a", "dummy", "template", "object", "which", "represents", "an", "empty", "selection", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/property/CmsClientTemplateBean.java#L83-L89
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java
RequestHeader.withPrincipal
public RequestHeader withPrincipal(Principal principal) { """ Return a copy of this request header with the principal set. @param principal The principal to set. @return A copy of this request header. """ return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, Optional.ofNullable(principal), headers, lowercaseHeaders); }
java
public RequestHeader withPrincipal(Principal principal) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, Optional.ofNullable(principal), headers, lowercaseHeaders); }
[ "public", "RequestHeader", "withPrincipal", "(", "Principal", "principal", ")", "{", "return", "new", "RequestHeader", "(", "method", ",", "uri", ",", "protocol", ",", "acceptedResponseProtocols", ",", "Optional", ".", "ofNullable", "(", "principal", ")", ",", "headers", ",", "lowercaseHeaders", ")", ";", "}" ]
Return a copy of this request header with the principal set. @param principal The principal to set. @return A copy of this request header.
[ "Return", "a", "copy", "of", "this", "request", "header", "with", "the", "principal", "set", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java#L127-L129
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java
HBaseSchemaManager.vaildateHostPort
private void vaildateHostPort(String host, String port) { """ Vaildate host port. @param host the host @param port the port """ if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) { logger.error("Host or port should not be null / port should be numeric"); throw new IllegalArgumentException("Host or port should not be null / port should be numeric"); } }
java
private void vaildateHostPort(String host, String port) { if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) { logger.error("Host or port should not be null / port should be numeric"); throw new IllegalArgumentException("Host or port should not be null / port should be numeric"); } }
[ "private", "void", "vaildateHostPort", "(", "String", "host", ",", "String", "port", ")", "{", "if", "(", "host", "==", "null", "||", "!", "StringUtils", ".", "isNumeric", "(", "port", ")", "||", "port", ".", "isEmpty", "(", ")", ")", "{", "logger", ".", "error", "(", "\"Host or port should not be null / port should be numeric\"", ")", ";", "throw", "new", "IllegalArgumentException", "(", "\"Host or port should not be null / port should be numeric\"", ")", ";", "}", "}" ]
Vaildate host port. @param host the host @param port the port
[ "Vaildate", "host", "port", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java#L558-L565
HalBuilder/halbuilder-guava
src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java
Representations.withLink
public static void withLink(Representation representation, String rel, URI uri, Predicate<ReadableRepresentation> predicate) { """ Add a link to this resource @param rel @param uri The target URI for the link, possibly relative to the href of this resource. """ withLink(representation, rel, uri.toASCIIString(), predicate); }
java
public static void withLink(Representation representation, String rel, URI uri, Predicate<ReadableRepresentation> predicate) { withLink(representation, rel, uri.toASCIIString(), predicate); }
[ "public", "static", "void", "withLink", "(", "Representation", "representation", ",", "String", "rel", ",", "URI", "uri", ",", "Predicate", "<", "ReadableRepresentation", ">", "predicate", ")", "{", "withLink", "(", "representation", ",", "rel", ",", "uri", ".", "toASCIIString", "(", ")", ",", "predicate", ")", ";", "}" ]
Add a link to this resource @param rel @param uri The target URI for the link, possibly relative to the href of this resource.
[ "Add", "a", "link", "to", "this", "resource" ]
train
https://github.com/HalBuilder/halbuilder-guava/blob/648cb1ae6c4b4cebd82364a8d72d9801bd3db771/src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java#L39-L41
jmchilton/galaxy-bootstrap
src/main/java/com/github/jmchilton/galaxybootstrap/GalaxyProperties.java
GalaxyProperties.isPre20141006Release
public boolean isPre20141006Release(File galaxyRoot) { """ Determines if this is a pre-2014.10.06 release of Galaxy. @param galaxyRoot The root directory of Galaxy. @return True if this is a pre-2014.10.06 release of Galaxy, false otherwise. """ if (galaxyRoot == null) { throw new IllegalArgumentException("galaxyRoot is null"); } else if (!galaxyRoot.exists()) { throw new IllegalArgumentException("galaxyRoot=" + galaxyRoot.getAbsolutePath() + " does not exist"); } File configDirectory = new File(galaxyRoot, CONFIG_DIR_NAME); return !(new File(configDirectory, "galaxy.ini.sample")).exists(); }
java
public boolean isPre20141006Release(File galaxyRoot) { if (galaxyRoot == null) { throw new IllegalArgumentException("galaxyRoot is null"); } else if (!galaxyRoot.exists()) { throw new IllegalArgumentException("galaxyRoot=" + galaxyRoot.getAbsolutePath() + " does not exist"); } File configDirectory = new File(galaxyRoot, CONFIG_DIR_NAME); return !(new File(configDirectory, "galaxy.ini.sample")).exists(); }
[ "public", "boolean", "isPre20141006Release", "(", "File", "galaxyRoot", ")", "{", "if", "(", "galaxyRoot", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"galaxyRoot is null\"", ")", ";", "}", "else", "if", "(", "!", "galaxyRoot", ".", "exists", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"galaxyRoot=\"", "+", "galaxyRoot", ".", "getAbsolutePath", "(", ")", "+", "\" does not exist\"", ")", ";", "}", "File", "configDirectory", "=", "new", "File", "(", "galaxyRoot", ",", "CONFIG_DIR_NAME", ")", ";", "return", "!", "(", "new", "File", "(", "configDirectory", ",", "\"galaxy.ini.sample\"", ")", ")", ".", "exists", "(", ")", ";", "}" ]
Determines if this is a pre-2014.10.06 release of Galaxy. @param galaxyRoot The root directory of Galaxy. @return True if this is a pre-2014.10.06 release of Galaxy, false otherwise.
[ "Determines", "if", "this", "is", "a", "pre", "-", "2014", ".", "10", ".", "06", "release", "of", "Galaxy", "." ]
train
https://github.com/jmchilton/galaxy-bootstrap/blob/4a899f5e6ec0c9f6f4b9b21d5a0320e5925ec649/src/main/java/com/github/jmchilton/galaxybootstrap/GalaxyProperties.java#L126-L135
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowOutputBinary.java
RowOutputBinary.writeIntData
public void writeIntData(int i, int position) { """ fredt@users - comment - methods for writing column type, name and data size """ int temp = count; count = position; writeInt(i); if (count < temp) { count = temp; } }
java
public void writeIntData(int i, int position) { int temp = count; count = position; writeInt(i); if (count < temp) { count = temp; } }
[ "public", "void", "writeIntData", "(", "int", "i", ",", "int", "position", ")", "{", "int", "temp", "=", "count", ";", "count", "=", "position", ";", "writeInt", "(", "i", ")", ";", "if", "(", "count", "<", "temp", ")", "{", "count", "=", "temp", ";", "}", "}" ]
fredt@users - comment - methods for writing column type, name and data size
[ "fredt" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowOutputBinary.java#L96-L107
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getRecommendations
public ResultList<MovieInfo> getRecommendations(int movieId, String language) throws MovieDbException { """ The recommendations method will let you retrieve the movie recommendations for a particular movie. @param movieId @param language @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RECOMMENDATIONS).buildUrl(parameters); WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "recommendations"); return wrapper.getResultsList(); }
java
public ResultList<MovieInfo> getRecommendations(int movieId, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RECOMMENDATIONS).buildUrl(parameters); WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "recommendations"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "MovieInfo", ">", "getRecommendations", "(", "int", "movieId", ",", "String", "language", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "movieId", ")", ";", "parameters", ".", "add", "(", "Param", ".", "LANGUAGE", ",", "language", ")", ";", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "MOVIE", ")", ".", "subMethod", "(", "MethodSub", ".", "RECOMMENDATIONS", ")", ".", "buildUrl", "(", "parameters", ")", ";", "WrapperGenericList", "<", "MovieInfo", ">", "wrapper", "=", "processWrapper", "(", "getTypeReference", "(", "MovieInfo", ".", "class", ")", ",", "url", ",", "\"recommendations\"", ")", ";", "return", "wrapper", ".", "getResultsList", "(", ")", ";", "}" ]
The recommendations method will let you retrieve the movie recommendations for a particular movie. @param movieId @param language @return @throws MovieDbException
[ "The", "recommendations", "method", "will", "let", "you", "retrieve", "the", "movie", "recommendations", "for", "a", "particular", "movie", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L273-L281
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceSnippet.java
ResourceSnippet.createResourceSnippet
public static ResourceSnippet createResourceSnippet(InputStream is, int startChar, int endChar, String charset) { """ extract a ResourceSnippet from InputStream at the given char positions @param is - InputStream of the Resource @param startChar - start position of the snippet @param endChar - end position of the snippet @param charset - use server's charset, default should be UTF-8 @return """ return createResourceSnippet(getContents(is, charset), startChar, endChar); }
java
public static ResourceSnippet createResourceSnippet(InputStream is, int startChar, int endChar, String charset) { return createResourceSnippet(getContents(is, charset), startChar, endChar); }
[ "public", "static", "ResourceSnippet", "createResourceSnippet", "(", "InputStream", "is", ",", "int", "startChar", ",", "int", "endChar", ",", "String", "charset", ")", "{", "return", "createResourceSnippet", "(", "getContents", "(", "is", ",", "charset", ")", ",", "startChar", ",", "endChar", ")", ";", "}" ]
extract a ResourceSnippet from InputStream at the given char positions @param is - InputStream of the Resource @param startChar - start position of the snippet @param endChar - end position of the snippet @param charset - use server's charset, default should be UTF-8 @return
[ "extract", "a", "ResourceSnippet", "from", "InputStream", "at", "the", "given", "char", "positions" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceSnippet.java#L106-L109
wcm-io-caravan/caravan-hal
resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java
HalResource.collectLinks
public List<Link> collectLinks(String rel) { """ recursively collects links within this resource and all embedded resources @param rel the relation your interested in @return a list of all links """ return collectResources(Link.class, HalResourceType.LINKS, rel); }
java
public List<Link> collectLinks(String rel) { return collectResources(Link.class, HalResourceType.LINKS, rel); }
[ "public", "List", "<", "Link", ">", "collectLinks", "(", "String", "rel", ")", "{", "return", "collectResources", "(", "Link", ".", "class", ",", "HalResourceType", ".", "LINKS", ",", "rel", ")", ";", "}" ]
recursively collects links within this resource and all embedded resources @param rel the relation your interested in @return a list of all links
[ "recursively", "collects", "links", "within", "this", "resource", "and", "all", "embedded", "resources" ]
train
https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java#L218-L220
elastic/elasticsearch-hadoop
pig/src/main/java/org/elasticsearch/hadoop/pig/PigValueWriter.java
PigValueWriter.isPopulatedMixedValueMap
private boolean isPopulatedMixedValueMap(ResourceFieldSchema schema, int field, Tuple object) { """ Checks to see if the given field is a schema-less Map that has values. @return true if Map has no schema but has values (mixed schema map). false if not a Map or if Map is just empty. """ if (schema.getType() != DataType.MAP) { // Can't be a mixed value map if it's not a map at all. return false; } try { Object fieldValue = object.get(field); Map<?, ?> map = (Map<?, ?>) fieldValue; return schema.getSchema() == null && !(map == null || map.isEmpty()); } catch (ExecException e) { throw new EsHadoopIllegalStateException(e); } }
java
private boolean isPopulatedMixedValueMap(ResourceFieldSchema schema, int field, Tuple object) { if (schema.getType() != DataType.MAP) { // Can't be a mixed value map if it's not a map at all. return false; } try { Object fieldValue = object.get(field); Map<?, ?> map = (Map<?, ?>) fieldValue; return schema.getSchema() == null && !(map == null || map.isEmpty()); } catch (ExecException e) { throw new EsHadoopIllegalStateException(e); } }
[ "private", "boolean", "isPopulatedMixedValueMap", "(", "ResourceFieldSchema", "schema", ",", "int", "field", ",", "Tuple", "object", ")", "{", "if", "(", "schema", ".", "getType", "(", ")", "!=", "DataType", ".", "MAP", ")", "{", "// Can't be a mixed value map if it's not a map at all.", "return", "false", ";", "}", "try", "{", "Object", "fieldValue", "=", "object", ".", "get", "(", "field", ")", ";", "Map", "<", "?", ",", "?", ">", "map", "=", "(", "Map", "<", "?", ",", "?", ">", ")", "fieldValue", ";", "return", "schema", ".", "getSchema", "(", ")", "==", "null", "&&", "!", "(", "map", "==", "null", "||", "map", ".", "isEmpty", "(", ")", ")", ";", "}", "catch", "(", "ExecException", "e", ")", "{", "throw", "new", "EsHadoopIllegalStateException", "(", "e", ")", ";", "}", "}" ]
Checks to see if the given field is a schema-less Map that has values. @return true if Map has no schema but has values (mixed schema map). false if not a Map or if Map is just empty.
[ "Checks", "to", "see", "if", "the", "given", "field", "is", "a", "schema", "-", "less", "Map", "that", "has", "values", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/pig/src/main/java/org/elasticsearch/hadoop/pig/PigValueWriter.java#L266-L279
hortonworks/dstream
dstream-api/src/main/java/io/dstream/DStreamOperation.java
DStreamOperation.setStreamsCombiner
void setStreamsCombiner(String operationName, AbstractStreamMergingFunction streamsCombiner) { """ Sets the given instance of {@link AbstractStreamMergingFunction} as the function of this {@link DStreamOperation}. """ this.operationNames.add(operationName); this.streamOperationFunction = streamsCombiner; }
java
void setStreamsCombiner(String operationName, AbstractStreamMergingFunction streamsCombiner) { this.operationNames.add(operationName); this.streamOperationFunction = streamsCombiner; }
[ "void", "setStreamsCombiner", "(", "String", "operationName", ",", "AbstractStreamMergingFunction", "streamsCombiner", ")", "{", "this", ".", "operationNames", ".", "add", "(", "operationName", ")", ";", "this", ".", "streamOperationFunction", "=", "streamsCombiner", ";", "}" ]
Sets the given instance of {@link AbstractStreamMergingFunction} as the function of this {@link DStreamOperation}.
[ "Sets", "the", "given", "instance", "of", "{" ]
train
https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-api/src/main/java/io/dstream/DStreamOperation.java#L199-L202
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/ItemizedOverlay.java
ItemizedOverlay.boundToHotspot
protected Drawable boundToHotspot(final Drawable marker, HotspotPlace hotspot) { """ Adjusts a drawable's bounds so that (0,0) is a pixel in the location described by the hotspot parameter. Useful for "pin"-like graphics. For convenience, returns the same drawable that was passed in. @param marker the drawable to adjust @param hotspot the hotspot for the drawable @return the same drawable that was passed in. """ if (hotspot == null) { hotspot = HotspotPlace.BOTTOM_CENTER; } final int markerWidth = marker.getIntrinsicWidth(); final int markerHeight = marker.getIntrinsicHeight(); final int offsetX; final int offsetY; switch(hotspot) { default: case NONE: case LEFT_CENTER: case UPPER_LEFT_CORNER: case LOWER_LEFT_CORNER: offsetX = 0; break; case CENTER: case BOTTOM_CENTER: case TOP_CENTER: offsetX = -markerWidth / 2; break; case RIGHT_CENTER: case UPPER_RIGHT_CORNER: case LOWER_RIGHT_CORNER: offsetX = -markerWidth; break; } switch (hotspot) { default: case NONE: case TOP_CENTER: case UPPER_LEFT_CORNER: case UPPER_RIGHT_CORNER: offsetY = 0; break; case CENTER: case RIGHT_CENTER: case LEFT_CENTER: offsetY = -markerHeight / 2; break; case BOTTOM_CENTER: case LOWER_RIGHT_CORNER: case LOWER_LEFT_CORNER: offsetY = -markerHeight; break; } marker.setBounds(offsetX, offsetY, offsetX + markerWidth, offsetY + markerHeight); return marker; }
java
protected Drawable boundToHotspot(final Drawable marker, HotspotPlace hotspot) { if (hotspot == null) { hotspot = HotspotPlace.BOTTOM_CENTER; } final int markerWidth = marker.getIntrinsicWidth(); final int markerHeight = marker.getIntrinsicHeight(); final int offsetX; final int offsetY; switch(hotspot) { default: case NONE: case LEFT_CENTER: case UPPER_LEFT_CORNER: case LOWER_LEFT_CORNER: offsetX = 0; break; case CENTER: case BOTTOM_CENTER: case TOP_CENTER: offsetX = -markerWidth / 2; break; case RIGHT_CENTER: case UPPER_RIGHT_CORNER: case LOWER_RIGHT_CORNER: offsetX = -markerWidth; break; } switch (hotspot) { default: case NONE: case TOP_CENTER: case UPPER_LEFT_CORNER: case UPPER_RIGHT_CORNER: offsetY = 0; break; case CENTER: case RIGHT_CENTER: case LEFT_CENTER: offsetY = -markerHeight / 2; break; case BOTTOM_CENTER: case LOWER_RIGHT_CORNER: case LOWER_LEFT_CORNER: offsetY = -markerHeight; break; } marker.setBounds(offsetX, offsetY, offsetX + markerWidth, offsetY + markerHeight); return marker; }
[ "protected", "Drawable", "boundToHotspot", "(", "final", "Drawable", "marker", ",", "HotspotPlace", "hotspot", ")", "{", "if", "(", "hotspot", "==", "null", ")", "{", "hotspot", "=", "HotspotPlace", ".", "BOTTOM_CENTER", ";", "}", "final", "int", "markerWidth", "=", "marker", ".", "getIntrinsicWidth", "(", ")", ";", "final", "int", "markerHeight", "=", "marker", ".", "getIntrinsicHeight", "(", ")", ";", "final", "int", "offsetX", ";", "final", "int", "offsetY", ";", "switch", "(", "hotspot", ")", "{", "default", ":", "case", "NONE", ":", "case", "LEFT_CENTER", ":", "case", "UPPER_LEFT_CORNER", ":", "case", "LOWER_LEFT_CORNER", ":", "offsetX", "=", "0", ";", "break", ";", "case", "CENTER", ":", "case", "BOTTOM_CENTER", ":", "case", "TOP_CENTER", ":", "offsetX", "=", "-", "markerWidth", "/", "2", ";", "break", ";", "case", "RIGHT_CENTER", ":", "case", "UPPER_RIGHT_CORNER", ":", "case", "LOWER_RIGHT_CORNER", ":", "offsetX", "=", "-", "markerWidth", ";", "break", ";", "}", "switch", "(", "hotspot", ")", "{", "default", ":", "case", "NONE", ":", "case", "TOP_CENTER", ":", "case", "UPPER_LEFT_CORNER", ":", "case", "UPPER_RIGHT_CORNER", ":", "offsetY", "=", "0", ";", "break", ";", "case", "CENTER", ":", "case", "RIGHT_CENTER", ":", "case", "LEFT_CENTER", ":", "offsetY", "=", "-", "markerHeight", "/", "2", ";", "break", ";", "case", "BOTTOM_CENTER", ":", "case", "LOWER_RIGHT_CORNER", ":", "case", "LOWER_LEFT_CORNER", ":", "offsetY", "=", "-", "markerHeight", ";", "break", ";", "}", "marker", ".", "setBounds", "(", "offsetX", ",", "offsetY", ",", "offsetX", "+", "markerWidth", ",", "offsetY", "+", "markerHeight", ")", ";", "return", "marker", ";", "}" ]
Adjusts a drawable's bounds so that (0,0) is a pixel in the location described by the hotspot parameter. Useful for "pin"-like graphics. For convenience, returns the same drawable that was passed in. @param marker the drawable to adjust @param hotspot the hotspot for the drawable @return the same drawable that was passed in.
[ "Adjusts", "a", "drawable", "s", "bounds", "so", "that", "(", "0", "0", ")", "is", "a", "pixel", "in", "the", "location", "described", "by", "the", "hotspot", "parameter", ".", "Useful", "for", "pin", "-", "like", "graphics", ".", "For", "convenience", "returns", "the", "same", "drawable", "that", "was", "passed", "in", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/ItemizedOverlay.java#L346-L394
aws/aws-sdk-java
aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/ErrorUnmarshallingHandler.java
ErrorUnmarshallingHandler.exceptionCaught
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception { """ An exception was propagated from further up the pipeline (probably an IO exception of some sort). Notify the handler and kill the connection. """ if (!notifiedOnFailure) { notifiedOnFailure = true; try { responseHandler.onFailure(new SdkClientException("Unable to execute HTTP request.", cause)); } finally { ctx.channel().close(); } } }
java
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception { if (!notifiedOnFailure) { notifiedOnFailure = true; try { responseHandler.onFailure(new SdkClientException("Unable to execute HTTP request.", cause)); } finally { ctx.channel().close(); } } }
[ "@", "Override", "public", "void", "exceptionCaught", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "Throwable", "cause", ")", "throws", "Exception", "{", "if", "(", "!", "notifiedOnFailure", ")", "{", "notifiedOnFailure", "=", "true", ";", "try", "{", "responseHandler", ".", "onFailure", "(", "new", "SdkClientException", "(", "\"Unable to execute HTTP request.\"", ",", "cause", ")", ")", ";", "}", "finally", "{", "ctx", ".", "channel", "(", ")", ".", "close", "(", ")", ";", "}", "}", "}" ]
An exception was propagated from further up the pipeline (probably an IO exception of some sort). Notify the handler and kill the connection.
[ "An", "exception", "was", "propagated", "from", "further", "up", "the", "pipeline", "(", "probably", "an", "IO", "exception", "of", "some", "sort", ")", ".", "Notify", "the", "handler", "and", "kill", "the", "connection", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/ErrorUnmarshallingHandler.java#L142-L152
qiujuer/OkHttpPacker
okhttp/src/main/java/net/qiujuer/common/okhttp/impl/RequestCallBuilder.java
RequestCallBuilder.buildGetParams
protected boolean buildGetParams(StringBuilder sb, boolean isFirst) { """ In this we should add same default params to the get builder @param sb Get Values @param isFirst The Url and values is have "?" char @return values is have "?" char """ BuilderListener listener = mListener; if (listener != null) { return listener.onBuildGetParams(sb, isFirst); } else { return isFirst; } }
java
protected boolean buildGetParams(StringBuilder sb, boolean isFirst) { BuilderListener listener = mListener; if (listener != null) { return listener.onBuildGetParams(sb, isFirst); } else { return isFirst; } }
[ "protected", "boolean", "buildGetParams", "(", "StringBuilder", "sb", ",", "boolean", "isFirst", ")", "{", "BuilderListener", "listener", "=", "mListener", ";", "if", "(", "listener", "!=", "null", ")", "{", "return", "listener", ".", "onBuildGetParams", "(", "sb", ",", "isFirst", ")", ";", "}", "else", "{", "return", "isFirst", ";", "}", "}" ]
In this we should add same default params to the get builder @param sb Get Values @param isFirst The Url and values is have "?" char @return values is have "?" char
[ "In", "this", "we", "should", "add", "same", "default", "params", "to", "the", "get", "builder" ]
train
https://github.com/qiujuer/OkHttpPacker/blob/d2d484facb66b7e11e6cbbfeb78025f76ce25ebd/okhttp/src/main/java/net/qiujuer/common/okhttp/impl/RequestCallBuilder.java#L59-L66
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/PeerGroup.java
PeerGroup.addBlocksDownloadedEventListener
public void addBlocksDownloadedEventListener(Executor executor, BlocksDownloadedEventListener listener) { """ <p>Adds a listener that will be notified on the given executor when blocks are downloaded by the download peer.</p> @see Peer#addBlocksDownloadedEventListener(Executor, BlocksDownloadedEventListener) """ peersBlocksDownloadedEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor)); for (Peer peer : getConnectedPeers()) peer.addBlocksDownloadedEventListener(executor, listener); for (Peer peer : getPendingPeers()) peer.addBlocksDownloadedEventListener(executor, listener); }
java
public void addBlocksDownloadedEventListener(Executor executor, BlocksDownloadedEventListener listener) { peersBlocksDownloadedEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor)); for (Peer peer : getConnectedPeers()) peer.addBlocksDownloadedEventListener(executor, listener); for (Peer peer : getPendingPeers()) peer.addBlocksDownloadedEventListener(executor, listener); }
[ "public", "void", "addBlocksDownloadedEventListener", "(", "Executor", "executor", ",", "BlocksDownloadedEventListener", "listener", ")", "{", "peersBlocksDownloadedEventListeners", ".", "add", "(", "new", "ListenerRegistration", "<>", "(", "checkNotNull", "(", "listener", ")", ",", "executor", ")", ")", ";", "for", "(", "Peer", "peer", ":", "getConnectedPeers", "(", ")", ")", "peer", ".", "addBlocksDownloadedEventListener", "(", "executor", ",", "listener", ")", ";", "for", "(", "Peer", "peer", ":", "getPendingPeers", "(", ")", ")", "peer", ".", "addBlocksDownloadedEventListener", "(", "executor", ",", "listener", ")", ";", "}" ]
<p>Adds a listener that will be notified on the given executor when blocks are downloaded by the download peer.</p> @see Peer#addBlocksDownloadedEventListener(Executor, BlocksDownloadedEventListener)
[ "<p", ">", "Adds", "a", "listener", "that", "will", "be", "notified", "on", "the", "given", "executor", "when", "blocks", "are", "downloaded", "by", "the", "download", "peer", ".", "<", "/", "p", ">" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L639-L645
finmath/finmath-lib
src/main/java/net/finmath/time/FloatingpointDate.java
FloatingpointDate.getDateFromFloatingPointDate
public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate) { """ Convert a floating point date to a LocalDate. Note: This method currently performs a rounding to the next day. In a future extension intra-day time offsets may be considered. If referenceDate is null, the method returns null. @param referenceDate The reference date associated with \( t=0 \). @param floatingPointDate The value to the time offset \( t \). @return The date resulting from adding Math.round(fixingTime*365.0) days to referenceDate. """ if(referenceDate == null) { return null; } return referenceDate.plusDays((int)Math.round(floatingPointDate*365.0)); }
java
public static LocalDate getDateFromFloatingPointDate(LocalDate referenceDate, double floatingPointDate) { if(referenceDate == null) { return null; } return referenceDate.plusDays((int)Math.round(floatingPointDate*365.0)); }
[ "public", "static", "LocalDate", "getDateFromFloatingPointDate", "(", "LocalDate", "referenceDate", ",", "double", "floatingPointDate", ")", "{", "if", "(", "referenceDate", "==", "null", ")", "{", "return", "null", ";", "}", "return", "referenceDate", ".", "plusDays", "(", "(", "int", ")", "Math", ".", "round", "(", "floatingPointDate", "*", "365.0", ")", ")", ";", "}" ]
Convert a floating point date to a LocalDate. Note: This method currently performs a rounding to the next day. In a future extension intra-day time offsets may be considered. If referenceDate is null, the method returns null. @param referenceDate The reference date associated with \( t=0 \). @param floatingPointDate The value to the time offset \( t \). @return The date resulting from adding Math.round(fixingTime*365.0) days to referenceDate.
[ "Convert", "a", "floating", "point", "date", "to", "a", "LocalDate", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/FloatingpointDate.java#L100-L105
aws/aws-sdk-java
aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/CreateLogGroupRequest.java
CreateLogGroupRequest.withTags
public CreateLogGroupRequest withTags(java.util.Map<String, String> tags) { """ <p> The key-value pairs to use for the tags. </p> @param tags The key-value pairs to use for the tags. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateLogGroupRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateLogGroupRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The key-value pairs to use for the tags. </p> @param tags The key-value pairs to use for the tags. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "key", "-", "value", "pairs", "to", "use", "for", "the", "tags", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/CreateLogGroupRequest.java#L197-L200
apache/flink
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java
SortOperationFactory.createLimitWithOffset
public TableOperation createLimitWithOffset(int offset, TableOperation child) { """ Adds offset to the underlying {@link SortTableOperation} if it is a valid one. @param offset offset to add @param child should be {@link SortTableOperation} @return valid sort operation with applied offset """ SortTableOperation previousSort = validateAndGetChildSort(child); if (offset < 0) { throw new ValidationException("Offset should be greater or equal 0"); } if (previousSort.getOffset() != -1) { throw new ValidationException("OFFSET already defined"); } return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, -1); }
java
public TableOperation createLimitWithOffset(int offset, TableOperation child) { SortTableOperation previousSort = validateAndGetChildSort(child); if (offset < 0) { throw new ValidationException("Offset should be greater or equal 0"); } if (previousSort.getOffset() != -1) { throw new ValidationException("OFFSET already defined"); } return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, -1); }
[ "public", "TableOperation", "createLimitWithOffset", "(", "int", "offset", ",", "TableOperation", "child", ")", "{", "SortTableOperation", "previousSort", "=", "validateAndGetChildSort", "(", "child", ")", ";", "if", "(", "offset", "<", "0", ")", "{", "throw", "new", "ValidationException", "(", "\"Offset should be greater or equal 0\"", ")", ";", "}", "if", "(", "previousSort", ".", "getOffset", "(", ")", "!=", "-", "1", ")", "{", "throw", "new", "ValidationException", "(", "\"OFFSET already defined\"", ")", ";", "}", "return", "new", "SortTableOperation", "(", "previousSort", ".", "getOrder", "(", ")", ",", "previousSort", ".", "getChild", "(", ")", ",", "offset", ",", "-", "1", ")", ";", "}" ]
Adds offset to the underlying {@link SortTableOperation} if it is a valid one. @param offset offset to add @param child should be {@link SortTableOperation} @return valid sort operation with applied offset
[ "Adds", "offset", "to", "the", "underlying", "{", "@link", "SortTableOperation", "}", "if", "it", "is", "a", "valid", "one", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java#L73-L85
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/common/Similarity.java
Similarity.averageCommonFeatureRank
public static double averageCommonFeatureRank(Vector a, Vector b) { """ Computes the Average Common Feature Rank between the two feature arrays. Uses the top 20 features for comparison. Converts types and calls averageCommonFeatureRank(double[],double[]) @throws IllegalArgumentException when the length of the two vectors are not the same. """ return averageCommonFeatureRank(Vectors.asDouble(a).toArray(), Vectors.asDouble(b).toArray()); }
java
public static double averageCommonFeatureRank(Vector a, Vector b) { return averageCommonFeatureRank(Vectors.asDouble(a).toArray(), Vectors.asDouble(b).toArray()); }
[ "public", "static", "double", "averageCommonFeatureRank", "(", "Vector", "a", ",", "Vector", "b", ")", "{", "return", "averageCommonFeatureRank", "(", "Vectors", ".", "asDouble", "(", "a", ")", ".", "toArray", "(", ")", ",", "Vectors", ".", "asDouble", "(", "b", ")", ".", "toArray", "(", ")", ")", ";", "}" ]
Computes the Average Common Feature Rank between the two feature arrays. Uses the top 20 features for comparison. Converts types and calls averageCommonFeatureRank(double[],double[]) @throws IllegalArgumentException when the length of the two vectors are not the same.
[ "Computes", "the", "Average", "Common", "Feature", "Rank", "between", "the", "two", "feature", "arrays", ".", "Uses", "the", "top", "20", "features", "for", "comparison", ".", "Converts", "types", "and", "calls", "averageCommonFeatureRank", "(", "double", "[]", "double", "[]", ")" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L1434-L1437
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.copyDocumentationTo
public void copyDocumentationTo(/* @Nullable */ final EObject source, /* @Nullable */ JvmIdentifiableElement jvmElement) { """ Attaches the given documentation of the source element to the given jvmElement. The documentation is computed lazily. """ if(source == null || jvmElement == null) return; DocumentationAdapter documentationAdapter = new DocumentationAdapter() { private boolean computed = false; @Override public String getDocumentation() { if (computed) { return super.getDocumentation(); } String result = JvmTypesBuilder.this.getDocumentation(source); setDocumentation(result); return result; } @Override public void setDocumentation(String documentation) { computed = true; super.setDocumentation(documentation); } }; jvmElement.eAdapters().add(documentationAdapter); }
java
public void copyDocumentationTo(/* @Nullable */ final EObject source, /* @Nullable */ JvmIdentifiableElement jvmElement) { if(source == null || jvmElement == null) return; DocumentationAdapter documentationAdapter = new DocumentationAdapter() { private boolean computed = false; @Override public String getDocumentation() { if (computed) { return super.getDocumentation(); } String result = JvmTypesBuilder.this.getDocumentation(source); setDocumentation(result); return result; } @Override public void setDocumentation(String documentation) { computed = true; super.setDocumentation(documentation); } }; jvmElement.eAdapters().add(documentationAdapter); }
[ "public", "void", "copyDocumentationTo", "(", "/* @Nullable */", "final", "EObject", "source", ",", "/* @Nullable */", "JvmIdentifiableElement", "jvmElement", ")", "{", "if", "(", "source", "==", "null", "||", "jvmElement", "==", "null", ")", "return", ";", "DocumentationAdapter", "documentationAdapter", "=", "new", "DocumentationAdapter", "(", ")", "{", "private", "boolean", "computed", "=", "false", ";", "@", "Override", "public", "String", "getDocumentation", "(", ")", "{", "if", "(", "computed", ")", "{", "return", "super", ".", "getDocumentation", "(", ")", ";", "}", "String", "result", "=", "JvmTypesBuilder", ".", "this", ".", "getDocumentation", "(", "source", ")", ";", "setDocumentation", "(", "result", ")", ";", "return", "result", ";", "}", "@", "Override", "public", "void", "setDocumentation", "(", "String", "documentation", ")", "{", "computed", "=", "true", ";", "super", ".", "setDocumentation", "(", "documentation", ")", ";", "}", "}", ";", "jvmElement", ".", "eAdapters", "(", ")", ".", "add", "(", "documentationAdapter", ")", ";", "}" ]
Attaches the given documentation of the source element to the given jvmElement. The documentation is computed lazily.
[ "Attaches", "the", "given", "documentation", "of", "the", "source", "element", "to", "the", "given", "jvmElement", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L278-L300
MaxLeap/SDK-CloudCode-Java
cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java
WebUtils.doRequestWithUrl
public static String doRequestWithUrl(String url, String method, Map<String, String> header, Map<String, String> params, String charset) throws IOException { """ 执行HTTP GET/DELETE请求。 @param url 请求地址 @param params 请求参数 @param charset 字符集,如UTF-8, GBK, GB2312 @return 响应字符串 @throws IOException """ HttpURLConnection conn = null; String rsp = null; try { String ctype = "application/json"; String query = buildQuery(params, charset); try { conn = getConnection(buildGetUrl(url, query), method, header, ctype); } catch (IOException e) { throw e; } try { rsp = getResponseAsString(conn); } catch (IOException e) { throw e; } } finally { if (conn != null) { conn.disconnect(); } } return rsp; }
java
public static String doRequestWithUrl(String url, String method, Map<String, String> header, Map<String, String> params, String charset) throws IOException { HttpURLConnection conn = null; String rsp = null; try { String ctype = "application/json"; String query = buildQuery(params, charset); try { conn = getConnection(buildGetUrl(url, query), method, header, ctype); } catch (IOException e) { throw e; } try { rsp = getResponseAsString(conn); } catch (IOException e) { throw e; } } finally { if (conn != null) { conn.disconnect(); } } return rsp; }
[ "public", "static", "String", "doRequestWithUrl", "(", "String", "url", ",", "String", "method", ",", "Map", "<", "String", ",", "String", ">", "header", ",", "Map", "<", "String", ",", "String", ">", "params", ",", "String", "charset", ")", "throws", "IOException", "{", "HttpURLConnection", "conn", "=", "null", ";", "String", "rsp", "=", "null", ";", "try", "{", "String", "ctype", "=", "\"application/json\"", ";", "String", "query", "=", "buildQuery", "(", "params", ",", "charset", ")", ";", "try", "{", "conn", "=", "getConnection", "(", "buildGetUrl", "(", "url", ",", "query", ")", ",", "method", ",", "header", ",", "ctype", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "e", ";", "}", "try", "{", "rsp", "=", "getResponseAsString", "(", "conn", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "e", ";", "}", "}", "finally", "{", "if", "(", "conn", "!=", "null", ")", "{", "conn", ".", "disconnect", "(", ")", ";", "}", "}", "return", "rsp", ";", "}" ]
执行HTTP GET/DELETE请求。 @param url 请求地址 @param params 请求参数 @param charset 字符集,如UTF-8, GBK, GB2312 @return 响应字符串 @throws IOException
[ "执行HTTP", "GET", "/", "DELETE请求。" ]
train
https://github.com/MaxLeap/SDK-CloudCode-Java/blob/756064c65dd613919c377bf136cf8710c7507968/cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java#L164-L190
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeColorWithDefault
@Pure public static Integer getAttributeColorWithDefault(Node document, Integer defaultValue, String... path) { """ Replies the color that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. Be careful about the fact that the names are case sensitives. @param document is the XML document to explore. @param path is the list of and ended by the attribute's name. @param defaultValue is the default value to reply. @return the color of the specified attribute. """ assert document != null : AssertMessages.notNullParameter(0); return getAttributeColorWithDefault(document, true, defaultValue, path); }
java
@Pure public static Integer getAttributeColorWithDefault(Node document, Integer defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeColorWithDefault(document, true, defaultValue, path); }
[ "@", "Pure", "public", "static", "Integer", "getAttributeColorWithDefault", "(", "Node", "document", ",", "Integer", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";", "return", "getAttributeColorWithDefault", "(", "document", ",", "true", ",", "defaultValue", ",", "path", ")", ";", "}" ]
Replies the color that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. Be careful about the fact that the names are case sensitives. @param document is the XML document to explore. @param path is the list of and ended by the attribute's name. @param defaultValue is the default value to reply. @return the color of the specified attribute.
[ "Replies", "the", "color", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L481-L485
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java
PJsonArray.getInt
@Override public final int getInt(final int i) { """ Get the element at the index as an integer. @param i the index of the element to access """ int val = this.array.optInt(i, Integer.MIN_VALUE); if (val == Integer.MIN_VALUE) { throw new ObjectMissingException(this, "[" + i + "]"); } return val; }
java
@Override public final int getInt(final int i) { int val = this.array.optInt(i, Integer.MIN_VALUE); if (val == Integer.MIN_VALUE) { throw new ObjectMissingException(this, "[" + i + "]"); } return val; }
[ "@", "Override", "public", "final", "int", "getInt", "(", "final", "int", "i", ")", "{", "int", "val", "=", "this", ".", "array", ".", "optInt", "(", "i", ",", "Integer", ".", "MIN_VALUE", ")", ";", "if", "(", "val", "==", "Integer", ".", "MIN_VALUE", ")", "{", "throw", "new", "ObjectMissingException", "(", "this", ",", "\"[\"", "+", "i", "+", "\"]\"", ")", ";", "}", "return", "val", ";", "}" ]
Get the element at the index as an integer. @param i the index of the element to access
[ "Get", "the", "element", "at", "the", "index", "as", "an", "integer", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java#L90-L97
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getLastIndexOf
public static int getLastIndexOf (@Nullable final String sText, @Nullable final String sSearch) { """ Get the last index of sSearch within sText. @param sText The text to search in. May be <code>null</code>. @param sSearch The text to search for. May be <code>null</code>. @return The last index of sSearch within sText or {@value #STRING_NOT_FOUND} if sSearch was not found or if any parameter was <code>null</code>. @see String#lastIndexOf(String) """ return sText != null && sSearch != null && sText.length () >= sSearch.length () ? sText.lastIndexOf (sSearch) : STRING_NOT_FOUND; }
java
public static int getLastIndexOf (@Nullable final String sText, @Nullable final String sSearch) { return sText != null && sSearch != null && sText.length () >= sSearch.length () ? sText.lastIndexOf (sSearch) : STRING_NOT_FOUND; }
[ "public", "static", "int", "getLastIndexOf", "(", "@", "Nullable", "final", "String", "sText", ",", "@", "Nullable", "final", "String", "sSearch", ")", "{", "return", "sText", "!=", "null", "&&", "sSearch", "!=", "null", "&&", "sText", ".", "length", "(", ")", ">=", "sSearch", ".", "length", "(", ")", "?", "sText", ".", "lastIndexOf", "(", "sSearch", ")", ":", "STRING_NOT_FOUND", ";", "}" ]
Get the last index of sSearch within sText. @param sText The text to search in. May be <code>null</code>. @param sSearch The text to search for. May be <code>null</code>. @return The last index of sSearch within sText or {@value #STRING_NOT_FOUND} if sSearch was not found or if any parameter was <code>null</code>. @see String#lastIndexOf(String)
[ "Get", "the", "last", "index", "of", "sSearch", "within", "sText", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2715-L2719
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java
MetadataService.createToken
public CompletableFuture<Revision> createToken(Author author, String appId, String secret) { """ Creates a new user-level {@link Token} with the specified {@code appId} and {@code secret}. """ return createToken(author, appId, secret, false); }
java
public CompletableFuture<Revision> createToken(Author author, String appId, String secret) { return createToken(author, appId, secret, false); }
[ "public", "CompletableFuture", "<", "Revision", ">", "createToken", "(", "Author", "author", ",", "String", "appId", ",", "String", "secret", ")", "{", "return", "createToken", "(", "author", ",", "appId", ",", "secret", ",", "false", ")", ";", "}" ]
Creates a new user-level {@link Token} with the specified {@code appId} and {@code secret}.
[ "Creates", "a", "new", "user", "-", "level", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L711-L713
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.longBinaryOperator
public static LongBinaryOperator longBinaryOperator(CheckedLongBinaryOperator operator, Consumer<Throwable> handler) { """ Wrap a {@link CheckedLongBinaryOperator} in a {@link LongBinaryOperator} with a custom handler for checked exceptions. <p> Example: <code><pre> LongStream.of(1L, 2L, 3L).reduce(Unchecked.longBinaryOperator( (l1, l2) -> { if (l2 &lt; 0L) throw new Exception("Only positive numbers allowed"); return l1 + l2; }, e -> { throw new IllegalStateException(e); } )); </pre></code> """ return (l1, l2) -> { try { return operator.applyAsLong(l1, l2); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static LongBinaryOperator longBinaryOperator(CheckedLongBinaryOperator operator, Consumer<Throwable> handler) { return (l1, l2) -> { try { return operator.applyAsLong(l1, l2); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "LongBinaryOperator", "longBinaryOperator", "(", "CheckedLongBinaryOperator", "operator", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "(", "l1", ",", "l2", ")", "->", "{", "try", "{", "return", "operator", ".", "applyAsLong", "(", "l1", ",", "l2", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "handler", ".", "accept", "(", "e", ")", ";", "throw", "new", "IllegalStateException", "(", "\"Exception handler must throw a RuntimeException\"", ",", "e", ")", ";", "}", "}", ";", "}" ]
Wrap a {@link CheckedLongBinaryOperator} in a {@link LongBinaryOperator} with a custom handler for checked exceptions. <p> Example: <code><pre> LongStream.of(1L, 2L, 3L).reduce(Unchecked.longBinaryOperator( (l1, l2) -> { if (l2 &lt; 0L) throw new Exception("Only positive numbers allowed"); return l1 + l2; }, e -> { throw new IllegalStateException(e); } )); </pre></code>
[ "Wrap", "a", "{", "@link", "CheckedLongBinaryOperator", "}", "in", "a", "{", "@link", "LongBinaryOperator", "}", "with", "a", "custom", "handler", "for", "checked", "exceptions", ".", "<p", ">", "Example", ":", "<code", ">", "<pre", ">", "LongStream", ".", "of", "(", "1L", "2L", "3L", ")", ".", "reduce", "(", "Unchecked", ".", "longBinaryOperator", "(", "(", "l1", "l2", ")", "-", ">", "{", "if", "(", "l2", "&lt", ";", "0L", ")", "throw", "new", "Exception", "(", "Only", "positive", "numbers", "allowed", ")", ";" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L595-L606
biezhi/anima
src/main/java/io/github/biezhi/anima/Anima.java
Anima.deleteById
public static <T extends Model> int deleteById(Class<T> model, Serializable id) { """ Delete model by id @param model model type class @param id model primary key @param <T> @return """ return new AnimaQuery<>(model).deleteById(id); }
java
public static <T extends Model> int deleteById(Class<T> model, Serializable id) { return new AnimaQuery<>(model).deleteById(id); }
[ "public", "static", "<", "T", "extends", "Model", ">", "int", "deleteById", "(", "Class", "<", "T", ">", "model", ",", "Serializable", "id", ")", "{", "return", "new", "AnimaQuery", "<>", "(", "model", ")", ".", "deleteById", "(", "id", ")", ";", "}" ]
Delete model by id @param model model type class @param id model primary key @param <T> @return
[ "Delete", "model", "by", "id" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/Anima.java#L444-L446
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java
ApplicationsInner.listByClusterWithServiceResponseAsync
public Observable<ServiceResponse<Page<ApplicationInner>>> listByClusterWithServiceResponseAsync(final String resourceGroupName, final String clusterName) { """ Lists all of the applications for the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ApplicationInner&gt; object """ return listByClusterSinglePageAsync(resourceGroupName, clusterName) .concatMap(new Func1<ServiceResponse<Page<ApplicationInner>>, Observable<ServiceResponse<Page<ApplicationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApplicationInner>>> call(ServiceResponse<Page<ApplicationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByClusterNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ApplicationInner>>> listByClusterWithServiceResponseAsync(final String resourceGroupName, final String clusterName) { return listByClusterSinglePageAsync(resourceGroupName, clusterName) .concatMap(new Func1<ServiceResponse<Page<ApplicationInner>>, Observable<ServiceResponse<Page<ApplicationInner>>>>() { @Override public Observable<ServiceResponse<Page<ApplicationInner>>> call(ServiceResponse<Page<ApplicationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByClusterNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ApplicationInner", ">", ">", ">", "listByClusterWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "clusterName", ")", "{", "return", "listByClusterSinglePageAsync", "(", "resourceGroupName", ",", "clusterName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ApplicationInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ApplicationInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ApplicationInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ApplicationInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listByClusterNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Lists all of the applications for the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ApplicationInner&gt; object
[ "Lists", "all", "of", "the", "applications", "for", "the", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java#L161-L173
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.mergeCalls
public void mergeCalls(String connId, String otherConnId) throws WorkspaceApiException { """ Merge the two specified calls. @param connId The connection ID of the first call to be merged. @param otherConnId The connection ID of the second call to be merged. """ this.mergeCalls(connId, otherConnId, null, null); }
java
public void mergeCalls(String connId, String otherConnId) throws WorkspaceApiException { this.mergeCalls(connId, otherConnId, null, null); }
[ "public", "void", "mergeCalls", "(", "String", "connId", ",", "String", "otherConnId", ")", "throws", "WorkspaceApiException", "{", "this", ".", "mergeCalls", "(", "connId", ",", "otherConnId", ",", "null", ",", "null", ")", ";", "}" ]
Merge the two specified calls. @param connId The connection ID of the first call to be merged. @param otherConnId The connection ID of the second call to be merged.
[ "Merge", "the", "two", "specified", "calls", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1241-L1243
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java
TimeZoneFormat.setTimeZoneNames
public TimeZoneFormat setTimeZoneNames(TimeZoneNames tznames) { """ Sets the time zone display name data to this instance. @param tznames the time zone display name data. @return this object. @throws UnsupportedOperationException when this object is frozen. @see #getTimeZoneNames() """ if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify frozen object"); } _tznames = tznames; // TimeZoneGenericNames must be changed to utilize the new TimeZoneNames instance. _gnames = new TimeZoneGenericNames(_locale, _tznames); return this; }
java
public TimeZoneFormat setTimeZoneNames(TimeZoneNames tznames) { if (isFrozen()) { throw new UnsupportedOperationException("Attempt to modify frozen object"); } _tznames = tznames; // TimeZoneGenericNames must be changed to utilize the new TimeZoneNames instance. _gnames = new TimeZoneGenericNames(_locale, _tznames); return this; }
[ "public", "TimeZoneFormat", "setTimeZoneNames", "(", "TimeZoneNames", "tznames", ")", "{", "if", "(", "isFrozen", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Attempt to modify frozen object\"", ")", ";", "}", "_tznames", "=", "tznames", ";", "// TimeZoneGenericNames must be changed to utilize the new TimeZoneNames instance.", "_gnames", "=", "new", "TimeZoneGenericNames", "(", "_locale", ",", "_tznames", ")", ";", "return", "this", ";", "}" ]
Sets the time zone display name data to this instance. @param tznames the time zone display name data. @return this object. @throws UnsupportedOperationException when this object is frozen. @see #getTimeZoneNames()
[ "Sets", "the", "time", "zone", "display", "name", "data", "to", "this", "instance", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L526-L534
alkacon/opencms-core
src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java
CmsLogChannelTable.filterTable
@SuppressWarnings("unchecked") public void filterTable(String search) { """ Filters the table according to given search string.<p> @param search string to be looked for. """ m_container.removeAllContainerFilters(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) { m_container.addContainerFilter( new Or( new SimpleStringFilter(TableColumn.Channel, search, true, false), new SimpleStringFilter(TableColumn.ParentChannel, search, true, false), new SimpleStringFilter(TableColumn.File, search, true, false))); } if ((getValue() != null) & !((Set<Logger>)getValue()).isEmpty()) { setCurrentPageFirstItemId(((Set<Logger>)getValue()).iterator().next()); } }
java
@SuppressWarnings("unchecked") public void filterTable(String search) { m_container.removeAllContainerFilters(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) { m_container.addContainerFilter( new Or( new SimpleStringFilter(TableColumn.Channel, search, true, false), new SimpleStringFilter(TableColumn.ParentChannel, search, true, false), new SimpleStringFilter(TableColumn.File, search, true, false))); } if ((getValue() != null) & !((Set<Logger>)getValue()).isEmpty()) { setCurrentPageFirstItemId(((Set<Logger>)getValue()).iterator().next()); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "filterTable", "(", "String", "search", ")", "{", "m_container", ".", "removeAllContainerFilters", "(", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "search", ")", ")", "{", "m_container", ".", "addContainerFilter", "(", "new", "Or", "(", "new", "SimpleStringFilter", "(", "TableColumn", ".", "Channel", ",", "search", ",", "true", ",", "false", ")", ",", "new", "SimpleStringFilter", "(", "TableColumn", ".", "ParentChannel", ",", "search", ",", "true", ",", "false", ")", ",", "new", "SimpleStringFilter", "(", "TableColumn", ".", "File", ",", "search", ",", "true", ",", "false", ")", ")", ")", ";", "}", "if", "(", "(", "getValue", "(", ")", "!=", "null", ")", "&", "!", "(", "(", "Set", "<", "Logger", ">", ")", "getValue", "(", ")", ")", ".", "isEmpty", "(", ")", ")", "{", "setCurrentPageFirstItemId", "(", "(", "(", "Set", "<", "Logger", ">", ")", "getValue", "(", ")", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ";", "}", "}" ]
Filters the table according to given search string.<p> @param search string to be looked for.
[ "Filters", "the", "table", "according", "to", "given", "search", "string", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java#L391-L405
VoltDB/voltdb
src/frontend/org/voltdb/expressions/ExpressionUtil.java
ExpressionUtil.getType
private static String getType(Database db, VoltXMLElement elm) { """ Get the underlying type of the VoltXMLElement node. Need reference to the catalog for PVE @param db catalog @param elm element under inspection @return string representation of the element node """ final String type = elm.getStringAttribute("valuetype", ""); if (! type.isEmpty()) { return type; } else if (elm.name.equals("columnref")) { final String tblName = elm.getStringAttribute("table", ""); final int colIndex = elm.getIntAttribute("index", 0); return StreamSupport.stream(db.getTables().spliterator(), false) .filter(tbl -> tbl.getTypeName().equals(tblName)) .findAny() .flatMap(tbl -> StreamSupport.stream(tbl.getColumns().spliterator(), false) .filter(col -> col.getIndex() == colIndex) .findAny()) .map(Column::getType) .map(typ -> VoltType.get((byte) ((int)typ)).getName()) .orElse(""); } else { return ""; } }
java
private static String getType(Database db, VoltXMLElement elm) { final String type = elm.getStringAttribute("valuetype", ""); if (! type.isEmpty()) { return type; } else if (elm.name.equals("columnref")) { final String tblName = elm.getStringAttribute("table", ""); final int colIndex = elm.getIntAttribute("index", 0); return StreamSupport.stream(db.getTables().spliterator(), false) .filter(tbl -> tbl.getTypeName().equals(tblName)) .findAny() .flatMap(tbl -> StreamSupport.stream(tbl.getColumns().spliterator(), false) .filter(col -> col.getIndex() == colIndex) .findAny()) .map(Column::getType) .map(typ -> VoltType.get((byte) ((int)typ)).getName()) .orElse(""); } else { return ""; } }
[ "private", "static", "String", "getType", "(", "Database", "db", ",", "VoltXMLElement", "elm", ")", "{", "final", "String", "type", "=", "elm", ".", "getStringAttribute", "(", "\"valuetype\"", ",", "\"\"", ")", ";", "if", "(", "!", "type", ".", "isEmpty", "(", ")", ")", "{", "return", "type", ";", "}", "else", "if", "(", "elm", ".", "name", ".", "equals", "(", "\"columnref\"", ")", ")", "{", "final", "String", "tblName", "=", "elm", ".", "getStringAttribute", "(", "\"table\"", ",", "\"\"", ")", ";", "final", "int", "colIndex", "=", "elm", ".", "getIntAttribute", "(", "\"index\"", ",", "0", ")", ";", "return", "StreamSupport", ".", "stream", "(", "db", ".", "getTables", "(", ")", ".", "spliterator", "(", ")", ",", "false", ")", ".", "filter", "(", "tbl", "->", "tbl", ".", "getTypeName", "(", ")", ".", "equals", "(", "tblName", ")", ")", ".", "findAny", "(", ")", ".", "flatMap", "(", "tbl", "->", "StreamSupport", ".", "stream", "(", "tbl", ".", "getColumns", "(", ")", ".", "spliterator", "(", ")", ",", "false", ")", ".", "filter", "(", "col", "->", "col", ".", "getIndex", "(", ")", "==", "colIndex", ")", ".", "findAny", "(", ")", ")", ".", "map", "(", "Column", "::", "getType", ")", ".", "map", "(", "typ", "->", "VoltType", ".", "get", "(", "(", "byte", ")", "(", "(", "int", ")", "typ", ")", ")", ".", "getName", "(", ")", ")", ".", "orElse", "(", "\"\"", ")", ";", "}", "else", "{", "return", "\"\"", ";", "}", "}" ]
Get the underlying type of the VoltXMLElement node. Need reference to the catalog for PVE @param db catalog @param elm element under inspection @return string representation of the element node
[ "Get", "the", "underlying", "type", "of", "the", "VoltXMLElement", "node", ".", "Need", "reference", "to", "the", "catalog", "for", "PVE" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ExpressionUtil.java#L120-L140
arquillian/arquillian-extension-warp
impl/src/main/java/org/jboss/arquillian/warp/impl/server/delegation/RequestDelegator.java
RequestDelegator.tryDelegateRequest
public boolean tryDelegateRequest(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) { """ Checks whether the request should be delegated to some of the registered {@link RequestDelegationService}s. """ for (RequestDelegationService service : delegationServices) { if (canDelegate(service, request)) { delegate(service, request, response, filterChain); return true; } } return false; }
java
public boolean tryDelegateRequest(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) { for (RequestDelegationService service : delegationServices) { if (canDelegate(service, request)) { delegate(service, request, response, filterChain); return true; } } return false; }
[ "public", "boolean", "tryDelegateRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "FilterChain", "filterChain", ")", "{", "for", "(", "RequestDelegationService", "service", ":", "delegationServices", ")", "{", "if", "(", "canDelegate", "(", "service", ",", "request", ")", ")", "{", "delegate", "(", "service", ",", "request", ",", "response", ",", "filterChain", ")", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks whether the request should be delegated to some of the registered {@link RequestDelegationService}s.
[ "Checks", "whether", "the", "request", "should", "be", "delegated", "to", "some", "of", "the", "registered", "{" ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/server/delegation/RequestDelegator.java#L52-L62
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.convertToMatrix
public static DMatrixRMaj convertToMatrix( Se3_F64 m , DMatrixRMaj A ) { """ Converts the SE3 into a 3x4 matrix. [R|T] @param m (Input) transform @param A (Output) equivalent 3x4 matrix represenation """ if( A == null ) A = new DMatrixRMaj(3,4); else A.reshape(3,4); CommonOps_DDRM.insert(m.R,A,0,0); A.data[3] = m.T.x; A.data[7] = m.T.y; A.data[11] = m.T.z; return A; }
java
public static DMatrixRMaj convertToMatrix( Se3_F64 m , DMatrixRMaj A ) { if( A == null ) A = new DMatrixRMaj(3,4); else A.reshape(3,4); CommonOps_DDRM.insert(m.R,A,0,0); A.data[3] = m.T.x; A.data[7] = m.T.y; A.data[11] = m.T.z; return A; }
[ "public", "static", "DMatrixRMaj", "convertToMatrix", "(", "Se3_F64", "m", ",", "DMatrixRMaj", "A", ")", "{", "if", "(", "A", "==", "null", ")", "A", "=", "new", "DMatrixRMaj", "(", "3", ",", "4", ")", ";", "else", "A", ".", "reshape", "(", "3", ",", "4", ")", ";", "CommonOps_DDRM", ".", "insert", "(", "m", ".", "R", ",", "A", ",", "0", ",", "0", ")", ";", "A", ".", "data", "[", "3", "]", "=", "m", ".", "T", ".", "x", ";", "A", ".", "data", "[", "7", "]", "=", "m", ".", "T", ".", "y", ";", "A", ".", "data", "[", "11", "]", "=", "m", ".", "T", ".", "z", ";", "return", "A", ";", "}" ]
Converts the SE3 into a 3x4 matrix. [R|T] @param m (Input) transform @param A (Output) equivalent 3x4 matrix represenation
[ "Converts", "the", "SE3", "into", "a", "3x4", "matrix", ".", "[", "R|T", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L751-L761
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java
ReplicationLinksInner.beginFailoverAllowDataLossAsync
public Observable<Void> beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { """ Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { return beginFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginFailoverAllowDataLossAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "linkId", ")", "{", "return", "beginFailoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "linkId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Sets", "which", "replica", "database", "is", "primary", "by", "failing", "over", "from", "the", "current", "primary", "replica", "database", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L591-L598
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java
CharsTrie.next
public Result next(int inUnit) { """ Traverses the trie from the current state for this input char. @param inUnit Input char value. Values below 0 and above 0xffff will never match. @return The match/value Result. """ int pos=pos_; if(pos<0) { return Result.NO_MATCH; } int length=remainingMatchLength_; // Actual remaining match length minus 1. if(length>=0) { // Remaining part of a linear-match node. if(inUnit==chars_.charAt(pos++)) { remainingMatchLength_=--length; pos_=pos; int node; return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ? valueResults_[node>>15] : Result.NO_VALUE; } else { stop(); return Result.NO_MATCH; } } return nextImpl(pos, inUnit); }
java
public Result next(int inUnit) { int pos=pos_; if(pos<0) { return Result.NO_MATCH; } int length=remainingMatchLength_; // Actual remaining match length minus 1. if(length>=0) { // Remaining part of a linear-match node. if(inUnit==chars_.charAt(pos++)) { remainingMatchLength_=--length; pos_=pos; int node; return (length<0 && (node=chars_.charAt(pos))>=kMinValueLead) ? valueResults_[node>>15] : Result.NO_VALUE; } else { stop(); return Result.NO_MATCH; } } return nextImpl(pos, inUnit); }
[ "public", "Result", "next", "(", "int", "inUnit", ")", "{", "int", "pos", "=", "pos_", ";", "if", "(", "pos", "<", "0", ")", "{", "return", "Result", ".", "NO_MATCH", ";", "}", "int", "length", "=", "remainingMatchLength_", ";", "// Actual remaining match length minus 1.", "if", "(", "length", ">=", "0", ")", "{", "// Remaining part of a linear-match node.", "if", "(", "inUnit", "==", "chars_", ".", "charAt", "(", "pos", "++", ")", ")", "{", "remainingMatchLength_", "=", "--", "length", ";", "pos_", "=", "pos", ";", "int", "node", ";", "return", "(", "length", "<", "0", "&&", "(", "node", "=", "chars_", ".", "charAt", "(", "pos", ")", ")", ">=", "kMinValueLead", ")", "?", "valueResults_", "[", "node", ">>", "15", "]", ":", "Result", ".", "NO_VALUE", ";", "}", "else", "{", "stop", "(", ")", ";", "return", "Result", ".", "NO_MATCH", ";", "}", "}", "return", "nextImpl", "(", "pos", ",", "inUnit", ")", ";", "}" ]
Traverses the trie from the current state for this input char. @param inUnit Input char value. Values below 0 and above 0xffff will never match. @return The match/value Result.
[ "Traverses", "the", "trie", "from", "the", "current", "state", "for", "this", "input", "char", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrie.java#L169-L189
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java
JspViewDeclarationLanguageBase.actuallyRenderView
protected boolean actuallyRenderView(FacesContext facesContext, UIViewRoot viewToRender) throws IOException { """ Render the view now - properly setting and resetting the response writer [MF] Modified to return a boolean so subclass that delegates can determine whether the rendering succeeded or not. TRUE means success. """ // Set the new ResponseWriter into the FacesContext, saving the old one aside. ResponseWriter responseWriter = facesContext.getResponseWriter(); // Now we actually render the document // Call startDocument() on the ResponseWriter. responseWriter.startDocument(); // Call encodeAll() on the UIViewRoot viewToRender.encodeAll(facesContext); // Call endDocument() on the ResponseWriter responseWriter.endDocument(); responseWriter.flush(); // rendered successfully -- forge ahead return true; }
java
protected boolean actuallyRenderView(FacesContext facesContext, UIViewRoot viewToRender) throws IOException { // Set the new ResponseWriter into the FacesContext, saving the old one aside. ResponseWriter responseWriter = facesContext.getResponseWriter(); // Now we actually render the document // Call startDocument() on the ResponseWriter. responseWriter.startDocument(); // Call encodeAll() on the UIViewRoot viewToRender.encodeAll(facesContext); // Call endDocument() on the ResponseWriter responseWriter.endDocument(); responseWriter.flush(); // rendered successfully -- forge ahead return true; }
[ "protected", "boolean", "actuallyRenderView", "(", "FacesContext", "facesContext", ",", "UIViewRoot", "viewToRender", ")", "throws", "IOException", "{", "// Set the new ResponseWriter into the FacesContext, saving the old one aside.", "ResponseWriter", "responseWriter", "=", "facesContext", ".", "getResponseWriter", "(", ")", ";", "// Now we actually render the document", "// Call startDocument() on the ResponseWriter.", "responseWriter", ".", "startDocument", "(", ")", ";", "// Call encodeAll() on the UIViewRoot", "viewToRender", ".", "encodeAll", "(", "facesContext", ")", ";", "// Call endDocument() on the ResponseWriter", "responseWriter", ".", "endDocument", "(", ")", ";", "responseWriter", ".", "flush", "(", ")", ";", "// rendered successfully -- forge ahead", "return", "true", ";", "}" ]
Render the view now - properly setting and resetting the response writer [MF] Modified to return a boolean so subclass that delegates can determine whether the rendering succeeded or not. TRUE means success.
[ "Render", "the", "view", "now", "-", "properly", "setting", "and", "resetting", "the", "response", "writer", "[", "MF", "]", "Modified", "to", "return", "a", "boolean", "so", "subclass", "that", "delegates", "can", "determine", "whether", "the", "rendering", "succeeded", "or", "not", ".", "TRUE", "means", "success", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java#L340-L360
Stratio/stratio-cassandra
src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java
DebuggableScheduledThreadPoolExecutor.afterExecute
@Override public void afterExecute(Runnable r, Throwable t) { """ We need this as well as the wrapper for the benefit of non-repeating tasks """ super.afterExecute(r,t); DebuggableThreadPoolExecutor.logExceptionsAfterExecute(r, t); }
java
@Override public void afterExecute(Runnable r, Throwable t) { super.afterExecute(r,t); DebuggableThreadPoolExecutor.logExceptionsAfterExecute(r, t); }
[ "@", "Override", "public", "void", "afterExecute", "(", "Runnable", "r", ",", "Throwable", "t", ")", "{", "super", ".", "afterExecute", "(", "r", ",", "t", ")", ";", "DebuggableThreadPoolExecutor", ".", "logExceptionsAfterExecute", "(", "r", ",", "t", ")", ";", "}" ]
We need this as well as the wrapper for the benefit of non-repeating tasks
[ "We", "need", "this", "as", "well", "as", "the", "wrapper", "for", "the", "benefit", "of", "non", "-", "repeating", "tasks" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java#L49-L54
huahang/crypto-utils
crypto-utils/src/main/java/im/chic/utils/crypto/DigestUtils.java
DigestUtils.dgstHex
public static String dgstHex(byte[] input, Digest digest) { """ Calculates digest and returns the value as a hex string. @param input input bytes @param digest digest algorithm @return digest as a hex string """ checkNotNull(input); byte[] dgstBytes = dgst(input, digest); return BaseEncoding.base16().encode(dgstBytes); }
java
public static String dgstHex(byte[] input, Digest digest) { checkNotNull(input); byte[] dgstBytes = dgst(input, digest); return BaseEncoding.base16().encode(dgstBytes); }
[ "public", "static", "String", "dgstHex", "(", "byte", "[", "]", "input", ",", "Digest", "digest", ")", "{", "checkNotNull", "(", "input", ")", ";", "byte", "[", "]", "dgstBytes", "=", "dgst", "(", "input", ",", "digest", ")", ";", "return", "BaseEncoding", ".", "base16", "(", ")", ".", "encode", "(", "dgstBytes", ")", ";", "}" ]
Calculates digest and returns the value as a hex string. @param input input bytes @param digest digest algorithm @return digest as a hex string
[ "Calculates", "digest", "and", "returns", "the", "value", "as", "a", "hex", "string", "." ]
train
https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/DigestUtils.java#L125-L129
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseArrayGeneratorExpression
private Expr parseArrayGeneratorExpression(EnclosingScope scope, boolean terminated) { """ Parse an array generator expression, which is of the form: <pre> ArrayGeneratorExpr ::= '[' Expr ';' Expr ']' </pre> @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return """ int start = index; match(LeftSquare); Expr element = parseExpression(scope, true); match(SemiColon); Expr count = parseExpression(scope, true); match(RightSquare); return annotateSourceLocation(new Expr.ArrayGenerator(Type.Void, element, count), start); }
java
private Expr parseArrayGeneratorExpression(EnclosingScope scope, boolean terminated) { int start = index; match(LeftSquare); Expr element = parseExpression(scope, true); match(SemiColon); Expr count = parseExpression(scope, true); match(RightSquare); return annotateSourceLocation(new Expr.ArrayGenerator(Type.Void, element, count), start); }
[ "private", "Expr", "parseArrayGeneratorExpression", "(", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "int", "start", "=", "index", ";", "match", "(", "LeftSquare", ")", ";", "Expr", "element", "=", "parseExpression", "(", "scope", ",", "true", ")", ";", "match", "(", "SemiColon", ")", ";", "Expr", "count", "=", "parseExpression", "(", "scope", ",", "true", ")", ";", "match", "(", "RightSquare", ")", ";", "return", "annotateSourceLocation", "(", "new", "Expr", ".", "ArrayGenerator", "(", "Type", ".", "Void", ",", "element", ",", "count", ")", ",", "start", ")", ";", "}" ]
Parse an array generator expression, which is of the form: <pre> ArrayGeneratorExpr ::= '[' Expr ';' Expr ']' </pre> @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return
[ "Parse", "an", "array", "generator", "expression", "which", "is", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2733-L2741
wcm-io-caravan/caravan-hal
docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java
GenerateHalDocsJsonMojo.hasAnnotation
private boolean hasAnnotation(JavaAnnotatedElement clazz, Class<? extends Annotation> annotationClazz) { """ Checks if the given element has an annotation set. @param clazz QDox class @param annotationClazz Annotation class @return true if annotation is present """ return clazz.getAnnotations().stream() .filter(item -> item.getType().isA(annotationClazz.getName())) .count() > 0; }
java
private boolean hasAnnotation(JavaAnnotatedElement clazz, Class<? extends Annotation> annotationClazz) { return clazz.getAnnotations().stream() .filter(item -> item.getType().isA(annotationClazz.getName())) .count() > 0; }
[ "private", "boolean", "hasAnnotation", "(", "JavaAnnotatedElement", "clazz", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationClazz", ")", "{", "return", "clazz", ".", "getAnnotations", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "item", "->", "item", ".", "getType", "(", ")", ".", "isA", "(", "annotationClazz", ".", "getName", "(", ")", ")", ")", ".", "count", "(", ")", ">", "0", ";", "}" ]
Checks if the given element has an annotation set. @param clazz QDox class @param annotationClazz Annotation class @return true if annotation is present
[ "Checks", "if", "the", "given", "element", "has", "an", "annotation", "set", "." ]
train
https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java#L315-L319
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageAdvancedForm.java
CmsImageAdvancedForm.fillContent
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { """ Displays the provided image information.<p> @param imageInfo the image information @param imageAttributes the image attributes @param initialFill flag to indicate that a new image has been selected """ for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { if ((entry.getKey() == Attribute.linkPath) && val.startsWith(CmsCoreProvider.get().getVfsPrefix())) { entry.getValue().setFormValueAsString(val.substring(CmsCoreProvider.get().getVfsPrefix().length())); } else { entry.getValue().setFormValueAsString(val); } } } }
java
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { if ((entry.getKey() == Attribute.linkPath) && val.startsWith(CmsCoreProvider.get().getVfsPrefix())) { entry.getValue().setFormValueAsString(val.substring(CmsCoreProvider.get().getVfsPrefix().length())); } else { entry.getValue().setFormValueAsString(val); } } } }
[ "public", "void", "fillContent", "(", "CmsImageInfoBean", "imageInfo", ",", "CmsJSONMap", "imageAttributes", ",", "boolean", "initialFill", ")", "{", "for", "(", "Entry", "<", "Attribute", ",", "I_CmsFormWidget", ">", "entry", ":", "m_fields", ".", "entrySet", "(", ")", ")", "{", "String", "val", "=", "imageAttributes", ".", "getString", "(", "entry", ".", "getKey", "(", ")", ".", "name", "(", ")", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "val", ")", ")", "{", "if", "(", "(", "entry", ".", "getKey", "(", ")", "==", "Attribute", ".", "linkPath", ")", "&&", "val", ".", "startsWith", "(", "CmsCoreProvider", ".", "get", "(", ")", ".", "getVfsPrefix", "(", ")", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setFormValueAsString", "(", "val", ".", "substring", "(", "CmsCoreProvider", ".", "get", "(", ")", ".", "getVfsPrefix", "(", ")", ".", "length", "(", ")", ")", ")", ";", "}", "else", "{", "entry", ".", "getValue", "(", ")", ".", "setFormValueAsString", "(", "val", ")", ";", "}", "}", "}", "}" ]
Displays the provided image information.<p> @param imageInfo the image information @param imageAttributes the image attributes @param initialFill flag to indicate that a new image has been selected
[ "Displays", "the", "provided", "image", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageAdvancedForm.java#L192-L204
osglworks/java-tool-ext
src/main/java/org/osgl/util/Token.java
Token.isTokenValid
@Deprecated @SuppressWarnings("unused") public static boolean isTokenValid(String secret, String oid, String token) { """ This method is deprecated. Please use {@link #isTokenValid(byte[], String, String)} instead Check if a string is a valid token @param secret the secret to decrypt the string @param oid the ID supposed to be encapsulated in the token @param token the token string @return {@code true} if the token is valid """ return isTokenValid(secret.getBytes(Charsets.UTF_8), oid, token); }
java
@Deprecated @SuppressWarnings("unused") public static boolean isTokenValid(String secret, String oid, String token) { return isTokenValid(secret.getBytes(Charsets.UTF_8), oid, token); }
[ "@", "Deprecated", "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "boolean", "isTokenValid", "(", "String", "secret", ",", "String", "oid", ",", "String", "token", ")", "{", "return", "isTokenValid", "(", "secret", ".", "getBytes", "(", "Charsets", ".", "UTF_8", ")", ",", "oid", ",", "token", ")", ";", "}" ]
This method is deprecated. Please use {@link #isTokenValid(byte[], String, String)} instead Check if a string is a valid token @param secret the secret to decrypt the string @param oid the ID supposed to be encapsulated in the token @param token the token string @return {@code true} if the token is valid
[ "This", "method", "is", "deprecated", ".", "Please", "use", "{", "@link", "#isTokenValid", "(", "byte", "[]", "String", "String", ")", "}", "instead" ]
train
https://github.com/osglworks/java-tool-ext/blob/43f034bd0a42e571e437f44aa20487d45248a30b/src/main/java/org/osgl/util/Token.java#L402-L406
seedstack/business
core/src/main/java/org/seedstack/business/util/Tuples.java
Tuples.create
@SuppressWarnings("unchecked") public static <T extends Tuple> T create(Iterable<?> objects, int limit) { """ Builds a tuple from an {@link Iterable}, optionally limiting the number of items. @param objects the iterable of objects (size must be less or equal than 10). @param limit the item number limit (-1 means no limit). @param <T> the tuple type. @return the constructed tuple. """ List<Object> list = new ArrayList<>(); int index = 0; for (Object object : objects) { if (limit != -1 && ++index > limit) { break; } list.add(object); } return create(list); }
java
@SuppressWarnings("unchecked") public static <T extends Tuple> T create(Iterable<?> objects, int limit) { List<Object> list = new ArrayList<>(); int index = 0; for (Object object : objects) { if (limit != -1 && ++index > limit) { break; } list.add(object); } return create(list); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Tuple", ">", "T", "create", "(", "Iterable", "<", "?", ">", "objects", ",", "int", "limit", ")", "{", "List", "<", "Object", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "index", "=", "0", ";", "for", "(", "Object", "object", ":", "objects", ")", "{", "if", "(", "limit", "!=", "-", "1", "&&", "++", "index", ">", "limit", ")", "{", "break", ";", "}", "list", ".", "add", "(", "object", ")", ";", "}", "return", "create", "(", "list", ")", ";", "}" ]
Builds a tuple from an {@link Iterable}, optionally limiting the number of items. @param objects the iterable of objects (size must be less or equal than 10). @param limit the item number limit (-1 means no limit). @param <T> the tuple type. @return the constructed tuple.
[ "Builds", "a", "tuple", "from", "an", "{", "@link", "Iterable", "}", "optionally", "limiting", "the", "number", "of", "items", "." ]
train
https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/util/Tuples.java#L83-L94
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java
JsonSerializationContext.traceError
public RuntimeException traceError( Object value, RuntimeException cause ) { """ Trace an error and returns a corresponding exception. @param value current value @param cause cause of the error @return a {@link JsonSerializationException} if we wrap the exceptions, the cause otherwise """ getLogger().log( Level.SEVERE, "Error during serialization", cause ); if ( wrapExceptions ) { return new JsonSerializationException( cause ); } else { return cause; } }
java
public RuntimeException traceError( Object value, RuntimeException cause ) { getLogger().log( Level.SEVERE, "Error during serialization", cause ); if ( wrapExceptions ) { return new JsonSerializationException( cause ); } else { return cause; } }
[ "public", "RuntimeException", "traceError", "(", "Object", "value", ",", "RuntimeException", "cause", ")", "{", "getLogger", "(", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error during serialization\"", ",", "cause", ")", ";", "if", "(", "wrapExceptions", ")", "{", "return", "new", "JsonSerializationException", "(", "cause", ")", ";", "}", "else", "{", "return", "cause", ";", "}", "}" ]
Trace an error and returns a corresponding exception. @param value current value @param cause cause of the error @return a {@link JsonSerializationException} if we wrap the exceptions, the cause otherwise
[ "Trace", "an", "error", "and", "returns", "a", "corresponding", "exception", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java#L533-L540
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
GridGraph.addDimension
public GridGraph addDimension(long size, boolean wrapEndpoints) { """ Required configuration for each dimension of the graph. @param size number of vertices; dimensions of size 1 are prohibited due to having no effect on the generated graph @param wrapEndpoints whether to connect first and last vertices; this has no effect on dimensions of size 2 @return this """ Preconditions.checkArgument(size >= 2, "Dimension size must be at least 2"); vertexCount = Math.multiplyExact(vertexCount, size); // prevent duplicate edges if (size == 2) { wrapEndpoints = false; } dimensions.add(new Tuple2<>(size, wrapEndpoints)); return this; }
java
public GridGraph addDimension(long size, boolean wrapEndpoints) { Preconditions.checkArgument(size >= 2, "Dimension size must be at least 2"); vertexCount = Math.multiplyExact(vertexCount, size); // prevent duplicate edges if (size == 2) { wrapEndpoints = false; } dimensions.add(new Tuple2<>(size, wrapEndpoints)); return this; }
[ "public", "GridGraph", "addDimension", "(", "long", "size", ",", "boolean", "wrapEndpoints", ")", "{", "Preconditions", ".", "checkArgument", "(", "size", ">=", "2", ",", "\"Dimension size must be at least 2\"", ")", ";", "vertexCount", "=", "Math", ".", "multiplyExact", "(", "vertexCount", ",", "size", ")", ";", "// prevent duplicate edges", "if", "(", "size", "==", "2", ")", "{", "wrapEndpoints", "=", "false", ";", "}", "dimensions", ".", "add", "(", "new", "Tuple2", "<>", "(", "size", ",", "wrapEndpoints", ")", ")", ";", "return", "this", ";", "}" ]
Required configuration for each dimension of the graph. @param size number of vertices; dimensions of size 1 are prohibited due to having no effect on the generated graph @param wrapEndpoints whether to connect first and last vertices; this has no effect on dimensions of size 2 @return this
[ "Required", "configuration", "for", "each", "dimension", "of", "the", "graph", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java#L71-L84
reactor/reactor-netty
src/main/java/reactor/netty/tcp/TcpServer.java
TcpServer.selectorAttr
public final <T> TcpServer selectorAttr(AttributeKey<T> key, T value) { """ Injects default attribute to the future {@link io.netty.channel.ServerChannel} selector connection. @param key the attribute key @param value the attribute value @param <T> the attribute type @return a new {@link TcpServer} @see ServerBootstrap#attr(AttributeKey, Object) """ Objects.requireNonNull(key, "key"); return bootstrap(b -> b.attr(key, value)); }
java
public final <T> TcpServer selectorAttr(AttributeKey<T> key, T value) { Objects.requireNonNull(key, "key"); return bootstrap(b -> b.attr(key, value)); }
[ "public", "final", "<", "T", ">", "TcpServer", "selectorAttr", "(", "AttributeKey", "<", "T", ">", "key", ",", "T", "value", ")", "{", "Objects", ".", "requireNonNull", "(", "key", ",", "\"key\"", ")", ";", "return", "bootstrap", "(", "b", "->", "b", ".", "attr", "(", "key", ",", "value", ")", ")", ";", "}" ]
Injects default attribute to the future {@link io.netty.channel.ServerChannel} selector connection. @param key the attribute key @param value the attribute value @param <T> the attribute type @return a new {@link TcpServer} @see ServerBootstrap#attr(AttributeKey, Object)
[ "Injects", "default", "attribute", "to", "the", "future", "{", "@link", "io", ".", "netty", ".", "channel", ".", "ServerChannel", "}", "selector", "connection", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/TcpServer.java#L493-L496
hatunet/spring-data-mybatis
spring-data-mybatis/src/main/java/org/springframework/data/mybatis/repository/support/SqlSessionRepositorySupport.java
SqlSessionRepositorySupport.calculateTotal
protected <X> long calculateTotal(Pageable pager, List<X> result) { """ Calculate total mount. @return if return -1 means can not judge ,need count from database. """ if (pager.hasPrevious()) { if (CollectionUtils.isEmpty(result)) { return -1; } if (result.size() == pager.getPageSize()) { return -1; } return (pager.getPageNumber() - 1) * pager.getPageSize() + result.size(); } if (result.size() < pager.getPageSize()) { return result.size(); } return -1; }
java
protected <X> long calculateTotal(Pageable pager, List<X> result) { if (pager.hasPrevious()) { if (CollectionUtils.isEmpty(result)) { return -1; } if (result.size() == pager.getPageSize()) { return -1; } return (pager.getPageNumber() - 1) * pager.getPageSize() + result.size(); } if (result.size() < pager.getPageSize()) { return result.size(); } return -1; }
[ "protected", "<", "X", ">", "long", "calculateTotal", "(", "Pageable", "pager", ",", "List", "<", "X", ">", "result", ")", "{", "if", "(", "pager", ".", "hasPrevious", "(", ")", ")", "{", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "result", ")", ")", "{", "return", "-", "1", ";", "}", "if", "(", "result", ".", "size", "(", ")", "==", "pager", ".", "getPageSize", "(", ")", ")", "{", "return", "-", "1", ";", "}", "return", "(", "pager", ".", "getPageNumber", "(", ")", "-", "1", ")", "*", "pager", ".", "getPageSize", "(", ")", "+", "result", ".", "size", "(", ")", ";", "}", "if", "(", "result", ".", "size", "(", ")", "<", "pager", ".", "getPageSize", "(", ")", ")", "{", "return", "result", ".", "size", "(", ")", ";", "}", "return", "-", "1", ";", "}" ]
Calculate total mount. @return if return -1 means can not judge ,need count from database.
[ "Calculate", "total", "mount", "." ]
train
https://github.com/hatunet/spring-data-mybatis/blob/ee6316f2c29f45e8e9ef1538957a29c21c89055f/spring-data-mybatis/src/main/java/org/springframework/data/mybatis/repository/support/SqlSessionRepositorySupport.java#L92-L106
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/ObjectBindTransform.java
ObjectBindTransform.generateSerializeOnXml
@Override public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) { """ /* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty) """ // TODO QUA // TypeName typeName = resolveTypeName(property.getParent(), // property.getPropertyType().getTypeName()); TypeName typeName = property.getPropertyType().getTypeName(); String bindName = context.getBindMapperName(context, typeName); // @formatter:off if (property.isNullable() && !property.isInCollection()) { methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); } methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property)); methodBuilder.addStatement("$L.serializeOnXml($L, xmlSerializer, $L)", bindName, getter(beanName, beanClass, property), XmlPullParser.START_TAG); methodBuilder.addStatement("$L.writeEndElement()", serializerName); if (property.isNullable() && !property.isInCollection()) { methodBuilder.endControlFlow(); } // @formatter:on }
java
@Override public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) { // TODO QUA // TypeName typeName = resolveTypeName(property.getParent(), // property.getPropertyType().getTypeName()); TypeName typeName = property.getPropertyType().getTypeName(); String bindName = context.getBindMapperName(context, typeName); // @formatter:off if (property.isNullable() && !property.isInCollection()) { methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); } methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property)); methodBuilder.addStatement("$L.serializeOnXml($L, xmlSerializer, $L)", bindName, getter(beanName, beanClass, property), XmlPullParser.START_TAG); methodBuilder.addStatement("$L.writeEndElement()", serializerName); if (property.isNullable() && !property.isInCollection()) { methodBuilder.endControlFlow(); } // @formatter:on }
[ "@", "Override", "public", "void", "generateSerializeOnXml", "(", "BindTypeContext", "context", ",", "MethodSpec", ".", "Builder", "methodBuilder", ",", "String", "serializerName", ",", "TypeName", "beanClass", ",", "String", "beanName", ",", "BindProperty", "property", ")", "{", "// TODO QUA", "// TypeName typeName = resolveTypeName(property.getParent(),", "// property.getPropertyType().getTypeName());", "TypeName", "typeName", "=", "property", ".", "getPropertyType", "(", ")", ".", "getTypeName", "(", ")", ";", "String", "bindName", "=", "context", ".", "getBindMapperName", "(", "context", ",", "typeName", ")", ";", "// @formatter:off", "if", "(", "property", ".", "isNullable", "(", ")", "&&", "!", "property", ".", "isInCollection", "(", ")", ")", "{", "methodBuilder", ".", "beginControlFlow", "(", "\"if ($L!=null) \"", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ")", ";", "}", "methodBuilder", ".", "addStatement", "(", "\"$L.writeStartElement($S)\"", ",", "serializerName", ",", "BindProperty", ".", "xmlName", "(", "property", ")", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$L.serializeOnXml($L, xmlSerializer, $L)\"", ",", "bindName", ",", "getter", "(", "beanName", ",", "beanClass", ",", "property", ")", ",", "XmlPullParser", ".", "START_TAG", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"$L.writeEndElement()\"", ",", "serializerName", ")", ";", "if", "(", "property", ".", "isNullable", "(", ")", "&&", "!", "property", ".", "isInCollection", "(", ")", ")", "{", "methodBuilder", ".", "endControlFlow", "(", ")", ";", "}", "// @formatter:on", "}" ]
/* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/ObjectBindTransform.java#L69-L91
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.pixelXToTileX
public static int pixelXToTileX(double pixelX, byte zoomLevel, int tileSize) { """ Converts a pixel X coordinate to the tile X number. @param pixelX the pixel X coordinate that should be converted. @param zoomLevel the zoom level at which the coordinate should be converted. @return the tile X number. """ return (int) Math.min(Math.max(pixelX / tileSize, 0), Math.pow(2, zoomLevel) - 1); }
java
public static int pixelXToTileX(double pixelX, byte zoomLevel, int tileSize) { return (int) Math.min(Math.max(pixelX / tileSize, 0), Math.pow(2, zoomLevel) - 1); }
[ "public", "static", "int", "pixelXToTileX", "(", "double", "pixelX", ",", "byte", "zoomLevel", ",", "int", "tileSize", ")", "{", "return", "(", "int", ")", "Math", ".", "min", "(", "Math", ".", "max", "(", "pixelX", "/", "tileSize", ",", "0", ")", ",", "Math", ".", "pow", "(", "2", ",", "zoomLevel", ")", "-", "1", ")", ";", "}" ]
Converts a pixel X coordinate to the tile X number. @param pixelX the pixel X coordinate that should be converted. @param zoomLevel the zoom level at which the coordinate should be converted. @return the tile X number.
[ "Converts", "a", "pixel", "X", "coordinate", "to", "the", "tile", "X", "number", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L378-L380
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toByte
public static Byte toByte(Object o, Byte defaultValue) { """ cast a Object to a Byte Object(reference type) @param o Object to cast @param defaultValue @return casted Byte Object """ if (o instanceof Byte) return (Byte) o; if (defaultValue != null) return new Byte(toByteValue(o, defaultValue.byteValue())); byte res = toByteValue(o, Byte.MIN_VALUE); if (res == Byte.MIN_VALUE) return defaultValue; return new Byte(res); }
java
public static Byte toByte(Object o, Byte defaultValue) { if (o instanceof Byte) return (Byte) o; if (defaultValue != null) return new Byte(toByteValue(o, defaultValue.byteValue())); byte res = toByteValue(o, Byte.MIN_VALUE); if (res == Byte.MIN_VALUE) return defaultValue; return new Byte(res); }
[ "public", "static", "Byte", "toByte", "(", "Object", "o", ",", "Byte", "defaultValue", ")", "{", "if", "(", "o", "instanceof", "Byte", ")", "return", "(", "Byte", ")", "o", ";", "if", "(", "defaultValue", "!=", "null", ")", "return", "new", "Byte", "(", "toByteValue", "(", "o", ",", "defaultValue", ".", "byteValue", "(", ")", ")", ")", ";", "byte", "res", "=", "toByteValue", "(", "o", ",", "Byte", ".", "MIN_VALUE", ")", ";", "if", "(", "res", "==", "Byte", ".", "MIN_VALUE", ")", "return", "defaultValue", ";", "return", "new", "Byte", "(", "res", ")", ";", "}" ]
cast a Object to a Byte Object(reference type) @param o Object to cast @param defaultValue @return casted Byte Object
[ "cast", "a", "Object", "to", "a", "Byte", "Object", "(", "reference", "type", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1338-L1344
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.setNetworkTimeout
private void setNetworkTimeout(final Connection connection, final long timeoutMs) throws SQLException { """ Set the network timeout, if <code>isUseNetworkTimeout</code> is <code>true</code> and the driver supports it. @param connection the connection to set the network timeout on @param timeoutMs the number of milliseconds before timeout @throws SQLException throw if the connection.setNetworkTimeout() call throws """ if (isNetworkTimeoutSupported == TRUE) { connection.setNetworkTimeout(netTimeoutExecutor, (int) timeoutMs); } }
java
private void setNetworkTimeout(final Connection connection, final long timeoutMs) throws SQLException { if (isNetworkTimeoutSupported == TRUE) { connection.setNetworkTimeout(netTimeoutExecutor, (int) timeoutMs); } }
[ "private", "void", "setNetworkTimeout", "(", "final", "Connection", "connection", ",", "final", "long", "timeoutMs", ")", "throws", "SQLException", "{", "if", "(", "isNetworkTimeoutSupported", "==", "TRUE", ")", "{", "connection", ".", "setNetworkTimeout", "(", "netTimeoutExecutor", ",", "(", "int", ")", "timeoutMs", ")", ";", "}", "}" ]
Set the network timeout, if <code>isUseNetworkTimeout</code> is <code>true</code> and the driver supports it. @param connection the connection to set the network timeout on @param timeoutMs the number of milliseconds before timeout @throws SQLException throw if the connection.setNetworkTimeout() call throws
[ "Set", "the", "network", "timeout", "if", "<code", ">", "isUseNetworkTimeout<", "/", "code", ">", "is", "<code", ">", "true<", "/", "code", ">", "and", "the", "driver", "supports", "it", "." ]
train
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L549-L554
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_acl_accountId_GET
public OvhAcl domain_acl_accountId_GET(String domain, String accountId) throws IOException { """ Get this object properties REST: GET /email/domain/{domain}/acl/{accountId} @param domain [required] Name of your domain name @param accountId [required] OVH customer unique identifier """ String qPath = "/email/domain/{domain}/acl/{accountId}"; StringBuilder sb = path(qPath, domain, accountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAcl.class); }
java
public OvhAcl domain_acl_accountId_GET(String domain, String accountId) throws IOException { String qPath = "/email/domain/{domain}/acl/{accountId}"; StringBuilder sb = path(qPath, domain, accountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAcl.class); }
[ "public", "OvhAcl", "domain_acl_accountId_GET", "(", "String", "domain", ",", "String", "accountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/acl/{accountId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "domain", ",", "accountId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhAcl", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/domain/{domain}/acl/{accountId} @param domain [required] Name of your domain name @param accountId [required] OVH customer unique identifier
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1308-L1313
derari/cthul
objects/src/main/java/org/cthul/objects/Boxing.java
Boxing.unboxAllAs
public static <T> T unboxAllAs(Object src, Class<T> type) { """ Transforms any array into a primitive array. @param <T> @param src source array @param type target type @return primitive array """ return (T) unboxAll(type, src, 0, -1); }
java
public static <T> T unboxAllAs(Object src, Class<T> type) { return (T) unboxAll(type, src, 0, -1); }
[ "public", "static", "<", "T", ">", "T", "unboxAllAs", "(", "Object", "src", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "(", "T", ")", "unboxAll", "(", "type", ",", "src", ",", "0", ",", "-", "1", ")", ";", "}" ]
Transforms any array into a primitive array. @param <T> @param src source array @param type target type @return primitive array
[ "Transforms", "any", "array", "into", "a", "primitive", "array", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L227-L229
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.evictionOrder
@SuppressWarnings("GuardedByChecker") Map<K, V> evictionOrder(int limit, Function<V, V> transformer, boolean hottest) { """ Returns an unmodifiable snapshot map ordered in eviction order, either ascending or descending. Beware that obtaining the mappings is <em>NOT</em> a constant-time operation. @param limit the maximum number of entries @param transformer a function that unwraps the value @param hottest the iteration order @return an unmodifiable snapshot in a specified order """ Supplier<Iterator<Node<K, V>>> iteratorSupplier = () -> { Comparator<Node<K, V>> comparator = Comparator.comparingInt(node -> { K key = node.getKey(); return (key == null) ? 0 : frequencySketch().frequency(key); }); if (hottest) { PeekingIterator<Node<K, V>> secondary = PeekingIterator.comparing( accessOrderProbationDeque().descendingIterator(), accessOrderWindowDeque().descendingIterator(), comparator); return PeekingIterator.concat(accessOrderProtectedDeque().descendingIterator(), secondary); } else { PeekingIterator<Node<K, V>> primary = PeekingIterator.comparing( accessOrderWindowDeque().iterator(), accessOrderProbationDeque().iterator(), comparator.reversed()); return PeekingIterator.concat(primary, accessOrderProtectedDeque().iterator()); } }; return fixedSnapshot(iteratorSupplier, limit, transformer); }
java
@SuppressWarnings("GuardedByChecker") Map<K, V> evictionOrder(int limit, Function<V, V> transformer, boolean hottest) { Supplier<Iterator<Node<K, V>>> iteratorSupplier = () -> { Comparator<Node<K, V>> comparator = Comparator.comparingInt(node -> { K key = node.getKey(); return (key == null) ? 0 : frequencySketch().frequency(key); }); if (hottest) { PeekingIterator<Node<K, V>> secondary = PeekingIterator.comparing( accessOrderProbationDeque().descendingIterator(), accessOrderWindowDeque().descendingIterator(), comparator); return PeekingIterator.concat(accessOrderProtectedDeque().descendingIterator(), secondary); } else { PeekingIterator<Node<K, V>> primary = PeekingIterator.comparing( accessOrderWindowDeque().iterator(), accessOrderProbationDeque().iterator(), comparator.reversed()); return PeekingIterator.concat(primary, accessOrderProtectedDeque().iterator()); } }; return fixedSnapshot(iteratorSupplier, limit, transformer); }
[ "@", "SuppressWarnings", "(", "\"GuardedByChecker\"", ")", "Map", "<", "K", ",", "V", ">", "evictionOrder", "(", "int", "limit", ",", "Function", "<", "V", ",", "V", ">", "transformer", ",", "boolean", "hottest", ")", "{", "Supplier", "<", "Iterator", "<", "Node", "<", "K", ",", "V", ">", ">", ">", "iteratorSupplier", "=", "(", ")", "->", "{", "Comparator", "<", "Node", "<", "K", ",", "V", ">", ">", "comparator", "=", "Comparator", ".", "comparingInt", "(", "node", "->", "{", "K", "key", "=", "node", ".", "getKey", "(", ")", ";", "return", "(", "key", "==", "null", ")", "?", "0", ":", "frequencySketch", "(", ")", ".", "frequency", "(", "key", ")", ";", "}", ")", ";", "if", "(", "hottest", ")", "{", "PeekingIterator", "<", "Node", "<", "K", ",", "V", ">", ">", "secondary", "=", "PeekingIterator", ".", "comparing", "(", "accessOrderProbationDeque", "(", ")", ".", "descendingIterator", "(", ")", ",", "accessOrderWindowDeque", "(", ")", ".", "descendingIterator", "(", ")", ",", "comparator", ")", ";", "return", "PeekingIterator", ".", "concat", "(", "accessOrderProtectedDeque", "(", ")", ".", "descendingIterator", "(", ")", ",", "secondary", ")", ";", "}", "else", "{", "PeekingIterator", "<", "Node", "<", "K", ",", "V", ">", ">", "primary", "=", "PeekingIterator", ".", "comparing", "(", "accessOrderWindowDeque", "(", ")", ".", "iterator", "(", ")", ",", "accessOrderProbationDeque", "(", ")", ".", "iterator", "(", ")", ",", "comparator", ".", "reversed", "(", ")", ")", ";", "return", "PeekingIterator", ".", "concat", "(", "primary", ",", "accessOrderProtectedDeque", "(", ")", ".", "iterator", "(", ")", ")", ";", "}", "}", ";", "return", "fixedSnapshot", "(", "iteratorSupplier", ",", "limit", ",", "transformer", ")", ";", "}" ]
Returns an unmodifiable snapshot map ordered in eviction order, either ascending or descending. Beware that obtaining the mappings is <em>NOT</em> a constant-time operation. @param limit the maximum number of entries @param transformer a function that unwraps the value @param hottest the iteration order @return an unmodifiable snapshot in a specified order
[ "Returns", "an", "unmodifiable", "snapshot", "map", "ordered", "in", "eviction", "order", "either", "ascending", "or", "descending", ".", "Beware", "that", "obtaining", "the", "mappings", "is", "<em", ">", "NOT<", "/", "em", ">", "a", "constant", "-", "time", "operation", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L2619-L2639
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/content/CmsPropertyChange.java
CmsPropertyChange.setPropertyInFolder
private List setPropertyInFolder( String resourceRootPath, String propertyDefinition, String newValue, boolean recursive) throws CmsException, CmsVfsException { """ Sets the given property with the given value to the given resource (potentially recursiv) if it has not been set before.<p> Returns a list with all sub resources that have been modified this way.<p> @param resourceRootPath the resource on which property definition values are changed @param propertyDefinition the name of the propertydefinition to change the value @param newValue the new value of the propertydefinition @param recursive if true, change recursively all property values on sub-resources (only for folders) @return a list with the <code>{@link CmsResource}</code>'s where the property value has been changed @throws CmsVfsException for now only when the search for the oldvalue failed. @throws CmsException if operation was not successful """ CmsObject cms = getCms(); // collect the resources to look up List resources = new ArrayList(); if (recursive) { resources = cms.readResources(resourceRootPath, CmsResourceFilter.IGNORE_EXPIRATION); } else { resources.add(resourceRootPath); } List changedResources = new ArrayList(resources.size()); CmsProperty newProperty = new CmsProperty(propertyDefinition, null, null); // create permission set and filter to check each resource for (int i = 0; i < resources.size(); i++) { // loop through found resources and check property values CmsResource res = (CmsResource)resources.get(i); CmsProperty property = cms.readPropertyObject(res, propertyDefinition, false); if (property.isNullProperty()) { // change structure value newProperty.setStructureValue(newValue); newProperty.setName(propertyDefinition); cms.writePropertyObject(cms.getRequestContext().removeSiteRoot(res.getRootPath()), newProperty); changedResources.add(res); } else { // nop } } return changedResources; }
java
private List setPropertyInFolder( String resourceRootPath, String propertyDefinition, String newValue, boolean recursive) throws CmsException, CmsVfsException { CmsObject cms = getCms(); // collect the resources to look up List resources = new ArrayList(); if (recursive) { resources = cms.readResources(resourceRootPath, CmsResourceFilter.IGNORE_EXPIRATION); } else { resources.add(resourceRootPath); } List changedResources = new ArrayList(resources.size()); CmsProperty newProperty = new CmsProperty(propertyDefinition, null, null); // create permission set and filter to check each resource for (int i = 0; i < resources.size(); i++) { // loop through found resources and check property values CmsResource res = (CmsResource)resources.get(i); CmsProperty property = cms.readPropertyObject(res, propertyDefinition, false); if (property.isNullProperty()) { // change structure value newProperty.setStructureValue(newValue); newProperty.setName(propertyDefinition); cms.writePropertyObject(cms.getRequestContext().removeSiteRoot(res.getRootPath()), newProperty); changedResources.add(res); } else { // nop } } return changedResources; }
[ "private", "List", "setPropertyInFolder", "(", "String", "resourceRootPath", ",", "String", "propertyDefinition", ",", "String", "newValue", ",", "boolean", "recursive", ")", "throws", "CmsException", ",", "CmsVfsException", "{", "CmsObject", "cms", "=", "getCms", "(", ")", ";", "// collect the resources to look up", "List", "resources", "=", "new", "ArrayList", "(", ")", ";", "if", "(", "recursive", ")", "{", "resources", "=", "cms", ".", "readResources", "(", "resourceRootPath", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "}", "else", "{", "resources", ".", "add", "(", "resourceRootPath", ")", ";", "}", "List", "changedResources", "=", "new", "ArrayList", "(", "resources", ".", "size", "(", ")", ")", ";", "CmsProperty", "newProperty", "=", "new", "CmsProperty", "(", "propertyDefinition", ",", "null", ",", "null", ")", ";", "// create permission set and filter to check each resource", "for", "(", "int", "i", "=", "0", ";", "i", "<", "resources", ".", "size", "(", ")", ";", "i", "++", ")", "{", "// loop through found resources and check property values", "CmsResource", "res", "=", "(", "CmsResource", ")", "resources", ".", "get", "(", "i", ")", ";", "CmsProperty", "property", "=", "cms", ".", "readPropertyObject", "(", "res", ",", "propertyDefinition", ",", "false", ")", ";", "if", "(", "property", ".", "isNullProperty", "(", ")", ")", "{", "// change structure value", "newProperty", ".", "setStructureValue", "(", "newValue", ")", ";", "newProperty", ".", "setName", "(", "propertyDefinition", ")", ";", "cms", ".", "writePropertyObject", "(", "cms", ".", "getRequestContext", "(", ")", ".", "removeSiteRoot", "(", "res", ".", "getRootPath", "(", ")", ")", ",", "newProperty", ")", ";", "changedResources", ".", "add", "(", "res", ")", ";", "}", "else", "{", "// nop", "}", "}", "return", "changedResources", ";", "}" ]
Sets the given property with the given value to the given resource (potentially recursiv) if it has not been set before.<p> Returns a list with all sub resources that have been modified this way.<p> @param resourceRootPath the resource on which property definition values are changed @param propertyDefinition the name of the propertydefinition to change the value @param newValue the new value of the propertydefinition @param recursive if true, change recursively all property values on sub-resources (only for folders) @return a list with the <code>{@link CmsResource}</code>'s where the property value has been changed @throws CmsVfsException for now only when the search for the oldvalue failed. @throws CmsException if operation was not successful
[ "Sets", "the", "given", "property", "with", "the", "given", "value", "to", "the", "given", "resource", "(", "potentially", "recursiv", ")", "if", "it", "has", "not", "been", "set", "before", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsPropertyChange.java#L469-L503
adyliu/jafka
src/main/java/io/jafka/network/SocketServer.java
SocketServer.startup
public void startup() throws InterruptedException { """ Start the socket server and waiting for finished @throws InterruptedException thread interrupted """ final int maxCacheConnectionPerThread = serverConfig.getMaxConnections() / processors.length; logger.debug("start {} Processor threads",processors.length); for (int i = 0; i < processors.length; i++) { processors[i] = new Processor(handlerFactory, stats, maxRequestSize, maxCacheConnectionPerThread); Utils.newThread("jafka-processor-" + i, processors[i], false).start(); } Utils.newThread("jafka-acceptor", acceptor, false).start(); acceptor.awaitStartup(); }
java
public void startup() throws InterruptedException { final int maxCacheConnectionPerThread = serverConfig.getMaxConnections() / processors.length; logger.debug("start {} Processor threads",processors.length); for (int i = 0; i < processors.length; i++) { processors[i] = new Processor(handlerFactory, stats, maxRequestSize, maxCacheConnectionPerThread); Utils.newThread("jafka-processor-" + i, processors[i], false).start(); } Utils.newThread("jafka-acceptor", acceptor, false).start(); acceptor.awaitStartup(); }
[ "public", "void", "startup", "(", ")", "throws", "InterruptedException", "{", "final", "int", "maxCacheConnectionPerThread", "=", "serverConfig", ".", "getMaxConnections", "(", ")", "/", "processors", ".", "length", ";", "logger", ".", "debug", "(", "\"start {} Processor threads\"", ",", "processors", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "processors", ".", "length", ";", "i", "++", ")", "{", "processors", "[", "i", "]", "=", "new", "Processor", "(", "handlerFactory", ",", "stats", ",", "maxRequestSize", ",", "maxCacheConnectionPerThread", ")", ";", "Utils", ".", "newThread", "(", "\"jafka-processor-\"", "+", "i", ",", "processors", "[", "i", "]", ",", "false", ")", ".", "start", "(", ")", ";", "}", "Utils", ".", "newThread", "(", "\"jafka-acceptor\"", ",", "acceptor", ",", "false", ")", ".", "start", "(", ")", ";", "acceptor", ".", "awaitStartup", "(", ")", ";", "}" ]
Start the socket server and waiting for finished @throws InterruptedException thread interrupted
[ "Start", "the", "socket", "server", "and", "waiting", "for", "finished" ]
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/network/SocketServer.java#L81-L90
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java
CPSpecificationOptionPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { """ Removes all the cp specification options where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID """ for (CPSpecificationOption cpSpecificationOption : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpSpecificationOption); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPSpecificationOption cpSpecificationOption : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpSpecificationOption); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CPSpecificationOption", "cpSpecificationOption", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "cpSpecificationOption", ")", ";", "}", "}" ]
Removes all the cp specification options where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "cp", "specification", "options", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java#L1413-L1419
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.removeDeletedFromModified
private void removeDeletedFromModified(CmsClientSitemapEntry entry, CmsSitemapClipboardData data) { """ Removes the given entry and it's descendants from the modified list.<p> @param entry the entry @param data the clip board data """ data.removeModified(entry); for (CmsClientSitemapEntry child : entry.getSubEntries()) { removeDeletedFromModified(child, data); } }
java
private void removeDeletedFromModified(CmsClientSitemapEntry entry, CmsSitemapClipboardData data) { data.removeModified(entry); for (CmsClientSitemapEntry child : entry.getSubEntries()) { removeDeletedFromModified(child, data); } }
[ "private", "void", "removeDeletedFromModified", "(", "CmsClientSitemapEntry", "entry", ",", "CmsSitemapClipboardData", "data", ")", "{", "data", ".", "removeModified", "(", "entry", ")", ";", "for", "(", "CmsClientSitemapEntry", "child", ":", "entry", ".", "getSubEntries", "(", ")", ")", "{", "removeDeletedFromModified", "(", "child", ",", "data", ")", ";", "}", "}" ]
Removes the given entry and it's descendants from the modified list.<p> @param entry the entry @param data the clip board data
[ "Removes", "the", "given", "entry", "and", "it", "s", "descendants", "from", "the", "modified", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L2409-L2415
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java
StreamHelper.writeSafeUTF
public static void writeSafeUTF (@Nonnull final DataOutput aDO, @Nullable final String sStr) throws IOException { """ Because {@link DataOutputStream#writeUTF(String)} has a limit of 64KB this methods provides a similar solution but simply writing the bytes. @param aDO {@link DataOutput} to write to. May not be <code>null</code>. @param sStr The string to be written. May be <code>null</code>. @throws IOException on write error @see #readSafeUTF(DataInput) """ ValueEnforcer.notNull (aDO, "DataOutput"); if (sStr == null) { // Only write a 0 byte // Writing a length of 0 would mean that the differentiation between "null" and // empty string would be lost. aDO.writeByte (0); } else { // Non-null indicator; basically the version of layout how the data was written aDO.writeByte (2); final byte [] aUTF8Bytes = sStr.getBytes (StandardCharsets.UTF_8); // Write number of bytes aDO.writeInt (aUTF8Bytes.length); // Write main bytes aDO.write (aUTF8Bytes); // Was added in layout version 2: aDO.writeInt (END_OF_STRING_MARKER); } }
java
public static void writeSafeUTF (@Nonnull final DataOutput aDO, @Nullable final String sStr) throws IOException { ValueEnforcer.notNull (aDO, "DataOutput"); if (sStr == null) { // Only write a 0 byte // Writing a length of 0 would mean that the differentiation between "null" and // empty string would be lost. aDO.writeByte (0); } else { // Non-null indicator; basically the version of layout how the data was written aDO.writeByte (2); final byte [] aUTF8Bytes = sStr.getBytes (StandardCharsets.UTF_8); // Write number of bytes aDO.writeInt (aUTF8Bytes.length); // Write main bytes aDO.write (aUTF8Bytes); // Was added in layout version 2: aDO.writeInt (END_OF_STRING_MARKER); } }
[ "public", "static", "void", "writeSafeUTF", "(", "@", "Nonnull", "final", "DataOutput", "aDO", ",", "@", "Nullable", "final", "String", "sStr", ")", "throws", "IOException", "{", "ValueEnforcer", ".", "notNull", "(", "aDO", ",", "\"DataOutput\"", ")", ";", "if", "(", "sStr", "==", "null", ")", "{", "// Only write a 0 byte", "// Writing a length of 0 would mean that the differentiation between \"null\" and", "// empty string would be lost.", "aDO", ".", "writeByte", "(", "0", ")", ";", "}", "else", "{", "// Non-null indicator; basically the version of layout how the data was written", "aDO", ".", "writeByte", "(", "2", ")", ";", "final", "byte", "[", "]", "aUTF8Bytes", "=", "sStr", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ";", "// Write number of bytes", "aDO", ".", "writeInt", "(", "aUTF8Bytes", ".", "length", ")", ";", "// Write main bytes", "aDO", ".", "write", "(", "aUTF8Bytes", ")", ";", "// Was added in layout version 2:", "aDO", ".", "writeInt", "(", "END_OF_STRING_MARKER", ")", ";", "}", "}" ]
Because {@link DataOutputStream#writeUTF(String)} has a limit of 64KB this methods provides a similar solution but simply writing the bytes. @param aDO {@link DataOutput} to write to. May not be <code>null</code>. @param sStr The string to be written. May be <code>null</code>. @throws IOException on write error @see #readSafeUTF(DataInput)
[ "Because", "{", "@link", "DataOutputStream#writeUTF", "(", "String", ")", "}", "has", "a", "limit", "of", "64KB", "this", "methods", "provides", "a", "similar", "solution", "but", "simply", "writing", "the", "bytes", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1635-L1660
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java
FailoverGroupsInner.listByServerAsync
public Observable<Page<FailoverGroupInner>> listByServerAsync(final String resourceGroupName, final String serverName) { """ Lists the failover groups in a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;FailoverGroupInner&gt; object """ return listByServerWithServiceResponseAsync(resourceGroupName, serverName) .map(new Func1<ServiceResponse<Page<FailoverGroupInner>>, Page<FailoverGroupInner>>() { @Override public Page<FailoverGroupInner> call(ServiceResponse<Page<FailoverGroupInner>> response) { return response.body(); } }); }
java
public Observable<Page<FailoverGroupInner>> listByServerAsync(final String resourceGroupName, final String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName) .map(new Func1<ServiceResponse<Page<FailoverGroupInner>>, Page<FailoverGroupInner>>() { @Override public Page<FailoverGroupInner> call(ServiceResponse<Page<FailoverGroupInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "FailoverGroupInner", ">", ">", "listByServerAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "FailoverGroupInner", ">", ">", ",", "Page", "<", "FailoverGroupInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "FailoverGroupInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "FailoverGroupInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the failover groups in a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;FailoverGroupInner&gt; object
[ "Lists", "the", "failover", "groups", "in", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L805-L813
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java
ExitSignCreator.postProcess
@Override void postProcess(TextView textView, List<BannerComponentNode> bannerComponentNodes) { """ One coordinator should override this method, and this should be the coordinator which populates the textView with text. @param textView to populate @param bannerComponentNodes containing instructions """ if (exitNumber != null) { LayoutInflater inflater = (LayoutInflater) textView.getContext().getSystemService(Context .LAYOUT_INFLATER_SERVICE); ViewGroup root = (ViewGroup) textView.getParent(); TextView exitSignView; if (modifier.equals(LEFT)) { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_left, root, false); } else { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_right, root, false); } exitSignView.setText(exitNumber); textViewUtils.setImageSpan(textView, exitSignView, startIndex, startIndex + exitNumber .length()); } }
java
@Override void postProcess(TextView textView, List<BannerComponentNode> bannerComponentNodes) { if (exitNumber != null) { LayoutInflater inflater = (LayoutInflater) textView.getContext().getSystemService(Context .LAYOUT_INFLATER_SERVICE); ViewGroup root = (ViewGroup) textView.getParent(); TextView exitSignView; if (modifier.equals(LEFT)) { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_left, root, false); } else { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_right, root, false); } exitSignView.setText(exitNumber); textViewUtils.setImageSpan(textView, exitSignView, startIndex, startIndex + exitNumber .length()); } }
[ "@", "Override", "void", "postProcess", "(", "TextView", "textView", ",", "List", "<", "BannerComponentNode", ">", "bannerComponentNodes", ")", "{", "if", "(", "exitNumber", "!=", "null", ")", "{", "LayoutInflater", "inflater", "=", "(", "LayoutInflater", ")", "textView", ".", "getContext", "(", ")", ".", "getSystemService", "(", "Context", ".", "LAYOUT_INFLATER_SERVICE", ")", ";", "ViewGroup", "root", "=", "(", "ViewGroup", ")", "textView", ".", "getParent", "(", ")", ";", "TextView", "exitSignView", ";", "if", "(", "modifier", ".", "equals", "(", "LEFT", ")", ")", "{", "exitSignView", "=", "(", "TextView", ")", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "exit_sign_view_left", ",", "root", ",", "false", ")", ";", "}", "else", "{", "exitSignView", "=", "(", "TextView", ")", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "exit_sign_view_right", ",", "root", ",", "false", ")", ";", "}", "exitSignView", ".", "setText", "(", "exitNumber", ")", ";", "textViewUtils", ".", "setImageSpan", "(", "textView", ",", "exitSignView", ",", "startIndex", ",", "startIndex", "+", "exitNumber", ".", "length", "(", ")", ")", ";", "}", "}" ]
One coordinator should override this method, and this should be the coordinator which populates the textView with text. @param textView to populate @param bannerComponentNodes containing instructions
[ "One", "coordinator", "should", "override", "this", "method", "and", "this", "should", "be", "the", "coordinator", "which", "populates", "the", "textView", "with", "text", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java#L48-L69
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.methodInsnEqual
public static boolean methodInsnEqual(MethodInsnNode insn1, MethodInsnNode insn2) { """ Checks if two {@link MethodInsnNode} are equals. @param insn1 the insn1 @param insn2 the insn2 @return true, if successful """ return insn1.owner.equals(insn2.owner) && insn1.name.equals(insn2.name) && insn1.desc.equals(insn2.desc); }
java
public static boolean methodInsnEqual(MethodInsnNode insn1, MethodInsnNode insn2) { return insn1.owner.equals(insn2.owner) && insn1.name.equals(insn2.name) && insn1.desc.equals(insn2.desc); }
[ "public", "static", "boolean", "methodInsnEqual", "(", "MethodInsnNode", "insn1", ",", "MethodInsnNode", "insn2", ")", "{", "return", "insn1", ".", "owner", ".", "equals", "(", "insn2", ".", "owner", ")", "&&", "insn1", ".", "name", ".", "equals", "(", "insn2", ".", "name", ")", "&&", "insn1", ".", "desc", ".", "equals", "(", "insn2", ".", "desc", ")", ";", "}" ]
Checks if two {@link MethodInsnNode} are equals. @param insn1 the insn1 @param insn2 the insn2 @return true, if successful
[ "Checks", "if", "two", "{", "@link", "MethodInsnNode", "}", "are", "equals", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L195-L198
alkacon/opencms-core
src/org/opencms/xml/CmsXmlMessages.java
CmsXmlMessages.getConfigValue
protected String getConfigValue(String key, Object[] args) { """ Returns the substituted value for the given key and arguments from the configuration file.<p> @param key the key to get the value for @param args the arguments that should be substituted @return the substituted value for the given key and arguments """ String value = getConfigValue(key); CmsMacroResolver resolver = CmsMacroResolver.newInstance(); for (int i = 0; i < args.length; i++) { resolver.addMacro(String.valueOf(i), args[i].toString()); } return resolver.resolveMacros(value); }
java
protected String getConfigValue(String key, Object[] args) { String value = getConfigValue(key); CmsMacroResolver resolver = CmsMacroResolver.newInstance(); for (int i = 0; i < args.length; i++) { resolver.addMacro(String.valueOf(i), args[i].toString()); } return resolver.resolveMacros(value); }
[ "protected", "String", "getConfigValue", "(", "String", "key", ",", "Object", "[", "]", "args", ")", "{", "String", "value", "=", "getConfigValue", "(", "key", ")", ";", "CmsMacroResolver", "resolver", "=", "CmsMacroResolver", ".", "newInstance", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "resolver", ".", "addMacro", "(", "String", ".", "valueOf", "(", "i", ")", ",", "args", "[", "i", "]", ".", "toString", "(", ")", ")", ";", "}", "return", "resolver", ".", "resolveMacros", "(", "value", ")", ";", "}" ]
Returns the substituted value for the given key and arguments from the configuration file.<p> @param key the key to get the value for @param args the arguments that should be substituted @return the substituted value for the given key and arguments
[ "Returns", "the", "substituted", "value", "for", "the", "given", "key", "and", "arguments", "from", "the", "configuration", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlMessages.java#L238-L246
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java
ClientDecorationBuilder.addRpc
public <I extends RpcRequest, O extends RpcResponse> ClientDecorationBuilder addRpc(DecoratingClientFunction<I, O> decorator) { """ Adds the specified RPC-level {@code decorator}. @param decorator the {@link DecoratingClientFunction} that intercepts an invocation @param <I> the {@link Request} type of the {@link Client} being decorated @param <O> the {@link Response} type of the {@link Client} being decorated """ @SuppressWarnings("unchecked") final DecoratingClientFunction<RpcRequest, RpcResponse> cast = (DecoratingClientFunction<RpcRequest, RpcResponse>) decorator; return add0(RpcRequest.class, RpcResponse.class, cast); }
java
public <I extends RpcRequest, O extends RpcResponse> ClientDecorationBuilder addRpc(DecoratingClientFunction<I, O> decorator) { @SuppressWarnings("unchecked") final DecoratingClientFunction<RpcRequest, RpcResponse> cast = (DecoratingClientFunction<RpcRequest, RpcResponse>) decorator; return add0(RpcRequest.class, RpcResponse.class, cast); }
[ "public", "<", "I", "extends", "RpcRequest", ",", "O", "extends", "RpcResponse", ">", "ClientDecorationBuilder", "addRpc", "(", "DecoratingClientFunction", "<", "I", ",", "O", ">", "decorator", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "DecoratingClientFunction", "<", "RpcRequest", ",", "RpcResponse", ">", "cast", "=", "(", "DecoratingClientFunction", "<", "RpcRequest", ",", "RpcResponse", ">", ")", "decorator", ";", "return", "add0", "(", "RpcRequest", ".", "class", ",", "RpcResponse", ".", "class", ",", "cast", ")", ";", "}" ]
Adds the specified RPC-level {@code decorator}. @param decorator the {@link DecoratingClientFunction} that intercepts an invocation @param <I> the {@link Request} type of the {@link Client} being decorated @param <O> the {@link Response} type of the {@link Client} being decorated
[ "Adds", "the", "specified", "RPC", "-", "level", "{", "@code", "decorator", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientDecorationBuilder.java#L132-L138
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsAdditionalInfosDialog.java
CmsAdditionalInfosDialog.saveAddInfo
private void saveAddInfo(String key, String value) { """ Adds additional info to user.<p> (Doesn't write the user)<p> @param key string @param value string """ int pos = key.indexOf("@"); String className = ""; if (pos > -1) { className = key.substring(pos + 1); key = key.substring(0, pos); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_user.deleteAdditionalInfo(key); return; } if (pos < 0) { m_user.setAdditionalInfo(key, value); return; } Class<?> clazz; try { // try the class name clazz = Class.forName(className); } catch (Throwable e) { try { // try the class in the java.lang package clazz = Class.forName(Integer.class.getPackage().getName() + "." + className); } catch (Throwable e1) { clazz = String.class; } } m_user.setAdditionalInfo(key, CmsDataTypeUtil.parse(value, clazz)); }
java
private void saveAddInfo(String key, String value) { int pos = key.indexOf("@"); String className = ""; if (pos > -1) { className = key.substring(pos + 1); key = key.substring(0, pos); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { m_user.deleteAdditionalInfo(key); return; } if (pos < 0) { m_user.setAdditionalInfo(key, value); return; } Class<?> clazz; try { // try the class name clazz = Class.forName(className); } catch (Throwable e) { try { // try the class in the java.lang package clazz = Class.forName(Integer.class.getPackage().getName() + "." + className); } catch (Throwable e1) { clazz = String.class; } } m_user.setAdditionalInfo(key, CmsDataTypeUtil.parse(value, clazz)); }
[ "private", "void", "saveAddInfo", "(", "String", "key", ",", "String", "value", ")", "{", "int", "pos", "=", "key", ".", "indexOf", "(", "\"@\"", ")", ";", "String", "className", "=", "\"\"", ";", "if", "(", "pos", ">", "-", "1", ")", "{", "className", "=", "key", ".", "substring", "(", "pos", "+", "1", ")", ";", "key", "=", "key", ".", "substring", "(", "0", ",", "pos", ")", ";", "}", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "value", ")", ")", "{", "m_user", ".", "deleteAdditionalInfo", "(", "key", ")", ";", "return", ";", "}", "if", "(", "pos", "<", "0", ")", "{", "m_user", ".", "setAdditionalInfo", "(", "key", ",", "value", ")", ";", "return", ";", "}", "Class", "<", "?", ">", "clazz", ";", "try", "{", "// try the class name", "clazz", "=", "Class", ".", "forName", "(", "className", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "try", "{", "// try the class in the java.lang package", "clazz", "=", "Class", ".", "forName", "(", "Integer", ".", "class", ".", "getPackage", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "className", ")", ";", "}", "catch", "(", "Throwable", "e1", ")", "{", "clazz", "=", "String", ".", "class", ";", "}", "}", "m_user", ".", "setAdditionalInfo", "(", "key", ",", "CmsDataTypeUtil", ".", "parse", "(", "value", ",", "clazz", ")", ")", ";", "}" ]
Adds additional info to user.<p> (Doesn't write the user)<p> @param key string @param value string
[ "Adds", "additional", "info", "to", "user", ".", "<p", ">", "(", "Doesn", "t", "write", "the", "user", ")", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsAdditionalInfosDialog.java#L283-L316
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java
UrlUtils.pathDecode
public static String pathDecode(String value) { """ URL path segments may contain '+' symbols which should not be decoded into ' ' This method replaces '+' with %2B and delegates to URLDecoder @param value value to decode """ return urlDecode(value, StandardCharsets.UTF_8.name(), true); }
java
public static String pathDecode(String value) { return urlDecode(value, StandardCharsets.UTF_8.name(), true); }
[ "public", "static", "String", "pathDecode", "(", "String", "value", ")", "{", "return", "urlDecode", "(", "value", ",", "StandardCharsets", ".", "UTF_8", ".", "name", "(", ")", ",", "true", ")", ";", "}" ]
URL path segments may contain '+' symbols which should not be decoded into ' ' This method replaces '+' with %2B and delegates to URLDecoder @param value value to decode
[ "URL", "path", "segments", "may", "contain", "+", "symbols", "which", "should", "not", "be", "decoded", "into", "This", "method", "replaces", "+", "with", "%2B", "and", "delegates", "to", "URLDecoder" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java#L141-L143
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/Search.java
Search.groupField
public Search groupField(String fieldName, boolean isNumber) { """ Group results by the specified field. @param fieldName by which to group results @param isNumber whether field isNumeric. @return this for additional parameter setting or to query """ assertNotEmpty(fieldName, "fieldName"); if (isNumber) { databaseHelper.query("group_field", fieldName + "<number>"); } else { databaseHelper.query("group_field", fieldName); } return this; }
java
public Search groupField(String fieldName, boolean isNumber) { assertNotEmpty(fieldName, "fieldName"); if (isNumber) { databaseHelper.query("group_field", fieldName + "<number>"); } else { databaseHelper.query("group_field", fieldName); } return this; }
[ "public", "Search", "groupField", "(", "String", "fieldName", ",", "boolean", "isNumber", ")", "{", "assertNotEmpty", "(", "fieldName", ",", "\"fieldName\"", ")", ";", "if", "(", "isNumber", ")", "{", "databaseHelper", ".", "query", "(", "\"group_field\"", ",", "fieldName", "+", "\"<number>\"", ")", ";", "}", "else", "{", "databaseHelper", ".", "query", "(", "\"group_field\"", ",", "fieldName", ")", ";", "}", "return", "this", ";", "}" ]
Group results by the specified field. @param fieldName by which to group results @param isNumber whether field isNumeric. @return this for additional parameter setting or to query
[ "Group", "results", "by", "the", "specified", "field", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Search.java#L301-L309
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java
ProxyDataSourceBuilder.logSlowQueryBySlf4j
public ProxyDataSourceBuilder logSlowQueryBySlf4j(long thresholdTime, TimeUnit timeUnit) { """ Register {@link SLF4JSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @return builder @since 1.4.1 """ return logSlowQueryBySlf4j(thresholdTime, timeUnit, null, null); }
java
public ProxyDataSourceBuilder logSlowQueryBySlf4j(long thresholdTime, TimeUnit timeUnit) { return logSlowQueryBySlf4j(thresholdTime, timeUnit, null, null); }
[ "public", "ProxyDataSourceBuilder", "logSlowQueryBySlf4j", "(", "long", "thresholdTime", ",", "TimeUnit", "timeUnit", ")", "{", "return", "logSlowQueryBySlf4j", "(", "thresholdTime", ",", "timeUnit", ",", "null", ",", "null", ")", ";", "}" ]
Register {@link SLF4JSlowQueryListener}. @param thresholdTime slow query threshold time @param timeUnit slow query threshold time unit @return builder @since 1.4.1
[ "Register", "{", "@link", "SLF4JSlowQueryListener", "}", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L335-L337
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.zrevrank
@Override public Long zrevrank(final byte[] key, final byte[] member) { """ Return the rank (or index) or member in the sorted set at key, with scores being ordered from high to low. <p> When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands. <p> <b>Time complexity:</b> <p> O(log(N)) @see #zrank(byte[], byte[]) @param key @param member @return Integer reply or a nil bulk reply, specifically: the rank of the element as an integer reply if the element exists. A nil bulk reply if there is no such element. """ checkIsInMultiOrPipeline(); client.zrevrank(key, member); return client.getIntegerReply(); }
java
@Override public Long zrevrank(final byte[] key, final byte[] member) { checkIsInMultiOrPipeline(); client.zrevrank(key, member); return client.getIntegerReply(); }
[ "@", "Override", "public", "Long", "zrevrank", "(", "final", "byte", "[", "]", "key", ",", "final", "byte", "[", "]", "member", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "zrevrank", "(", "key", ",", "member", ")", ";", "return", "client", ".", "getIntegerReply", "(", ")", ";", "}" ]
Return the rank (or index) or member in the sorted set at key, with scores being ordered from high to low. <p> When the given member does not exist in the sorted set, the special value 'nil' is returned. The returned rank (or index) of the member is 0-based for both commands. <p> <b>Time complexity:</b> <p> O(log(N)) @see #zrank(byte[], byte[]) @param key @param member @return Integer reply or a nil bulk reply, specifically: the rank of the element as an integer reply if the element exists. A nil bulk reply if there is no such element.
[ "Return", "the", "rank", "(", "or", "index", ")", "or", "member", "in", "the", "sorted", "set", "at", "key", "with", "scores", "being", "ordered", "from", "high", "to", "low", ".", "<p", ">", "When", "the", "given", "member", "does", "not", "exist", "in", "the", "sorted", "set", "the", "special", "value", "nil", "is", "returned", ".", "The", "returned", "rank", "(", "or", "index", ")", "of", "the", "member", "is", "0", "-", "based", "for", "both", "commands", ".", "<p", ">", "<b", ">", "Time", "complexity", ":", "<", "/", "b", ">", "<p", ">", "O", "(", "log", "(", "N", "))" ]
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1783-L1788