repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PeopleApi.java
PeopleApi.getGroups
public Groups getGroups(String userId, EnumSet<JinxConstants.GroupExtras> extras) throws JinxException { JinxUtils.validateParams(userId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.people.getGroups"); params.put("user_id", userId); if (!JinxUtils.isNullOrEmpty(extras)) { params.put("extras", JinxUtils.buildCommaDelimitedList(extras)); } return jinx.flickrGet(params, Groups.class); }
java
public Groups getGroups(String userId, EnumSet<JinxConstants.GroupExtras> extras) throws JinxException { JinxUtils.validateParams(userId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.people.getGroups"); params.put("user_id", userId); if (!JinxUtils.isNullOrEmpty(extras)) { params.put("extras", JinxUtils.buildCommaDelimitedList(extras)); } return jinx.flickrGet(params, Groups.class); }
[ "public", "Groups", "getGroups", "(", "String", "userId", ",", "EnumSet", "<", "JinxConstants", ".", "GroupExtras", ">", "extras", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "userId", ")", ";", "Map", "<", "String", ",", "S...
Returns the list of groups a user is a member of. <br> This method requires authentication with 'read' permission. <br> Flickr does not return pagination information for this call. The returned object will not have any values set for pagination, and the the getPage(), getPages(), getPerPage(), or getTotal() methods will return null. @param userId (Required) The user id of the user to fetch groups for. @param extras extra information to fetch for each returned record. @return object with information about the groups the user is a member of. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.people.getGroups.html">flickr.people.getGroups</a>
[ "Returns", "the", "list", "of", "groups", "a", "user", "is", "a", "member", "of", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "read", "permission", ".", "<br", ">", "Flickr", "does", "not", "return", "pagination", "information", ...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PeopleApi.java#L102-L111
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java
CommerceWarehousePersistenceImpl.removeByG_A
@Override public void removeByG_A(long groupId, boolean active) { for (CommerceWarehouse commerceWarehouse : findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWarehouse); } }
java
@Override public void removeByG_A(long groupId, boolean active) { for (CommerceWarehouse commerceWarehouse : findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceWarehouse); } }
[ "@", "Override", "public", "void", "removeByG_A", "(", "long", "groupId", ",", "boolean", "active", ")", "{", "for", "(", "CommerceWarehouse", "commerceWarehouse", ":", "findByG_A", "(", "groupId", ",", "active", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUt...
Removes all the commerce warehouses where groupId = &#63; and active = &#63; from the database. @param groupId the group ID @param active the active
[ "Removes", "all", "the", "commerce", "warehouses", "where", "groupId", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java#L1083-L1089
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java
SymSpell.lookup
public List<SuggestItem> lookup(String input, Verbosity verbosity) { return lookup(input, verbosity, maxDictionaryEditDistance); }
java
public List<SuggestItem> lookup(String input, Verbosity verbosity) { return lookup(input, verbosity, maxDictionaryEditDistance); }
[ "public", "List", "<", "SuggestItem", ">", "lookup", "(", "String", "input", ",", "Verbosity", "verbosity", ")", "{", "return", "lookup", "(", "input", ",", "verbosity", ",", "maxDictionaryEditDistance", ")", ";", "}" ]
/ sorted by edit distance, and secondarily by count frequency.</returns>
[ "/", "sorted", "by", "edit", "distance", "and", "secondarily", "by", "count", "frequency", ".", "<", "/", "returns", ">" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java#L303-L305
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getString
public String getString(Integer id, Integer type) { return (getString(m_meta.getOffset(id, type))); }
java
public String getString(Integer id, Integer type) { return (getString(m_meta.getOffset(id, type))); }
[ "public", "String", "getString", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "return", "(", "getString", "(", "m_meta", ".", "getOffset", "(", "id", ",", "type", ")", ")", ")", ";", "}" ]
This method retrieves a string of the specified type, belonging to the item with the specified unique ID. @param id unique ID of entity to which this data belongs @param type data type identifier @return required string data
[ "This", "method", "retrieves", "a", "string", "of", "the", "specified", "type", "belonging", "to", "the", "item", "with", "the", "specified", "unique", "ID", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L239-L242
btrplace/scheduler
json/src/main/java/org/btrplace/json/JSONs.java
JSONs.requiredInt
public static int requiredInt(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return (Integer) o.get(id); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a int from string '" + id + "'", e); } }
java
public static int requiredInt(JSONObject o, String id) throws JSONConverterException { checkKeys(o, id); try { return (Integer) o.get(id); } catch (ClassCastException e) { throw new JSONConverterException("Unable to read a int from string '" + id + "'", e); } }
[ "public", "static", "int", "requiredInt", "(", "JSONObject", "o", ",", "String", "id", ")", "throws", "JSONConverterException", "{", "checkKeys", "(", "o", ",", "id", ")", ";", "try", "{", "return", "(", "Integer", ")", "o", ".", "get", "(", "id", ")",...
Read an expected integer. @param o the object to parse @param id the key in the map that points to an integer @return the int @throws JSONConverterException if the key does not point to a int
[ "Read", "an", "expected", "integer", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/JSONs.java#L92-L99
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/Properties.java
Properties.getProperty
public String getProperty(String propName, String defaultValue) { return props.getProperty(propName, defaultValue); }
java
public String getProperty(String propName, String defaultValue) { return props.getProperty(propName, defaultValue); }
[ "public", "String", "getProperty", "(", "String", "propName", ",", "String", "defaultValue", ")", "{", "return", "props", ".", "getProperty", "(", "propName", ",", "defaultValue", ")", ";", "}" ]
Returns the string property associated with {@code propName}, or {@code defaultValue} if there is no property.
[ "Returns", "the", "string", "property", "associated", "with", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/Properties.java#L65-L67
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/util/Util.java
Util.getMinimumSequence
public static long getMinimumSequence(final Sequence[] sequences, long minimum) { for (int i = 0, n = sequences.length; i < n; i++) { long value = sequences[i].get(); minimum = Math.min(minimum, value); } return minimum; }
java
public static long getMinimumSequence(final Sequence[] sequences, long minimum) { for (int i = 0, n = sequences.length; i < n; i++) { long value = sequences[i].get(); minimum = Math.min(minimum, value); } return minimum; }
[ "public", "static", "long", "getMinimumSequence", "(", "final", "Sequence", "[", "]", "sequences", ",", "long", "minimum", ")", "{", "for", "(", "int", "i", "=", "0", ",", "n", "=", "sequences", ".", "length", ";", "i", "<", "n", ";", "i", "++", ")...
Get the minimum sequence from an array of {@link com.lmax.disruptor.Sequence}s. @param sequences to compare. @param minimum an initial default minimum. If the array is empty this value will be returned. @return the smaller of minimum sequence value found in {@code sequences} and {@code minimum}; {@code minimum} if {@code sequences} is empty
[ "Get", "the", "minimum", "sequence", "from", "an", "array", "of", "{", "@link", "com", ".", "lmax", ".", "disruptor", ".", "Sequence", "}", "s", "." ]
train
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/util/Util.java#L63-L72
elki-project/elki
elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/AbstractStaticHistogram.java
AbstractStaticHistogram.growSize
protected static int growSize(int current, int requiredSize) { // Double until 64, then increase by 50% each time. int newCapacity = ((current < 64) ? ((current + 1) << 1) : ((current >> 1) * 3)); // overflow? if (newCapacity < 0) { throw new OutOfMemoryError(); } if (requiredSize > newCapacity) { newCapacity = requiredSize; } return requiredSize; }
java
protected static int growSize(int current, int requiredSize) { // Double until 64, then increase by 50% each time. int newCapacity = ((current < 64) ? ((current + 1) << 1) : ((current >> 1) * 3)); // overflow? if (newCapacity < 0) { throw new OutOfMemoryError(); } if (requiredSize > newCapacity) { newCapacity = requiredSize; } return requiredSize; }
[ "protected", "static", "int", "growSize", "(", "int", "current", ",", "int", "requiredSize", ")", "{", "// Double until 64, then increase by 50% each time.", "int", "newCapacity", "=", "(", "(", "current", "<", "64", ")", "?", "(", "(", "current", "+", "1", ")...
Compute the size to grow to. @param current Current size @param requiredSize Required size @return Size to allocate
[ "Compute", "the", "size", "to", "grow", "to", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/AbstractStaticHistogram.java#L98-L109
dnsjava/dnsjava
org/xbill/DNS/DNSOutput.java
DNSOutput.writeU16At
public void writeU16At(int val, int where) { check(val, 16); if (where > pos - 2) throw new IllegalArgumentException("cannot write past " + "end of data"); array[where++] = (byte)((val >>> 8) & 0xFF); array[where++] = (byte)(val & 0xFF); }
java
public void writeU16At(int val, int where) { check(val, 16); if (where > pos - 2) throw new IllegalArgumentException("cannot write past " + "end of data"); array[where++] = (byte)((val >>> 8) & 0xFF); array[where++] = (byte)(val & 0xFF); }
[ "public", "void", "writeU16At", "(", "int", "val", ",", "int", "where", ")", "{", "check", "(", "val", ",", "16", ")", ";", "if", "(", "where", ">", "pos", "-", "2", ")", "throw", "new", "IllegalArgumentException", "(", "\"cannot write past \"", "+", "...
Writes an unsigned 16 bit value to the specified position in the stream. @param val The value to be written @param where The position to write the value.
[ "Writes", "an", "unsigned", "16", "bit", "value", "to", "the", "specified", "position", "in", "the", "stream", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/DNSOutput.java#L132-L140
WolfgangFahl/Mediawiki-Japi
src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java
WikiUser.getInput
public static String getInput(String name, BufferedReader br) throws IOException { // prompt the user to enter the given name System.out.print("Please Enter " + name + ": "); String value = br.readLine(); return value; }
java
public static String getInput(String name, BufferedReader br) throws IOException { // prompt the user to enter the given name System.out.print("Please Enter " + name + ": "); String value = br.readLine(); return value; }
[ "public", "static", "String", "getInput", "(", "String", "name", ",", "BufferedReader", "br", ")", "throws", "IOException", "{", "// prompt the user to enter the given name", "System", ".", "out", ".", "print", "(", "\"Please Enter \"", "+", "name", "+", "\": \"", ...
get input from standard in @param name @param br - the buffered reader to read from @return the input returned @throws IOException
[ "get", "input", "from", "standard", "in" ]
train
https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java#L76-L83
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java
DefaultApplicationObjectConfigurer.configureIcon
protected void configureIcon(IconConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); Icon icon = loadIcon(objectName, ICON_KEY); if (icon != null) { configurable.setIcon(icon); } }
java
protected void configureIcon(IconConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); Icon icon = loadIcon(objectName, ICON_KEY); if (icon != null) { configurable.setIcon(icon); } }
[ "protected", "void", "configureIcon", "(", "IconConfigurable", "configurable", ",", "String", "objectName", ")", "{", "Assert", ".", "notNull", "(", "configurable", ",", "\"configurable\"", ")", ";", "Assert", ".", "notNull", "(", "objectName", ",", "\"objectName\...
Sets the icon of the given object. The icon is loaded from this instance's {@link IconSource} using a key in the format <pre> &lt;objectName&gt;.icon </pre> If the icon source cannot find an icon under that key, the object's icon will be set to null. @param configurable The object to be configured. Must not be null. @param objectName The name of the configurable object, unique within the application. Must not be null. @throws IllegalArgumentException if either argument is null.
[ "Sets", "the", "icon", "of", "the", "given", "object", ".", "The", "icon", "is", "loaded", "from", "this", "instance", "s", "{", "@link", "IconSource", "}", "using", "a", "key", "in", "the", "format" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java#L525-L534
vkostyukov/la4j
src/main/java/org/la4j/vector/SparseVector.java
SparseVector.fromMap
public static SparseVector fromMap(Map<Integer, ? extends Number> map, int length) { return CompressedVector.fromMap(map, length); }
java
public static SparseVector fromMap(Map<Integer, ? extends Number> map, int length) { return CompressedVector.fromMap(map, length); }
[ "public", "static", "SparseVector", "fromMap", "(", "Map", "<", "Integer", ",", "?", "extends", "Number", ">", "map", ",", "int", "length", ")", "{", "return", "CompressedVector", ".", "fromMap", "(", "map", ",", "length", ")", ";", "}" ]
Creates new {@link SparseVector} from given index-value map @param map @return
[ "Creates", "new", "{", "@link", "SparseVector", "}", "from", "given", "index", "-", "value", "map" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/vector/SparseVector.java#L143-L145
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/RevisionPair.java
RevisionPair.containsIgnoreCase
private boolean containsIgnoreCase(List<String> stringlist, String match) { for (String s : stringlist) { if (s.equalsIgnoreCase(match)) { return true; } } return false; }
java
private boolean containsIgnoreCase(List<String> stringlist, String match) { for (String s : stringlist) { if (s.equalsIgnoreCase(match)) { return true; } } return false; }
[ "private", "boolean", "containsIgnoreCase", "(", "List", "<", "String", ">", "stringlist", ",", "String", "match", ")", "{", "for", "(", "String", "s", ":", "stringlist", ")", "{", "if", "(", "s", ".", "equalsIgnoreCase", "(", "match", ")", ")", "{", "...
Checks if a list of string contains a String while ignoring case @param stringlist a list of string @param match the string to look for @return true, if the list contains the string, false else
[ "Checks", "if", "a", "list", "of", "string", "contains", "a", "String", "while", "ignoring", "case" ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/RevisionPair.java#L154-L161
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.prepareROI
public static ROI prepareROI( Geometry roi, AffineTransform mt2d ) throws Exception { // transform the geometry to raster space so that we can use it as a ROI source Geometry rasterSpaceGeometry = JTS.transform(roi, new AffineTransform2D(mt2d.createInverse())); // simplify the geometry so that it's as precise as the coverage, excess coordinates // just make it slower to determine the point in polygon relationship Geometry simplifiedGeometry = DouglasPeuckerSimplifier.simplify(rasterSpaceGeometry, 1); // build a shape using a fast point in polygon wrapper return new ROIShape(new FastLiteShape(simplifiedGeometry)); }
java
public static ROI prepareROI( Geometry roi, AffineTransform mt2d ) throws Exception { // transform the geometry to raster space so that we can use it as a ROI source Geometry rasterSpaceGeometry = JTS.transform(roi, new AffineTransform2D(mt2d.createInverse())); // simplify the geometry so that it's as precise as the coverage, excess coordinates // just make it slower to determine the point in polygon relationship Geometry simplifiedGeometry = DouglasPeuckerSimplifier.simplify(rasterSpaceGeometry, 1); // build a shape using a fast point in polygon wrapper return new ROIShape(new FastLiteShape(simplifiedGeometry)); }
[ "public", "static", "ROI", "prepareROI", "(", "Geometry", "roi", ",", "AffineTransform", "mt2d", ")", "throws", "Exception", "{", "// transform the geometry to raster space so that we can use it as a ROI source", "Geometry", "rasterSpaceGeometry", "=", "JTS", ".", "transform"...
Utility method for transforming a geometry ROI into the raster space, using the provided affine transformation. @param roi a {@link Geometry} in model space. @param mt2d an {@link AffineTransform} that maps from raster to model space. This is already referred to the pixel corner. @return a {@link ROI} suitable for using with JAI. @throws ProcessException in case there are problems with ivnerting the provided {@link AffineTransform}. Very unlikely to happen.
[ "Utility", "method", "for", "transforming", "a", "geometry", "ROI", "into", "the", "raster", "space", "using", "the", "provided", "affine", "transformation", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1281-L1291
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java
AbstractEventSerializer.parseAttributes
private Map<String, String> parseAttributes() throws IOException { if (jsonParser.nextToken() != JsonToken.START_OBJECT) { throw new JsonParseException("Not a Attributes object", jsonParser.getCurrentLocation()); } Map<String, String> attributes = new HashMap<>(); while (jsonParser.nextToken() != JsonToken.END_OBJECT) { String key = jsonParser.getCurrentName(); String value = jsonParser.nextTextValue(); attributes.put(key, value); } return attributes; }
java
private Map<String, String> parseAttributes() throws IOException { if (jsonParser.nextToken() != JsonToken.START_OBJECT) { throw new JsonParseException("Not a Attributes object", jsonParser.getCurrentLocation()); } Map<String, String> attributes = new HashMap<>(); while (jsonParser.nextToken() != JsonToken.END_OBJECT) { String key = jsonParser.getCurrentName(); String value = jsonParser.nextTextValue(); attributes.put(key, value); } return attributes; }
[ "private", "Map", "<", "String", ",", "String", ">", "parseAttributes", "(", ")", "throws", "IOException", "{", "if", "(", "jsonParser", ".", "nextToken", "(", ")", "!=", "JsonToken", ".", "START_OBJECT", ")", "{", "throw", "new", "JsonParseException", "(", ...
Parses attributes as a Map, used in both parseWebIdentitySessionContext and parseSessionContext @return attributes for either session context or web identity session context @throws IOException
[ "Parses", "attributes", "as", "a", "Map", "used", "in", "both", "parseWebIdentitySessionContext", "and", "parseSessionContext" ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L497-L511
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.deleteItem
public String deleteItem(String iid) throws ExecutionException, InterruptedException, IOException { return deleteItem(iid, new DateTime()); }
java
public String deleteItem(String iid) throws ExecutionException, InterruptedException, IOException { return deleteItem(iid, new DateTime()); }
[ "public", "String", "deleteItem", "(", "String", "iid", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "IOException", "{", "return", "deleteItem", "(", "iid", ",", "new", "DateTime", "(", ")", ")", ";", "}" ]
Deletes a item. Event time is recorded as the time when the function is called. @param iid ID of the item @return ID of this event
[ "Deletes", "a", "item", ".", "Event", "time", "is", "recorded", "as", "the", "time", "when", "the", "function", "is", "called", "." ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L599-L602
hageldave/ImagingKit
ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/Fourier.java
Fourier.horizontalInverseTransform
public static ColorImg horizontalInverseTransform(ColorImg target, ComplexImg fourier, int channel) { Dimension dim = fourier.getDimension(); // if no target was specified create a new one if(target == null) { target = new ColorImg(dim, channel==ColorImg.channel_a); } // continue sanity checks sanityCheckInverse_target(target, dim, channel); // now do the transforms try( NativeRealArray row = new NativeRealArray(target.getWidth()); NativeRealArray fft_r = new NativeRealArray(row.length); NativeRealArray fft_i = new NativeRealArray(row.length); ){ ComplexValuedSampler complexIn = getSamplerForShiftedComplexImg(fourier); for(int y = 0; y < target.getHeight(); y++){ for(int x = 0; x < target.getWidth(); x++){ fft_r.set(x, complexIn.getValueAt(false, x,y)); fft_i.set(x, complexIn.getValueAt(true, x,y)); } FFTW_Guru.execute_split_c2r(fft_r, fft_i, row, target.getWidth()); row.get(0, target.getWidth(), y*target.getWidth(), target.getData()[channel]); } } double scaling = 1.0/target.getWidth(); ArrayUtils.scaleArray(target.getData()[channel], scaling); return target; }
java
public static ColorImg horizontalInverseTransform(ColorImg target, ComplexImg fourier, int channel) { Dimension dim = fourier.getDimension(); // if no target was specified create a new one if(target == null) { target = new ColorImg(dim, channel==ColorImg.channel_a); } // continue sanity checks sanityCheckInverse_target(target, dim, channel); // now do the transforms try( NativeRealArray row = new NativeRealArray(target.getWidth()); NativeRealArray fft_r = new NativeRealArray(row.length); NativeRealArray fft_i = new NativeRealArray(row.length); ){ ComplexValuedSampler complexIn = getSamplerForShiftedComplexImg(fourier); for(int y = 0; y < target.getHeight(); y++){ for(int x = 0; x < target.getWidth(); x++){ fft_r.set(x, complexIn.getValueAt(false, x,y)); fft_i.set(x, complexIn.getValueAt(true, x,y)); } FFTW_Guru.execute_split_c2r(fft_r, fft_i, row, target.getWidth()); row.get(0, target.getWidth(), y*target.getWidth(), target.getData()[channel]); } } double scaling = 1.0/target.getWidth(); ArrayUtils.scaleArray(target.getData()[channel], scaling); return target; }
[ "public", "static", "ColorImg", "horizontalInverseTransform", "(", "ColorImg", "target", ",", "ComplexImg", "fourier", ",", "int", "channel", ")", "{", "Dimension", "dim", "=", "fourier", ".", "getDimension", "(", ")", ";", "// if no target was specified create a new ...
Executes row wise inverse Fourier transforms of the specified {@link ComplexImg}. A 1-dimensional Fourier transform is done for each row of the ComplexImg. The resulting transforms will be stored in the specified channel of the specified target {@link ColorImg}. If target is null, a new ColorImg is created. @param target image of which one channel is to be transformed @param fourier the image that will be transformed @param channel the channel to which the results are stored @return the specified target or a new {@link ColorImg} if target was null @throws IllegalArgumentException if the specified channel is out of range ([0..3]) or is alpha (3) but the specified image does not have an alpha channel
[ "Executes", "row", "wise", "inverse", "Fourier", "transforms", "of", "the", "specified", "{", "@link", "ComplexImg", "}", ".", "A", "1", "-", "dimensional", "Fourier", "transform", "is", "done", "for", "each", "row", "of", "the", "ComplexImg", ".", "The", ...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/Fourier.java#L261-L288
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Envelope2D.java
Envelope2D.queryCorners
public void queryCorners(Point2D[] corners) { if ((corners == null) || (corners.length < 4)) throw new IllegalArgumentException(); if (corners[0] != null) corners[0].setCoords(xmin, ymin); else corners[0] = new Point2D(xmin, ymin); if (corners[1] != null) corners[1].setCoords(xmin, ymax); else corners[1] = new Point2D(xmin, ymax); if (corners[2] != null) corners[2].setCoords(xmax, ymax); else corners[2] = new Point2D(xmax, ymax); if (corners[3] != null) corners[3].setCoords(xmax, ymin); else corners[3] = new Point2D(xmax, ymin); }
java
public void queryCorners(Point2D[] corners) { if ((corners == null) || (corners.length < 4)) throw new IllegalArgumentException(); if (corners[0] != null) corners[0].setCoords(xmin, ymin); else corners[0] = new Point2D(xmin, ymin); if (corners[1] != null) corners[1].setCoords(xmin, ymax); else corners[1] = new Point2D(xmin, ymax); if (corners[2] != null) corners[2].setCoords(xmax, ymax); else corners[2] = new Point2D(xmax, ymax); if (corners[3] != null) corners[3].setCoords(xmax, ymin); else corners[3] = new Point2D(xmax, ymin); }
[ "public", "void", "queryCorners", "(", "Point2D", "[", "]", "corners", ")", "{", "if", "(", "(", "corners", "==", "null", ")", "||", "(", "corners", ".", "length", "<", "4", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "...
Queries corners into a given array. The array length must be at least 4. Starts from the lower left corner and goes clockwise. @param corners The array of four points.
[ "Queries", "corners", "into", "a", "given", "array", ".", "The", "array", "length", "must", "be", "at", "least", "4", ".", "Starts", "from", "the", "lower", "left", "corner", "and", "goes", "clockwise", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Envelope2D.java#L386-L408
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.writeAscii
public static int writeAscii(ByteBuf buf, CharSequence seq) { // ASCII uses 1 byte per char final int len = seq.length(); if (seq instanceof AsciiString) { AsciiString asciiString = (AsciiString) seq; buf.writeBytes(asciiString.array(), asciiString.arrayOffset(), len); } else { for (;;) { if (buf instanceof WrappedCompositeByteBuf) { // WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special handling. buf = buf.unwrap(); } else if (buf instanceof AbstractByteBuf) { AbstractByteBuf byteBuf = (AbstractByteBuf) buf; byteBuf.ensureWritable0(len); int written = writeAscii(byteBuf, byteBuf.writerIndex, seq, len); byteBuf.writerIndex += written; return written; } else if (buf instanceof WrappedByteBuf) { // Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path. buf = buf.unwrap(); } else { byte[] bytes = seq.toString().getBytes(CharsetUtil.US_ASCII); buf.writeBytes(bytes); return bytes.length; } } } return len; }
java
public static int writeAscii(ByteBuf buf, CharSequence seq) { // ASCII uses 1 byte per char final int len = seq.length(); if (seq instanceof AsciiString) { AsciiString asciiString = (AsciiString) seq; buf.writeBytes(asciiString.array(), asciiString.arrayOffset(), len); } else { for (;;) { if (buf instanceof WrappedCompositeByteBuf) { // WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special handling. buf = buf.unwrap(); } else if (buf instanceof AbstractByteBuf) { AbstractByteBuf byteBuf = (AbstractByteBuf) buf; byteBuf.ensureWritable0(len); int written = writeAscii(byteBuf, byteBuf.writerIndex, seq, len); byteBuf.writerIndex += written; return written; } else if (buf instanceof WrappedByteBuf) { // Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path. buf = buf.unwrap(); } else { byte[] bytes = seq.toString().getBytes(CharsetUtil.US_ASCII); buf.writeBytes(bytes); return bytes.length; } } } return len; }
[ "public", "static", "int", "writeAscii", "(", "ByteBuf", "buf", ",", "CharSequence", "seq", ")", "{", "// ASCII uses 1 byte per char", "final", "int", "len", "=", "seq", ".", "length", "(", ")", ";", "if", "(", "seq", "instanceof", "AsciiString", ")", "{", ...
Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/ASCII">ASCII</a> and write it to a {@link ByteBuf}. This method returns the actual number of bytes written.
[ "Encode", "a", "{", "@link", "CharSequence", "}", "in", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "ASCII", ">", "ASCII<", "/", "a", ">", "and", "write", "it", "to", "a", "{", "@link", "ByteBuf", "...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L681-L709
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java
StructureTools.getAllNonHAtomArray
public static final Atom[] getAllNonHAtomArray(Structure s, boolean hetAtoms) { AtomIterator iter = new AtomIterator(s); return getAllNonHAtomArray(s, hetAtoms, iter); }
java
public static final Atom[] getAllNonHAtomArray(Structure s, boolean hetAtoms) { AtomIterator iter = new AtomIterator(s); return getAllNonHAtomArray(s, hetAtoms, iter); }
[ "public", "static", "final", "Atom", "[", "]", "getAllNonHAtomArray", "(", "Structure", "s", ",", "boolean", "hetAtoms", ")", "{", "AtomIterator", "iter", "=", "new", "AtomIterator", "(", "s", ")", ";", "return", "getAllNonHAtomArray", "(", "s", ",", "hetAto...
Returns and array of all non-Hydrogen atoms in the given Structure, optionally including HET atoms or not. Waters are not included. @param s @param hetAtoms if true HET atoms are included in array, if false they are not @return
[ "Returns", "and", "array", "of", "all", "non", "-", "Hydrogen", "atoms", "in", "the", "given", "Structure", "optionally", "including", "HET", "atoms", "or", "not", ".", "Waters", "are", "not", "included", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L674-L677
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java
ClientPNCounterProxy.updateObservedReplicaTimestamps
private void updateObservedReplicaTimestamps(List<Entry<String, Long>> receivedLogicalTimestamps) { final VectorClock received = toVectorClock(receivedLogicalTimestamps); for (; ; ) { final VectorClock currentClock = this.observedClock; if (currentClock.isAfter(received)) { break; } if (OBSERVED_TIMESTAMPS_UPDATER.compareAndSet(this, currentClock, received)) { break; } } }
java
private void updateObservedReplicaTimestamps(List<Entry<String, Long>> receivedLogicalTimestamps) { final VectorClock received = toVectorClock(receivedLogicalTimestamps); for (; ; ) { final VectorClock currentClock = this.observedClock; if (currentClock.isAfter(received)) { break; } if (OBSERVED_TIMESTAMPS_UPDATER.compareAndSet(this, currentClock, received)) { break; } } }
[ "private", "void", "updateObservedReplicaTimestamps", "(", "List", "<", "Entry", "<", "String", ",", "Long", ">", ">", "receivedLogicalTimestamps", ")", "{", "final", "VectorClock", "received", "=", "toVectorClock", "(", "receivedLogicalTimestamps", ")", ";", "for",...
Updates the locally observed CRDT vector clock atomically. This method is thread safe and can be called concurrently. The method will only update the clock if the {@code receivedLogicalTimestamps} is higher than the currently observed vector clock. @param receivedLogicalTimestamps logical timestamps received from a replica state read
[ "Updates", "the", "locally", "observed", "CRDT", "vector", "clock", "atomically", ".", "This", "method", "is", "thread", "safe", "and", "can", "be", "called", "concurrently", ".", "The", "method", "will", "only", "update", "the", "clock", "if", "the", "{", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java#L413-L424
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java
ICETransportManager.sessionEstablished
@Override public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException { if (lc instanceof ICECandidate) { if (((ICECandidate) lc).getType().equals(Type.relay)) { RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); } } }
java
@Override public void sessionEstablished(PayloadType pt, TransportCandidate rc, TransportCandidate lc, JingleSession jingleSession) throws NotConnectedException, InterruptedException { if (lc instanceof ICECandidate) { if (((ICECandidate) lc).getType().equals(Type.relay)) { RTPBridge rtpBridge = RTPBridge.relaySession(lc.getConnection(), lc.getSessionId(), lc.getPassword(), rc, lc); } } }
[ "@", "Override", "public", "void", "sessionEstablished", "(", "PayloadType", "pt", ",", "TransportCandidate", "rc", ",", "TransportCandidate", "lc", ",", "JingleSession", "jingleSession", ")", "throws", "NotConnectedException", ",", "InterruptedException", "{", "if", ...
Implement a Session Listener to relay candidates after establishment
[ "Implement", "a", "Session", "Listener", "to", "relay", "candidates", "after", "establishment" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/ICETransportManager.java#L61-L68
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/processor/jasper/DataSourceProcessor.java
DataSourceProcessor.setAttributes
public void setAttributes(final Map<String, Attribute> attributes) { this.internalAttributes = attributes; this.allAttributes.putAll(attributes); }
java
public void setAttributes(final Map<String, Attribute> attributes) { this.internalAttributes = attributes; this.allAttributes.putAll(attributes); }
[ "public", "void", "setAttributes", "(", "final", "Map", "<", "String", ",", "Attribute", ">", "attributes", ")", "{", "this", ".", "internalAttributes", "=", "attributes", ";", "this", ".", "allAttributes", ".", "putAll", "(", "attributes", ")", ";", "}" ]
All the attributes needed either by the processors for each datasource row or by the jasper template. @param attributes the attributes.
[ "All", "the", "attributes", "needed", "either", "by", "the", "processors", "for", "each", "datasource", "row", "or", "by", "the", "jasper", "template", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/jasper/DataSourceProcessor.java#L153-L156
hortonworks/dstream
dstream-api/src/main/java/io/dstream/utils/PropertiesHelper.java
PropertiesHelper.loadProperties
public static Properties loadProperties(String propertyFilePath){ Properties prop = new Properties(); InputStream is = null; ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { is = cl.getResourceAsStream(propertyFilePath); Assert.notNull(is, "Failed to obtain InputStream for " + propertyFilePath); prop.load(is); resolveSystemPropertyPlaceholders(prop); } catch (Exception e) { throw new IllegalStateException("Failed to load configuration properties: " + propertyFilePath, e); } finally { try { is.close(); } catch (Exception e2) { // ignore } } return prop; }
java
public static Properties loadProperties(String propertyFilePath){ Properties prop = new Properties(); InputStream is = null; ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { is = cl.getResourceAsStream(propertyFilePath); Assert.notNull(is, "Failed to obtain InputStream for " + propertyFilePath); prop.load(is); resolveSystemPropertyPlaceholders(prop); } catch (Exception e) { throw new IllegalStateException("Failed to load configuration properties: " + propertyFilePath, e); } finally { try { is.close(); } catch (Exception e2) { // ignore } } return prop; }
[ "public", "static", "Properties", "loadProperties", "(", "String", "propertyFilePath", ")", "{", "Properties", "prop", "=", "new", "Properties", "(", ")", ";", "InputStream", "is", "=", "null", ";", "ClassLoader", "cl", "=", "Thread", ".", "currentThread", "("...
Will create an instance of {@link Properties} object loaded from the properties file identified by the given <i>propertyFilePath</i> relative to the root of the classpath @param propertyFilePath path to the property file. @return
[ "Will", "create", "an", "instance", "of", "{", "@link", "Properties", "}", "object", "loaded", "from", "the", "properties", "file", "identified", "by", "the", "given", "<i", ">", "propertyFilePath<", "/", "i", ">", "relative", "to", "the", "root", "of", "t...
train
https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-api/src/main/java/io/dstream/utils/PropertiesHelper.java#L38-L59
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java
SegmentAggregator.reconcileOperation
private CompletableFuture<WriterFlushResult> reconcileOperation(StorageOperation op, SegmentProperties storageInfo, TimeoutTimer timer) { CompletableFuture<WriterFlushResult> result; if (isAppendOperation(op)) { result = reconcileAppendOperation((AggregatedAppendOperation) op, storageInfo, timer); } else if (op instanceof MergeSegmentOperation) { result = reconcileMergeOperation((MergeSegmentOperation) op, storageInfo, timer); } else if (op instanceof StreamSegmentSealOperation) { result = reconcileSealOperation(storageInfo, timer.getRemaining()); } else if (isTruncateOperation(op)) { // Nothing to reconcile here. updateStatePostTruncate(); result = CompletableFuture.completedFuture(new WriterFlushResult()); } else { result = Futures.failedFuture(new ReconciliationFailureException(String.format("Operation '%s' is not supported for reconciliation.", op), this.metadata, storageInfo)); } return result; }
java
private CompletableFuture<WriterFlushResult> reconcileOperation(StorageOperation op, SegmentProperties storageInfo, TimeoutTimer timer) { CompletableFuture<WriterFlushResult> result; if (isAppendOperation(op)) { result = reconcileAppendOperation((AggregatedAppendOperation) op, storageInfo, timer); } else if (op instanceof MergeSegmentOperation) { result = reconcileMergeOperation((MergeSegmentOperation) op, storageInfo, timer); } else if (op instanceof StreamSegmentSealOperation) { result = reconcileSealOperation(storageInfo, timer.getRemaining()); } else if (isTruncateOperation(op)) { // Nothing to reconcile here. updateStatePostTruncate(); result = CompletableFuture.completedFuture(new WriterFlushResult()); } else { result = Futures.failedFuture(new ReconciliationFailureException(String.format("Operation '%s' is not supported for reconciliation.", op), this.metadata, storageInfo)); } return result; }
[ "private", "CompletableFuture", "<", "WriterFlushResult", ">", "reconcileOperation", "(", "StorageOperation", "op", ",", "SegmentProperties", "storageInfo", ",", "TimeoutTimer", "timer", ")", "{", "CompletableFuture", "<", "WriterFlushResult", ">", "result", ";", "if", ...
Attempts to reconcile the given StorageOperation. @param op The Operation to reconcile. @param storageInfo The current state of the Segment in Storage. @param timer Timer for the operation. @return A CompletableFuture containing a FlushResult with the number of bytes reconciled, or failed with a ReconciliationFailureException, if the operation cannot be reconciled, based on the in-memory metadata or the current state of the Segment in Storage.
[ "Attempts", "to", "reconcile", "the", "given", "StorageOperation", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L1277-L1294
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.createAsync
public Observable<StorageAccountInner> createAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<StorageAccountInner>, StorageAccountInner>() { @Override public StorageAccountInner call(ServiceResponse<StorageAccountInner> response) { return response.body(); } }); }
java
public Observable<StorageAccountInner> createAsync(String resourceGroupName, String accountName, StorageAccountCreateParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<StorageAccountInner>, StorageAccountInner>() { @Override public StorageAccountInner call(ServiceResponse<StorageAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageAccountInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "StorageAccountCreateParameters", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ","...
Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param parameters The parameters to provide for the created account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Asynchronously", "creates", "a", "new", "storage", "account", "with", "the", "specified", "parameters", ".", "If", "an", "account", "is", "already", "created", "and", "a", "subsequent", "create", "request", "is", "issued", "with", "different", "properties", "th...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L254-L261
wisdom-framework/wisdom
extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java
BalancerFilter.updateHeaders
@Override public void updateHeaders(RequestContext context, Multimap<String, String> headers) { if (!proxyPassReverse) { return; } for (Map.Entry<String, String> h : new LinkedHashSet<>(headers.entries())) { if (REVERSE_PROXY_HEADERS.contains(h.getKey())) { URI location = URI.create(h.getValue()).normalize(); if (location.isAbsolute() && isBackendLocation(location)) { String initial = context.request().uri(); URI uri = URI.create(initial); try { URI newURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), location.getPath(), location.getQuery(), location.getFragment()); headers.remove(h.getKey(), h.getValue()); headers.put(h.getKey(), newURI.toString()); } catch (URISyntaxException e) { logger.error("Cannot manipulate the header {} (value={}) to enforce reverse routing", h .getKey(), h.getValue(), e); } } } } }
java
@Override public void updateHeaders(RequestContext context, Multimap<String, String> headers) { if (!proxyPassReverse) { return; } for (Map.Entry<String, String> h : new LinkedHashSet<>(headers.entries())) { if (REVERSE_PROXY_HEADERS.contains(h.getKey())) { URI location = URI.create(h.getValue()).normalize(); if (location.isAbsolute() && isBackendLocation(location)) { String initial = context.request().uri(); URI uri = URI.create(initial); try { URI newURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), location.getPath(), location.getQuery(), location.getFragment()); headers.remove(h.getKey(), h.getValue()); headers.put(h.getKey(), newURI.toString()); } catch (URISyntaxException e) { logger.error("Cannot manipulate the header {} (value={}) to enforce reverse routing", h .getKey(), h.getValue(), e); } } } } }
[ "@", "Override", "public", "void", "updateHeaders", "(", "RequestContext", "context", ",", "Multimap", "<", "String", ",", "String", ">", "headers", ")", "{", "if", "(", "!", "proxyPassReverse", ")", "{", "return", ";", "}", "for", "(", "Map", ".", "Entr...
Callback that can be overridden to customize the header ot the request. This method implements the reverse routing. It updates URLs contained in the headers. @param context the request context @param headers the current set of headers, that need to be modified
[ "Callback", "that", "can", "be", "overridden", "to", "customize", "the", "header", "ot", "the", "request", ".", "This", "method", "implements", "the", "reverse", "routing", ".", "It", "updates", "URLs", "contained", "in", "the", "headers", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/BalancerFilter.java#L202-L225
aws/aws-sdk-java
aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/CreateAppRequest.java
CreateAppRequest.withEnvironmentVariables
public CreateAppRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) { setEnvironmentVariables(environmentVariables); return this; }
java
public CreateAppRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) { setEnvironmentVariables(environmentVariables); return this; }
[ "public", "CreateAppRequest", "withEnvironmentVariables", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "environmentVariables", ")", "{", "setEnvironmentVariables", "(", "environmentVariables", ")", ";", "return", "this", ";", "}" ]
<p> Environment variables map for an Amplify App. </p> @param environmentVariables Environment variables map for an Amplify App. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Environment", "variables", "map", "for", "an", "Amplify", "App", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/CreateAppRequest.java#L411-L414
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.isEqual
public static IsEqual isEqual(NumberExpression left, Object constant) { if (!(constant instanceof Number)) throw new IllegalArgumentException("constant is not a Number"); return new IsEqual(left, constant((Number)constant)); }
java
public static IsEqual isEqual(NumberExpression left, Object constant) { if (!(constant instanceof Number)) throw new IllegalArgumentException("constant is not a Number"); return new IsEqual(left, constant((Number)constant)); }
[ "public", "static", "IsEqual", "isEqual", "(", "NumberExpression", "left", ",", "Object", "constant", ")", "{", "if", "(", "!", "(", "constant", "instanceof", "Number", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"constant is not a Number\"", ")",...
Creates an IsEqual expression from the given expression and constant. @param left The left expression. @param constant The constant to compare to (must be a Number). @throws IllegalArgumentException If constant is not a Number. @return A new IsEqual binary expression.
[ "Creates", "an", "IsEqual", "expression", "from", "the", "given", "expression", "and", "constant", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L160-L166
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageEditor.java
CmsContainerpageEditor.enableToolbarButtons
public void enableToolbarButtons(boolean hasChanges, String noEditReason) { for (Widget button : m_toolbar.getAll()) { // enable all buttons that are not equal save or reset or the page has changes if (button instanceof I_CmsToolbarButton) { ((I_CmsToolbarButton)button).setEnabled(true); } } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(noEditReason)) { m_add.disable(noEditReason); m_clipboard.disable(noEditReason); } m_toolbar.setVisible(true); }
java
public void enableToolbarButtons(boolean hasChanges, String noEditReason) { for (Widget button : m_toolbar.getAll()) { // enable all buttons that are not equal save or reset or the page has changes if (button instanceof I_CmsToolbarButton) { ((I_CmsToolbarButton)button).setEnabled(true); } } if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(noEditReason)) { m_add.disable(noEditReason); m_clipboard.disable(noEditReason); } m_toolbar.setVisible(true); }
[ "public", "void", "enableToolbarButtons", "(", "boolean", "hasChanges", ",", "String", "noEditReason", ")", "{", "for", "(", "Widget", "button", ":", "m_toolbar", ".", "getAll", "(", ")", ")", "{", "// enable all buttons that are not equal save or reset or the page has ...
Enables the toolbar buttons.<p> @param hasChanges if the page has changes @param noEditReason the no edit reason
[ "Enables", "the", "toolbar", "buttons", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageEditor.java#L197-L211
jbossws/jbossws-cxf
modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java
SEDProcessor.findWhitespace
private static int findWhitespace(CharSequence s, int start) { final int len = s.length(); for (int i = start; i < len; i++) { if (Character.isWhitespace(s.charAt(i))) { return i; } } return len; }
java
private static int findWhitespace(CharSequence s, int start) { final int len = s.length(); for (int i = start; i < len; i++) { if (Character.isWhitespace(s.charAt(i))) { return i; } } return len; }
[ "private", "static", "int", "findWhitespace", "(", "CharSequence", "s", ",", "int", "start", ")", "{", "final", "int", "len", "=", "s", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "start", ";", "i", "<", "len", ";", "i", "++", ")",...
Finds and returns the first whitespace character in the given sequence at or after start. Returns the length of the string if no whitespace is found. @param s the character sequence @param start the first index to consider in the char sequence @return the index containing the first whitespace character at or after start, or the length of the character sequence if all characters are blank
[ "Finds", "and", "returns", "the", "first", "whitespace", "character", "in", "the", "given", "sequence", "at", "or", "after", "start", ".", "Returns", "the", "length", "of", "the", "string", "if", "no", "whitespace", "is", "found", "." ]
train
https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/server/src/main/java/org/jboss/wsf/stack/cxf/addressRewrite/SEDProcessor.java#L382-L393
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/DirectlyRelevantTypeQualifiersDatabase.java
DirectlyRelevantTypeQualifiersDatabase.setDirectlyRelevantTypeQualifiers
public void setDirectlyRelevantTypeQualifiers(MethodDescriptor methodDescriptor, Collection<TypeQualifierValue<?>> qualifiers) { methodToDirectlyRelevantQualifiersMap.put(methodDescriptor, qualifiers); allKnownQualifiers.addAll(qualifiers); }
java
public void setDirectlyRelevantTypeQualifiers(MethodDescriptor methodDescriptor, Collection<TypeQualifierValue<?>> qualifiers) { methodToDirectlyRelevantQualifiersMap.put(methodDescriptor, qualifiers); allKnownQualifiers.addAll(qualifiers); }
[ "public", "void", "setDirectlyRelevantTypeQualifiers", "(", "MethodDescriptor", "methodDescriptor", ",", "Collection", "<", "TypeQualifierValue", "<", "?", ">", ">", "qualifiers", ")", "{", "methodToDirectlyRelevantQualifiersMap", ".", "put", "(", "methodDescriptor", ",",...
Set the collection of directly-relevant type qualifiers for a given method. @param methodDescriptor MethodDescriptor identifying a method @param qualifiers collection of directly-relevant type qualifiers for the method
[ "Set", "the", "collection", "of", "directly", "-", "relevant", "type", "qualifiers", "for", "a", "given", "method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/DirectlyRelevantTypeQualifiersDatabase.java#L84-L87
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java
BloomFilter.seeded
static int seeded(int item, int i) { long hash = SEED[i] * item; hash += hash >>> 32; return (int) hash; }
java
static int seeded(int item, int i) { long hash = SEED[i] * item; hash += hash >>> 32; return (int) hash; }
[ "static", "int", "seeded", "(", "int", "item", ",", "int", "i", ")", "{", "long", "hash", "=", "SEED", "[", "i", "]", "*", "item", ";", "hash", "+=", "hash", ">>>", "32", ";", "return", "(", "int", ")", "hash", ";", "}" ]
Applies the independent hash function for the given seed index. @param item the element's hash @param i the hash seed index @return the table index
[ "Applies", "the", "independent", "hash", "function", "for", "the", "given", "seed", "index", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java#L140-L144
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.encodeInteger
private static void encodeInteger(ByteBuf out, int mask, int n, int i) { encodeInteger(out, mask, n, (long) i); }
java
private static void encodeInteger(ByteBuf out, int mask, int n, int i) { encodeInteger(out, mask, n, (long) i); }
[ "private", "static", "void", "encodeInteger", "(", "ByteBuf", "out", ",", "int", "mask", ",", "int", "n", ",", "int", "i", ")", "{", "encodeInteger", "(", "out", ",", "mask", ",", "n", ",", "(", "long", ")", "i", ")", ";", "}" ]
Encode integer according to <a href="https://tools.ietf.org/html/rfc7541#section-5.1">Section 5.1</a>.
[ "Encode", "integer", "according", "to", "<a", "href", "=", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc7541#section", "-", "5", ".", "1", ">", "Section", "5", ".", "1<", "/", "a", ">", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L227-L229
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/IdGenerator.java
IdGenerator.onTableGenerator
private Object onTableGenerator(EntityMetadata m, Client<?> client, IdDiscriptor keyValue, Object e) { Object tablegenerator = getAutoGenClazz(client); if (tablegenerator instanceof TableGenerator) { Object generatedId = ((TableGenerator) tablegenerator).generate(keyValue.getTableDiscriptor(), (ClientBase) client, m.getIdAttribute().getJavaType().getSimpleName()); try { generatedId = PropertyAccessorHelper.fromSourceToTargetClass(m.getIdAttribute().getJavaType(), generatedId.getClass(), generatedId); PropertyAccessorHelper.setId(e, m, generatedId); return generatedId; } catch (IllegalArgumentException iae) { log.error("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType()); throw new KunderaException("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType(), iae); } } throw new IllegalArgumentException(GenerationType.class.getSimpleName() + "." + GenerationType.TABLE + " Strategy not supported by this client :" + client.getClass().getName()); }
java
private Object onTableGenerator(EntityMetadata m, Client<?> client, IdDiscriptor keyValue, Object e) { Object tablegenerator = getAutoGenClazz(client); if (tablegenerator instanceof TableGenerator) { Object generatedId = ((TableGenerator) tablegenerator).generate(keyValue.getTableDiscriptor(), (ClientBase) client, m.getIdAttribute().getJavaType().getSimpleName()); try { generatedId = PropertyAccessorHelper.fromSourceToTargetClass(m.getIdAttribute().getJavaType(), generatedId.getClass(), generatedId); PropertyAccessorHelper.setId(e, m, generatedId); return generatedId; } catch (IllegalArgumentException iae) { log.error("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType()); throw new KunderaException("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType(), iae); } } throw new IllegalArgumentException(GenerationType.class.getSimpleName() + "." + GenerationType.TABLE + " Strategy not supported by this client :" + client.getClass().getName()); }
[ "private", "Object", "onTableGenerator", "(", "EntityMetadata", "m", ",", "Client", "<", "?", ">", "client", ",", "IdDiscriptor", "keyValue", ",", "Object", "e", ")", "{", "Object", "tablegenerator", "=", "getAutoGenClazz", "(", "client", ")", ";", "if", "("...
Generate Id when given table generation strategy. @param m @param client @param keyValue @param e
[ "Generate", "Id", "when", "given", "table", "generation", "strategy", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/IdGenerator.java#L203-L226
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java
UnifiedResponse.setAllowMimeSniffing
@Nonnull public final UnifiedResponse setAllowMimeSniffing (final boolean bAllow) { if (bAllow) removeCustomResponseHeaders (CHttpHeader.X_CONTENT_TYPE_OPTIONS); else setCustomResponseHeader (CHttpHeader.X_CONTENT_TYPE_OPTIONS, CHttpHeader.VALUE_NOSNIFF); return this; }
java
@Nonnull public final UnifiedResponse setAllowMimeSniffing (final boolean bAllow) { if (bAllow) removeCustomResponseHeaders (CHttpHeader.X_CONTENT_TYPE_OPTIONS); else setCustomResponseHeader (CHttpHeader.X_CONTENT_TYPE_OPTIONS, CHttpHeader.VALUE_NOSNIFF); return this; }
[ "@", "Nonnull", "public", "final", "UnifiedResponse", "setAllowMimeSniffing", "(", "final", "boolean", "bAllow", ")", "{", "if", "(", "bAllow", ")", "removeCustomResponseHeaders", "(", "CHttpHeader", ".", "X_CONTENT_TYPE_OPTIONS", ")", ";", "else", "setCustomResponseH...
When specifying <code>false</code>, this method uses a special response header to prevent certain browsers from MIME-sniffing a response away from the declared content-type. When passing <code>true</code>, that header is removed. @param bAllow Whether or not sniffing should be allowed (default is <code>true</code>). @return this
[ "When", "specifying", "<code", ">", "false<", "/", "code", ">", "this", "method", "uses", "a", "special", "response", "header", "to", "prevent", "certain", "browsers", "from", "MIME", "-", "sniffing", "a", "response", "away", "from", "the", "declared", "cont...
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponse.java#L1036-L1044
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java
KltTracker.computeGandE_border
protected int computeGandE_border(KltFeature feature, float cx, float cy) { computeSubImageBounds(feature, cx, cy); ImageMiscOps.fill(currDesc, Float.NaN); currDesc.subimage(dstX0, dstY0, dstX1, dstY1, subimage); interpInput.setImage(image); interpInput.region(srcX0, srcY0, subimage); int total = 0; Gxx = 0; Gyy = 0; Gxy = 0; Ex = 0; Ey = 0; for( int i = 0; i < lengthFeature; i++ ) { float template = feature.desc.data[i]; float current = currDesc.data[i]; // if the description was outside of the image here skip it if( Float.isNaN(template) || Float.isNaN(current)) continue; // count total number of points inbounds total++; float dX = feature.derivX.data[i]; float dY = feature.derivY.data[i]; // compute the difference between the previous and the current image float d = template - current; Ex += d * dX; Ey += d * dY; Gxx += dX * dX; Gyy += dY * dY; Gxy += dX * dY; } return total; }
java
protected int computeGandE_border(KltFeature feature, float cx, float cy) { computeSubImageBounds(feature, cx, cy); ImageMiscOps.fill(currDesc, Float.NaN); currDesc.subimage(dstX0, dstY0, dstX1, dstY1, subimage); interpInput.setImage(image); interpInput.region(srcX0, srcY0, subimage); int total = 0; Gxx = 0; Gyy = 0; Gxy = 0; Ex = 0; Ey = 0; for( int i = 0; i < lengthFeature; i++ ) { float template = feature.desc.data[i]; float current = currDesc.data[i]; // if the description was outside of the image here skip it if( Float.isNaN(template) || Float.isNaN(current)) continue; // count total number of points inbounds total++; float dX = feature.derivX.data[i]; float dY = feature.derivY.data[i]; // compute the difference between the previous and the current image float d = template - current; Ex += d * dX; Ey += d * dY; Gxx += dX * dX; Gyy += dY * dY; Gxy += dX * dY; } return total; }
[ "protected", "int", "computeGandE_border", "(", "KltFeature", "feature", ",", "float", "cx", ",", "float", "cy", ")", "{", "computeSubImageBounds", "(", "feature", ",", "cx", ",", "cy", ")", ";", "ImageMiscOps", ".", "fill", "(", "currDesc", ",", "Float", ...
When part of the region is outside the image G and E need to be recomputed
[ "When", "part", "of", "the", "region", "is", "outside", "the", "image", "G", "and", "E", "need", "to", "be", "recomputed" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L379-L419
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java
StringSearch.initializePatternPCETable
private int initializePatternPCETable() { long[] pcetable = new long[INITIAL_ARRAY_SIZE_]; int pcetablesize = pcetable.length; int patternlength = pattern_.text_.length(); CollationElementIterator coleiter = utilIter_; if (coleiter == null) { coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else { coleiter.setText(pattern_.text_); } int offset = 0; int result = 0; long pce; CollationPCE iter = new CollationPCE(coleiter); // ** Should processed CEs be signed or unsigned? // ** (the rest of the code in this file seems to play fast-and-loose with // ** whether a CE is signed or unsigned. For example, look at routine above this one.) while ((pce = iter.nextProcessed(null)) != CollationPCE.PROCESSED_NULLORDER) { long[] temp = addToLongArray(pcetable, offset, pcetablesize, pce, patternlength - coleiter.getOffset() + 1); offset++; pcetable = temp; } pcetable[offset] = 0; pattern_.PCE_ = pcetable; pattern_.PCELength_ = offset; return result; }
java
private int initializePatternPCETable() { long[] pcetable = new long[INITIAL_ARRAY_SIZE_]; int pcetablesize = pcetable.length; int patternlength = pattern_.text_.length(); CollationElementIterator coleiter = utilIter_; if (coleiter == null) { coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else { coleiter.setText(pattern_.text_); } int offset = 0; int result = 0; long pce; CollationPCE iter = new CollationPCE(coleiter); // ** Should processed CEs be signed or unsigned? // ** (the rest of the code in this file seems to play fast-and-loose with // ** whether a CE is signed or unsigned. For example, look at routine above this one.) while ((pce = iter.nextProcessed(null)) != CollationPCE.PROCESSED_NULLORDER) { long[] temp = addToLongArray(pcetable, offset, pcetablesize, pce, patternlength - coleiter.getOffset() + 1); offset++; pcetable = temp; } pcetable[offset] = 0; pattern_.PCE_ = pcetable; pattern_.PCELength_ = offset; return result; }
[ "private", "int", "initializePatternPCETable", "(", ")", "{", "long", "[", "]", "pcetable", "=", "new", "long", "[", "INITIAL_ARRAY_SIZE_", "]", ";", "int", "pcetablesize", "=", "pcetable", ".", "length", ";", "int", "patternlength", "=", "pattern_", ".", "t...
Initializing the pce table for a pattern. Stores non-ignorable collation keys. Table size will be estimated by the size of the pattern text. Table expansion will be perform as we go along. Adding 1 to ensure that the table size definitely increases. @return total number of expansions
[ "Initializing", "the", "pce", "table", "for", "a", "pattern", ".", "Stores", "non", "-", "ignorable", "collation", "keys", ".", "Table", "size", "will", "be", "estimated", "by", "the", "size", "of", "the", "pattern", "text", ".", "Table", "expansion", "wil...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L733-L766
VoltDB/voltdb
src/frontend/org/voltdb/utils/PersistentBinaryDeque.java
PersistentBinaryDeque.getSegmentFileName
private String getSegmentFileName(long currentId, long previousId) { return PbdSegmentName.createName(m_nonce, currentId, previousId, false); }
java
private String getSegmentFileName(long currentId, long previousId) { return PbdSegmentName.createName(m_nonce, currentId, previousId, false); }
[ "private", "String", "getSegmentFileName", "(", "long", "currentId", ",", "long", "previousId", ")", "{", "return", "PbdSegmentName", ".", "createName", "(", "m_nonce", ",", "currentId", ",", "previousId", ",", "false", ")", ";", "}" ]
Return a segment file name from m_nonce and current + previous segment ids. @see parseFiles for file name structure @param currentId current segment id @param previousId previous segment id @return segment file name
[ "Return", "a", "segment", "file", "name", "from", "m_nonce", "and", "current", "+", "previous", "segment", "ids", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/PersistentBinaryDeque.java#L463-L465
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfoBase.java
TEEJBInvocationInfoBase.writeDeployedSupportInfo
protected static void writeDeployedSupportInfo(EJSDeployedSupport s, StringBuffer sbuf, EJSWrapperBase wrapper, Throwable t) { BeanId beanId = wrapper.beanId; // d163197 EJBMethodInfoImpl mInfo = s.getEJBMethodInfoImpl(); ContainerTx containerTx = s.getCurrentTx(); sbuf .append(s.getEJBMethodId()).append(DataDelimiter) .append((mInfo != null) ? mInfo.getMethodName() : UnknownValue).append(DataDelimiter) .append((mInfo != null) ? mInfo.getMethodSignature() : UnknownValue).append(DataDelimiter) .append((mInfo != null) ? (mInfo.isHome() ? "true" : "false") : UnknownValue).append(DataDelimiter) .append(s.beganInThisScope()).append(DataDelimiter) .append(containerTx != null ? containerTx.toString() : NullPointerMarker).append(DataDelimiter) .append(containerTx != null ? (containerTx.isTransactionGlobal() ? GlobalTxType : LocalTxType) : UnSpecifiedTxType).append(DataDelimiter) .append(beanId == null ? (mInfo != null && mInfo.isHome() ? HomeMethodBeanId : NonEJBInvocationBeanId) : beanId.getIdString()).append(DataDelimiter) .append(t == null ? NullPointerMarker : t.getClass().getName()).append(DataDelimiter); }
java
protected static void writeDeployedSupportInfo(EJSDeployedSupport s, StringBuffer sbuf, EJSWrapperBase wrapper, Throwable t) { BeanId beanId = wrapper.beanId; // d163197 EJBMethodInfoImpl mInfo = s.getEJBMethodInfoImpl(); ContainerTx containerTx = s.getCurrentTx(); sbuf .append(s.getEJBMethodId()).append(DataDelimiter) .append((mInfo != null) ? mInfo.getMethodName() : UnknownValue).append(DataDelimiter) .append((mInfo != null) ? mInfo.getMethodSignature() : UnknownValue).append(DataDelimiter) .append((mInfo != null) ? (mInfo.isHome() ? "true" : "false") : UnknownValue).append(DataDelimiter) .append(s.beganInThisScope()).append(DataDelimiter) .append(containerTx != null ? containerTx.toString() : NullPointerMarker).append(DataDelimiter) .append(containerTx != null ? (containerTx.isTransactionGlobal() ? GlobalTxType : LocalTxType) : UnSpecifiedTxType).append(DataDelimiter) .append(beanId == null ? (mInfo != null && mInfo.isHome() ? HomeMethodBeanId : NonEJBInvocationBeanId) : beanId.getIdString()).append(DataDelimiter) .append(t == null ? NullPointerMarker : t.getClass().getName()).append(DataDelimiter); }
[ "protected", "static", "void", "writeDeployedSupportInfo", "(", "EJSDeployedSupport", "s", ",", "StringBuffer", "sbuf", ",", "EJSWrapperBase", "wrapper", ",", "Throwable", "t", ")", "{", "BeanId", "beanId", "=", "wrapper", ".", "beanId", ";", "// d163197", "EJBMet...
Collects all the method call information from the input EJSDeploySupport, EJSWrapperBase and Throwable objects, converts them to their textual representation and write it out to the input <i>sbuf</i>.
[ "Collects", "all", "the", "method", "call", "information", "from", "the", "input", "EJSDeploySupport", "EJSWrapperBase", "and", "Throwable", "objects", "converts", "them", "to", "their", "textual", "representation", "and", "write", "it", "out", "to", "the", "input...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfoBase.java#L53-L77
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java
HCRenderer.getAsHTMLStringWithoutNamespaces
@Nonnull public static String getAsHTMLStringWithoutNamespaces (@Nonnull final IHCNode aHCNode) { return getAsHTMLString (aHCNode, HCSettings.getConversionSettingsWithoutNamespaces ()); }
java
@Nonnull public static String getAsHTMLStringWithoutNamespaces (@Nonnull final IHCNode aHCNode) { return getAsHTMLString (aHCNode, HCSettings.getConversionSettingsWithoutNamespaces ()); }
[ "@", "Nonnull", "public", "static", "String", "getAsHTMLStringWithoutNamespaces", "(", "@", "Nonnull", "final", "IHCNode", "aHCNode", ")", "{", "return", "getAsHTMLString", "(", "aHCNode", ",", "HCSettings", ".", "getConversionSettingsWithoutNamespaces", "(", ")", ")"...
Convert the passed HC node to an HTML string without namespaces. Indent and align status is determined from {@link GlobalDebug#isDebugMode()} @param aHCNode The node to be converted. May not be <code>null</code>. @return The node as XML with or without indentation.
[ "Convert", "the", "passed", "HC", "node", "to", "an", "HTML", "string", "without", "namespaces", ".", "Indent", "and", "align", "status", "is", "determined", "from", "{", "@link", "GlobalDebug#isDebugMode", "()", "}" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L291-L295
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayPosition
public static Expression arrayPosition(String expression, Expression value) { return arrayPosition(x(expression), value); }
java
public static Expression arrayPosition(String expression, Expression value) { return arrayPosition(x(expression), value); }
[ "public", "static", "Expression", "arrayPosition", "(", "String", "expression", ",", "Expression", "value", ")", "{", "return", "arrayPosition", "(", "x", "(", "expression", ")", ",", "value", ")", ";", "}" ]
Returned expression results in the first position of value within the array, or -1. Array position is zero-based, i.e. the first position is 0.
[ "Returned", "expression", "results", "in", "the", "first", "position", "of", "value", "within", "the", "array", "or", "-", "1", ".", "Array", "position", "is", "zero", "-", "based", "i", ".", "e", ".", "the", "first", "position", "is", "0", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L267-L269
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java
SQLiteDatabase.openDatabase
public static SQLiteDatabase openDatabase(String path, CursorFactory factory, int flags) { return openDatabase(path, factory, flags, null); }
java
public static SQLiteDatabase openDatabase(String path, CursorFactory factory, int flags) { return openDatabase(path, factory, flags, null); }
[ "public", "static", "SQLiteDatabase", "openDatabase", "(", "String", "path", ",", "CursorFactory", "factory", ",", "int", "flags", ")", "{", "return", "openDatabase", "(", "path", ",", "factory", ",", "flags", ",", "null", ")", ";", "}" ]
Open the database according to the flags {@link #OPEN_READWRITE} {@link #OPEN_READONLY} {@link #CREATE_IF_NECESSARY} and/or {@link #NO_LOCALIZED_COLLATORS}. <p>Sets the locale of the database to the the system's current locale. Call {@link #setLocale} if you would like something else.</p> @param path to database file to open and/or create @param factory an optional factory class that is called to instantiate a cursor when query is called, or null for default @param flags to control database access mode @return the newly opened database @throws SQLiteException if the database cannot be opened
[ "Open", "the", "database", "according", "to", "the", "flags", "{", "@link", "#OPEN_READWRITE", "}", "{", "@link", "#OPEN_READONLY", "}", "{", "@link", "#CREATE_IF_NECESSARY", "}", "and", "/", "or", "{", "@link", "#NO_LOCALIZED_COLLATORS", "}", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L672-L674
cdk/cdk
display/renderawt/src/main/java/org/openscience/cdk/renderer/visitor/AbstractAWTDrawVisitor.java
AbstractAWTDrawVisitor.getTextBounds
protected Rectangle2D getTextBounds(String text, double xCoord, double yCoord, Graphics2D graphics) { FontMetrics fontMetrics = graphics.getFontMetrics(); Rectangle2D bounds = fontMetrics.getStringBounds(text, graphics); double widthPad = 3; double heightPad = 1; double width = bounds.getWidth() + widthPad; double height = bounds.getHeight() + heightPad; int[] point = this.transformPoint(xCoord, yCoord); return new Rectangle2D.Double(point[0] - width / 2, point[1] - height / 2, width, height); }
java
protected Rectangle2D getTextBounds(String text, double xCoord, double yCoord, Graphics2D graphics) { FontMetrics fontMetrics = graphics.getFontMetrics(); Rectangle2D bounds = fontMetrics.getStringBounds(text, graphics); double widthPad = 3; double heightPad = 1; double width = bounds.getWidth() + widthPad; double height = bounds.getHeight() + heightPad; int[] point = this.transformPoint(xCoord, yCoord); return new Rectangle2D.Double(point[0] - width / 2, point[1] - height / 2, width, height); }
[ "protected", "Rectangle2D", "getTextBounds", "(", "String", "text", ",", "double", "xCoord", ",", "double", "yCoord", ",", "Graphics2D", "graphics", ")", "{", "FontMetrics", "fontMetrics", "=", "graphics", ".", "getFontMetrics", "(", ")", ";", "Rectangle2D", "bo...
Calculates the boundaries of a text string in screen coordinates. @param text the text string @param xCoord the world x-coordinate of where the text should be placed @param yCoord the world y-coordinate of where the text should be placed @param graphics the graphics to which the text is provided as output @return the screen coordinates
[ "Calculates", "the", "boundaries", "of", "a", "text", "string", "in", "screen", "coordinates", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderawt/src/main/java/org/openscience/cdk/renderer/visitor/AbstractAWTDrawVisitor.java#L73-L84
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/IdManager.java
IdManager.makeSureMsgId
public static boolean makeSureMsgId(Map<String, Object> map) { boolean newMsgIdGenerated = false; if (StringUtil.isEmpty(map.get("$msgId"))) { if (MsgIdHolder.get() == null) { MsgIdHolder.init(); newMsgIdGenerated = true; LOG.debug("没有提供$msgId,因此这里初始化一个!"); } map.put("$msgId", MsgIdHolder.get()); } else { MsgIdHolder.set(map.get("$msgId").toString()); } return newMsgIdGenerated; }
java
public static boolean makeSureMsgId(Map<String, Object> map) { boolean newMsgIdGenerated = false; if (StringUtil.isEmpty(map.get("$msgId"))) { if (MsgIdHolder.get() == null) { MsgIdHolder.init(); newMsgIdGenerated = true; LOG.debug("没有提供$msgId,因此这里初始化一个!"); } map.put("$msgId", MsgIdHolder.get()); } else { MsgIdHolder.set(map.get("$msgId").toString()); } return newMsgIdGenerated; }
[ "public", "static", "boolean", "makeSureMsgId", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "boolean", "newMsgIdGenerated", "=", "false", ";", "if", "(", "StringUtil", ".", "isEmpty", "(", "map", ".", "get", "(", "\"$msgId\"", ")", ")...
map与MsgIdHolder内的$msgId同步,如果二者都没有$msgId,那么为他们初始化一个 @return newMsgIdGenerated 若初始化了一个新的$msgId,那么返回true @deprecated We use message context to transmit the msg id now, "$" var in map is deprecated.
[ "map与MsgIdHolder内的$msgId同步,如果二者都没有$msgId,那么为他们初始化一个" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/IdManager.java#L103-L116
astrapi69/jaulp-wicket
jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/ajax/modal/BaseModalPanel.java
BaseModalPanel.newCancelButton
protected AjaxButton newCancelButton(final String id) { final AjaxButton close = new AjaxButton(id) { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { target.add(note); onCancel(target); } /** * {@inheritDoc} */ @Override public void onSubmit(final AjaxRequestTarget target, final Form<?> form) { target.add(note); onCancel(target); } }; return close; }
java
protected AjaxButton newCancelButton(final String id) { final AjaxButton close = new AjaxButton(id) { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ @Override protected void onError(final AjaxRequestTarget target, final Form<?> form) { target.add(note); onCancel(target); } /** * {@inheritDoc} */ @Override public void onSubmit(final AjaxRequestTarget target, final Form<?> form) { target.add(note); onCancel(target); } }; return close; }
[ "protected", "AjaxButton", "newCancelButton", "(", "final", "String", "id", ")", "{", "final", "AjaxButton", "close", "=", "new", "AjaxButton", "(", "id", ")", "{", "/**\r\n\t\t\t * The serialVersionUID.\r\n\t\t\t */", "private", "static", "final", "long", "serialVers...
Factory method for creating the new cancel {@link AjaxButton}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new cancel {@link AjaxButton}. @param id the id @return the new cancel {@link AjaxButton}
[ "Factory", "method", "for", "creating", "the", "new", "cancel", "{", "@link", "AjaxButton", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/ajax/modal/BaseModalPanel.java#L83-L113
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/util/GraphSerialization.java
GraphSerialization.saveGraph
public static void saveGraph(DirectedGraph<Integer, DefaultEdge> graph, String location) throws IOException { File file = new File(location); file.createNewFile(); if (!file.canWrite()) { throw new IOException("Cannot write to file " + location); } GraphSerialization.saveGraph(graph, file); }
java
public static void saveGraph(DirectedGraph<Integer, DefaultEdge> graph, String location) throws IOException { File file = new File(location); file.createNewFile(); if (!file.canWrite()) { throw new IOException("Cannot write to file " + location); } GraphSerialization.saveGraph(graph, file); }
[ "public", "static", "void", "saveGraph", "(", "DirectedGraph", "<", "Integer", ",", "DefaultEdge", ">", "graph", ",", "String", "location", ")", "throws", "IOException", "{", "File", "file", "=", "new", "File", "(", "location", ")", ";", "file", ".", "crea...
Serializes the given {@link DirectedGraph} object to the given location. @param graph Must not be {@code null}. @param location Must not be {@code null} and a valid file path. @throws IOException Thrown if errors occurred on the IO level.
[ "Serializes", "the", "given", "{", "@link", "DirectedGraph", "}", "object", "to", "the", "given", "location", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/util/GraphSerialization.java#L52-L59
nulab/backlog4j
src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java
CreateIssueParams.notifiedUserIds
public CreateIssueParams notifiedUserIds(List notifiedUserIds) { for (Object notifiedUserId : notifiedUserIds) { parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString())); } return this; }
java
public CreateIssueParams notifiedUserIds(List notifiedUserIds) { for (Object notifiedUserId : notifiedUserIds) { parameters.add(new NameValuePair("notifiedUserId[]", notifiedUserId.toString())); } return this; }
[ "public", "CreateIssueParams", "notifiedUserIds", "(", "List", "notifiedUserIds", ")", "{", "for", "(", "Object", "notifiedUserId", ":", "notifiedUserIds", ")", "{", "parameters", ".", "add", "(", "new", "NameValuePair", "(", "\"notifiedUserId[]\"", ",", "notifiedUs...
Sets the issue notified users. @param notifiedUserIds notified user identifiers @return CreateIssueParams instance
[ "Sets", "the", "issue", "notified", "users", "." ]
train
https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/CreateIssueParams.java#L187-L193
VoltDB/voltdb
src/frontend/org/voltdb/DRConsumerDrIdTracker.java
DRConsumerDrIdTracker.addRange
public void addRange(long startDrId, long endDrId, long spUniqueId, long mpUniqueId) { // Note that any given range or tracker could have either sp or mp sentinel values m_lastSpUniqueId = Math.max(m_lastSpUniqueId, spUniqueId); m_lastMpUniqueId = Math.max(m_lastMpUniqueId, mpUniqueId); addRange(startDrId, endDrId); }
java
public void addRange(long startDrId, long endDrId, long spUniqueId, long mpUniqueId) { // Note that any given range or tracker could have either sp or mp sentinel values m_lastSpUniqueId = Math.max(m_lastSpUniqueId, spUniqueId); m_lastMpUniqueId = Math.max(m_lastMpUniqueId, mpUniqueId); addRange(startDrId, endDrId); }
[ "public", "void", "addRange", "(", "long", "startDrId", ",", "long", "endDrId", ",", "long", "spUniqueId", ",", "long", "mpUniqueId", ")", "{", "// Note that any given range or tracker could have either sp or mp sentinel values", "m_lastSpUniqueId", "=", "Math", ".", "max...
Add a range to the tracker. @param startDrId @param endDrId @param spUniqueId @param mpUniqueId
[ "Add", "a", "range", "to", "the", "tracker", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/DRConsumerDrIdTracker.java#L313-L318
Netflix/conductor
core/src/main/java/com/netflix/conductor/service/utils/ServiceUtils.java
ServiceUtils.checkNotNull
public static void checkNotNull(Object object, String errorMessage){ try { Preconditions.checkNotNull(object, errorMessage); } catch (NullPointerException exception) { throw new ApplicationException(ApplicationException.Code.INVALID_INPUT, errorMessage); } }
java
public static void checkNotNull(Object object, String errorMessage){ try { Preconditions.checkNotNull(object, errorMessage); } catch (NullPointerException exception) { throw new ApplicationException(ApplicationException.Code.INVALID_INPUT, errorMessage); } }
[ "public", "static", "void", "checkNotNull", "(", "Object", "object", ",", "String", "errorMessage", ")", "{", "try", "{", "Preconditions", ".", "checkNotNull", "(", "object", ",", "errorMessage", ")", ";", "}", "catch", "(", "NullPointerException", "exception", ...
This method checks if the object is null or empty. @param object input of type {@link Object} @param errorMessage The exception message use if the object is empty or null @throws com.netflix.conductor.core.execution.ApplicationException if input object is not valid
[ "This", "method", "checks", "if", "the", "object", "is", "null", "or", "empty", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/utils/ServiceUtils.java#L102-L108
motown-io/motown
chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java
DomainService.updateConnector
public Connector updateConnector(Long chargingStationTypeId, Long evseId, Connector connector) { ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId); Evse evse = getEvseById(chargingStationType, evseId); Connector existingConnector = getConnectorById(evse, connector.getId(), false); if (existingConnector != null) { evse.getConnectors().remove(existingConnector); } evse.getConnectors().add(connector); chargingStationType = chargingStationTypeRepository.createOrUpdate(chargingStationType); evse = getEvseById(chargingStationType, evseId); return getConnectorById(evse, connector.getId()); }
java
public Connector updateConnector(Long chargingStationTypeId, Long evseId, Connector connector) { ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId); Evse evse = getEvseById(chargingStationType, evseId); Connector existingConnector = getConnectorById(evse, connector.getId(), false); if (existingConnector != null) { evse.getConnectors().remove(existingConnector); } evse.getConnectors().add(connector); chargingStationType = chargingStationTypeRepository.createOrUpdate(chargingStationType); evse = getEvseById(chargingStationType, evseId); return getConnectorById(evse, connector.getId()); }
[ "public", "Connector", "updateConnector", "(", "Long", "chargingStationTypeId", ",", "Long", "evseId", ",", "Connector", "connector", ")", "{", "ChargingStationType", "chargingStationType", "=", "chargingStationTypeRepository", ".", "findOne", "(", "chargingStationTypeId", ...
Update a connector. @param chargingStationTypeId charging station type identifier. @param evseId the id of the evse that contains the connector. @param connector the payload from the request. @return updated connector.
[ "Update", "a", "connector", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L222-L236
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java
RunsInner.beginCancel
public void beginCancel(String resourceGroupName, String registryName, String runId) { beginCancelWithServiceResponseAsync(resourceGroupName, registryName, runId).toBlocking().single().body(); }
java
public void beginCancel(String resourceGroupName, String registryName, String runId) { beginCancelWithServiceResponseAsync(resourceGroupName, registryName, runId).toBlocking().single().body(); }
[ "public", "void", "beginCancel", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "runId", ")", "{", "beginCancelWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "runId", ")", ".", "toBlocking", "(", ")"...
Cancel an existing run. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param runId The run ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Cancel", "an", "existing", "run", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L951-L953
SeleniumHQ/fluent-selenium
java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java
FluentSelect.deselectByVisibleText
public FluentSelect deselectByVisibleText(final String text) { executeAndWrapReThrowIfNeeded(new DeselectByVisibleText(text), Context.singular(context, "deselectByVisibleText", null, text), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
java
public FluentSelect deselectByVisibleText(final String text) { executeAndWrapReThrowIfNeeded(new DeselectByVisibleText(text), Context.singular(context, "deselectByVisibleText", null, text), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
[ "public", "FluentSelect", "deselectByVisibleText", "(", "final", "String", "text", ")", "{", "executeAndWrapReThrowIfNeeded", "(", "new", "DeselectByVisibleText", "(", "text", ")", ",", "Context", ".", "singular", "(", "context", ",", "\"deselectByVisibleText\"", ",",...
<p> Deselect all options that display text matching the argument. That is, when given "Bar" this would deselect an option like: </p> &lt;option value="foo"&gt;Bar&lt;/option&gt; @param text The visible text to match against
[ "<p", ">", "Deselect", "all", "options", "that", "display", "text", "matching", "the", "argument", ".", "That", "is", "when", "given", "Bar", "this", "would", "deselect", "an", "option", "like", ":", "<", "/", "p", ">", "&lt", ";", "option", "value", "...
train
https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java#L166-L169
elki-project/elki
elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/distance/similarityfunction/SharedNearestNeighborSimilarityFunction.java
SharedNearestNeighborSimilarityFunction.countSharedNeighbors
static protected int countSharedNeighbors(DBIDs neighbors1, DBIDs neighbors2) { int intersection = 0; DBIDIter iter1 = neighbors1.iter(); DBIDIter iter2 = neighbors2.iter(); while(iter1.valid() && iter2.valid()) { final int comp = DBIDUtil.compare(iter1, iter2); if(comp == 0) { intersection++; iter1.advance(); iter2.advance(); } else if(comp < 0) { iter1.advance(); } else // iter2 < iter1 { iter2.advance(); } } return intersection; }
java
static protected int countSharedNeighbors(DBIDs neighbors1, DBIDs neighbors2) { int intersection = 0; DBIDIter iter1 = neighbors1.iter(); DBIDIter iter2 = neighbors2.iter(); while(iter1.valid() && iter2.valid()) { final int comp = DBIDUtil.compare(iter1, iter2); if(comp == 0) { intersection++; iter1.advance(); iter2.advance(); } else if(comp < 0) { iter1.advance(); } else // iter2 < iter1 { iter2.advance(); } } return intersection; }
[ "static", "protected", "int", "countSharedNeighbors", "(", "DBIDs", "neighbors1", ",", "DBIDs", "neighbors2", ")", "{", "int", "intersection", "=", "0", ";", "DBIDIter", "iter1", "=", "neighbors1", ".", "iter", "(", ")", ";", "DBIDIter", "iter2", "=", "neigh...
Compute the intersection size @param neighbors1 SORTED neighbors of first @param neighbors2 SORTED neighbors of second @return Intersection size
[ "Compute", "the", "intersection", "size" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/distance/similarityfunction/SharedNearestNeighborSimilarityFunction.java#L61-L81
att/AAF
authz/authz-cass/src/main/java/com/att/dao/Cached.java
Cached.startCleansing
public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) { for(CachedDAO<?,?,?> d : dao) { for(int i=0;i<d.segSize;++i) { startCleansing(env, d.table()+i); } } }
java
public static void startCleansing(AuthzEnv env, CachedDAO<?,?,?> ... dao) { for(CachedDAO<?,?,?> d : dao) { for(int i=0;i<d.segSize;++i) { startCleansing(env, d.table()+i); } } }
[ "public", "static", "void", "startCleansing", "(", "AuthzEnv", "env", ",", "CachedDAO", "<", "?", ",", "?", ",", "?", ">", "...", "dao", ")", "{", "for", "(", "CachedDAO", "<", "?", ",", "?", ",", "?", ">", "d", ":", "dao", ")", "{", "for", "("...
Each Cached object has multiple Segments that need cleaning. Derive each, and add to Cleansing Thread @param env @param dao
[ "Each", "Cached", "object", "has", "multiple", "Segments", "that", "need", "cleaning", ".", "Derive", "each", "and", "add", "to", "Cleansing", "Thread" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/Cached.java#L119-L125
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java
StringUtils.ifNotEmptyPrepend
public static String ifNotEmptyPrepend(String chekString, String value) { if (hasText(chekString)) { return chekString+value; } else { return ""; } }
java
public static String ifNotEmptyPrepend(String chekString, String value) { if (hasText(chekString)) { return chekString+value; } else { return ""; } }
[ "public", "static", "String", "ifNotEmptyPrepend", "(", "String", "chekString", ",", "String", "value", ")", "{", "if", "(", "hasText", "(", "chekString", ")", ")", "{", "return", "chekString", "+", "value", ";", "}", "else", "{", "return", "\"\"", ";", ...
<p> If <code>checkString</code> has text, returns checkString+value string. Otherwise empty string was returned </p> @param chekString the chek string @param value the value @return the string
[ "<p", ">", "If", "<code", ">", "checkString<", "/", "code", ">", "has", "text", "returns", "checkString", "+", "value", "string", ".", "Otherwise", "empty", "string", "was", "returned", "<", "/", "p", ">" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java#L267-L273
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.listUsageMetricsNext
public PagedList<PoolUsageMetrics> listUsageMetricsNext(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> response = listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single(); return new PagedList<PoolUsageMetrics>(response.body()) { @Override public Page<PoolUsageMetrics> nextPage(String nextPageLink) { return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<PoolUsageMetrics> listUsageMetricsNext(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> response = listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single(); return new PagedList<PoolUsageMetrics>(response.body()) { @Override public Page<PoolUsageMetrics> nextPage(String nextPageLink) { return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "PoolUsageMetrics", ">", "listUsageMetricsNext", "(", "final", "String", "nextPageLink", ",", "final", "PoolListUsageMetricsNextOptions", "poolListUsageMetricsNextOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolUsageMetrics...
Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. @param nextPageLink The NextLink from the previous successful call to List operation. @param poolListUsageMetricsNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;PoolUsageMetrics&gt; object if successful.
[ "Lists", "the", "usage", "metrics", "aggregated", "by", "pool", "across", "individual", "time", "intervals", "for", "the", "specified", "account", ".", "If", "you", "do", "not", "specify", "a", "$filter", "clause", "including", "a", "poolId", "the", "response"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L3767-L3775
wdtinc/mapbox-vector-tile-java
src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/MvtReader.java
MvtReader.loadMvt
public static JtsMvt loadMvt(InputStream is, GeometryFactory geomFactory, ITagConverter tagConverter) throws IOException { return loadMvt(is, geomFactory, tagConverter, RING_CLASSIFIER_V2_1); }
java
public static JtsMvt loadMvt(InputStream is, GeometryFactory geomFactory, ITagConverter tagConverter) throws IOException { return loadMvt(is, geomFactory, tagConverter, RING_CLASSIFIER_V2_1); }
[ "public", "static", "JtsMvt", "loadMvt", "(", "InputStream", "is", ",", "GeometryFactory", "geomFactory", ",", "ITagConverter", "tagConverter", ")", "throws", "IOException", "{", "return", "loadMvt", "(", "is", ",", "geomFactory", ",", "tagConverter", ",", "RING_C...
Load an MVT to JTS geometries using coordinates. Uses {@code tagConverter} to create user data from feature properties. @param is stream with MVT data @param geomFactory allows for JTS geometry creation @param tagConverter converts MVT feature tags to JTS user data object. @return JTS MVT with geometry in MVT coordinates @throws IOException failure reading MVT from stream @see Geometry @see Geometry#getUserData() @see RingClassifier
[ "Load", "an", "MVT", "to", "JTS", "geometries", "using", "coordinates", ".", "Uses", "{", "@code", "tagConverter", "}", "to", "create", "user", "data", "from", "feature", "properties", "." ]
train
https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/MvtReader.java#L94-L98
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/internal/EvaluateConcordantPairs.java
EvaluateConcordantPairs.countTies
protected int countTies(double[] withinDistances, int[] withinTies) { int wties = 0, running = 1; for(int i = 1; i <= withinDistances.length; ++i) { if(i == withinDistances.length || withinDistances[i - 1] != withinDistances[i]) { for(int j = i - running; j < i; j++) { withinTies[j] = running; } wties += running - 1; running = 1; } else { running++; } } return wties; }
java
protected int countTies(double[] withinDistances, int[] withinTies) { int wties = 0, running = 1; for(int i = 1; i <= withinDistances.length; ++i) { if(i == withinDistances.length || withinDistances[i - 1] != withinDistances[i]) { for(int j = i - running; j < i; j++) { withinTies[j] = running; } wties += running - 1; running = 1; } else { running++; } } return wties; }
[ "protected", "int", "countTies", "(", "double", "[", "]", "withinDistances", ",", "int", "[", "]", "withinTies", ")", "{", "int", "wties", "=", "0", ",", "running", "=", "1", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "withinDistances", ...
Count (and annotate) the number of tied values. @param withinDistances Distances array @param withinTies Output array of tie counts. @return Number of tied values.
[ "Count", "(", "and", "annotate", ")", "the", "number", "of", "tied", "values", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/internal/EvaluateConcordantPairs.java#L223-L238
alkacon/opencms-core
src/org/opencms/module/CmsModuleImportExportHandler.java
CmsModuleImportExportHandler.importData
@Deprecated public void importData(CmsObject cms, String importFile, String importPath, I_CmsReport report) throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException { CmsImportParameters parameters = new CmsImportParameters(importFile, importPath, true); setImportParameters(parameters); importData(cms, report); }
java
@Deprecated public void importData(CmsObject cms, String importFile, String importPath, I_CmsReport report) throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException { CmsImportParameters parameters = new CmsImportParameters(importFile, importPath, true); setImportParameters(parameters); importData(cms, report); }
[ "@", "Deprecated", "public", "void", "importData", "(", "CmsObject", "cms", ",", "String", "importFile", ",", "String", "importPath", ",", "I_CmsReport", "report", ")", "throws", "CmsXmlException", ",", "CmsImportExportException", ",", "CmsRoleViolationException", ","...
@see org.opencms.importexport.I_CmsImportExportHandler#importData(org.opencms.file.CmsObject, java.lang.String, java.lang.String, org.opencms.report.I_CmsReport) @deprecated use {@link #importData(CmsObject, I_CmsReport)} instead
[ "@see", "org", ".", "opencms", ".", "importexport", ".", "I_CmsImportExportHandler#importData", "(", "org", ".", "opencms", ".", "file", ".", "CmsObject", "java", ".", "lang", ".", "String", "java", ".", "lang", ".", "String", "org", ".", "opencms", ".", "...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleImportExportHandler.java#L574-L582
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java
DataServiceVisitorJsBuilder.createMethodBody
void createMethodBody(String classname, ExecutableElement methodElement, List<String> arguments, Writer writer) throws IOException { String methodName = getMethodName(methodElement); boolean ws = isWebsocketDataService(methodElement); String args = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()); String keys = computeKeys(methodElement, arguments); createReturnOcelotPromiseFactory(classname, methodName, ws, args, keys, writer); }
java
void createMethodBody(String classname, ExecutableElement methodElement, List<String> arguments, Writer writer) throws IOException { String methodName = getMethodName(methodElement); boolean ws = isWebsocketDataService(methodElement); String args = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()); String keys = computeKeys(methodElement, arguments); createReturnOcelotPromiseFactory(classname, methodName, ws, args, keys, writer); }
[ "void", "createMethodBody", "(", "String", "classname", ",", "ExecutableElement", "methodElement", ",", "List", "<", "String", ">", "arguments", ",", "Writer", "writer", ")", "throws", "IOException", "{", "String", "methodName", "=", "getMethodName", "(", "methodE...
Create javascript method body @param classname @param methodElement @param arguments @param writer @throws IOException
[ "Create", "javascript", "method", "body" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L186-L192
alkacon/opencms-core
src/org/opencms/workplace/tools/CmsToolManager.java
CmsToolManager.linkForToolPath
public static String linkForToolPath(CmsJspActionElement jsp, String toolPath) { StringBuffer result = new StringBuffer(); result.append(jsp.link(VIEW_JSPPAGE_LOCATION)); result.append('?'); result.append(CmsToolDialog.PARAM_PATH); result.append('='); result.append(CmsEncoder.encode(toolPath)); return result.toString(); }
java
public static String linkForToolPath(CmsJspActionElement jsp, String toolPath) { StringBuffer result = new StringBuffer(); result.append(jsp.link(VIEW_JSPPAGE_LOCATION)); result.append('?'); result.append(CmsToolDialog.PARAM_PATH); result.append('='); result.append(CmsEncoder.encode(toolPath)); return result.toString(); }
[ "public", "static", "String", "linkForToolPath", "(", "CmsJspActionElement", "jsp", ",", "String", "toolPath", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "result", ".", "append", "(", "jsp", ".", "link", "(", "VIEW_JSPPAGE_L...
Returns the OpenCms link for the given tool path which requires no parameters.<p> @param jsp the jsp action element @param toolPath the tool path @return the OpenCms link for the given tool path which requires parameters
[ "Returns", "the", "OpenCms", "link", "for", "the", "given", "tool", "path", "which", "requires", "no", "parameters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L114-L123
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java
MarkLogicRepositoryConnection.prepareUpdate
@Override public MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString, String baseURI) throws RepositoryException, MalformedQueryException { if (QueryLanguage.SPARQL.equals(queryLanguage)) { return new MarkLogicUpdateQuery(this.client, new SPARQLQueryBindingSet(), baseURI, queryString, defaultGraphPerms, defaultQueryDef, defaultRulesets); } throw new UnsupportedQueryLanguageException("Unsupported query language " + queryLanguage.getName()); }
java
@Override public MarkLogicUpdateQuery prepareUpdate(QueryLanguage queryLanguage, String queryString, String baseURI) throws RepositoryException, MalformedQueryException { if (QueryLanguage.SPARQL.equals(queryLanguage)) { return new MarkLogicUpdateQuery(this.client, new SPARQLQueryBindingSet(), baseURI, queryString, defaultGraphPerms, defaultQueryDef, defaultRulesets); } throw new UnsupportedQueryLanguageException("Unsupported query language " + queryLanguage.getName()); }
[ "@", "Override", "public", "MarkLogicUpdateQuery", "prepareUpdate", "(", "QueryLanguage", "queryLanguage", ",", "String", "queryString", ",", "String", "baseURI", ")", "throws", "RepositoryException", ",", "MalformedQueryException", "{", "if", "(", "QueryLanguage", ".",...
base method for prepareUpdate @param queryLanguage @param queryString @param baseURI @return MarkLogicUpdateQuery @throws RepositoryException @throws MalformedQueryException
[ "base", "method", "for", "prepareUpdate" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L445-L451
padrig64/ValidationFramework
validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/TabbedPaneDemo.java
TabbedPaneDemo.createTabContent
private Component createTabContent(CompositeReadableProperty<Boolean> tabResultsProperty) { JPanel panel = new JPanel(); panel.setLayout(new MigLayout("fill, wrap 2", "[][grow, fill]")); for (int i = 0; i < 2; i++) { panel.add(new JLabel("Field " + (i + 1) + ":")); // Create formatted textfield JTextField field = new JTextField(); panel.add(field); field.setColumns(10); field.setText("Value"); // Create field validator tabResultsProperty.addProperty(installFieldValidation(field)); } return panel; }
java
private Component createTabContent(CompositeReadableProperty<Boolean> tabResultsProperty) { JPanel panel = new JPanel(); panel.setLayout(new MigLayout("fill, wrap 2", "[][grow, fill]")); for (int i = 0; i < 2; i++) { panel.add(new JLabel("Field " + (i + 1) + ":")); // Create formatted textfield JTextField field = new JTextField(); panel.add(field); field.setColumns(10); field.setText("Value"); // Create field validator tabResultsProperty.addProperty(installFieldValidation(field)); } return panel; }
[ "private", "Component", "createTabContent", "(", "CompositeReadableProperty", "<", "Boolean", ">", "tabResultsProperty", ")", "{", "JPanel", "panel", "=", "new", "JPanel", "(", ")", ";", "panel", ".", "setLayout", "(", "new", "MigLayout", "(", "\"fill, wrap 2\"", ...
Creates some content to put in a tab in the tabbed pane. @param tabResultsProperty Composite property to put the tab-wise result into. @return Component representing the tab content and to be added to the tabbed pane.
[ "Creates", "some", "content", "to", "put", "in", "a", "tab", "in", "the", "tabbed", "pane", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-demo/src/main/java/com/google/code/validationframework/demo/swing/TabbedPaneDemo.java#L157-L175
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/WatcherDelegate.java
WatcherDelegate.createWatchingException
public static WatchingException createWatchingException(InvocationTargetException exception, File file) { Throwable cause = exception.getTargetException(); if (WatchingException.class.getName().equals(exception.getTargetException().getClass().getName())) { try { Method line = cause.getClass().getMethod("getLine"); Method character = cause.getClass().getMethod("getCharacter"); Method source = cause.getClass().getMethod("getFile"); Method title = cause.getClass().getMethod("getTitle"); return new WatchingException( (String) title.invoke(cause), cause.getMessage(), (File) source.invoke(cause), (Integer) line.invoke(cause), (Integer) character.invoke(cause), cause.getCause()); } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw new IllegalArgumentException("Cannot create the watching exception from " + cause); } } else { return new WatchingException(cause.getMessage(), file, cause); } }
java
public static WatchingException createWatchingException(InvocationTargetException exception, File file) { Throwable cause = exception.getTargetException(); if (WatchingException.class.getName().equals(exception.getTargetException().getClass().getName())) { try { Method line = cause.getClass().getMethod("getLine"); Method character = cause.getClass().getMethod("getCharacter"); Method source = cause.getClass().getMethod("getFile"); Method title = cause.getClass().getMethod("getTitle"); return new WatchingException( (String) title.invoke(cause), cause.getMessage(), (File) source.invoke(cause), (Integer) line.invoke(cause), (Integer) character.invoke(cause), cause.getCause()); } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw new IllegalArgumentException("Cannot create the watching exception from " + cause); } } else { return new WatchingException(cause.getMessage(), file, cause); } }
[ "public", "static", "WatchingException", "createWatchingException", "(", "InvocationTargetException", "exception", ",", "File", "file", ")", "{", "Throwable", "cause", "=", "exception", ".", "getTargetException", "(", ")", ";", "if", "(", "WatchingException", ".", "...
Even {@link org.wisdom.maven.WatchingException} cannot be used directly, so we need to use reflection to recreate the exception with the same content. <p> This method checks if the cause of the {@link java.lang.reflect .InvocationTargetException} is a {@link org.wisdom.maven.WatchingException}, in this case if create an exception with the same content. Otherwise it creates a new {@link org.wisdom.maven .WatchingException} from the given exception's cause. @param exception the invocation target exception caught by the delegate @param file the file having thrown the exception (the processed file). @return a Watching Exception containing the content from the given exception if possible or a new exception from the {@literal exception}'s cause.
[ "Even", "{", "@link", "org", ".", "wisdom", ".", "maven", ".", "WatchingException", "}", "cannot", "be", "used", "directly", "so", "we", "need", "to", "use", "reflection", "to", "recreate", "the", "exception", "with", "the", "same", "content", ".", "<p", ...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/pipeline/WatcherDelegate.java#L102-L124
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java
SeaGlassTabbedPaneUI.paintContentBorder
protected void paintContentBorder(SeaGlassContext ss, Graphics g, int tabPlacement, int selectedIndex) { int width = tabPane.getWidth(); int height = tabPane.getHeight(); Insets insets = tabPane.getInsets(); int x = insets.left; int y = insets.top; int w = width - insets.right - insets.left; int h = height - insets.top - insets.bottom; switch (tabPlacement) { case LEFT: x += calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); w -= (x - insets.left); break; case RIGHT: w -= calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); break; case BOTTOM: h -= calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); break; case TOP: default: y += calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); h -= (y - insets.top); } SeaGlassLookAndFeel.updateSubregion(ss, g, new Rectangle(x, y, w, h)); ss.getPainter().paintTabbedPaneContentBackground(ss, g, x, y, w, h); ss.getPainter().paintTabbedPaneContentBorder(ss, g, x, y, w, h); }
java
protected void paintContentBorder(SeaGlassContext ss, Graphics g, int tabPlacement, int selectedIndex) { int width = tabPane.getWidth(); int height = tabPane.getHeight(); Insets insets = tabPane.getInsets(); int x = insets.left; int y = insets.top; int w = width - insets.right - insets.left; int h = height - insets.top - insets.bottom; switch (tabPlacement) { case LEFT: x += calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); w -= (x - insets.left); break; case RIGHT: w -= calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth); break; case BOTTOM: h -= calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); break; case TOP: default: y += calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight); h -= (y - insets.top); } SeaGlassLookAndFeel.updateSubregion(ss, g, new Rectangle(x, y, w, h)); ss.getPainter().paintTabbedPaneContentBackground(ss, g, x, y, w, h); ss.getPainter().paintTabbedPaneContentBorder(ss, g, x, y, w, h); }
[ "protected", "void", "paintContentBorder", "(", "SeaGlassContext", "ss", ",", "Graphics", "g", ",", "int", "tabPlacement", ",", "int", "selectedIndex", ")", "{", "int", "width", "=", "tabPane", ".", "getWidth", "(", ")", ";", "int", "height", "=", "tabPane",...
Paint the content pane's border. @param ss the SynthContext. @param g the Graphics context. @param tabPlacement the side the tabs are on. @param selectedIndex the current selected tab index.
[ "Paint", "the", "content", "pane", "s", "border", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java#L913-L947
Omertron/api-omdb
src/main/java/com/omertron/omdbapi/tools/OmdbBuilder.java
OmdbBuilder.setSearchTerm
public OmdbBuilder setSearchTerm(final String searchTerm) throws OMDBException { if (StringUtils.isBlank(searchTerm)) { throw new OMDBException(ApiExceptionType.UNKNOWN_CAUSE, "Must provide a search term!"); } params.add(Param.SEARCH, searchTerm); return this; }
java
public OmdbBuilder setSearchTerm(final String searchTerm) throws OMDBException { if (StringUtils.isBlank(searchTerm)) { throw new OMDBException(ApiExceptionType.UNKNOWN_CAUSE, "Must provide a search term!"); } params.add(Param.SEARCH, searchTerm); return this; }
[ "public", "OmdbBuilder", "setSearchTerm", "(", "final", "String", "searchTerm", ")", "throws", "OMDBException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "searchTerm", ")", ")", "{", "throw", "new", "OMDBException", "(", "ApiExceptionType", ".", "UNKNO...
Set the search term @param searchTerm The text to build for @return @throws com.omertron.omdbapi.OMDBException
[ "Set", "the", "search", "term" ]
train
https://github.com/Omertron/api-omdb/blob/acb506ded2d7b8a4159b48161ffab8cb5b7bad44/src/main/java/com/omertron/omdbapi/tools/OmdbBuilder.java#L59-L65
CloudSlang/cs-actions
cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/C3P0PooledDataSourceProvider.java
C3P0PooledDataSourceProvider.openPooledDataSource
public DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword) throws SQLException { final DataSource unPooledDS = DataSources.unpooledDataSource(aDbUrl, aUsername, aPassword); //override the default properties with ours final Map<String, String> props = this.getPoolingProperties(aDbType); return DataSources.pooledDataSource(unPooledDS, props); }
java
public DataSource openPooledDataSource(DBType aDbType, String aDbUrl, String aUsername, String aPassword) throws SQLException { final DataSource unPooledDS = DataSources.unpooledDataSource(aDbUrl, aUsername, aPassword); //override the default properties with ours final Map<String, String> props = this.getPoolingProperties(aDbType); return DataSources.pooledDataSource(unPooledDS, props); }
[ "public", "DataSource", "openPooledDataSource", "(", "DBType", "aDbType", ",", "String", "aDbUrl", ",", "String", "aUsername", ",", "String", "aPassword", ")", "throws", "SQLException", "{", "final", "DataSource", "unPooledDS", "=", "DataSources", ".", "unpooledData...
get the pooled datasource from c3p0 pool @param aDbType a supported database type. @param aDbUrl a connection url @param aUsername a username for the database @param aPassword a password for the database connection @return a DataSource a pooled data source @throws SQLException
[ "get", "the", "pooled", "datasource", "from", "c3p0", "pool" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/C3P0PooledDataSourceProvider.java#L111-L120
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.removeAlias
public String removeAlias(String indice,String alias){ String removeAlias = new StringBuilder().append("{\"actions\": [{\"remove\": {\"index\":\"").append(indice).append("\",\"alias\": \"").append(alias).append("\"}}]}").toString(); return this.client.executeHttp("_aliases",removeAlias,ClientUtil.HTTP_POST); }
java
public String removeAlias(String indice,String alias){ String removeAlias = new StringBuilder().append("{\"actions\": [{\"remove\": {\"index\":\"").append(indice).append("\",\"alias\": \"").append(alias).append("\"}}]}").toString(); return this.client.executeHttp("_aliases",removeAlias,ClientUtil.HTTP_POST); }
[ "public", "String", "removeAlias", "(", "String", "indice", ",", "String", "alias", ")", "{", "String", "removeAlias", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"{\\\"actions\\\": [{\\\"remove\\\": {\\\"index\\\":\\\"\"", ")", ".", "append", "(", ...
removing that same alias [alias] of [indice] more detail see : * https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html @param indice @param alias @return
[ "removing", "that", "same", "alias", "[", "alias", "]", "of", "[", "indice", "]", "more", "detail", "see", ":", "*", "https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current"...
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L3513-L3516
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/EnumParse.java
EnumParse.enumWithRawValue
public static <T extends Enum & ParsableEnum> T enumWithRawValue(Class<T> enumClass, int value) throws NoEnumFoundException { for (Object oneEnumRaw : EnumSet.allOf(enumClass)) { // This is an awkward hack: we _know_ T oneEnumRaw is of type T, since allOf(TClass) // only returns T-type enums, but allOf doesn't guarantee this //noinspection unchecked T oneEnum = (T) oneEnumRaw; if (value == oneEnum.getRawValue()) { return oneEnum; } } throw new NoEnumFoundException(String.format( "No enum found for class %s with raw value %d", enumClass.getName(), value)); }
java
public static <T extends Enum & ParsableEnum> T enumWithRawValue(Class<T> enumClass, int value) throws NoEnumFoundException { for (Object oneEnumRaw : EnumSet.allOf(enumClass)) { // This is an awkward hack: we _know_ T oneEnumRaw is of type T, since allOf(TClass) // only returns T-type enums, but allOf doesn't guarantee this //noinspection unchecked T oneEnum = (T) oneEnumRaw; if (value == oneEnum.getRawValue()) { return oneEnum; } } throw new NoEnumFoundException(String.format( "No enum found for class %s with raw value %d", enumClass.getName(), value)); }
[ "public", "static", "<", "T", "extends", "Enum", "&", "ParsableEnum", ">", "T", "enumWithRawValue", "(", "Class", "<", "T", ">", "enumClass", ",", "int", "value", ")", "throws", "NoEnumFoundException", "{", "for", "(", "Object", "oneEnumRaw", ":", "EnumSet",...
Retrieve the enum of a given type from a given raw value. Enums must implement the {@link com.punchthrough.bean.sdk.internal.utility.EnumParse.ParsableEnum} interface to ensure they have a {@link com.punchthrough.bean.sdk.internal.utility.EnumParse.ParsableEnum#getRawValue()} method. <a href="http://stackoverflow.com/a/16406386/254187">Based on this StackOverflow answer.</a> @param enumClass The class of the enum type being parsed, e.g. <code>BeanState.class</code> @param value The raw int value of the enum to be retrieved @param <T> The enum type being parsed @return The enum value with the given raw value @throws com.punchthrough.bean.sdk.internal.exception.NoEnumFoundException if the given enum type has no enum value with a raw value matching the given value
[ "Retrieve", "the", "enum", "of", "a", "given", "type", "from", "a", "given", "raw", "value", ".", "Enums", "must", "implement", "the", "{", "@link", "com", ".", "punchthrough", ".", "bean", ".", "sdk", ".", "internal", ".", "utility", ".", "EnumParse", ...
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/EnumParse.java#L33-L48
cdk/cdk
storage/ctab/src/main/java/org/openscience/cdk/io/MDLRXNWriter.java
MDLRXNWriter.formatMDLInt
private String formatMDLInt(int i, int l) { String s = "", fs = ""; NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH); nf.setParseIntegerOnly(true); nf.setMinimumIntegerDigits(1); nf.setMaximumIntegerDigits(l); nf.setGroupingUsed(false); s = nf.format(i); l = l - s.length(); for (int f = 0; f < l; f++) fs += " "; fs += s; return fs; }
java
private String formatMDLInt(int i, int l) { String s = "", fs = ""; NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH); nf.setParseIntegerOnly(true); nf.setMinimumIntegerDigits(1); nf.setMaximumIntegerDigits(l); nf.setGroupingUsed(false); s = nf.format(i); l = l - s.length(); for (int f = 0; f < l; f++) fs += " "; fs += s; return fs; }
[ "private", "String", "formatMDLInt", "(", "int", "i", ",", "int", "l", ")", "{", "String", "s", "=", "\"\"", ",", "fs", "=", "\"\"", ";", "NumberFormat", "nf", "=", "NumberFormat", ".", "getNumberInstance", "(", "Locale", ".", "ENGLISH", ")", ";", "nf"...
Formats an int to fit into the connectiontable and changes it to a String. @param i The int to be formated @param l Length of the String @return The String to be written into the connectiontable
[ "Formats", "an", "int", "to", "fit", "into", "the", "connectiontable", "and", "changes", "it", "to", "a", "String", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/ctab/src/main/java/org/openscience/cdk/io/MDLRXNWriter.java#L310-L323
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/ServerHelper.java
ServerHelper.shutdownStandalone
public static void shutdownStandalone(final ModelControllerClient client, final int timeout) throws IOException { final ModelNode op = Operations.createOperation("shutdown"); op.get("timeout").set(timeout); final ModelNode response = client.execute(op); if (Operations.isSuccessfulOutcome(response)) { while (true) { if (isStandaloneRunning(client)) { try { TimeUnit.MILLISECONDS.sleep(20L); } catch (InterruptedException e) { LOGGER.trace("Interrupted during sleep", e); } } else { break; } } } else { throw new OperationExecutionException(op, response); } }
java
public static void shutdownStandalone(final ModelControllerClient client, final int timeout) throws IOException { final ModelNode op = Operations.createOperation("shutdown"); op.get("timeout").set(timeout); final ModelNode response = client.execute(op); if (Operations.isSuccessfulOutcome(response)) { while (true) { if (isStandaloneRunning(client)) { try { TimeUnit.MILLISECONDS.sleep(20L); } catch (InterruptedException e) { LOGGER.trace("Interrupted during sleep", e); } } else { break; } } } else { throw new OperationExecutionException(op, response); } }
[ "public", "static", "void", "shutdownStandalone", "(", "final", "ModelControllerClient", "client", ",", "final", "int", "timeout", ")", "throws", "IOException", "{", "final", "ModelNode", "op", "=", "Operations", ".", "createOperation", "(", "\"shutdown\"", ")", "...
Shuts down a standalone server. @param client the client used to communicate with the server @param timeout the graceful shutdown timeout, a value of {@code -1} will wait indefinitely and a value of {@code 0} will not attempt a graceful shutdown @throws IOException if an error occurs communicating with the server
[ "Shuts", "down", "a", "standalone", "server", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/ServerHelper.java#L372-L391
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.parseObject
@Override public Object parseObject(String source, ParsePosition pos) { if (!msgPattern.hasNamedArguments()) { return parse(source, pos); } else { return parseToMap(source, pos); } }
java
@Override public Object parseObject(String source, ParsePosition pos) { if (!msgPattern.hasNamedArguments()) { return parse(source, pos); } else { return parseToMap(source, pos); } }
[ "@", "Override", "public", "Object", "parseObject", "(", "String", "source", ",", "ParsePosition", "pos", ")", "{", "if", "(", "!", "msgPattern", ".", "hasNamedArguments", "(", ")", ")", "{", "return", "parse", "(", "source", ",", "pos", ")", ";", "}", ...
Parses text from a string to produce an object array or Map. <p> The method attempts to parse text starting at the index given by <code>pos</code>. If parsing succeeds, then the index of <code>pos</code> is updated to the index after the last character used (parsing does not necessarily use all characters up to the end of the string), and the parsed object array is returned. The updated <code>pos</code> can be used to indicate the starting point for the next call to this method. If an error occurs, then the index of <code>pos</code> is not changed, the error index of <code>pos</code> is set to the index of the character where the error occurred, and null is returned. <p> See the {@link #parse(String, ParsePosition)} method for more information on message parsing. @param source A <code>String</code>, part of which should be parsed. @param pos A <code>ParsePosition</code> object with index and error index information as described above. @return An <code>Object</code> parsed from the string, either an array of Object, or a Map, depending on whether named arguments are used. This can be queried using <code>usesNamedArguments</code>. In case of error, returns null. @throws NullPointerException if <code>pos</code> is null.
[ "Parses", "text", "from", "a", "string", "to", "produce", "an", "object", "array", "or", "Map", ".", "<p", ">", "The", "method", "attempts", "to", "parse", "text", "starting", "at", "the", "index", "given", "by", "<code", ">", "pos<", "/", "code", ">",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L1379-L1386
OpenLiberty/open-liberty
dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceInjectionBinding.java
ResourceInjectionBinding.setEnvEntryType
public void setEnvEntryType(ResourceImpl annotation, Object type) // F743-32443 throws InjectionException { if (type instanceof String) { setInjectionClassTypeName((String) type); } else { Class<?> classType = (Class<?>) type; annotation.ivType = classType; annotation.ivIsSetType = true; setInjectionClassType(classType); } }
java
public void setEnvEntryType(ResourceImpl annotation, Object type) // F743-32443 throws InjectionException { if (type instanceof String) { setInjectionClassTypeName((String) type); } else { Class<?> classType = (Class<?>) type; annotation.ivType = classType; annotation.ivIsSetType = true; setInjectionClassType(classType); } }
[ "public", "void", "setEnvEntryType", "(", "ResourceImpl", "annotation", ",", "Object", "type", ")", "// F743-32443", "throws", "InjectionException", "{", "if", "(", "type", "instanceof", "String", ")", "{", "setInjectionClassTypeName", "(", "(", "String", ")", "ty...
Sets the type of this binding. @param annotation the merged data @param type a type object returned from {@link #getEnvEntryType}
[ "Sets", "the", "type", "of", "this", "binding", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceInjectionBinding.java#L1718-L1732
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/util/NodeModelUtils.java
NodeModelUtils.compactDump
public static String compactDump(INode node, boolean showHidden) { StringBuilder result = new StringBuilder(); try { compactDump(node, showHidden, "", result); } catch (IOException e) { return e.getMessage(); } return result.toString(); }
java
public static String compactDump(INode node, boolean showHidden) { StringBuilder result = new StringBuilder(); try { compactDump(node, showHidden, "", result); } catch (IOException e) { return e.getMessage(); } return result.toString(); }
[ "public", "static", "String", "compactDump", "(", "INode", "node", ",", "boolean", "showHidden", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "compactDump", "(", "node", ",", "showHidden", ",", "\"\"", ",", "...
Creates a string representation of the given node. Useful for debugging. @return a debug string for the given node.
[ "Creates", "a", "string", "representation", "of", "the", "given", "node", ".", "Useful", "for", "debugging", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/util/NodeModelUtils.java#L341-L349
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java
RPUtils.queryAll
public static INDArray queryAll(INDArray toQuery,INDArray X,List<RPTree> trees,int n,String similarityFunction) { if(trees.isEmpty()) { throw new ND4JIllegalArgumentException("Trees is empty!"); } List<Integer> candidates = getCandidates(toQuery, trees,similarityFunction); val sortedCandidates = sortCandidates(toQuery,X,candidates,similarityFunction); int numReturns = Math.min(n,sortedCandidates.size()); INDArray result = Nd4j.create(numReturns); for(int i = 0; i < numReturns; i++) { result.putScalar(i,sortedCandidates.get(i).getSecond()); } return result; }
java
public static INDArray queryAll(INDArray toQuery,INDArray X,List<RPTree> trees,int n,String similarityFunction) { if(trees.isEmpty()) { throw new ND4JIllegalArgumentException("Trees is empty!"); } List<Integer> candidates = getCandidates(toQuery, trees,similarityFunction); val sortedCandidates = sortCandidates(toQuery,X,candidates,similarityFunction); int numReturns = Math.min(n,sortedCandidates.size()); INDArray result = Nd4j.create(numReturns); for(int i = 0; i < numReturns; i++) { result.putScalar(i,sortedCandidates.get(i).getSecond()); } return result; }
[ "public", "static", "INDArray", "queryAll", "(", "INDArray", "toQuery", ",", "INDArray", "X", ",", "List", "<", "RPTree", ">", "trees", ",", "int", "n", ",", "String", "similarityFunction", ")", "{", "if", "(", "trees", ".", "isEmpty", "(", ")", ")", "...
Query all trees using the given input and data @param toQuery the query vector @param X the input data to query @param trees the trees to query @param n the number of results to search for @param similarityFunction the similarity function to use @return the indices (in order) in the ndarray
[ "Query", "all", "trees", "using", "the", "given", "input", "and", "data" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L170-L186
looly/hutool
hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java
InternalJSONUtil.propertyPut
protected static JSONObject propertyPut(JSONObject jsonObject, Object key, Object value) { String keyStr = Convert.toStr(key); String[] path = StrUtil.split(keyStr, StrUtil.DOT); int last = path.length - 1; JSONObject target = jsonObject; for (int i = 0; i < last; i += 1) { String segment = path[i]; JSONObject nextTarget = target.getJSONObject(segment); if (nextTarget == null) { nextTarget = new JSONObject(); target.put(segment, nextTarget); } target = nextTarget; } target.put(path[last], value); return jsonObject; }
java
protected static JSONObject propertyPut(JSONObject jsonObject, Object key, Object value) { String keyStr = Convert.toStr(key); String[] path = StrUtil.split(keyStr, StrUtil.DOT); int last = path.length - 1; JSONObject target = jsonObject; for (int i = 0; i < last; i += 1) { String segment = path[i]; JSONObject nextTarget = target.getJSONObject(segment); if (nextTarget == null) { nextTarget = new JSONObject(); target.put(segment, nextTarget); } target = nextTarget; } target.put(path[last], value); return jsonObject; }
[ "protected", "static", "JSONObject", "propertyPut", "(", "JSONObject", "jsonObject", ",", "Object", "key", ",", "Object", "value", ")", "{", "String", "keyStr", "=", "Convert", ".", "toStr", "(", "key", ")", ";", "String", "[", "]", "path", "=", "StrUtil",...
将Property的键转化为JSON形式<br> 用于识别类似于:com.luxiaolei.package.hutool这类用点隔开的键 @param jsonObject JSONObject @param key 键 @param value 值 @return JSONObject
[ "将Property的键转化为JSON形式<br", ">", "用于识别类似于:com", ".", "luxiaolei", ".", "package", ".", "hutool这类用点隔开的键" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java#L191-L207
alkacon/opencms-core
src/org/opencms/cache/CmsVfsMemoryObjectCache.java
CmsVfsMemoryObjectCache.getCacheKey
private String getCacheKey(String systemId, boolean online) { if (online) { return "online_(" + m_id + ")_" + systemId; } return "offline_(" + m_id + ")_" + systemId; }
java
private String getCacheKey(String systemId, boolean online) { if (online) { return "online_(" + m_id + ")_" + systemId; } return "offline_(" + m_id + ")_" + systemId; }
[ "private", "String", "getCacheKey", "(", "String", "systemId", ",", "boolean", "online", ")", "{", "if", "(", "online", ")", "{", "return", "\"online_(\"", "+", "m_id", "+", "\")_\"", "+", "systemId", ";", "}", "return", "\"offline_(\"", "+", "m_id", "+", ...
Returns a cache key for the given system id (filename) based on the status of the given project flag.<p> @param systemId the system id (filename) to get the cache key for @param online indicates if this key is generated for the online project @return the cache key for the system id
[ "Returns", "a", "cache", "key", "for", "the", "given", "system", "id", "(", "filename", ")", "based", "on", "the", "status", "of", "the", "given", "project", "flag", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsMemoryObjectCache.java#L155-L161
primefaces/primefaces
src/main/java/org/primefaces/component/picklist/PickList.java
PickList.checkDisabled
protected void checkDisabled(FacesContext facesContext, String label, List<?> newEntries, List<?> oldEntries) { if (!isValid()) { return; } Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap(); String varName = getVar(); String clientId = getClientId(facesContext); Object originalItem = requestMap.get(varName); for (int i = 0; i < newEntries.size(); i++) { Object item = newEntries.get(i); // Set the current item in request map to get its properties via stateHelper().eval() call requestMap.put(varName, item); boolean itemDisabled = isItemDisabled(); // Check if disabled item has been moved from its former/original list if (itemDisabled && !oldEntries.contains(item)) { FacesMessage message = MessageFactory.getMessage(UPDATE_MESSAGE_ID, FacesMessage.SEVERITY_ERROR, new Object[] {label}); facesContext.addMessage(clientId, message); setValid(false); break; } } // put the original value back requestMap.put(varName, originalItem); }
java
protected void checkDisabled(FacesContext facesContext, String label, List<?> newEntries, List<?> oldEntries) { if (!isValid()) { return; } Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap(); String varName = getVar(); String clientId = getClientId(facesContext); Object originalItem = requestMap.get(varName); for (int i = 0; i < newEntries.size(); i++) { Object item = newEntries.get(i); // Set the current item in request map to get its properties via stateHelper().eval() call requestMap.put(varName, item); boolean itemDisabled = isItemDisabled(); // Check if disabled item has been moved from its former/original list if (itemDisabled && !oldEntries.contains(item)) { FacesMessage message = MessageFactory.getMessage(UPDATE_MESSAGE_ID, FacesMessage.SEVERITY_ERROR, new Object[] {label}); facesContext.addMessage(clientId, message); setValid(false); break; } } // put the original value back requestMap.put(varName, originalItem); }
[ "protected", "void", "checkDisabled", "(", "FacesContext", "facesContext", ",", "String", "label", ",", "List", "<", "?", ">", "newEntries", ",", "List", "<", "?", ">", "oldEntries", ")", "{", "if", "(", "!", "isValid", "(", ")", ")", "{", "return", ";...
Prohibits client-side manipulation of disabled entries, when CSS style-class ui-state-disabled is removed. See <a href="https://github.com/primefaces/primefaces/issues/2127">https://github.com/primefaces/primefaces/issues/2127</a> @param newEntries new/set entries of model source/target list @param oldEntries old/former entries of model source/target list
[ "Prohibits", "client", "-", "side", "manipulation", "of", "disabled", "entries", "when", "CSS", "style", "-", "class", "ui", "-", "state", "-", "disabled", "is", "removed", ".", "See", "<a", "href", "=", "https", ":", "//", "github", ".", "com", "/", "...
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/component/picklist/PickList.java#L151-L177
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java
BaseBigtableTableAdminClient.createTable
public final Table createTable(InstanceName parent, String tableId, Table table) { CreateTableRequest request = CreateTableRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setTableId(tableId) .setTable(table) .build(); return createTable(request); }
java
public final Table createTable(InstanceName parent, String tableId, Table table) { CreateTableRequest request = CreateTableRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setTableId(tableId) .setTable(table) .build(); return createTable(request); }
[ "public", "final", "Table", "createTable", "(", "InstanceName", "parent", ",", "String", "tableId", ",", "Table", "table", ")", "{", "CreateTableRequest", "request", "=", "CreateTableRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", ...
Creates a new table in the specified instance. The table can be created with a full set of initial column families, specified in the request. <p>Sample code: <pre><code> try (BaseBigtableTableAdminClient baseBigtableTableAdminClient = BaseBigtableTableAdminClient.create()) { InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]"); String tableId = ""; Table table = Table.newBuilder().build(); Table response = baseBigtableTableAdminClient.createTable(parent, tableId, table); } </code></pre> @param parent The unique name of the instance in which to create the table. Values are of the form `projects/&lt;project&gt;/instances/&lt;instance&gt;`. @param tableId The name by which the new table should be referred to within the parent instance, e.g., `foobar` rather than `&lt;parent&gt;/tables/foobar`. @param table The Table to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "table", "in", "the", "specified", "instance", ".", "The", "table", "can", "be", "created", "with", "a", "full", "set", "of", "initial", "column", "families", "specified", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BaseBigtableTableAdminClient.java#L160-L169
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.getSnippet
public Snippet getSnippet(Object projectIdOrPath, Integer snippetId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); return (response.readEntity(Snippet.class)); }
java
public Snippet getSnippet(Object projectIdOrPath, Integer snippetId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); return (response.readEntity(Snippet.class)); }
[ "public", "Snippet", "getSnippet", "(", "Object", "projectIdOrPath", ",", "Integer", "snippetId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "g...
Get a single of project snippet. <pre><code>GET /projects/:id/snippets/:snippet_id</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param snippetId the ID of the project's snippet @return the specified project Snippet @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "of", "project", "snippet", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L1946-L1949
apache/incubator-heron
heron/spi/src/java/org/apache/heron/spi/packing/Resource.java
Resource.subtractAbsolute
public Resource subtractAbsolute(Resource other) { double cpuDifference = this.getCpu() - other.getCpu(); double extraCpu = Math.max(0, cpuDifference); ByteAmount ramDifference = this.getRam().minus(other.getRam()); ByteAmount extraRam = ByteAmount.ZERO.max(ramDifference); ByteAmount diskDifference = this.getDisk().minus(other.getDisk()); ByteAmount extraDisk = ByteAmount.ZERO.max(diskDifference); return new Resource(extraCpu, extraRam, extraDisk); }
java
public Resource subtractAbsolute(Resource other) { double cpuDifference = this.getCpu() - other.getCpu(); double extraCpu = Math.max(0, cpuDifference); ByteAmount ramDifference = this.getRam().minus(other.getRam()); ByteAmount extraRam = ByteAmount.ZERO.max(ramDifference); ByteAmount diskDifference = this.getDisk().minus(other.getDisk()); ByteAmount extraDisk = ByteAmount.ZERO.max(diskDifference); return new Resource(extraCpu, extraRam, extraDisk); }
[ "public", "Resource", "subtractAbsolute", "(", "Resource", "other", ")", "{", "double", "cpuDifference", "=", "this", ".", "getCpu", "(", ")", "-", "other", ".", "getCpu", "(", ")", ";", "double", "extraCpu", "=", "Math", ".", "max", "(", "0", ",", "cp...
Subtracts a given resource from the current resource. The results is never negative.
[ "Subtracts", "a", "given", "resource", "from", "the", "current", "resource", ".", "The", "results", "is", "never", "negative", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/packing/Resource.java#L80-L88
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/fastzipfilereader/ZipFileSliceReader.java
ZipFileSliceReader.getLong
static long getLong(final byte[] arr, final long off) throws IOException { final int ioff = (int) off; if (ioff < 0 || ioff > arr.length - 8) { throw new IndexOutOfBoundsException(); } return ((arr[ioff + 7] & 0xffL) << 56) // | ((arr[ioff + 6] & 0xffL) << 48) // | ((arr[ioff + 5] & 0xffL) << 40) // | ((arr[ioff + 4] & 0xffL) << 32) // | ((arr[ioff + 3] & 0xffL) << 24) // | ((arr[ioff + 2] & 0xffL) << 16) // | ((arr[ioff + 1] & 0xffL) << 8) // | (arr[ioff] & 0xffL); }
java
static long getLong(final byte[] arr, final long off) throws IOException { final int ioff = (int) off; if (ioff < 0 || ioff > arr.length - 8) { throw new IndexOutOfBoundsException(); } return ((arr[ioff + 7] & 0xffL) << 56) // | ((arr[ioff + 6] & 0xffL) << 48) // | ((arr[ioff + 5] & 0xffL) << 40) // | ((arr[ioff + 4] & 0xffL) << 32) // | ((arr[ioff + 3] & 0xffL) << 24) // | ((arr[ioff + 2] & 0xffL) << 16) // | ((arr[ioff + 1] & 0xffL) << 8) // | (arr[ioff] & 0xffL); }
[ "static", "long", "getLong", "(", "final", "byte", "[", "]", "arr", ",", "final", "long", "off", ")", "throws", "IOException", "{", "final", "int", "ioff", "=", "(", "int", ")", "off", ";", "if", "(", "ioff", "<", "0", "||", "ioff", ">", "arr", "...
Get a long from a byte array. @param arr the byte array @param off the offset to start reading from @return the long @throws IOException if an I/O exception occurs.
[ "Get", "a", "long", "from", "a", "byte", "array", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/fastzipfilereader/ZipFileSliceReader.java#L240-L253
JoeKerouac/utils
src/main/java/com/joe/utils/reflect/ReflectUtil.java
ReflectUtil.getFieldValue
public static <T extends Object> T getFieldValue(Object obj, String fieldName) { Assert.notNull(obj, "obj不能为空"); Assert.notNull(fieldName, "fieldName不能为空"); Field field; if (obj instanceof Class) { field = getField((Class) obj, fieldName); } else { field = getField(obj.getClass(), fieldName); } return getFieldValue(obj, field); }
java
public static <T extends Object> T getFieldValue(Object obj, String fieldName) { Assert.notNull(obj, "obj不能为空"); Assert.notNull(fieldName, "fieldName不能为空"); Field field; if (obj instanceof Class) { field = getField((Class) obj, fieldName); } else { field = getField(obj.getClass(), fieldName); } return getFieldValue(obj, field); }
[ "public", "static", "<", "T", "extends", "Object", ">", "T", "getFieldValue", "(", "Object", "obj", ",", "String", "fieldName", ")", "{", "Assert", ".", "notNull", "(", "obj", ",", "\"obj不能为空\");", "", "", "Assert", ".", "notNull", "(", "fieldName", ",",...
获取指定对象中指定字段名对应的字段的值 @param obj 对象,如果要获取的字段是静态字段那么需要传入Class @param fieldName 字段名 @param <T> 字段类型 @return 指定对象中指定字段名对应字段的值
[ "获取指定对象中指定字段名对应的字段的值" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/ReflectUtil.java#L302-L314
googleapis/google-cloud-java
google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/ProfileServiceClient.java
ProfileServiceClient.createProfile
public final Profile createProfile(String parent, Profile profile) { CreateProfileRequest request = CreateProfileRequest.newBuilder().setParent(parent).setProfile(profile).build(); return createProfile(request); }
java
public final Profile createProfile(String parent, Profile profile) { CreateProfileRequest request = CreateProfileRequest.newBuilder().setParent(parent).setProfile(profile).build(); return createProfile(request); }
[ "public", "final", "Profile", "createProfile", "(", "String", "parent", ",", "Profile", "profile", ")", "{", "CreateProfileRequest", "request", "=", "CreateProfileRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setProfile", "("...
Creates and returns a new profile. <p>Sample code: <pre><code> try (ProfileServiceClient profileServiceClient = ProfileServiceClient.create()) { TenantName parent = TenantName.of("[PROJECT]", "[TENANT]"); Profile profile = Profile.newBuilder().build(); Profile response = profileServiceClient.createProfile(parent.toString(), profile); } </code></pre> @param parent Required. <p>The name of the tenant this profile belongs to. <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenants/foo". @param profile Required. <p>The profile to be created. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "and", "returns", "a", "new", "profile", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/ProfileServiceClient.java#L349-L354
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.waitFor
public <V> V waitFor(final Function<? super WebDriver, V> function) { return newWebDriverWait().until(function); }
java
public <V> V waitFor(final Function<? super WebDriver, V> function) { return newWebDriverWait().until(function); }
[ "public", "<", "V", ">", "V", "waitFor", "(", "final", "Function", "<", "?", "super", "WebDriver", ",", "V", ">", "function", ")", "{", "return", "newWebDriverWait", "(", ")", ".", "until", "(", "function", ")", ";", "}" ]
Repeatedly applies the current {@link WebDriver} instance to the specified function until one of the following occurs: <ol> <li>the function returns neither null nor false,</li> <li>the function throws an unignored exception,</li> <li>the timeout expires, <li>the current thread is interrupted</li> </ol> @param function the function @param <V> the function's expected return type @return the function's return value if the function returned something different from null or false before the timeout expired @throws TimeoutException if the timeout expires.
[ "Repeatedly", "applies", "the", "current", "{", "@link", "WebDriver", "}", "instance", "to", "the", "specified", "function", "until", "one", "of", "the", "following", "occurs", ":", "<ol", ">", "<li", ">", "the", "function", "returns", "neither", "null", "no...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L281-L283
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java
XPathParser.parseQuantifiedExpr
private void parseQuantifiedExpr() throws TTXPathException { // identify quantifier type final boolean isSome = is("some", true); if (!isSome) { consume("every", true); } // count number of variables int varNo = 0; do { // parse variable name consume(TokenType.DOLLAR, true); final String varName = parseVarName(); consume("in", true); varNo++; parseExprSingle(); mPipeBuilder.addVariableExpr(getTransaction(), varName); } while (is(TokenType.COMMA, true)); // parse satisfies expression consume("satisfies", true); parseExprSingle(); mPipeBuilder.addQuantifierExpr(getTransaction(), isSome, varNo); }
java
private void parseQuantifiedExpr() throws TTXPathException { // identify quantifier type final boolean isSome = is("some", true); if (!isSome) { consume("every", true); } // count number of variables int varNo = 0; do { // parse variable name consume(TokenType.DOLLAR, true); final String varName = parseVarName(); consume("in", true); varNo++; parseExprSingle(); mPipeBuilder.addVariableExpr(getTransaction(), varName); } while (is(TokenType.COMMA, true)); // parse satisfies expression consume("satisfies", true); parseExprSingle(); mPipeBuilder.addQuantifierExpr(getTransaction(), isSome, varNo); }
[ "private", "void", "parseQuantifiedExpr", "(", ")", "throws", "TTXPathException", "{", "// identify quantifier type", "final", "boolean", "isSome", "=", "is", "(", "\"some\"", ",", "true", ")", ";", "if", "(", "!", "isSome", ")", "{", "consume", "(", "\"every\...
Parses the the rule QuantifiedExpr according to the following production rule: <p> [6] QuantifiedExpr ::= (<"some" "$"> | <"every" "$">) VarName "in" ExprSingle ("," "$" VarName "in" ExprSingle)* "satisfies" ExprSingle . </p> @throws TTXPathException
[ "Parses", "the", "the", "rule", "QuantifiedExpr", "according", "to", "the", "following", "production", "rule", ":", "<p", ">", "[", "6", "]", "QuantifiedExpr", "::", "=", "(", "<", "some", "$", ">", "|", "<", "every", "$", ">", ")", "VarName", "in", ...
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L249-L280
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java
BackupLongTermRetentionVaultsInner.createOrUpdate
public BackupLongTermRetentionVaultInner createOrUpdate(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).toBlocking().last().body(); }
java
public BackupLongTermRetentionVaultInner createOrUpdate(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).toBlocking().last().body(); }
[ "public", "BackupLongTermRetentionVaultInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "recoveryServicesVaultResourceId", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serv...
Updates a server backup long term retention vault. @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 recoveryServicesVaultResourceId The azure recovery services vault resource id @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the BackupLongTermRetentionVaultInner object if successful.
[ "Updates", "a", "server", "backup", "long", "term", "retention", "vault", "." ]
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/BackupLongTermRetentionVaultsInner.java#L173-L175
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/password/hash/PasswordHashCreatorManager.java
PasswordHashCreatorManager.createUserPasswordHash
@Nonnull public PasswordHash createUserPasswordHash (@Nonnull @Nonempty final String sAlgorithmName, @Nullable final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword) { ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword"); final IPasswordHashCreator aPHC = getPasswordHashCreatorOfAlgorithm (sAlgorithmName); if (aPHC == null) throw new IllegalArgumentException ("No password hash creator for algorithm '" + sAlgorithmName + "' registered!"); final String sPasswordHash = aPHC.createPasswordHash (aSalt, sPlainTextPassword); return new PasswordHash (sAlgorithmName, aSalt, sPasswordHash); }
java
@Nonnull public PasswordHash createUserPasswordHash (@Nonnull @Nonempty final String sAlgorithmName, @Nullable final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword) { ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword"); final IPasswordHashCreator aPHC = getPasswordHashCreatorOfAlgorithm (sAlgorithmName); if (aPHC == null) throw new IllegalArgumentException ("No password hash creator for algorithm '" + sAlgorithmName + "' registered!"); final String sPasswordHash = aPHC.createPasswordHash (aSalt, sPlainTextPassword); return new PasswordHash (sAlgorithmName, aSalt, sPasswordHash); }
[ "@", "Nonnull", "public", "PasswordHash", "createUserPasswordHash", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sAlgorithmName", ",", "@", "Nullable", "final", "IPasswordSalt", "aSalt", ",", "@", "Nonnull", "final", "String", "sPlainTextPassword", ")",...
Create the password hash from the passed plain text password, using the default password hash creator. @param sAlgorithmName The password hash creator algorithm name to query. May neither be <code>null</code> nor empty. @param aSalt Optional salt to be used. This parameter is only <code>null</code> for backwards compatibility reasons. @param sPlainTextPassword Plain text password. May not be <code>null</code>. @return The password hash. Never <code>null</code>. @see #getDefaultPasswordHashCreator()
[ "Create", "the", "password", "hash", "from", "the", "passed", "plain", "text", "password", "using", "the", "default", "password", "hash", "creator", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/password/hash/PasswordHashCreatorManager.java#L214-L228
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.getIntAttribute
public Integer getIntAttribute(String name, Integer defaultValue) { return getValue(intAttributes, name, defaultValue); }
java
public Integer getIntAttribute(String name, Integer defaultValue) { return getValue(intAttributes, name, defaultValue); }
[ "public", "Integer", "getIntAttribute", "(", "String", "name", ",", "Integer", "defaultValue", ")", "{", "return", "getValue", "(", "intAttributes", ",", "name", ",", "defaultValue", ")", ";", "}" ]
Gets the int value of an attribute. @param name The name of the attribute. Not null. @param defaultValue The default value for the attribute. May be null. This value will be returned if this metadata object does not contain an int value for the specified attribute name. @return Either the int value of the attribute with the specified name, or the value specified by the defaultValue object if this metadata object does not contain an int value for the specified attribute name. @throws NullPointerException if name is null.
[ "Gets", "the", "int", "value", "of", "an", "attribute", "." ]
train
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L289-L291
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java
PluginDownloader.start
@Override public void start() { try { forceMkdir(downloadDir); for (File tempFile : listTempFile(this.downloadDir)) { deleteQuietly(tempFile); } } catch (IOException e) { throw new IllegalStateException("Fail to create the directory: " + downloadDir, e); } }
java
@Override public void start() { try { forceMkdir(downloadDir); for (File tempFile : listTempFile(this.downloadDir)) { deleteQuietly(tempFile); } } catch (IOException e) { throw new IllegalStateException("Fail to create the directory: " + downloadDir, e); } }
[ "@", "Override", "public", "void", "start", "(", ")", "{", "try", "{", "forceMkdir", "(", "downloadDir", ")", ";", "for", "(", "File", "tempFile", ":", "listTempFile", "(", "this", ".", "downloadDir", ")", ")", "{", "deleteQuietly", "(", "tempFile", ")",...
Deletes the temporary files remaining from previous downloads
[ "Deletes", "the", "temporary", "files", "remaining", "from", "previous", "downloads" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/PluginDownloader.java#L74-L84
MTDdk/jawn
jawn-core/src/main/java/net/javapla/jawn/core/templates/config/SiteConfigurationReader.java
SiteConfigurationReader.mergeConfigurations
private SiteConfiguration mergeConfigurations(SiteConfiguration rootConf, SiteConfiguration controllerConf) { // do not do any overwrites to the rootConf // clone it instead (or create an entirely new object) SiteConfiguration topConf = rootConf.clone(); if (controllerConf.title != null && !controllerConf.title.isEmpty()) topConf.title = controllerConf.title; if (controllerConf.scripts != null) { if (topConf.scripts != null) { SiteConfiguration.Tag[] scripts = new SiteConfiguration.Tag[topConf.scripts.length + controllerConf.scripts.length]; System.arraycopy(topConf.scripts, 0, scripts, 0, topConf.scripts.length); System.arraycopy(controllerConf.scripts, 0, scripts, topConf.scripts.length, controllerConf.scripts.length); topConf.scripts = scripts; } else { topConf.scripts = Arrays.copyOf(controllerConf.scripts, controllerConf.scripts.length); } } if (controllerConf.styles != null) { if (topConf.styles != null) { SiteConfiguration.Tag[] styles = new SiteConfiguration.Tag[topConf.styles.length + controllerConf.styles.length]; System.arraycopy(topConf.styles, 0, styles, 0, topConf.styles.length); System.arraycopy(controllerConf.styles, 0, styles, topConf.styles.length, controllerConf.styles.length); topConf.styles = styles; } else { topConf.styles = Arrays.copyOf(controllerConf.styles, controllerConf.styles.length); } } return topConf; }
java
private SiteConfiguration mergeConfigurations(SiteConfiguration rootConf, SiteConfiguration controllerConf) { // do not do any overwrites to the rootConf // clone it instead (or create an entirely new object) SiteConfiguration topConf = rootConf.clone(); if (controllerConf.title != null && !controllerConf.title.isEmpty()) topConf.title = controllerConf.title; if (controllerConf.scripts != null) { if (topConf.scripts != null) { SiteConfiguration.Tag[] scripts = new SiteConfiguration.Tag[topConf.scripts.length + controllerConf.scripts.length]; System.arraycopy(topConf.scripts, 0, scripts, 0, topConf.scripts.length); System.arraycopy(controllerConf.scripts, 0, scripts, topConf.scripts.length, controllerConf.scripts.length); topConf.scripts = scripts; } else { topConf.scripts = Arrays.copyOf(controllerConf.scripts, controllerConf.scripts.length); } } if (controllerConf.styles != null) { if (topConf.styles != null) { SiteConfiguration.Tag[] styles = new SiteConfiguration.Tag[topConf.styles.length + controllerConf.styles.length]; System.arraycopy(topConf.styles, 0, styles, 0, topConf.styles.length); System.arraycopy(controllerConf.styles, 0, styles, topConf.styles.length, controllerConf.styles.length); topConf.styles = styles; } else { topConf.styles = Arrays.copyOf(controllerConf.styles, controllerConf.styles.length); } } return topConf; }
[ "private", "SiteConfiguration", "mergeConfigurations", "(", "SiteConfiguration", "rootConf", ",", "SiteConfiguration", "controllerConf", ")", "{", "// do not do any overwrites to the rootConf", "// clone it instead (or create an entirely new object)", "SiteConfiguration", "topConf", "=...
Letting <code>controllerConf</code> take precedence over <code>rootConf</code>. <br>Adding them uncritically <p>Does not do any overwrites on any of the parameters. Instead it creates a new object with all the merges @param rootConf The default configuration at the root of the templateFolder @param controllerConf The controller configuration - might be empty, if no {@value #SITE_FILE} is found within the controller path @return The merged SiteConfiguration
[ "Letting", "<code", ">", "controllerConf<", "/", "code", ">", "take", "precedence", "over", "<code", ">", "rootConf<", "/", "code", ">", ".", "<br", ">", "Adding", "them", "uncritically" ]
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/templates/config/SiteConfigurationReader.java#L200-L229
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java
PathOperationComponent.buildDescriptionSection
private void buildDescriptionSection(MarkupDocBuilder markupDocBuilder, PathOperation operation) { MarkupDocBuilder descriptionBuilder = copyMarkupDocBuilder(markupDocBuilder); applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_BEGIN, descriptionBuilder, operation)); String description = operation.getOperation().getDescription(); if (isNotBlank(description)) { descriptionBuilder.paragraph(markupDescription(config.getSwaggerMarkupLanguage(), markupDocBuilder, description)); } applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_END, descriptionBuilder, operation)); String descriptionContent = descriptionBuilder.toString(); applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_BEFORE, markupDocBuilder, operation)); if (isNotBlank(descriptionContent)) { buildSectionTitle(markupDocBuilder, labels.getLabel(DESCRIPTION)); markupDocBuilder.text(descriptionContent); } applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_AFTER, markupDocBuilder, operation)); }
java
private void buildDescriptionSection(MarkupDocBuilder markupDocBuilder, PathOperation operation) { MarkupDocBuilder descriptionBuilder = copyMarkupDocBuilder(markupDocBuilder); applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_BEGIN, descriptionBuilder, operation)); String description = operation.getOperation().getDescription(); if (isNotBlank(description)) { descriptionBuilder.paragraph(markupDescription(config.getSwaggerMarkupLanguage(), markupDocBuilder, description)); } applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_END, descriptionBuilder, operation)); String descriptionContent = descriptionBuilder.toString(); applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_BEFORE, markupDocBuilder, operation)); if (isNotBlank(descriptionContent)) { buildSectionTitle(markupDocBuilder, labels.getLabel(DESCRIPTION)); markupDocBuilder.text(descriptionContent); } applyPathsDocumentExtension(new PathsDocumentExtension.Context(Position.OPERATION_DESCRIPTION_AFTER, markupDocBuilder, operation)); }
[ "private", "void", "buildDescriptionSection", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "PathOperation", "operation", ")", "{", "MarkupDocBuilder", "descriptionBuilder", "=", "copyMarkupDocBuilder", "(", "markupDocBuilder", ")", ";", "applyPathsDocumentExtension", "("...
Adds a operation description to the document. @param operation the Swagger Operation
[ "Adds", "a", "operation", "description", "to", "the", "document", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java#L172-L188
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createLabel
public GitlabLabel createLabel(Serializable projectId, GitlabLabel label) throws IOException { String name = label.getName(); String color = label.getColor(); return createLabel(projectId, name, color); }
java
public GitlabLabel createLabel(Serializable projectId, GitlabLabel label) throws IOException { String name = label.getName(); String color = label.getColor(); return createLabel(projectId, name, color); }
[ "public", "GitlabLabel", "createLabel", "(", "Serializable", "projectId", ",", "GitlabLabel", "label", ")", "throws", "IOException", "{", "String", "name", "=", "label", ".", "getName", "(", ")", ";", "String", "color", "=", "label", ".", "getColor", "(", ")...
Creates a new label. @param projectId The ID of the project containing the label. @param label The label to create. @return The newly created label.
[ "Creates", "a", "new", "label", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2803-L2808
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BooleanExtensions.java
BooleanExtensions.operator_or
@Pure @Inline(value="($1 || $2)", constantExpression=true) public static boolean operator_or(boolean a, boolean b) { return a || b; }
java
@Pure @Inline(value="($1 || $2)", constantExpression=true) public static boolean operator_or(boolean a, boolean b) { return a || b; }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"($1 || $2)\"", ",", "constantExpression", "=", "true", ")", "public", "static", "boolean", "operator_or", "(", "boolean", "a", ",", "boolean", "b", ")", "{", "return", "a", "||", "b", ";", "}" ]
A logical <code>or</code> (disjunction). This is the equivalent to the java <code>||</code> operator. @param a a boolean value. @param b another boolean value. @return <code>a || b</code>
[ "A", "logical", "<code", ">", "or<", "/", "code", ">", "(", "disjunction", ")", ".", "This", "is", "the", "equivalent", "to", "the", "java", "<code", ">", "||<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BooleanExtensions.java#L45-L49
alkacon/opencms-core
src/org/opencms/module/CmsModuleImportExportRepository.java
CmsModuleImportExportRepository.importModule
public synchronized void importModule(String name, byte[] content) throws CmsException { String moduleName = null; boolean ok = true; try { if (content.length == 0) { // Happens when using CmsResourceWrapperModules with JLAN and createResource is called LOG.debug("Zero-length module import content, ignoring it..."); } else { ensureFoldersExist(); String targetFilePath = createImportZipPath(name); try { FileOutputStream out = new FileOutputStream(new File(targetFilePath)); out.write(content); out.close(); } catch (IOException e) { throw new CmsImportExportException( Messages.get().container(Messages.ERR_FILE_IO_1, targetFilePath)); } CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(targetFilePath); moduleName = module.getName(); I_CmsReport report = createReport(); OpenCms.getModuleManager().replaceModule(m_adminCms, targetFilePath, report); new File(targetFilePath).delete(); if (report.hasError() || report.hasWarning()) { ok = false; } } } catch (CmsException e) { ok = false; throw e; } catch (RuntimeException e) { ok = false; throw e; } finally { m_moduleLog.log(moduleName, Action.importModule, ok); } }
java
public synchronized void importModule(String name, byte[] content) throws CmsException { String moduleName = null; boolean ok = true; try { if (content.length == 0) { // Happens when using CmsResourceWrapperModules with JLAN and createResource is called LOG.debug("Zero-length module import content, ignoring it..."); } else { ensureFoldersExist(); String targetFilePath = createImportZipPath(name); try { FileOutputStream out = new FileOutputStream(new File(targetFilePath)); out.write(content); out.close(); } catch (IOException e) { throw new CmsImportExportException( Messages.get().container(Messages.ERR_FILE_IO_1, targetFilePath)); } CmsModule module = CmsModuleImportExportHandler.readModuleFromImport(targetFilePath); moduleName = module.getName(); I_CmsReport report = createReport(); OpenCms.getModuleManager().replaceModule(m_adminCms, targetFilePath, report); new File(targetFilePath).delete(); if (report.hasError() || report.hasWarning()) { ok = false; } } } catch (CmsException e) { ok = false; throw e; } catch (RuntimeException e) { ok = false; throw e; } finally { m_moduleLog.log(moduleName, Action.importModule, ok); } }
[ "public", "synchronized", "void", "importModule", "(", "String", "name", ",", "byte", "[", "]", "content", ")", "throws", "CmsException", "{", "String", "moduleName", "=", "null", ";", "boolean", "ok", "=", "true", ";", "try", "{", "if", "(", "content", ...
Imports module data.<p> @param name the module file name @param content the module ZIP file data @throws CmsException if something goes wrong
[ "Imports", "module", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleImportExportRepository.java#L241-L278
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java
QrCodeDecoderBits.checkPaddingBytes
boolean checkPaddingBytes(QrCode qr, int lengthBytes) { boolean a = true; for (int i = lengthBytes; i < qr.corrected.length; i++) { if (a) { if (0b00110111 != (qr.corrected[i] & 0xFF)) return false; } else { if (0b10001000 != (qr.corrected[i] & 0xFF)) { // the pattern starts over at the beginning of a block. Strictly enforcing the standard // requires knowing size of a data chunk and where it starts. Possible but // probably not worth the effort the implement as a strict requirement. if (0b00110111 == (qr.corrected[i] & 0xFF)) { a = true; } else { return false; } } } a = !a; } return true; }
java
boolean checkPaddingBytes(QrCode qr, int lengthBytes) { boolean a = true; for (int i = lengthBytes; i < qr.corrected.length; i++) { if (a) { if (0b00110111 != (qr.corrected[i] & 0xFF)) return false; } else { if (0b10001000 != (qr.corrected[i] & 0xFF)) { // the pattern starts over at the beginning of a block. Strictly enforcing the standard // requires knowing size of a data chunk and where it starts. Possible but // probably not worth the effort the implement as a strict requirement. if (0b00110111 == (qr.corrected[i] & 0xFF)) { a = true; } else { return false; } } } a = !a; } return true; }
[ "boolean", "checkPaddingBytes", "(", "QrCode", "qr", ",", "int", "lengthBytes", ")", "{", "boolean", "a", "=", "true", ";", "for", "(", "int", "i", "=", "lengthBytes", ";", "i", "<", "qr", ".", "corrected", ".", "length", ";", "i", "++", ")", "{", ...
Makes sure the used bytes have the expected values @param lengthBytes Number of bytes that data should be been written to and not filled with padding.
[ "Makes", "sure", "the", "used", "bytes", "have", "the", "expected", "values" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeDecoderBits.java#L208-L231
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/FileSystemClassInformationRepository.java
FileSystemClassInformationRepository.addIndividual
public void addIndividual(String className, ClassInformation classInformation) { Validate.notNull(className); Validate.notNull(classInformation); Validate.isTrue(!hierarchyMap.containsKey(className)); hierarchyMap.put(className, classInformation); }
java
public void addIndividual(String className, ClassInformation classInformation) { Validate.notNull(className); Validate.notNull(classInformation); Validate.isTrue(!hierarchyMap.containsKey(className)); hierarchyMap.put(className, classInformation); }
[ "public", "void", "addIndividual", "(", "String", "className", ",", "ClassInformation", "classInformation", ")", "{", "Validate", ".", "notNull", "(", "className", ")", ";", "Validate", ".", "notNull", "(", "classInformation", ")", ";", "Validate", ".", "isTrue"...
Add a custom class. @param className name of class @param classInformation information for class @throws NullPointerException if any argument is {@code null} @throws IllegalArgumentException if {@code className} already exists in this repository
[ "Add", "a", "custom", "class", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/FileSystemClassInformationRepository.java#L67-L73
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.binaryTree
public static Matcher<BinaryTree> binaryTree( final Matcher<ExpressionTree> matcher1, final Matcher<ExpressionTree> matcher2) { return new Matcher<BinaryTree>() { @Override public boolean matches(BinaryTree t, VisitorState state) { return null != ASTHelpers.matchBinaryTree(t, Arrays.asList(matcher1, matcher2), state); } }; }
java
public static Matcher<BinaryTree> binaryTree( final Matcher<ExpressionTree> matcher1, final Matcher<ExpressionTree> matcher2) { return new Matcher<BinaryTree>() { @Override public boolean matches(BinaryTree t, VisitorState state) { return null != ASTHelpers.matchBinaryTree(t, Arrays.asList(matcher1, matcher2), state); } }; }
[ "public", "static", "Matcher", "<", "BinaryTree", ">", "binaryTree", "(", "final", "Matcher", "<", "ExpressionTree", ">", "matcher1", ",", "final", "Matcher", "<", "ExpressionTree", ">", "matcher2", ")", "{", "return", "new", "Matcher", "<", "BinaryTree", ">",...
Matches a binary tree if the given matchers match the operands in either order. That is, returns true if either: matcher1 matches the left operand and matcher2 matches the right operand or matcher2 matches the left operand and matcher1 matches the right operand
[ "Matches", "a", "binary", "tree", "if", "the", "given", "matchers", "match", "the", "operands", "in", "either", "order", ".", "That", "is", "returns", "true", "if", "either", ":", "matcher1", "matches", "the", "left", "operand", "and", "matcher2", "matches",...
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1130-L1138
kite-sdk/kite
kite-tools-parent/kite-tools/src/main/java/org/kitesdk/cli/commands/BaseDatasetCommand.java
BaseDatasetCommand.viewMatches
@VisibleForTesting static boolean viewMatches(URI view, String requested) { // test that the requested options are a subset of the final options Map<String, String> requestedOptions = optionsForUri(URI.create(requested)); Map<String, String> finalOptions = optionsForUri(view); for (Map.Entry<String, String> entry : requestedOptions.entrySet()) { if (!finalOptions.containsKey(entry.getKey()) || !finalOptions.get(entry.getKey()).equals(entry.getValue())) { return false; } } return true; }
java
@VisibleForTesting static boolean viewMatches(URI view, String requested) { // test that the requested options are a subset of the final options Map<String, String> requestedOptions = optionsForUri(URI.create(requested)); Map<String, String> finalOptions = optionsForUri(view); for (Map.Entry<String, String> entry : requestedOptions.entrySet()) { if (!finalOptions.containsKey(entry.getKey()) || !finalOptions.get(entry.getKey()).equals(entry.getValue())) { return false; } } return true; }
[ "@", "VisibleForTesting", "static", "boolean", "viewMatches", "(", "URI", "view", ",", "String", "requested", ")", "{", "// test that the requested options are a subset of the final options", "Map", "<", "String", ",", "String", ">", "requestedOptions", "=", "optionsForUr...
Verify that a view matches the URI that loaded it without extra options. <p> This is used to prevent mis-interpreted URIs from succeeding. For example, the URI: view:file:./table?year=2014&month=3&dy=14 resolves a view for all of March 2014 because "dy" wasn't recognized as "day" and was ignored. This works by verifying that all of the options are accounted for in the final view and would fail the above because "dy" is not in the view's options. @param view a View's URI @param requested the requested View URI @return true if the view's URI and the requested URI match exactly
[ "Verify", "that", "a", "view", "matches", "the", "URI", "that", "loaded", "it", "without", "extra", "options", ".", "<p", ">", "This", "is", "used", "to", "prevent", "mis", "-", "interpreted", "URIs", "from", "succeeding", ".", "For", "example", "the", "...
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-tools-parent/kite-tools/src/main/java/org/kitesdk/cli/commands/BaseDatasetCommand.java#L179-L191