repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.addPanel
private static void addPanel(TabbedPanel2 tabbedPanel, AbstractPanel panel, boolean visible) { if (visible) { tabbedPanel.addTab(panel); } else { tabbedPanel.addTabHidden(panel); } }
java
private static void addPanel(TabbedPanel2 tabbedPanel, AbstractPanel panel, boolean visible) { if (visible) { tabbedPanel.addTab(panel); } else { tabbedPanel.addTabHidden(panel); } }
[ "private", "static", "void", "addPanel", "(", "TabbedPanel2", "tabbedPanel", ",", "AbstractPanel", "panel", ",", "boolean", "visible", ")", "{", "if", "(", "visible", ")", "{", "tabbedPanel", ".", "addTab", "(", "panel", ")", ";", "}", "else", "{", "tabbed...
Adds the given {@code panel} to the given {@code tabbedPanel}. @param tabbedPanel the tabbed panel to add the panel @param panel the panel to add @param visible {@code true} if the panel should be visible, {@code false} otherwise. @see #addPanels(TabbedPanel2, List, boolean)
[ "Adds", "the", "given", "{", "@code", "panel", "}", "to", "the", "given", "{", "@code", "tabbedPanel", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L893-L899
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/resolver/LuceneLocationResolver.java
LuceneLocationResolver.resolveLocations
@Override @Deprecated public List<ResolvedLocation> resolveLocations(List<LocationOccurrence> locations, boolean fuzzy) throws IOException, ParseException { logger.warn("LuceneLocationResolver is deprecated. Use ClavinLocationResolver."); try { return delegate.resolveLocations(locations, maxHitDepth, maxContextWindow, fuzzy); } catch (ClavinException ce) { Throwable t = ce.getCause(); if (t instanceof ParseException) { throw (ParseException)t; } else if (t instanceof IOException) { throw (IOException)t; } else { throw new IllegalStateException("Error resolving locations.", ce); } } }
java
@Override @Deprecated public List<ResolvedLocation> resolveLocations(List<LocationOccurrence> locations, boolean fuzzy) throws IOException, ParseException { logger.warn("LuceneLocationResolver is deprecated. Use ClavinLocationResolver."); try { return delegate.resolveLocations(locations, maxHitDepth, maxContextWindow, fuzzy); } catch (ClavinException ce) { Throwable t = ce.getCause(); if (t instanceof ParseException) { throw (ParseException)t; } else if (t instanceof IOException) { throw (IOException)t; } else { throw new IllegalStateException("Error resolving locations.", ce); } } }
[ "@", "Override", "@", "Deprecated", "public", "List", "<", "ResolvedLocation", ">", "resolveLocations", "(", "List", "<", "LocationOccurrence", ">", "locations", ",", "boolean", "fuzzy", ")", "throws", "IOException", ",", "ParseException", "{", "logger", ".", "w...
Resolves the supplied list of location names into {@link ResolvedLocation}s containing {@link com.bericotech.clavin.gazetteer.GeoName} objects. Calls {@link com.bericotech.clavin.gazetteer.query.Gazetteer#getClosestLocations} on each location name to find all possible matches, then uses heuristics to select the best match for each by calling {@link ClavinLocationResolver#pickBestCandidates}. @param locations list of location names to be resolved @param fuzzy switch for turning on/off fuzzy matching @return list of {@link ResolvedLocation} objects @throws ParseException @throws IOException @deprecated 2.0.0 Use {@link ClavinLocationResolver#resolveLocations(java.util.List, boolean)} or {@link ClavinLocationResolver#resolveLocations(java.util.List, int, int, boolean)}
[ "Resolves", "the", "supplied", "list", "of", "location", "names", "into", "{", "@link", "ResolvedLocation", "}", "s", "containing", "{", "@link", "com", ".", "bericotech", ".", "clavin", ".", "gazetteer", ".", "GeoName", "}", "objects", "." ]
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/resolver/LuceneLocationResolver.java#L113-L129
geomajas/geomajas-project-client-gwt2
common-gwt/command/src/main/java/org/geomajas/gwt/client/command/GwtCommandDispatcher.java
GwtCommandDispatcher.isEqual
private boolean isEqual(Object o1, Object o2) { return o1 == null ? o2 == null : o1.equals(o2); }
java
private boolean isEqual(Object o1, Object o2) { return o1 == null ? o2 == null : o1.equals(o2); }
[ "private", "boolean", "isEqual", "(", "Object", "o1", ",", "Object", "o2", ")", "{", "return", "o1", "==", "null", "?", "o2", "==", "null", ":", "o1", ".", "equals", "(", "o2", ")", ";", "}" ]
Checks whether 2 objects are equal. Null-safe, 2 null objects are considered equal. @param o1 first object to compare @param o2 second object to compare @return true if object are equal, false otherwise
[ "Checks", "whether", "2", "objects", "are", "equal", ".", "Null", "-", "safe", "2", "null", "objects", "are", "considered", "equal", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/command/GwtCommandDispatcher.java#L686-L688
cdk/cdk
base/valencycheck/src/main/java/org/openscience/cdk/tools/SaturationChecker.java
SaturationChecker.isSaturated
@Override public boolean isSaturated(IAtom atom, IAtomContainer ac) throws CDKException { IAtomType[] atomTypes = getAtomTypeFactory(atom.getBuilder()).getAtomTypes(atom.getSymbol()); if (atomTypes.length == 0) return true; double bondOrderSum = ac.getBondOrderSum(atom); IBond.Order maxBondOrder = ac.getMaximumBondOrder(atom); Integer hcount = atom.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : atom.getImplicitHydrogenCount(); Integer charge = atom.getFormalCharge() == CDKConstants.UNSET ? 0 : atom.getFormalCharge(); try { logger.debug("*** Checking saturation of atom ", atom.getSymbol(), "" + ac.indexOf(atom) + " ***"); logger.debug("bondOrderSum: " + bondOrderSum); logger.debug("maxBondOrder: " + maxBondOrder); logger.debug("hcount: " + hcount); } catch (Exception exc) { logger.debug(exc); } for (int f = 0; f < atomTypes.length; f++) { if (bondOrderSum - charge + hcount == atomTypes[f].getBondOrderSum() && !BondManipulator.isHigherOrder(maxBondOrder, atomTypes[f].getMaxBondOrder())) { logger.debug("*** Good ! ***"); return true; } } logger.debug("*** Bad ! ***"); return false; }
java
@Override public boolean isSaturated(IAtom atom, IAtomContainer ac) throws CDKException { IAtomType[] atomTypes = getAtomTypeFactory(atom.getBuilder()).getAtomTypes(atom.getSymbol()); if (atomTypes.length == 0) return true; double bondOrderSum = ac.getBondOrderSum(atom); IBond.Order maxBondOrder = ac.getMaximumBondOrder(atom); Integer hcount = atom.getImplicitHydrogenCount() == CDKConstants.UNSET ? 0 : atom.getImplicitHydrogenCount(); Integer charge = atom.getFormalCharge() == CDKConstants.UNSET ? 0 : atom.getFormalCharge(); try { logger.debug("*** Checking saturation of atom ", atom.getSymbol(), "" + ac.indexOf(atom) + " ***"); logger.debug("bondOrderSum: " + bondOrderSum); logger.debug("maxBondOrder: " + maxBondOrder); logger.debug("hcount: " + hcount); } catch (Exception exc) { logger.debug(exc); } for (int f = 0; f < atomTypes.length; f++) { if (bondOrderSum - charge + hcount == atomTypes[f].getBondOrderSum() && !BondManipulator.isHigherOrder(maxBondOrder, atomTypes[f].getMaxBondOrder())) { logger.debug("*** Good ! ***"); return true; } } logger.debug("*** Bad ! ***"); return false; }
[ "@", "Override", "public", "boolean", "isSaturated", "(", "IAtom", "atom", ",", "IAtomContainer", "ac", ")", "throws", "CDKException", "{", "IAtomType", "[", "]", "atomTypes", "=", "getAtomTypeFactory", "(", "atom", ".", "getBuilder", "(", ")", ")", ".", "ge...
Checks whether an Atom is saturated by comparing it with known AtomTypes.
[ "Checks", "whether", "an", "Atom", "is", "saturated", "by", "comparing", "it", "with", "known", "AtomTypes", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SaturationChecker.java#L161-L186
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java
AbstractDateCalculator.moveByTenor
@Override public DateCalculator<E> moveByTenor(final Tenor tenor, final int spotLag) { if (tenor == null) { throw new IllegalArgumentException("Tenor cannot be null"); } TenorCode tenorCode = tenor.getCode(); if (tenorCode != TenorCode.OVERNIGHT && tenorCode != TenorCode.TOM_NEXT /*&& spotLag != 0*/) { // get to the Spot date first: moveToSpotDate(spotLag); } int unit = tenor.getUnits(); if (tenorCode == TenorCode.WEEK) { tenorCode = TenorCode.DAY; unit *= DAYS_IN_WEEK; } if (tenorCode == TenorCode.YEAR) { tenorCode = TenorCode.MONTH; unit *= MONTHS_IN_YEAR; } return applyTenor(tenorCode, unit); }
java
@Override public DateCalculator<E> moveByTenor(final Tenor tenor, final int spotLag) { if (tenor == null) { throw new IllegalArgumentException("Tenor cannot be null"); } TenorCode tenorCode = tenor.getCode(); if (tenorCode != TenorCode.OVERNIGHT && tenorCode != TenorCode.TOM_NEXT /*&& spotLag != 0*/) { // get to the Spot date first: moveToSpotDate(spotLag); } int unit = tenor.getUnits(); if (tenorCode == TenorCode.WEEK) { tenorCode = TenorCode.DAY; unit *= DAYS_IN_WEEK; } if (tenorCode == TenorCode.YEAR) { tenorCode = TenorCode.MONTH; unit *= MONTHS_IN_YEAR; } return applyTenor(tenorCode, unit); }
[ "@", "Override", "public", "DateCalculator", "<", "E", ">", "moveByTenor", "(", "final", "Tenor", "tenor", ",", "final", "int", "spotLag", ")", "{", "if", "(", "tenor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Tenor cannot ...
move the current date by a given tenor, this means that if a date is either a 'weekend' or holiday, it will be skipped acording to the holiday handler and not count towards the number of days to move. @param tenor the tenor. @param spotLag number of days to "spot" days, this can vary from one market to the other. @return the current businessCalendar (so one can do calendar.moveByTenor(StandardTenor.T_2M).getCurrentBusinessDate();)
[ "move", "the", "current", "date", "by", "a", "given", "tenor", "this", "means", "that", "if", "a", "date", "is", "either", "a", "weekend", "or", "holiday", "it", "will", "be", "skipped", "acording", "to", "the", "holiday", "handler", "and", "not", "count...
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractDateCalculator.java#L145-L168
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java
AbstractCodeCreator.findPropertyValueAsIntWithDefault
public int findPropertyValueAsIntWithDefault(String name, int defVal) { return properties().stream() .filter(p->name.equals(p.getName())) .map(CreatorProperty::getLatestValueAsInt) .findFirst().orElse(defVal); }
java
public int findPropertyValueAsIntWithDefault(String name, int defVal) { return properties().stream() .filter(p->name.equals(p.getName())) .map(CreatorProperty::getLatestValueAsInt) .findFirst().orElse(defVal); }
[ "public", "int", "findPropertyValueAsIntWithDefault", "(", "String", "name", ",", "int", "defVal", ")", "{", "return", "properties", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "p", "->", "name", ".", "equals", "(", "p", ".", "getName", "(", ...
Find the integer value of a property or a default if it is not set @param name the property name @param defVal the default value @return the properties integer value or the default
[ "Find", "the", "integer", "value", "of", "a", "property", "or", "a", "default", "if", "it", "is", "not", "set" ]
train
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java#L177-L182
reactiverse/reactive-pg-client
src/main/java/io/reactiverse/pgclient/impl/PgConnectionUriParser.java
PgConnectionUriParser.doParse
private static void doParse(String connectionUri, JsonObject configuration) { Pattern pattern = Pattern.compile(FULL_URI_REGEX); Matcher matcher = pattern.matcher(connectionUri); if (matcher.matches()) { // parse the user and password parseUserandPassword(matcher.group(USER_INFO_GROUP), configuration); // parse the IP address/host/unix domainSocket address parseNetLocation(matcher.group(NET_LOCATION_GROUP), configuration); // parse the port parsePort(matcher.group(PORT_GROUP), configuration); // parse the database name parseDatabaseName(matcher.group(DATABASE_GROUP), configuration); // parse the parameters parseParameters(matcher.group(PARAMETER_GROUP), configuration); } else { throw new IllegalArgumentException("Wrong syntax of connection URI"); } }
java
private static void doParse(String connectionUri, JsonObject configuration) { Pattern pattern = Pattern.compile(FULL_URI_REGEX); Matcher matcher = pattern.matcher(connectionUri); if (matcher.matches()) { // parse the user and password parseUserandPassword(matcher.group(USER_INFO_GROUP), configuration); // parse the IP address/host/unix domainSocket address parseNetLocation(matcher.group(NET_LOCATION_GROUP), configuration); // parse the port parsePort(matcher.group(PORT_GROUP), configuration); // parse the database name parseDatabaseName(matcher.group(DATABASE_GROUP), configuration); // parse the parameters parseParameters(matcher.group(PARAMETER_GROUP), configuration); } else { throw new IllegalArgumentException("Wrong syntax of connection URI"); } }
[ "private", "static", "void", "doParse", "(", "String", "connectionUri", ",", "JsonObject", "configuration", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "FULL_URI_REGEX", ")", ";", "Matcher", "matcher", "=", "pattern", ".", "matcher", "...
execute the parsing process and store options in the configuration
[ "execute", "the", "parsing", "process", "and", "store", "options", "in", "the", "configuration" ]
train
https://github.com/reactiverse/reactive-pg-client/blob/be75cc5462f0945f81d325f58db5f297403067bf/src/main/java/io/reactiverse/pgclient/impl/PgConnectionUriParser.java#L57-L80
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java
JsonUtil.getString
public static String getString(JsonObject object, String field, String defaultValue) { final JsonValue value = object.get(field); if (value == null || value.isNull()) { return defaultValue; } else { return value.asString(); } }
java
public static String getString(JsonObject object, String field, String defaultValue) { final JsonValue value = object.get(field); if (value == null || value.isNull()) { return defaultValue; } else { return value.asString(); } }
[ "public", "static", "String", "getString", "(", "JsonObject", "object", ",", "String", "field", ",", "String", "defaultValue", ")", "{", "final", "JsonValue", "value", "=", "object", ".", "get", "(", "field", ")", ";", "if", "(", "value", "==", "null", "...
Returns a field in a Json object as a string. @param object the Json Object @param field the field in the Json object to return @param defaultValue a default value for the field if the field value is null @return the Json field value as a string
[ "Returns", "a", "field", "in", "a", "Json", "object", "as", "a", "string", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L182-L189
ronmamo/reflections
src/main/java/org/reflections/Reflections.java
Reflections.collect
public Reflections collect(final File file) { FileInputStream inputStream = null; try { inputStream = new FileInputStream(file); return collect(inputStream); } catch (FileNotFoundException e) { throw new ReflectionsException("could not obtain input stream from file " + file, e); } finally { Utils.close(inputStream); } }
java
public Reflections collect(final File file) { FileInputStream inputStream = null; try { inputStream = new FileInputStream(file); return collect(inputStream); } catch (FileNotFoundException e) { throw new ReflectionsException("could not obtain input stream from file " + file, e); } finally { Utils.close(inputStream); } }
[ "public", "Reflections", "collect", "(", "final", "File", "file", ")", "{", "FileInputStream", "inputStream", "=", "null", ";", "try", "{", "inputStream", "=", "new", "FileInputStream", "(", "file", ")", ";", "return", "collect", "(", "inputStream", ")", ";"...
merges saved Reflections resources from the given file, using the serializer configured in this instance's Configuration <p> useful if you know the serialized resource location and prefer not to look it up the classpath
[ "merges", "saved", "Reflections", "resources", "from", "the", "given", "file", "using", "the", "serializer", "configured", "in", "this", "instance", "s", "Configuration", "<p", ">", "useful", "if", "you", "know", "the", "serialized", "resource", "location", "and...
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Reflections.java#L341-L351
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/xpath/XPathFactoryFinder.java
XPathFactoryFinder.which
private static String which(String classname, ClassLoader loader) { String classnameAsResource = classname.replace('.', '/') + ".class"; if (loader==null) loader = ClassLoader.getSystemClassLoader(); URL it = loader.getResource(classnameAsResource); return it != null ? it.toString() : null; }
java
private static String which(String classname, ClassLoader loader) { String classnameAsResource = classname.replace('.', '/') + ".class"; if (loader==null) loader = ClassLoader.getSystemClassLoader(); URL it = loader.getResource(classnameAsResource); return it != null ? it.toString() : null; }
[ "private", "static", "String", "which", "(", "String", "classname", ",", "ClassLoader", "loader", ")", "{", "String", "classnameAsResource", "=", "classname", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".class\"", ";", "if", "(", "loader", ...
<p>Search the specified classloader for the given classname.</p> @param classname the fully qualified name of the class to search for @param loader the classloader to search @return the source location of the resource, or null if it wasn't found
[ "<p", ">", "Search", "the", "specified", "classloader", "for", "the", "given", "classname", ".", "<", "/", "p", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/xpath/XPathFactoryFinder.java#L363-L369
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java
BaseFileManager.handleOptions
public boolean handleOptions(Map<Option, String> map) { boolean ok = true; for (Map.Entry<Option, String> e: map.entrySet()) { try { ok = ok & handleOption(e.getKey(), e.getValue()); } catch (IllegalArgumentException ex) { log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage())); ok = false; } } return ok; }
java
public boolean handleOptions(Map<Option, String> map) { boolean ok = true; for (Map.Entry<Option, String> e: map.entrySet()) { try { ok = ok & handleOption(e.getKey(), e.getValue()); } catch (IllegalArgumentException ex) { log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage())); ok = false; } } return ok; }
[ "public", "boolean", "handleOptions", "(", "Map", "<", "Option", ",", "String", ">", "map", ")", "{", "boolean", "ok", "=", "true", ";", "for", "(", "Map", ".", "Entry", "<", "Option", ",", "String", ">", "e", ":", "map", ".", "entrySet", "(", ")",...
Call handleOption for collection of options and corresponding values. @param map a collection of options and corresponding values @return true if all the calls are successful
[ "Call", "handleOption", "for", "collection", "of", "options", "and", "corresponding", "values", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java#L278-L289
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java
JAltGridScreen.addDetailComponent
public Component addDetailComponent(TableModel model, Object aValue, int iRowIndex, int iColumnIndex, GridBagConstraints c) { JComponent component = null; String string = ""; if (aValue instanceof ImageIcon) { component = new JLabel((ImageIcon)aValue); } if (aValue instanceof PortableImage) { component = new JLabel(new ImageIcon((Image)((PortableImage)aValue).getImage())); } else if (aValue != null) { string = aValue.toString(); if (model.isCellEditable(iRowIndex, iColumnIndex)) { if (string.length() == 0) component = new JTextField(3); else component = new JTextField(string); } else component = new JLabel(string); } return component; }
java
public Component addDetailComponent(TableModel model, Object aValue, int iRowIndex, int iColumnIndex, GridBagConstraints c) { JComponent component = null; String string = ""; if (aValue instanceof ImageIcon) { component = new JLabel((ImageIcon)aValue); } if (aValue instanceof PortableImage) { component = new JLabel(new ImageIcon((Image)((PortableImage)aValue).getImage())); } else if (aValue != null) { string = aValue.toString(); if (model.isCellEditable(iRowIndex, iColumnIndex)) { if (string.length() == 0) component = new JTextField(3); else component = new JTextField(string); } else component = new JLabel(string); } return component; }
[ "public", "Component", "addDetailComponent", "(", "TableModel", "model", ",", "Object", "aValue", ",", "int", "iRowIndex", ",", "int", "iColumnIndex", ",", "GridBagConstraints", "c", ")", "{", "JComponent", "component", "=", "null", ";", "String", "string", "=",...
Create the appropriate component and add it to the grid detail at this location. @param model The table model to read through. @param iRowIndex The row to add this item. @param iColumnIndex The column index of this component. @param c The constraint to use.
[ "Create", "the", "appropriate", "component", "and", "add", "it", "to", "the", "grid", "detail", "at", "this", "location", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L255-L281
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/SerializationUtils.java
SerializationUtils.writeObject
public static void writeObject(Serializable toSave, OutputStream writeTo) { try { ObjectOutputStream os = new ObjectOutputStream(writeTo); os.writeObject(toSave); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void writeObject(Serializable toSave, OutputStream writeTo) { try { ObjectOutputStream os = new ObjectOutputStream(writeTo); os.writeObject(toSave); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "writeObject", "(", "Serializable", "toSave", ",", "OutputStream", "writeTo", ")", "{", "try", "{", "ObjectOutputStream", "os", "=", "new", "ObjectOutputStream", "(", "writeTo", ")", ";", "os", ".", "writeObject", "(", "toSave", ")"...
Writes the object to the output stream THIS DOES NOT FLUSH THE STREAM @param toSave the object to save @param writeTo the output stream to write to
[ "Writes", "the", "object", "to", "the", "output", "stream", "THIS", "DOES", "NOT", "FLUSH", "THE", "STREAM" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/SerializationUtils.java#L119-L126
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/operators/OperatorForEachFuture.java
OperatorForEachFuture.forEachFuture
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext) { return forEachFuture(source, onNext, Functionals.emptyThrowable(), Functionals.empty()); }
java
public static <T> FutureTask<Void> forEachFuture( Observable<? extends T> source, Action1<? super T> onNext) { return forEachFuture(source, onNext, Functionals.emptyThrowable(), Functionals.empty()); }
[ "public", "static", "<", "T", ">", "FutureTask", "<", "Void", ">", "forEachFuture", "(", "Observable", "<", "?", "extends", "T", ">", "source", ",", "Action1", "<", "?", "super", "T", ">", "onNext", ")", "{", "return", "forEachFuture", "(", "source", "...
Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future. @param <T> the element type of the Observable @param source the source Observable @param onNext the action to call with each emitted element @return the Future representing the entire for-each operation
[ "Subscribes", "to", "the", "given", "source", "and", "calls", "the", "callback", "for", "each", "emitted", "item", "and", "surfaces", "the", "completion", "or", "error", "through", "a", "Future", "." ]
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/operators/OperatorForEachFuture.java#L44-L48
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/collection/MultiDimensionalSet.java
MultiDimensionalSet.addAll
@Override public boolean addAll(Collection<? extends Pair<K, V>> c) { return backedSet.addAll(c); }
java
@Override public boolean addAll(Collection<? extends Pair<K, V>> c) { return backedSet.addAll(c); }
[ "@", "Override", "public", "boolean", "addAll", "(", "Collection", "<", "?", "extends", "Pair", "<", "K", ",", "V", ">", ">", "c", ")", "{", "return", "backedSet", ".", "addAll", "(", "c", ")", ";", "}" ]
Adds all of the elements in the specified collection to this applyTransformToDestination if they're not already present (optional operation). If the specified collection is also a applyTransformToDestination, the <tt>addAll</tt> operation effectively modifies this applyTransformToDestination so that its value is the <i>union</i> of the two sets. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. @param c collection containing elements to be added to this applyTransformToDestination @return <tt>true</tt> if this applyTransformToDestination changed as a result of the call @throws UnsupportedOperationException if the <tt>addAll</tt> operation is not supported by this applyTransformToDestination @throws ClassCastException if the class of an element of the specified collection prevents it from being added to this applyTransformToDestination @throws NullPointerException if the specified collection contains one or more null elements and this applyTransformToDestination does not permit null elements, or if the specified collection is null @throws IllegalArgumentException if some property of an element of the specified collection prevents it from being added to this applyTransformToDestination @see #add(Object)
[ "Adds", "all", "of", "the", "elements", "in", "the", "specified", "collection", "to", "this", "applyTransformToDestination", "if", "they", "re", "not", "already", "present", "(", "optional", "operation", ")", ".", "If", "the", "specified", "collection", "is", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/collection/MultiDimensionalSet.java#L279-L282
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.handleUpdateFunctions
public int handleUpdateFunctions(BasicDBObject query, BasicDBObject update, String collName) { DBCollection collection = mongoDb.getCollection(collName); KunderaCoreUtils.printQuery("Update collection:" + query, showQuery); WriteResult result = null; try { result = collection.update(query, update); } catch (MongoException ex) { return -1; } if (result.getN() <= 0) return -1; return result.getN(); }
java
public int handleUpdateFunctions(BasicDBObject query, BasicDBObject update, String collName) { DBCollection collection = mongoDb.getCollection(collName); KunderaCoreUtils.printQuery("Update collection:" + query, showQuery); WriteResult result = null; try { result = collection.update(query, update); } catch (MongoException ex) { return -1; } if (result.getN() <= 0) return -1; return result.getN(); }
[ "public", "int", "handleUpdateFunctions", "(", "BasicDBObject", "query", ",", "BasicDBObject", "update", ",", "String", "collName", ")", "{", "DBCollection", "collection", "=", "mongoDb", ".", "getCollection", "(", "collName", ")", ";", "KunderaCoreUtils", ".", "p...
Handle update functions. @param query the query @param update the update @param collName the coll name @return the int
[ "Handle", "update", "functions", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1932-L1948
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java
DoubleUtils.shiftTowardsZeroWithClippingRecklessly
public static double shiftTowardsZeroWithClippingRecklessly(double val, double shift) { if (val > shift) { return val - shift; } else if (val < -shift) { return val + shift; } else { return 0.0; } }
java
public static double shiftTowardsZeroWithClippingRecklessly(double val, double shift) { if (val > shift) { return val - shift; } else if (val < -shift) { return val + shift; } else { return 0.0; } }
[ "public", "static", "double", "shiftTowardsZeroWithClippingRecklessly", "(", "double", "val", ",", "double", "shift", ")", "{", "if", "(", "val", ">", "shift", ")", "{", "return", "val", "-", "shift", ";", "}", "else", "if", "(", "val", "<", "-", "shift"...
Shifts the provided {@code val} towards but not past zero. If the absolute value of {@code val} is less than or equal to shift, zero will be returned. Otherwise, negative {@code val}s will have {@code shift} added and positive vals will have {@code shift} subtracted. If {@code shift} is negative, the result is undefined. This method is the same as {@link #shiftTowardsZeroWithClipping(double, double)} except that it eliminates the check on {@code shift} for speed in deep-inner loops. This is a profile/jitwatch-guided optimization. Inspired by AdaGradRDA.ISTAHelper from FACTORIE.
[ "Shifts", "the", "provided", "{", "@code", "val", "}", "towards", "but", "not", "past", "zero", ".", "If", "the", "absolute", "value", "of", "{", "@code", "val", "}", "is", "less", "than", "or", "equal", "to", "shift", "zero", "will", "be", "returned",...
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/primitives/DoubleUtils.java#L268-L276
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listWebWorkerUsagesWithServiceResponseAsync
public Observable<ServiceResponse<Page<UsageInner>>> listWebWorkerUsagesWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName) { return listWebWorkerUsagesSinglePageAsync(resourceGroupName, name, workerPoolName) .concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() { @Override public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWebWorkerUsagesNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<UsageInner>>> listWebWorkerUsagesWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName) { return listWebWorkerUsagesSinglePageAsync(resourceGroupName, name, workerPoolName) .concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() { @Override public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWebWorkerUsagesNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "UsageInner", ">", ">", ">", "listWebWorkerUsagesWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "workerPoolName", ")", ...
Get usage metrics for a worker pool of an App Service Environment. Get usage metrics for a worker pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UsageInner&gt; object
[ "Get", "usage", "metrics", "for", "a", "worker", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "usage", "metrics", "for", "a", "worker", "pool", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L6544-L6556
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java
HttpInputStream.setContentLength
public void setContentLength(long len) { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"setContentLength", "setContentLength --> "+len); } if ( len < 0 ) { logger.logp(Level.SEVERE, CLASS_NAME,"setContentLength", "Illegal.Argument.Invalid.Content.Length"); throw new IllegalArgumentException(nls.getString("Illegal.Argument.Invalid.Content.Length","Illegal Argument: Invalid Content Length")); } length = len; if ( Long.MAX_VALUE - total > len ) // PK79219 { limit = total + len; } }
java
public void setContentLength(long len) { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"setContentLength", "setContentLength --> "+len); } if ( len < 0 ) { logger.logp(Level.SEVERE, CLASS_NAME,"setContentLength", "Illegal.Argument.Invalid.Content.Length"); throw new IllegalArgumentException(nls.getString("Illegal.Argument.Invalid.Content.Length","Illegal Argument: Invalid Content Length")); } length = len; if ( Long.MAX_VALUE - total > len ) // PK79219 { limit = total + len; } }
[ "public", "void", "setContentLength", "(", "long", "len", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "logger", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "//306998.15", "logger", ".", "logp", "(", ...
Sets the content length for this input stream. This should be called once the headers have been read from the input stream. @param len the content length
[ "Sets", "the", "content", "length", "for", "this", "input", "stream", ".", "This", "should", "be", "called", "once", "the", "headers", "have", "been", "read", "from", "the", "input", "stream", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/http/HttpInputStream.java#L190-L205
landawn/AbacusUtil
src/com/landawn/abacus/util/Primitives.java
Primitives.box
@SafeVarargs public static Byte[] box(final byte... a) { if (a == null) { return null; } return box(a, 0, a.length); }
java
@SafeVarargs public static Byte[] box(final byte... a) { if (a == null) { return null; } return box(a, 0, a.length); }
[ "@", "SafeVarargs", "public", "static", "Byte", "[", "]", "box", "(", "final", "byte", "...", "a", ")", "{", "if", "(", "a", "==", "null", ")", "{", "return", "null", ";", "}", "return", "box", "(", "a", ",", "0", ",", "a", ".", "length", ")", ...
<p> Converts an array of primitive bytes to objects. </p> <p> This method returns {@code null} for a {@code null} input array. </p> @param a a {@code byte} array @return a {@code Byte} array, {@code null} if null array input
[ "<p", ">", "Converts", "an", "array", "of", "primitive", "bytes", "to", "objects", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L199-L206
knowm/XChange
xchange-bitflyer/src/main/java/org/knowm/xchange/bitflyer/BitflyerAdapters.java
BitflyerAdapters.adaptTicker
public static Ticker adaptTicker(BitflyerTicker ticker, CurrencyPair currencyPair) { BigDecimal bid = ticker.getBestBid(); BigDecimal ask = ticker.getBestAsk(); BigDecimal volume = ticker.getVolume(); BigDecimal last = ticker.getLtp(); Date timestamp = ticker.getTimestamp() != null ? BitflyerUtils.parseDate(ticker.getTimestamp()) : null; return new Ticker.Builder() .currencyPair(currencyPair) .bid(bid) .ask(ask) .last(ask) .volume(volume) .timestamp(timestamp) .build(); }
java
public static Ticker adaptTicker(BitflyerTicker ticker, CurrencyPair currencyPair) { BigDecimal bid = ticker.getBestBid(); BigDecimal ask = ticker.getBestAsk(); BigDecimal volume = ticker.getVolume(); BigDecimal last = ticker.getLtp(); Date timestamp = ticker.getTimestamp() != null ? BitflyerUtils.parseDate(ticker.getTimestamp()) : null; return new Ticker.Builder() .currencyPair(currencyPair) .bid(bid) .ask(ask) .last(ask) .volume(volume) .timestamp(timestamp) .build(); }
[ "public", "static", "Ticker", "adaptTicker", "(", "BitflyerTicker", "ticker", ",", "CurrencyPair", "currencyPair", ")", "{", "BigDecimal", "bid", "=", "ticker", ".", "getBestBid", "(", ")", ";", "BigDecimal", "ask", "=", "ticker", ".", "getBestAsk", "(", ")", ...
Adapts a BitflyerTicker to a Ticker Object @param ticker The exchange specific ticker @param currencyPair (e.g. BTC/USD) @return The ticker
[ "Adapts", "a", "BitflyerTicker", "to", "a", "Ticker", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitflyer/src/main/java/org/knowm/xchange/bitflyer/BitflyerAdapters.java#L85-L102
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java
GVRPicker.setPickRay
public void setPickRay(float ox, float oy, float oz, float dx, float dy, float dz) { synchronized (this) { mRayOrigin.x = ox; mRayOrigin.y = oy; mRayOrigin.z = oz; mRayDirection.x = dx; mRayDirection.y = dy; mRayDirection.z = dz; } }
java
public void setPickRay(float ox, float oy, float oz, float dx, float dy, float dz) { synchronized (this) { mRayOrigin.x = ox; mRayOrigin.y = oy; mRayOrigin.z = oz; mRayDirection.x = dx; mRayDirection.y = dy; mRayDirection.z = dz; } }
[ "public", "void", "setPickRay", "(", "float", "ox", ",", "float", "oy", ",", "float", "oz", ",", "float", "dx", ",", "float", "dy", ",", "float", "dz", ")", "{", "synchronized", "(", "this", ")", "{", "mRayOrigin", ".", "x", "=", "ox", ";", "mRayOr...
Sets the origin and direction of the pick ray. @param ox X coordinate of origin. @param oy Y coordinate of origin. @param oz Z coordinate of origin. @param dx X coordinate of ray direction. @param dy Y coordinate of ray direction. @param dz Z coordinate of ray direction. The coordinate system of the ray depends on the whether the picker is attached to a scene object or not. When attached to a scene object, the ray is in the coordinate system of that object where (0, 0, 0) is the center of the scene object and (0, 0, 1) is it's positive Z axis. If not attached to an object, the ray is in the coordinate system of the scene's main camera with (0, 0, 0) at the viewer and (0, 0, -1) where the viewer is looking. @see #doPick() @see #getPickRay() @see #getWorldPickRay(Vector3f, Vector3f)
[ "Sets", "the", "origin", "and", "direction", "of", "the", "pick", "ray", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L418-L429
Inbot/inbot-utils
src/main/java/io/inbot/utils/Math.java
Math.normalize
public static double normalize(double i, double factor) { Validate.isTrue(i >= 0, "should be positive value"); return (1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2; }
java
public static double normalize(double i, double factor) { Validate.isTrue(i >= 0, "should be positive value"); return (1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2; }
[ "public", "static", "double", "normalize", "(", "double", "i", ",", "double", "factor", ")", "{", "Validate", ".", "isTrue", "(", "i", ">=", "0", ",", "\"should be positive value\"", ")", ";", "return", "(", "1", "/", "(", "1", "+", "java", ".", "lang"...
Useful for normalizing integer or double values to a number between 0 and 1. This uses a simple logistic function: https://en.wikipedia.org/wiki/Logistic_function with some small adaptations: <pre> (1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2 </pre> @param i any positive long @param factor allows you to control how quickly things converge on 1. For values that range between 0 and the low hundreds, something like 0.05 is a good starting point. @return a double between 0 and 1.
[ "Useful", "for", "normalizing", "integer", "or", "double", "values", "to", "a", "number", "between", "0", "and", "1", ".", "This", "uses", "a", "simple", "logistic", "function", ":", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", ...
train
https://github.com/Inbot/inbot-utils/blob/3112bc08d4237e95fe0f8a219a5bbceb390d0505/src/main/java/io/inbot/utils/Math.java#L75-L78
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.parseQuery
public synchronized Query parseQuery(String searchString) throws ParseException, IndexException { if (searchString == null || searchString.trim().isEmpty()) { throw new ParseException("Query is null or empty"); } LOGGER.debug(searchString); final Query query = queryParser.parse(searchString); try { resetAnalyzers(); } catch (IOException ex) { throw new IndexException("Unable to reset the analyzer after parsing", ex); } return query; }
java
public synchronized Query parseQuery(String searchString) throws ParseException, IndexException { if (searchString == null || searchString.trim().isEmpty()) { throw new ParseException("Query is null or empty"); } LOGGER.debug(searchString); final Query query = queryParser.parse(searchString); try { resetAnalyzers(); } catch (IOException ex) { throw new IndexException("Unable to reset the analyzer after parsing", ex); } return query; }
[ "public", "synchronized", "Query", "parseQuery", "(", "String", "searchString", ")", "throws", "ParseException", ",", "IndexException", "{", "if", "(", "searchString", "==", "null", "||", "searchString", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", ...
Parses the given string into a Lucene Query. @param searchString the search text @return the Query object @throws ParseException thrown if the search text cannot be parsed @throws IndexException thrown if there is an error resetting the analyzers
[ "Parses", "the", "given", "string", "into", "a", "Lucene", "Query", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L280-L293
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/AnimatedDialog.java
AnimatedDialog.slideOpen
private void slideOpen() { TranslateAnimation slideUp = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0f); slideUp.setDuration(500); slideUp.setInterpolator(new AccelerateInterpolator()); ((ViewGroup) getWindow().getDecorView()).getChildAt(0).startAnimation(slideUp); super.show(); }
java
private void slideOpen() { TranslateAnimation slideUp = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0f); slideUp.setDuration(500); slideUp.setInterpolator(new AccelerateInterpolator()); ((ViewGroup) getWindow().getDecorView()).getChildAt(0).startAnimation(slideUp); super.show(); }
[ "private", "void", "slideOpen", "(", ")", "{", "TranslateAnimation", "slideUp", "=", "new", "TranslateAnimation", "(", "Animation", ".", "RELATIVE_TO_SELF", ",", "0", ",", "Animation", ".", "RELATIVE_TO_SELF", ",", "0", ",", "Animation", ".", "RELATIVE_TO_SELF", ...
</p> Opens the dialog with a translation animation to the content view </p>
[ "<", "/", "p", ">", "Opens", "the", "dialog", "with", "a", "translation", "animation", "to", "the", "content", "view", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/AnimatedDialog.java#L111-L117
Stratio/stratio-cassandra
src/java/org/apache/cassandra/service/pager/QueryPagers.java
QueryPagers.countPaged
public static int countPaged(String keyspace, String columnFamily, ByteBuffer key, SliceQueryFilter filter, ConsistencyLevel consistencyLevel, ClientState cState, final int pageSize, long now) throws RequestValidationException, RequestExecutionException { SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter); final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, cState, false); ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now); while (!pager.isExhausted()) { List<Row> next = pager.fetchPage(pageSize); if (!next.isEmpty()) counter.countAll(next.get(0).cf); } return counter.live(); }
java
public static int countPaged(String keyspace, String columnFamily, ByteBuffer key, SliceQueryFilter filter, ConsistencyLevel consistencyLevel, ClientState cState, final int pageSize, long now) throws RequestValidationException, RequestExecutionException { SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter); final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, cState, false); ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now); while (!pager.isExhausted()) { List<Row> next = pager.fetchPage(pageSize); if (!next.isEmpty()) counter.countAll(next.get(0).cf); } return counter.live(); }
[ "public", "static", "int", "countPaged", "(", "String", "keyspace", ",", "String", "columnFamily", ",", "ByteBuffer", "key", ",", "SliceQueryFilter", "filter", ",", "ConsistencyLevel", "consistencyLevel", ",", "ClientState", "cState", ",", "final", "int", "pageSize"...
Convenience method that count (live) cells/rows for a given slice of a row, but page underneath.
[ "Convenience", "method", "that", "count", "(", "live", ")", "cells", "/", "rows", "for", "a", "given", "slice", "of", "a", "row", "but", "page", "underneath", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/service/pager/QueryPagers.java#L175-L195
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.writeUnsignedLong
public static int writeUnsignedLong(byte[] target, int offset, long value) { return writeLong(target, offset, value ^ Long.MIN_VALUE); }
java
public static int writeUnsignedLong(byte[] target, int offset, long value) { return writeLong(target, offset, value ^ Long.MIN_VALUE); }
[ "public", "static", "int", "writeUnsignedLong", "(", "byte", "[", "]", "target", ",", "int", "offset", ",", "long", "value", ")", "{", "return", "writeLong", "(", "target", ",", "offset", ",", "value", "^", "Long", ".", "MIN_VALUE", ")", ";", "}" ]
Writes the given 64-bit Unsigned Long to the given byte array at the given offset. This value can then be deserialized using {@link #readUnsignedLong}. This method is not interoperable with {@link #readLong}. The advantage of serializing as Unsigned Long (vs. a normal Signed Long) is that the serialization will have the same natural order as the input value type (i.e., if compared using a lexicographic bitwise comparator such as ByteArrayComparator, it will have the same ordering as the typical Long type). @param target The byte array to write to. @param offset The offset within the byte array to write at. @param value The (signed) value to write. The value will be converted into the range [0, 2^64-1] before serialization by flipping the high order bit (so positive values will begin with 1 and negative values will begin with 0). @return The number of bytes written.
[ "Writes", "the", "given", "64", "-", "bit", "Unsigned", "Long", "to", "the", "given", "byte", "array", "at", "the", "given", "offset", ".", "This", "value", "can", "then", "be", "deserialized", "using", "{", "@link", "#readUnsignedLong", "}", ".", "This", ...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L316-L318
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.order_GET
public ArrayList<Long> order_GET(Date date_from, Date date_to) throws IOException { String qPath = "/me/order"; StringBuilder sb = path(qPath); query(sb, "date.from", date_from); query(sb, "date.to", date_to); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> order_GET(Date date_from, Date date_to) throws IOException { String qPath = "/me/order"; StringBuilder sb = path(qPath); query(sb, "date.from", date_from); query(sb, "date.to", date_to); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "order_GET", "(", "Date", "date_from", ",", "Date", "date_to", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/order\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(...
List of all the orders the logged account has REST: GET /me/order @param date_to [required] Filter the value of date property (<=) @param date_from [required] Filter the value of date property (>=)
[ "List", "of", "all", "the", "orders", "the", "logged", "account", "has" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2112-L2119
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/RangeStatisticImpl.java
RangeStatisticImpl.setWaterMark
public void setWaterMark(long curTime, long val) { lastSampleTime = curTime; if (!initWaterMark) { lowWaterMark = highWaterMark = val; initWaterMark = true; } else { if (val < lowWaterMark) lowWaterMark = val; if (val > highWaterMark) highWaterMark = val; } /* * if(val < lowWaterMark || lowWaterMark < 0) * lowWaterMark = val; * * if(val > highWaterMark) * highWaterMark = val; */ current = val; }
java
public void setWaterMark(long curTime, long val) { lastSampleTime = curTime; if (!initWaterMark) { lowWaterMark = highWaterMark = val; initWaterMark = true; } else { if (val < lowWaterMark) lowWaterMark = val; if (val > highWaterMark) highWaterMark = val; } /* * if(val < lowWaterMark || lowWaterMark < 0) * lowWaterMark = val; * * if(val > highWaterMark) * highWaterMark = val; */ current = val; }
[ "public", "void", "setWaterMark", "(", "long", "curTime", ",", "long", "val", ")", "{", "lastSampleTime", "=", "curTime", ";", "if", "(", "!", "initWaterMark", ")", "{", "lowWaterMark", "=", "highWaterMark", "=", "val", ";", "initWaterMark", "=", "true", "...
/* Non-Synchronizable: counter is "replaced" with the input value. Caller should synchronize.
[ "/", "*", "Non", "-", "Synchronizable", ":", "counter", "is", "replaced", "with", "the", "input", "value", ".", "Caller", "should", "synchronize", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/RangeStatisticImpl.java#L117-L138
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.translateConstantDeclaration
private void translateConstantDeclaration(WyilFile.Decl.StaticVariable decl) { if (decl.hasInitialiser()) { // The environments are needed to prevent clashes between variable // versions across verification conditions, and also to type variables // used in verification conditions. GlobalEnvironment globalEnvironment = new GlobalEnvironment(decl); LocalEnvironment localEnvironment = new LocalEnvironment(globalEnvironment); List<VerificationCondition> vcs = new ArrayList<>(); Context context = new Context(wyalFile, AssumptionSet.ROOT, localEnvironment, localEnvironment, null, vcs); // Pair<Expr, Context> rp = translateExpressionWithChecks(decl.getInitialiser(), null, context); generateTypeInvariantCheck(decl.getType(), rp.first(), context); // Translate each generated verification condition into an assertion in // the underlying WyalFile. createAssertions(decl, vcs, globalEnvironment); } }
java
private void translateConstantDeclaration(WyilFile.Decl.StaticVariable decl) { if (decl.hasInitialiser()) { // The environments are needed to prevent clashes between variable // versions across verification conditions, and also to type variables // used in verification conditions. GlobalEnvironment globalEnvironment = new GlobalEnvironment(decl); LocalEnvironment localEnvironment = new LocalEnvironment(globalEnvironment); List<VerificationCondition> vcs = new ArrayList<>(); Context context = new Context(wyalFile, AssumptionSet.ROOT, localEnvironment, localEnvironment, null, vcs); // Pair<Expr, Context> rp = translateExpressionWithChecks(decl.getInitialiser(), null, context); generateTypeInvariantCheck(decl.getType(), rp.first(), context); // Translate each generated verification condition into an assertion in // the underlying WyalFile. createAssertions(decl, vcs, globalEnvironment); } }
[ "private", "void", "translateConstantDeclaration", "(", "WyilFile", ".", "Decl", ".", "StaticVariable", "decl", ")", "{", "if", "(", "decl", ".", "hasInitialiser", "(", ")", ")", "{", "// The environments are needed to prevent clashes between variable", "// versions acros...
Translate a constant declaration into WyAL. At the moment, this does nothing because constant declarations are not supported in WyAL files. @param declaration The type declaration being translated. @param wyalFile The WyAL file being constructed
[ "Translate", "a", "constant", "declaration", "into", "WyAL", ".", "At", "the", "moment", "this", "does", "nothing", "because", "constant", "declarations", "are", "not", "supported", "in", "WyAL", "files", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L164-L180
hltcoe/annotated-nyt
src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java
NYTCorpusDocumentParser.parseStringToDOM
private Document parseStringToDOM(String s, String encoding) { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setValidating(false); InputStream is = new ByteArrayInputStream(s.getBytes(encoding)); Document doc = factory.newDocumentBuilder().parse(is); return doc; } catch (SAXException e) { e.printStackTrace(); System.out.println("Exception processing string."); } catch (ParserConfigurationException e) { e.printStackTrace(); System.out.println("Exception processing string."); } catch (IOException e) { e.printStackTrace(); System.out.println("Exception processing string."); } return null; }
java
private Document parseStringToDOM(String s, String encoding) { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setValidating(false); InputStream is = new ByteArrayInputStream(s.getBytes(encoding)); Document doc = factory.newDocumentBuilder().parse(is); return doc; } catch (SAXException e) { e.printStackTrace(); System.out.println("Exception processing string."); } catch (ParserConfigurationException e) { e.printStackTrace(); System.out.println("Exception processing string."); } catch (IOException e) { e.printStackTrace(); System.out.println("Exception processing string."); } return null; }
[ "private", "Document", "parseStringToDOM", "(", "String", "s", ",", "String", "encoding", ")", "{", "try", "{", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setValidating", "(", "false", ...
Parse a string to a DOM document. @param s A string containing an XML document. @return The DOM document if it can be parsed, or null otherwise.
[ "Parse", "a", "string", "to", "a", "DOM", "document", "." ]
train
https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java#L430-L449
wmdietl/jsr308-langtools
src/share/classes/javax/tools/ToolProvider.java
ToolProvider.trace
static <T> T trace(Level level, Object reason) { // NOTE: do not make this method private as it affects stack traces try { if (System.getProperty(propertyName) != null) { StackTraceElement[] st = Thread.currentThread().getStackTrace(); String method = "???"; String cls = ToolProvider.class.getName(); if (st.length > 2) { StackTraceElement frame = st[2]; method = String.format((Locale)null, "%s(%s:%s)", frame.getMethodName(), frame.getFileName(), frame.getLineNumber()); cls = frame.getClassName(); } Logger logger = Logger.getLogger(loggerName); if (reason instanceof Throwable) { logger.logp(level, cls, method, reason.getClass().getName(), (Throwable)reason); } else { logger.logp(level, cls, method, String.valueOf(reason)); } } } catch (SecurityException ex) { System.err.format((Locale)null, "%s: %s; %s%n", ToolProvider.class.getName(), reason, ex.getLocalizedMessage()); } return null; }
java
static <T> T trace(Level level, Object reason) { // NOTE: do not make this method private as it affects stack traces try { if (System.getProperty(propertyName) != null) { StackTraceElement[] st = Thread.currentThread().getStackTrace(); String method = "???"; String cls = ToolProvider.class.getName(); if (st.length > 2) { StackTraceElement frame = st[2]; method = String.format((Locale)null, "%s(%s:%s)", frame.getMethodName(), frame.getFileName(), frame.getLineNumber()); cls = frame.getClassName(); } Logger logger = Logger.getLogger(loggerName); if (reason instanceof Throwable) { logger.logp(level, cls, method, reason.getClass().getName(), (Throwable)reason); } else { logger.logp(level, cls, method, String.valueOf(reason)); } } } catch (SecurityException ex) { System.err.format((Locale)null, "%s: %s; %s%n", ToolProvider.class.getName(), reason, ex.getLocalizedMessage()); } return null; }
[ "static", "<", "T", ">", "T", "trace", "(", "Level", "level", ",", "Object", "reason", ")", "{", "// NOTE: do not make this method private as it affects stack traces", "try", "{", "if", "(", "System", ".", "getProperty", "(", "propertyName", ")", "!=", "null", "...
/* Define the system property "sun.tools.ToolProvider" to enable debugging: java ... -Dsun.tools.ToolProvider ...
[ "/", "*", "Define", "the", "system", "property", "sun", ".", "tools", ".", "ToolProvider", "to", "enable", "debugging", ":" ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/javax/tools/ToolProvider.java#L60-L90
uber/AutoDispose
static-analysis/autodispose-error-prone/src/main/java/com/uber/autodispose/errorprone/AbstractReturnValueIgnored.java
AbstractReturnValueIgnored.describe
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) { // Find the root of the field access chain, i.e. a.intern().trim() ==> a. ExpressionTree identifierExpr = ASTHelpers.getRootAssignable(methodInvocationTree); String identifierStr = null; Type identifierType = null; if (identifierExpr != null) { identifierStr = state.getSourceForNode(identifierExpr); if (identifierExpr instanceof JCIdent) { identifierType = ((JCIdent) identifierExpr).sym.type; } else if (identifierExpr instanceof JCFieldAccess) { identifierType = ((JCFieldAccess) identifierExpr).sym.type; } else { throw new IllegalStateException("Expected a JCIdent or a JCFieldAccess"); } } Type returnType = getReturnType(((JCMethodInvocation) methodInvocationTree).getMethodSelect()); Fix fix; if (identifierStr != null && !"this".equals(identifierStr) && returnType != null && state.getTypes().isAssignable(returnType, identifierType)) { // Fix by assigning the assigning the result of the call to the root receiver reference. fix = SuggestedFix.prefixWith(methodInvocationTree, identifierStr + " = "); } else { // Unclear what the programmer intended. Delete since we don't know what else to do. Tree parent = state.getPath().getParentPath().getLeaf(); fix = SuggestedFix.delete(parent); } return describeMatch(methodInvocationTree, fix); }
java
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) { // Find the root of the field access chain, i.e. a.intern().trim() ==> a. ExpressionTree identifierExpr = ASTHelpers.getRootAssignable(methodInvocationTree); String identifierStr = null; Type identifierType = null; if (identifierExpr != null) { identifierStr = state.getSourceForNode(identifierExpr); if (identifierExpr instanceof JCIdent) { identifierType = ((JCIdent) identifierExpr).sym.type; } else if (identifierExpr instanceof JCFieldAccess) { identifierType = ((JCFieldAccess) identifierExpr).sym.type; } else { throw new IllegalStateException("Expected a JCIdent or a JCFieldAccess"); } } Type returnType = getReturnType(((JCMethodInvocation) methodInvocationTree).getMethodSelect()); Fix fix; if (identifierStr != null && !"this".equals(identifierStr) && returnType != null && state.getTypes().isAssignable(returnType, identifierType)) { // Fix by assigning the assigning the result of the call to the root receiver reference. fix = SuggestedFix.prefixWith(methodInvocationTree, identifierStr + " = "); } else { // Unclear what the programmer intended. Delete since we don't know what else to do. Tree parent = state.getPath().getParentPath().getLeaf(); fix = SuggestedFix.delete(parent); } return describeMatch(methodInvocationTree, fix); }
[ "private", "Description", "describe", "(", "MethodInvocationTree", "methodInvocationTree", ",", "VisitorState", "state", ")", "{", "// Find the root of the field access chain, i.e. a.intern().trim() ==> a.", "ExpressionTree", "identifierExpr", "=", "ASTHelpers", ".", "getRootAssign...
Fixes the error by assigning the result of the call to the receiver reference, or deleting the method call.
[ "Fixes", "the", "error", "by", "assigning", "the", "result", "of", "the", "call", "to", "the", "receiver", "reference", "or", "deleting", "the", "method", "call", "." ]
train
https://github.com/uber/AutoDispose/blob/1115b0274f7960354289bb3ae7ba75b0c5a47457/static-analysis/autodispose-error-prone/src/main/java/com/uber/autodispose/errorprone/AbstractReturnValueIgnored.java#L262-L293
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java
TransformationPerformer.getObjectValue
private Object getObjectValue(String fieldname, boolean fromSource) throws Exception { Object sourceObject = fromSource ? source : target; Object result = null; for (String part : StringUtils.split(fieldname, ".")) { if (isTemporaryField(part)) { result = loadObjectFromTemporary(part, fieldname); } else { result = loadObjectFromField(part, result, sourceObject); } } return result; }
java
private Object getObjectValue(String fieldname, boolean fromSource) throws Exception { Object sourceObject = fromSource ? source : target; Object result = null; for (String part : StringUtils.split(fieldname, ".")) { if (isTemporaryField(part)) { result = loadObjectFromTemporary(part, fieldname); } else { result = loadObjectFromField(part, result, sourceObject); } } return result; }
[ "private", "Object", "getObjectValue", "(", "String", "fieldname", ",", "boolean", "fromSource", ")", "throws", "Exception", "{", "Object", "sourceObject", "=", "fromSource", "?", "source", ":", "target", ";", "Object", "result", "=", "null", ";", "for", "(", ...
Gets the value of the field with the field name either from the source object or the target object, depending on the parameters. Is also aware of temporary fields.
[ "Gets", "the", "value", "of", "the", "field", "with", "the", "field", "name", "either", "from", "the", "source", "object", "or", "the", "target", "object", "depending", "on", "the", "parameters", ".", "Is", "also", "aware", "of", "temporary", "fields", "."...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java#L166-L177
alkacon/opencms-core
src/org/opencms/ui/apps/modules/CmsModuleInfoDialog.java
CmsModuleInfoDialog.formatResourceType
@SuppressWarnings("deprecation") CmsResourceInfo formatResourceType(I_CmsResourceType type) { CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName()); Resource icon; String title; String subtitle; if (settings != null) { icon = CmsResourceUtil.getBigIconResource(settings, null); title = CmsVaadinUtils.getMessageText(settings.getKey()); if (title.startsWith("???")) { title = type.getTypeName(); } subtitle = type.getTypeName() + " (ID: " + type.getTypeId() + (settings.getReference() != null ? (", " + settings.getReference()) : "") + ")"; } else { icon = CmsResourceUtil.getBigIconResource( OpenCms.getWorkplaceManager().getExplorerTypeSetting("unknown"), null); title = type.getTypeName(); subtitle = type.getTypeName() + " (ID: " + type.getTypeId() + ")"; } CmsResourceInfo info = new CmsResourceInfo(title, subtitle, icon); return info; }
java
@SuppressWarnings("deprecation") CmsResourceInfo formatResourceType(I_CmsResourceType type) { CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName()); Resource icon; String title; String subtitle; if (settings != null) { icon = CmsResourceUtil.getBigIconResource(settings, null); title = CmsVaadinUtils.getMessageText(settings.getKey()); if (title.startsWith("???")) { title = type.getTypeName(); } subtitle = type.getTypeName() + " (ID: " + type.getTypeId() + (settings.getReference() != null ? (", " + settings.getReference()) : "") + ")"; } else { icon = CmsResourceUtil.getBigIconResource( OpenCms.getWorkplaceManager().getExplorerTypeSetting("unknown"), null); title = type.getTypeName(); subtitle = type.getTypeName() + " (ID: " + type.getTypeId() + ")"; } CmsResourceInfo info = new CmsResourceInfo(title, subtitle, icon); return info; }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "CmsResourceInfo", "formatResourceType", "(", "I_CmsResourceType", "type", ")", "{", "CmsExplorerTypeSettings", "settings", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getExplorerTypeSetting", "(", "t...
Creates the resource info box for a resource type.<p> @param type the resource type @return the resource info box
[ "Creates", "the", "resource", "info", "box", "for", "a", "resource", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsModuleInfoDialog.java#L172-L199
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.setLineDashPattern
public void setLineDashPattern (final float [] pattern, final float phase) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: setLineDashPattern is not allowed within a text block."); } write ((byte) '['); for (final float value : pattern) { writeOperand (value); } write ((byte) ']', (byte) ' '); writeOperand (phase); writeOperator ((byte) 'd'); }
java
public void setLineDashPattern (final float [] pattern, final float phase) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: setLineDashPattern is not allowed within a text block."); } write ((byte) '['); for (final float value : pattern) { writeOperand (value); } write ((byte) ']', (byte) ' '); writeOperand (phase); writeOperator ((byte) 'd'); }
[ "public", "void", "setLineDashPattern", "(", "final", "float", "[", "]", "pattern", ",", "final", "float", "phase", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error: setLineDashPattern is ...
Set the line dash pattern. @param pattern The pattern array @param phase The phase of the pattern @throws IOException If the content stream could not be written. @throws IllegalStateException If the method was called within a text block.
[ "Set", "the", "line", "dash", "pattern", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1494-L1508
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/slider/SliderRenderer.java
SliderRenderer.decode
@Override public void decode(FacesContext context, UIComponent component) { Slider slider = (Slider) component; if (slider.isDisabled() || slider.isReadonly()) { return; } decodeBehaviors(context, slider); String clientId = slider.getClientId(context); String submittedValue = (String) context.getExternalContext().getRequestParameterMap().get(clientId); if (submittedValue != null) { slider.setSubmittedValue(submittedValue); slider.setValid(true); } }
java
@Override public void decode(FacesContext context, UIComponent component) { Slider slider = (Slider) component; if (slider.isDisabled() || slider.isReadonly()) { return; } decodeBehaviors(context, slider); String clientId = slider.getClientId(context); String submittedValue = (String) context.getExternalContext().getRequestParameterMap().get(clientId); if (submittedValue != null) { slider.setSubmittedValue(submittedValue); slider.setValid(true); } }
[ "@", "Override", "public", "void", "decode", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "{", "Slider", "slider", "=", "(", "Slider", ")", "component", ";", "if", "(", "slider", ".", "isDisabled", "(", ")", "||", "slider", ".", ...
This methods receives and processes input made by the user. More specifically, it ckecks whether the user has interacted with the current b:slider. The default implementation simply stores the input value in the list of submitted values. If the validation checks are passed, the values in the <code>submittedValues</code> list are store in the backend bean. @param context the FacesContext. @param component the current b:slider.
[ "This", "methods", "receives", "and", "processes", "input", "made", "by", "the", "user", ".", "More", "specifically", "it", "ckecks", "whether", "the", "user", "has", "interacted", "with", "the", "current", "b", ":", "slider", ".", "The", "default", "impleme...
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/slider/SliderRenderer.java#L52-L69
citrusframework/citrus
modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java
PurgeJmsQueuesAction.getDestination
private Destination getDestination(Session session, String queueName) throws JMSException { return new DynamicDestinationResolver().resolveDestinationName(session, queueName, false); }
java
private Destination getDestination(Session session, String queueName) throws JMSException { return new DynamicDestinationResolver().resolveDestinationName(session, queueName, false); }
[ "private", "Destination", "getDestination", "(", "Session", "session", ",", "String", "queueName", ")", "throws", "JMSException", "{", "return", "new", "DynamicDestinationResolver", "(", ")", ".", "resolveDestinationName", "(", "session", ",", "queueName", ",", "fal...
Resolves destination by given name. @param session @param queueName @return @throws JMSException
[ "Resolves", "destination", "by", "given", "name", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L167-L169
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.relativeCubicTo
public SVGPath relativeCubicTo(double[] c1xy, double[] c2xy, double[] xy) { return append(PATH_CUBIC_TO_RELATIVE).append(c1xy[0]).append(c1xy[1]).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]); }
java
public SVGPath relativeCubicTo(double[] c1xy, double[] c2xy, double[] xy) { return append(PATH_CUBIC_TO_RELATIVE).append(c1xy[0]).append(c1xy[1]).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]); }
[ "public", "SVGPath", "relativeCubicTo", "(", "double", "[", "]", "c1xy", ",", "double", "[", "]", "c2xy", ",", "double", "[", "]", "xy", ")", "{", "return", "append", "(", "PATH_CUBIC_TO_RELATIVE", ")", ".", "append", "(", "c1xy", "[", "0", "]", ")", ...
Cubic Bezier line to the given relative coordinates. @param c1xy first control point @param c2xy second control point @param xy new coordinates @return path object, for compact syntax.
[ "Cubic", "Bezier", "line", "to", "the", "given", "relative", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L396-L398
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java
ConditionalFunctions.nullIf
public static Expression nullIf(Expression expression1, Expression expression2) { return x("NULLIF(" + expression1.toString() + ", " + expression2.toString() + ")"); }
java
public static Expression nullIf(Expression expression1, Expression expression2) { return x("NULLIF(" + expression1.toString() + ", " + expression2.toString() + ")"); }
[ "public", "static", "Expression", "nullIf", "(", "Expression", "expression1", ",", "Expression", "expression2", ")", "{", "return", "x", "(", "\"NULLIF(\"", "+", "expression1", ".", "toString", "(", ")", "+", "\", \"", "+", "expression2", ".", "toString", "(",...
Returned expression results in NULL if expression1 = expression2, otherwise returns expression1. Returns MISSING or NULL if either input is MISSING or NULL..
[ "Returned", "expression", "results", "in", "NULL", "if", "expression1", "=", "expression2", "otherwise", "returns", "expression1", ".", "Returns", "MISSING", "or", "NULL", "if", "either", "input", "is", "MISSING", "or", "NULL", ".." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L91-L93
netty/netty
transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java
AbstractEpollStreamChannel.doWriteSingle
protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception { // The outbound buffer contains only one message or it contains a file region. Object msg = in.current(); if (msg instanceof ByteBuf) { return writeBytes(in, (ByteBuf) msg); } else if (msg instanceof DefaultFileRegion) { return writeDefaultFileRegion(in, (DefaultFileRegion) msg); } else if (msg instanceof FileRegion) { return writeFileRegion(in, (FileRegion) msg); } else if (msg instanceof SpliceOutTask) { if (!((SpliceOutTask) msg).spliceOut()) { return WRITE_STATUS_SNDBUF_FULL; } in.remove(); return 1; } else { // Should never reach here. throw new Error(); } }
java
protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception { // The outbound buffer contains only one message or it contains a file region. Object msg = in.current(); if (msg instanceof ByteBuf) { return writeBytes(in, (ByteBuf) msg); } else if (msg instanceof DefaultFileRegion) { return writeDefaultFileRegion(in, (DefaultFileRegion) msg); } else if (msg instanceof FileRegion) { return writeFileRegion(in, (FileRegion) msg); } else if (msg instanceof SpliceOutTask) { if (!((SpliceOutTask) msg).spliceOut()) { return WRITE_STATUS_SNDBUF_FULL; } in.remove(); return 1; } else { // Should never reach here. throw new Error(); } }
[ "protected", "int", "doWriteSingle", "(", "ChannelOutboundBuffer", "in", ")", "throws", "Exception", "{", "// The outbound buffer contains only one message or it contains a file region.", "Object", "msg", "=", "in", ".", "current", "(", ")", ";", "if", "(", "msg", "inst...
Attempt to write a single object. @param in the collection which contains objects to write. @return The value that should be decremented from the write quantum which starts at {@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows: <ul> <li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content) is encountered</li> <li>1 - if a single call to write data was made to the OS</li> <li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no data was accepted</li> </ul> @throws Exception If an I/O error occurs.
[ "Attempt", "to", "write", "a", "single", "object", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L476-L495
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphDump.java
ObjectGraphDump.readField
private Object readField(final Field field, final Object obj) { try { return field.get(obj); } catch (IllegalAccessException e) { // Should not happen as we've called Field.setAccessible(true). LOG.error("Failed to read " + field.getName() + " of " + obj.getClass().getName(), e); } return null; }
java
private Object readField(final Field field, final Object obj) { try { return field.get(obj); } catch (IllegalAccessException e) { // Should not happen as we've called Field.setAccessible(true). LOG.error("Failed to read " + field.getName() + " of " + obj.getClass().getName(), e); } return null; }
[ "private", "Object", "readField", "(", "final", "Field", "field", ",", "final", "Object", "obj", ")", "{", "try", "{", "return", "field", ".", "get", "(", "obj", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "// Should not happen as...
Reads the contents of a field. @param field the field definition. @param obj the object to read the value from. @return the value of the field in the given object.
[ "Reads", "the", "contents", "of", "a", "field", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphDump.java#L189-L198
google/closure-compiler
src/com/google/javascript/jscomp/TypeCheck.java
TypeCheck.visitAssign
private void visitAssign(NodeTraversal t, Node assign) { JSDocInfo info = assign.getJSDocInfo(); Node lvalue = assign.getFirstChild(); Node rvalue = assign.getLastChild(); JSType rightType = getJSType(rvalue); checkCanAssignToWithScope(t, assign, lvalue, rightType, info, "assignment"); ensureTyped(assign, rightType); }
java
private void visitAssign(NodeTraversal t, Node assign) { JSDocInfo info = assign.getJSDocInfo(); Node lvalue = assign.getFirstChild(); Node rvalue = assign.getLastChild(); JSType rightType = getJSType(rvalue); checkCanAssignToWithScope(t, assign, lvalue, rightType, info, "assignment"); ensureTyped(assign, rightType); }
[ "private", "void", "visitAssign", "(", "NodeTraversal", "t", ",", "Node", "assign", ")", "{", "JSDocInfo", "info", "=", "assign", ".", "getJSDocInfo", "(", ")", ";", "Node", "lvalue", "=", "assign", ".", "getFirstChild", "(", ")", ";", "Node", "rvalue", ...
Visits an assignment <code>lvalue = rvalue</code>. If the <code>lvalue</code> is a prototype modification, we change the schema of the object type it is referring to. @param t the traversal @param assign the assign node (<code>assign.isAssign()</code> is an implicit invariant)
[ "Visits", "an", "assignment", "<code", ">", "lvalue", "=", "rvalue<", "/", "code", ">", ".", "If", "the", "<code", ">", "lvalue<", "/", "code", ">", "is", "a", "prototype", "modification", "we", "change", "the", "schema", "of", "the", "object", "type", ...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1095-L1103
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getEntityRolesAsync
public Observable<List<EntityRole>> getEntityRolesAsync(UUID appId, String versionId, UUID entityId) { return getEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
java
public Observable<List<EntityRole>> getEntityRolesAsync(UUID appId, String versionId, UUID entityId) { return getEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EntityRole", ">", ">", "getEntityRolesAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "getEntityRolesWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", ...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity Id @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EntityRole&gt; object
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7686-L7693
damianszczepanik/cucumber-reporting
src/main/java/net/masterthought/cucumber/ReportBuilder.java
ReportBuilder.generateReports
public Reportable generateReports() { Trends trends = null; try { // first copy static resources so ErrorPage is displayed properly copyStaticResources(); // create directory for embeddings before files are generated createEmbeddingsDirectory(); // add metadata info sourced from files reportParser.parseClassificationsFiles(configuration.getClassificationFiles()); // parse json files for results List<Feature> features = reportParser.parseJsonFiles(jsonFiles); reportResult = new ReportResult(features, configuration); Reportable reportable = reportResult.getFeatureReport(); if (configuration.isTrendsAvailable()) { // prepare data required by generators, collect generators and generate pages trends = updateAndSaveTrends(reportable); } // Collect and generate pages in a single pass generatePages(trends); return reportable; // whatever happens we want to provide at least error page instead of incomplete report or exception } catch (Exception e) { generateErrorPage(e); // update trends so there is information in history that the build failed // if trends was not created then something went wrong // and information about build failure should be saved if (!wasTrendsFileSaved && configuration.isTrendsAvailable()) { Reportable reportable = new EmptyReportable(); updateAndSaveTrends(reportable); } // something went wrong, don't pass result that might be incomplete return null; } }
java
public Reportable generateReports() { Trends trends = null; try { // first copy static resources so ErrorPage is displayed properly copyStaticResources(); // create directory for embeddings before files are generated createEmbeddingsDirectory(); // add metadata info sourced from files reportParser.parseClassificationsFiles(configuration.getClassificationFiles()); // parse json files for results List<Feature> features = reportParser.parseJsonFiles(jsonFiles); reportResult = new ReportResult(features, configuration); Reportable reportable = reportResult.getFeatureReport(); if (configuration.isTrendsAvailable()) { // prepare data required by generators, collect generators and generate pages trends = updateAndSaveTrends(reportable); } // Collect and generate pages in a single pass generatePages(trends); return reportable; // whatever happens we want to provide at least error page instead of incomplete report or exception } catch (Exception e) { generateErrorPage(e); // update trends so there is information in history that the build failed // if trends was not created then something went wrong // and information about build failure should be saved if (!wasTrendsFileSaved && configuration.isTrendsAvailable()) { Reportable reportable = new EmptyReportable(); updateAndSaveTrends(reportable); } // something went wrong, don't pass result that might be incomplete return null; } }
[ "public", "Reportable", "generateReports", "(", ")", "{", "Trends", "trends", "=", "null", ";", "try", "{", "// first copy static resources so ErrorPage is displayed properly", "copyStaticResources", "(", ")", ";", "// create directory for embeddings before files are generated", ...
Parses provided files and generates the report. When generating process fails report with information about error is provided. @return stats for the generated report
[ "Parses", "provided", "files", "and", "generates", "the", "report", ".", "When", "generating", "process", "fails", "report", "with", "information", "about", "error", "is", "provided", "." ]
train
https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/ReportBuilder.java#L74-L117
openbase/jul
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java
AbstractRemoteClient.addHandler
public void addHandler(final Handler handler, final boolean wait) throws InterruptedException, CouldNotPerformException { try { listener.addHandler(handler, wait); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not register Handler!", ex); } }
java
public void addHandler(final Handler handler, final boolean wait) throws InterruptedException, CouldNotPerformException { try { listener.addHandler(handler, wait); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not register Handler!", ex); } }
[ "public", "void", "addHandler", "(", "final", "Handler", "handler", ",", "final", "boolean", "wait", ")", "throws", "InterruptedException", ",", "CouldNotPerformException", "{", "try", "{", "listener", ".", "addHandler", "(", "handler", ",", "wait", ")", ";", ...
Method adds an handler to the internal rsb listener. @param handler @param wait @throws InterruptedException @throws CouldNotPerformException
[ "Method", "adds", "an", "handler", "to", "the", "internal", "rsb", "listener", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L358-L364
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/security/OSecurityManager.java
OSecurityManager.digest2String
public String digest2String(final String iInput, final boolean iIncludeAlgorithm) { final StringBuilder buffer = new StringBuilder(); if (iIncludeAlgorithm) buffer.append(ALGORITHM_PREFIX); buffer.append(OSecurityManager.instance().digest2String(iInput)); return buffer.toString(); }
java
public String digest2String(final String iInput, final boolean iIncludeAlgorithm) { final StringBuilder buffer = new StringBuilder(); if (iIncludeAlgorithm) buffer.append(ALGORITHM_PREFIX); buffer.append(OSecurityManager.instance().digest2String(iInput)); return buffer.toString(); }
[ "public", "String", "digest2String", "(", "final", "String", "iInput", ",", "final", "boolean", "iIncludeAlgorithm", ")", "{", "final", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "iIncludeAlgorithm", ")", "buffer", ".", "...
Hashes the input string. @param iInput String to hash @param iIncludeAlgorithm Include the algorithm used or not @return
[ "Hashes", "the", "input", "string", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/security/OSecurityManager.java#L77-L85
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/ResourceIndexImpl.java
ResourceIndexImpl.updateTriples
private void updateTriples(Set<Triple> set, boolean delete) throws ResourceIndexException { try { if (delete) { _writer.delete(getTripleIterator(set), _syncUpdates); } else { _writer.add(getTripleIterator(set), _syncUpdates); } } catch (Exception e) { throw new ResourceIndexException("Error updating triples", e); } }
java
private void updateTriples(Set<Triple> set, boolean delete) throws ResourceIndexException { try { if (delete) { _writer.delete(getTripleIterator(set), _syncUpdates); } else { _writer.add(getTripleIterator(set), _syncUpdates); } } catch (Exception e) { throw new ResourceIndexException("Error updating triples", e); } }
[ "private", "void", "updateTriples", "(", "Set", "<", "Triple", ">", "set", ",", "boolean", "delete", ")", "throws", "ResourceIndexException", "{", "try", "{", "if", "(", "delete", ")", "{", "_writer", ".", "delete", "(", "getTripleIterator", "(", "set", ")...
Applies the given adds or deletes to the triplestore. If _syncUpdates is true, changes will be flushed before returning.
[ "Applies", "the", "given", "adds", "or", "deletes", "to", "the", "triplestore", ".", "If", "_syncUpdates", "is", "true", "changes", "will", "be", "flushed", "before", "returning", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/ResourceIndexImpl.java#L159-L170
netty/netty
common/src/main/java/io/netty/util/concurrent/DefaultPromise.java
DefaultPromise.notifyProgressiveListeners
@SuppressWarnings("unchecked") void notifyProgressiveListeners(final long progress, final long total) { final Object listeners = progressiveListeners(); if (listeners == null) { return; } final ProgressiveFuture<V> self = (ProgressiveFuture<V>) this; EventExecutor executor = executor(); if (executor.inEventLoop()) { if (listeners instanceof GenericProgressiveFutureListener[]) { notifyProgressiveListeners0( self, (GenericProgressiveFutureListener<?>[]) listeners, progress, total); } else { notifyProgressiveListener0( self, (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners, progress, total); } } else { if (listeners instanceof GenericProgressiveFutureListener[]) { final GenericProgressiveFutureListener<?>[] array = (GenericProgressiveFutureListener<?>[]) listeners; safeExecute(executor, new Runnable() { @Override public void run() { notifyProgressiveListeners0(self, array, progress, total); } }); } else { final GenericProgressiveFutureListener<ProgressiveFuture<V>> l = (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners; safeExecute(executor, new Runnable() { @Override public void run() { notifyProgressiveListener0(self, l, progress, total); } }); } } }
java
@SuppressWarnings("unchecked") void notifyProgressiveListeners(final long progress, final long total) { final Object listeners = progressiveListeners(); if (listeners == null) { return; } final ProgressiveFuture<V> self = (ProgressiveFuture<V>) this; EventExecutor executor = executor(); if (executor.inEventLoop()) { if (listeners instanceof GenericProgressiveFutureListener[]) { notifyProgressiveListeners0( self, (GenericProgressiveFutureListener<?>[]) listeners, progress, total); } else { notifyProgressiveListener0( self, (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners, progress, total); } } else { if (listeners instanceof GenericProgressiveFutureListener[]) { final GenericProgressiveFutureListener<?>[] array = (GenericProgressiveFutureListener<?>[]) listeners; safeExecute(executor, new Runnable() { @Override public void run() { notifyProgressiveListeners0(self, array, progress, total); } }); } else { final GenericProgressiveFutureListener<ProgressiveFuture<V>> l = (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners; safeExecute(executor, new Runnable() { @Override public void run() { notifyProgressiveListener0(self, l, progress, total); } }); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "void", "notifyProgressiveListeners", "(", "final", "long", "progress", ",", "final", "long", "total", ")", "{", "final", "Object", "listeners", "=", "progressiveListeners", "(", ")", ";", "if", "(", "listeners...
Notify all progressive listeners. <p> No attempt is made to ensure notification order if multiple calls are made to this method before the original invocation completes. <p> This will do an iteration over all listeners to get all of type {@link GenericProgressiveFutureListener}s. @param progress the new progress. @param total the total progress.
[ "Notify", "all", "progressive", "listeners", ".", "<p", ">", "No", "attempt", "is", "made", "to", "ensure", "notification", "order", "if", "multiple", "calls", "are", "made", "to", "this", "method", "before", "the", "original", "invocation", "completes", ".", ...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java#L641-L680
huangp/entityunit
src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java
PreferredValueMakersRegistry.addConstructorParameterMaker
public PreferredValueMakersRegistry addConstructorParameterMaker(Class ownerType, int argIndex, Maker<?> maker) { Preconditions.checkNotNull(ownerType); Preconditions.checkArgument(argIndex >= 0); makers.put(Matchers.equalTo(String.format(Settable.FULL_NAME_FORMAT, ownerType.getName(), "arg" + argIndex)), maker); return this; }
java
public PreferredValueMakersRegistry addConstructorParameterMaker(Class ownerType, int argIndex, Maker<?> maker) { Preconditions.checkNotNull(ownerType); Preconditions.checkArgument(argIndex >= 0); makers.put(Matchers.equalTo(String.format(Settable.FULL_NAME_FORMAT, ownerType.getName(), "arg" + argIndex)), maker); return this; }
[ "public", "PreferredValueMakersRegistry", "addConstructorParameterMaker", "(", "Class", "ownerType", ",", "int", "argIndex", ",", "Maker", "<", "?", ">", "maker", ")", "{", "Preconditions", ".", "checkNotNull", "(", "ownerType", ")", ";", "Preconditions", ".", "ch...
Add a constructor parameter maker to a class type. i.e. with: <pre> {@code Class Person { Person(String name, int age) } } </pre> You could define a custom maker for name as (Person.class, 0, myNameMaker) @param ownerType the class that owns the field. @param argIndex constructor parameter index (0 based) @param maker custom maker @return this
[ "Add", "a", "constructor", "parameter", "maker", "to", "a", "class", "type", ".", "i", ".", "e", ".", "with", ":", "<pre", ">", "{", "@code" ]
train
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java#L102-L107
jtrfp/javamod
src/main/java/de/quippy/mp3/decoder/Bitstream.java
Bitstream.readFully
private int readFully(byte[] b, int offs, int len) throws BitstreamException { int nRead = 0; try { while (len > 0) { int bytesread = source.read(b, offs, len); if (bytesread == -1) { while (len-->0) { b[offs++] = 0; } break; //throw newBitstreamException(UNEXPECTED_EOF, new EOFException()); } nRead = nRead + bytesread; offs += bytesread; len -= bytesread; } } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR, ex); } return nRead; }
java
private int readFully(byte[] b, int offs, int len) throws BitstreamException { int nRead = 0; try { while (len > 0) { int bytesread = source.read(b, offs, len); if (bytesread == -1) { while (len-->0) { b[offs++] = 0; } break; //throw newBitstreamException(UNEXPECTED_EOF, new EOFException()); } nRead = nRead + bytesread; offs += bytesread; len -= bytesread; } } catch (IOException ex) { throw newBitstreamException(STREAM_ERROR, ex); } return nRead; }
[ "private", "int", "readFully", "(", "byte", "[", "]", "b", ",", "int", "offs", ",", "int", "len", ")", "throws", "BitstreamException", "{", "int", "nRead", "=", "0", ";", "try", "{", "while", "(", "len", ">", "0", ")", "{", "int", "bytesread", "=",...
Reads the exact number of bytes from the source input stream into a byte array. @param b The byte array to read the specified number of bytes into. @param offs The index in the array where the first byte read should be stored. @param len the number of bytes to read. @exception BitstreamException is thrown if the specified number of bytes could not be read from the stream.
[ "Reads", "the", "exact", "number", "of", "bytes", "from", "the", "source", "input", "stream", "into", "a", "byte", "array", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Bitstream.java#L604-L632
tommyettinger/RegExodus
src/main/java/regexodus/Replacer.java
Replacer.makeTable
public static Replacer makeTable(Map<String, String> dict) { if(dict == null || dict.isEmpty()) return new Replacer(Pattern.compile("$"), new DummySubstitution("")); TableSubstitution tab = new TableSubstitution(new LinkedHashMap<String, String>(dict)); StringBuilder sb = new StringBuilder(128); sb.append("(?>"); for(String s : tab.dictionary.keySet()) { sb.append("\\Q"); sb.append(s); sb.append("\\E|"); } if(sb.length() > 3) sb.setCharAt(sb.length() - 1, ')'); else sb.append(')'); return new Replacer(Pattern.compile(sb.toString()), tab); }
java
public static Replacer makeTable(Map<String, String> dict) { if(dict == null || dict.isEmpty()) return new Replacer(Pattern.compile("$"), new DummySubstitution("")); TableSubstitution tab = new TableSubstitution(new LinkedHashMap<String, String>(dict)); StringBuilder sb = new StringBuilder(128); sb.append("(?>"); for(String s : tab.dictionary.keySet()) { sb.append("\\Q"); sb.append(s); sb.append("\\E|"); } if(sb.length() > 3) sb.setCharAt(sb.length() - 1, ')'); else sb.append(')'); return new Replacer(Pattern.compile(sb.toString()), tab); }
[ "public", "static", "Replacer", "makeTable", "(", "Map", "<", "String", ",", "String", ">", "dict", ")", "{", "if", "(", "dict", "==", "null", "||", "dict", ".", "isEmpty", "(", ")", ")", "return", "new", "Replacer", "(", "Pattern", ".", "compile", "...
Makes a Replacer that replaces a literal String key in dict with the corresponding String value in dict. Doesn't need escapes in the Strings it searches for (at index 0, 2, 4, etc.), but cannot search for the exact two characters in immediate succession, backslash then capital E, because it finds literal Strings using {@code \\Q...\\E}. Uses only default modes (not case-insensitive, and most other flags don't have any effect since this doesn't care about "\\w" or other backslash-escaped special categories), but you can get the Pattern from this afterwards and set its flags with its setFlags() method. The Strings this replaces with are the values, and are also literal. If the Map this is given is a sorted Map of some kind or a (preferably) LinkedHashMap, then the order search strings will be tried will be stable; the same is not necessarily true for HashMap. @param dict a Map (hopefully with stable order) with search String keys and replacement String values @return a Replacer that will act as a replacement table for the given Strings
[ "Makes", "a", "Replacer", "that", "replaces", "a", "literal", "String", "key", "in", "dict", "with", "the", "corresponding", "String", "value", "in", "dict", ".", "Doesn", "t", "need", "escapes", "in", "the", "Strings", "it", "searches", "for", "(", "at", ...
train
https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/Replacer.java#L433-L449
lamarios/sherdog-parser
src/main/java/com/ftpix/sherdogparser/parsers/ParserUtils.java
ParserUtils.getDateFromStringToZoneId
static ZonedDateTime getDateFromStringToZoneId(String date, ZoneId zoneId) throws DateTimeParseException { ZonedDateTime usDate = ZonedDateTime.parse(date).withZoneSameInstant(ZoneId.of(Constants.SHERDOG_TIME_ZONE)); return usDate.withZoneSameInstant(zoneId); }
java
static ZonedDateTime getDateFromStringToZoneId(String date, ZoneId zoneId) throws DateTimeParseException { ZonedDateTime usDate = ZonedDateTime.parse(date).withZoneSameInstant(ZoneId.of(Constants.SHERDOG_TIME_ZONE)); return usDate.withZoneSameInstant(zoneId); }
[ "static", "ZonedDateTime", "getDateFromStringToZoneId", "(", "String", "date", ",", "ZoneId", "zoneId", ")", "throws", "DateTimeParseException", "{", "ZonedDateTime", "usDate", "=", "ZonedDateTime", ".", "parse", "(", "date", ")", ".", "withZoneSameInstant", "(", "Z...
Converts a String to the given timezone. @param date Date to format @param zoneId Zone id to convert from sherdog's time @return the converted zonedatetime
[ "Converts", "a", "String", "to", "the", "given", "timezone", "." ]
train
https://github.com/lamarios/sherdog-parser/blob/7cdb36280317caeaaa54db77c04dc4b4e1db053e/src/main/java/com/ftpix/sherdogparser/parsers/ParserUtils.java#L77-L80
alkacon/opencms-core
src/org/opencms/ui/components/CmsErrorDialog.java
CmsErrorDialog.showErrorDialog
public static void showErrorDialog(String message, Throwable t, Runnable onClose) { Window window = prepareWindow(DialogWidth.wide); window.setCaption(Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.GUI_ERROR_0)); window.setContent(new CmsErrorDialog(message, t, onClose, window)); A_CmsUI.get().addWindow(window); }
java
public static void showErrorDialog(String message, Throwable t, Runnable onClose) { Window window = prepareWindow(DialogWidth.wide); window.setCaption(Messages.get().getBundle(A_CmsUI.get().getLocale()).key(Messages.GUI_ERROR_0)); window.setContent(new CmsErrorDialog(message, t, onClose, window)); A_CmsUI.get().addWindow(window); }
[ "public", "static", "void", "showErrorDialog", "(", "String", "message", ",", "Throwable", "t", ",", "Runnable", "onClose", ")", "{", "Window", "window", "=", "prepareWindow", "(", "DialogWidth", ".", "wide", ")", ";", "window", ".", "setCaption", "(", "Mess...
Shows the error dialog.<p> @param message the error message @param t the error to be displayed @param onClose executed on close
[ "Shows", "the", "error", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsErrorDialog.java#L167-L173
jenetics/jenetics
jenetics/src/main/java/io/jenetics/internal/util/require.java
require.nonNegative
public static double nonNegative(final double value, final String message) { if (value < 0) { throw new IllegalArgumentException(format( "%s must not be negative: %f.", message, value )); } return value; }
java
public static double nonNegative(final double value, final String message) { if (value < 0) { throw new IllegalArgumentException(format( "%s must not be negative: %f.", message, value )); } return value; }
[ "public", "static", "double", "nonNegative", "(", "final", "double", "value", ",", "final", "String", "message", ")", "{", "if", "(", "value", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"%s must not be negative: %f.\"",...
Check if the specified value is not negative. @param value the value to check. @param message the exception message. @return the given value. @throws IllegalArgumentException if {@code value < 0}.
[ "Check", "if", "the", "specified", "value", "is", "not", "negative", "." ]
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/internal/util/require.java#L42-L49
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.generatePostRequest
protected HttpPost generatePostRequest(final String path, final String param) { final HttpPost post = new HttpPost(buildUri(path)); post.setEntity(new StringEntity(param, ContentType.APPLICATION_JSON)); return post; }
java
protected HttpPost generatePostRequest(final String path, final String param) { final HttpPost post = new HttpPost(buildUri(path)); post.setEntity(new StringEntity(param, ContentType.APPLICATION_JSON)); return post; }
[ "protected", "HttpPost", "generatePostRequest", "(", "final", "String", "path", ",", "final", "String", "param", ")", "{", "final", "HttpPost", "post", "=", "new", "HttpPost", "(", "buildUri", "(", "path", ")", ")", ";", "post", ".", "setEntity", "(", "new...
Helper method to build the POST request for the server. @param path the path. @param param json string. @return the post object.
[ "Helper", "method", "to", "build", "the", "POST", "request", "for", "the", "server", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L639-L643
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
NettyServerBuilder.permitKeepAliveTime
public NettyServerBuilder permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit) { checkArgument(keepAliveTime >= 0, "permit keepalive time must be non-negative"); permitKeepAliveTimeInNanos = timeUnit.toNanos(keepAliveTime); return this; }
java
public NettyServerBuilder permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit) { checkArgument(keepAliveTime >= 0, "permit keepalive time must be non-negative"); permitKeepAliveTimeInNanos = timeUnit.toNanos(keepAliveTime); return this; }
[ "public", "NettyServerBuilder", "permitKeepAliveTime", "(", "long", "keepAliveTime", ",", "TimeUnit", "timeUnit", ")", "{", "checkArgument", "(", "keepAliveTime", ">=", "0", ",", "\"permit keepalive time must be non-negative\"", ")", ";", "permitKeepAliveTimeInNanos", "=", ...
Specify the most aggressive keep-alive time clients are permitted to configure. The server will try to detect clients exceeding this rate and when detected will forcefully close the connection. The default is 5 minutes. <p>Even though a default is defined that allows some keep-alives, clients must not use keep-alive without approval from the service owner. Otherwise, they may experience failures in the future if the service becomes more restrictive. When unthrottled, keep-alives can cause a significant amount of traffic and CPU usage, so clients and servers should be conservative in what they use and accept. @see #permitKeepAliveWithoutCalls(boolean) @since 1.3.0
[ "Specify", "the", "most", "aggressive", "keep", "-", "alive", "time", "clients", "are", "permitted", "to", "configure", ".", "The", "server", "will", "try", "to", "detect", "clients", "exceeding", "this", "rate", "and", "when", "detected", "will", "forcefully"...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L477-L481
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java
SlingApi.postTruststoreAsync
public com.squareup.okhttp.Call postTruststoreAsync(String operation, String newPassword, String rePassword, String keyStoreType, String removeAlias, File certificate, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postTruststoreValidateBeforeCall(operation, newPassword, rePassword, keyStoreType, removeAlias, certificate, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call postTruststoreAsync(String operation, String newPassword, String rePassword, String keyStoreType, String removeAlias, File certificate, final ApiCallback<String> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postTruststoreValidateBeforeCall(operation, newPassword, rePassword, keyStoreType, removeAlias, certificate, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<String>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postTruststoreAsync", "(", "String", "operation", ",", "String", "newPassword", ",", "String", "rePassword", ",", "String", "keyStoreType", ",", "String", "removeAlias", ",", "File", "certificate", "...
(asynchronously) @param operation (optional) @param newPassword (optional) @param rePassword (optional) @param keyStoreType (optional) @param removeAlias (optional) @param certificate (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java#L4495-L4520
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.setDatabasePageSize
public void setDatabasePageSize(Integer bytes, Class<? extends Storable> type) { if (mDatabasePageSizes == null) { mDatabasePageSizes = new HashMap<Class<?>, Integer>(); } mDatabasePageSizes.put(type, bytes); }
java
public void setDatabasePageSize(Integer bytes, Class<? extends Storable> type) { if (mDatabasePageSizes == null) { mDatabasePageSizes = new HashMap<Class<?>, Integer>(); } mDatabasePageSizes.put(type, bytes); }
[ "public", "void", "setDatabasePageSize", "(", "Integer", "bytes", ",", "Class", "<", "?", "extends", "Storable", ">", "type", ")", "{", "if", "(", "mDatabasePageSizes", "==", "null", ")", "{", "mDatabasePageSizes", "=", "new", "HashMap", "<", "Class", "<", ...
Sets the desired page size for a given type. If not specified, the page size applies to all types.
[ "Sets", "the", "desired", "page", "size", "for", "a", "given", "type", ".", "If", "not", "specified", "the", "page", "size", "applies", "to", "all", "types", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L713-L718
Hygieia/Hygieia
collectors/audit/nfrr/src/main/java/com/capitalone/dashboard/collector/AuditCollectorUtil.java
AuditCollectorUtil.doBasicAuditCheck
private static Audit doBasicAuditCheck(JSONArray jsonArray, JSONArray global, AuditType auditType) { Audit audit = new Audit(); audit.setType(auditType); if (!isConfigured(auditType, global)) { audit.setDataStatus(DataStatus.NOT_CONFIGURED); audit.setAuditStatus(AuditStatus.NA); return audit; } if (jsonArray == null || CollectionUtils.isEmpty(jsonArray)) { audit.setAuditStatus(AuditStatus.NA); audit.setDataStatus(DataStatus.NO_DATA); return audit; } if (isCollectorError(jsonArray)) { audit.setAuditStatus(AuditStatus.NA); audit.setDataStatus(DataStatus.ERROR); return audit; } return null; }
java
private static Audit doBasicAuditCheck(JSONArray jsonArray, JSONArray global, AuditType auditType) { Audit audit = new Audit(); audit.setType(auditType); if (!isConfigured(auditType, global)) { audit.setDataStatus(DataStatus.NOT_CONFIGURED); audit.setAuditStatus(AuditStatus.NA); return audit; } if (jsonArray == null || CollectionUtils.isEmpty(jsonArray)) { audit.setAuditStatus(AuditStatus.NA); audit.setDataStatus(DataStatus.NO_DATA); return audit; } if (isCollectorError(jsonArray)) { audit.setAuditStatus(AuditStatus.NA); audit.setDataStatus(DataStatus.ERROR); return audit; } return null; }
[ "private", "static", "Audit", "doBasicAuditCheck", "(", "JSONArray", "jsonArray", ",", "JSONArray", "global", ",", "AuditType", "auditType", ")", "{", "Audit", "audit", "=", "new", "Audit", "(", ")", ";", "audit", ".", "setType", "(", "auditType", ")", ";", ...
Do basic audit check - configuration, collector error, no data
[ "Do", "basic", "audit", "check", "-", "configuration", "collector", "error", "no", "data" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/audit/nfrr/src/main/java/com/capitalone/dashboard/collector/AuditCollectorUtil.java#L138-L157
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuEventElapsedTime
public static int cuEventElapsedTime(float pMilliseconds[], CUevent hStart, CUevent hEnd) { return checkResult(cuEventElapsedTimeNative(pMilliseconds, hStart, hEnd)); }
java
public static int cuEventElapsedTime(float pMilliseconds[], CUevent hStart, CUevent hEnd) { return checkResult(cuEventElapsedTimeNative(pMilliseconds, hStart, hEnd)); }
[ "public", "static", "int", "cuEventElapsedTime", "(", "float", "pMilliseconds", "[", "]", ",", "CUevent", "hStart", ",", "CUevent", "hEnd", ")", "{", "return", "checkResult", "(", "cuEventElapsedTimeNative", "(", "pMilliseconds", ",", "hStart", ",", "hEnd", ")",...
Computes the elapsed time between two events. <pre> CUresult cuEventElapsedTime ( float* pMilliseconds, CUevent hStart, CUevent hEnd ) </pre> <div> <p>Computes the elapsed time between two events. Computes the elapsed time between two events (in milliseconds with a resolution of around 0.5 microseconds). </p> <p>If either event was last recorded in a non-NULL stream, the resulting time may be greater than expected (even if both used the same stream handle). This happens because the cuEventRecord() operation takes place asynchronously and there is no guarantee that the measured latency is actually just between the two events. Any number of other different stream operations could execute in between the two measured events, thus altering the timing in a significant way. </p> <p>If cuEventRecord() has not been called on either event then CUDA_ERROR_INVALID_HANDLE is returned. If cuEventRecord() has been called on both events but one or both of them has not yet been completed (that is, cuEventQuery() would return CUDA_ERROR_NOT_READY on at least one of the events), CUDA_ERROR_NOT_READY is returned. If either event was created with the CU_EVENT_DISABLE_TIMING flag, then this function will return CUDA_ERROR_INVALID_HANDLE. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param pMilliseconds Time between hStart and hEnd in ms @param hStart Starting event @param hEnd Ending event @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_NOT_READY @see JCudaDriver#cuEventCreate @see JCudaDriver#cuEventRecord @see JCudaDriver#cuEventQuery @see JCudaDriver#cuEventSynchronize @see JCudaDriver#cuEventDestroy
[ "Computes", "the", "elapsed", "time", "between", "two", "events", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L13657-L13660
Red5/red5-io
src/main/java/org/red5/io/matroska/VINT.java
VINT.fromValue
public static VINT fromValue(long value) { BitSet bs = BitSet.valueOf(new long[] { value }); byte length = (byte) (1 + bs.length() / BIT_IN_BYTE); if (bs.length() == length * BIT_IN_BYTE) { length++; } bs.set(length * BIT_IN_BYTE - length); long binary = bs.toLongArray()[0]; return new VINT(binary, length, value); }
java
public static VINT fromValue(long value) { BitSet bs = BitSet.valueOf(new long[] { value }); byte length = (byte) (1 + bs.length() / BIT_IN_BYTE); if (bs.length() == length * BIT_IN_BYTE) { length++; } bs.set(length * BIT_IN_BYTE - length); long binary = bs.toLongArray()[0]; return new VINT(binary, length, value); }
[ "public", "static", "VINT", "fromValue", "(", "long", "value", ")", "{", "BitSet", "bs", "=", "BitSet", ".", "valueOf", "(", "new", "long", "[", "]", "{", "value", "}", ")", ";", "byte", "length", "=", "(", "byte", ")", "(", "1", "+", "bs", ".", ...
method to construct {@link VINT} based on its value @param value - value of {@link VINT} @return {@link VINT} corresponding to this value
[ "method", "to", "construct", "{", "@link", "VINT", "}", "based", "on", "its", "value" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/VINT.java#L144-L153
lightbend/config
config/src/main/java/com/typesafe/config/ConfigRenderOptions.java
ConfigRenderOptions.setJson
public ConfigRenderOptions setJson(boolean value) { if (value == json) return this; else return new ConfigRenderOptions(originComments, comments, formatted, value); }
java
public ConfigRenderOptions setJson(boolean value) { if (value == json) return this; else return new ConfigRenderOptions(originComments, comments, formatted, value); }
[ "public", "ConfigRenderOptions", "setJson", "(", "boolean", "value", ")", "{", "if", "(", "value", "==", "json", ")", "return", "this", ";", "else", "return", "new", "ConfigRenderOptions", "(", "originComments", ",", "comments", ",", "formatted", ",", "value",...
Returns options with JSON toggled. JSON means that HOCON extensions (omitting commas, quotes for example) won't be used. However, whether to use comments is controlled by the separate {@link #setComments(boolean)} and {@link #setOriginComments(boolean)} options. So if you enable comments you will get invalid JSON despite setting this to true. @param value true to include non-JSON extensions in the render @return options with requested setting for JSON
[ "Returns", "options", "with", "JSON", "toggled", ".", "JSON", "means", "that", "HOCON", "extensions", "(", "omitting", "commas", "quotes", "for", "example", ")", "won", "t", "be", "used", ".", "However", "whether", "to", "use", "comments", "is", "controlled"...
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigRenderOptions.java#L149-L154
Nexmo/nexmo-java
src/main/java/com/nexmo/client/sms/SmsClient.java
SmsClient.searchRejectedMessages
public SearchRejectedMessagesResponse searchRejectedMessages(Date date, String to) throws IOException, NexmoClientException { return this.searchRejectedMessages(new SearchRejectedMessagesRequest(date, to)); }
java
public SearchRejectedMessagesResponse searchRejectedMessages(Date date, String to) throws IOException, NexmoClientException { return this.searchRejectedMessages(new SearchRejectedMessagesRequest(date, to)); }
[ "public", "SearchRejectedMessagesResponse", "searchRejectedMessages", "(", "Date", "date", ",", "String", "to", ")", "throws", "IOException", ",", "NexmoClientException", "{", "return", "this", ".", "searchRejectedMessages", "(", "new", "SearchRejectedMessagesRequest", "(...
Search for rejected SMS transactions by date and recipient MSISDN. @param date the date of the rejected SMS message to be looked up @param to the MSISDN number of the SMS recipient @return rejection data matching the provided criteria
[ "Search", "for", "rejected", "SMS", "transactions", "by", "date", "and", "recipient", "MSISDN", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/sms/SmsClient.java#L137-L139
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
SkbShellFactory.newCommand
public static SkbShellCommand newCommand(String command, SkbShellCommandCategory category, String description, String addedHelp){ return new AbstractShellCommand(command, null, category, description, addedHelp); }
java
public static SkbShellCommand newCommand(String command, SkbShellCommandCategory category, String description, String addedHelp){ return new AbstractShellCommand(command, null, category, description, addedHelp); }
[ "public", "static", "SkbShellCommand", "newCommand", "(", "String", "command", ",", "SkbShellCommandCategory", "category", ",", "String", "description", ",", "String", "addedHelp", ")", "{", "return", "new", "AbstractShellCommand", "(", "command", ",", "null", ",", ...
Returns a new shell command without formal arguments, use the factory to create one. @param command the actual command @param category the command's category, can be null @param description the command's description @param addedHelp additional help, can be null @return new shell command @throws IllegalArgumentException if command or description was null
[ "Returns", "a", "new", "shell", "command", "without", "formal", "arguments", "use", "the", "factory", "to", "create", "one", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L140-L142
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
WorkflowsInner.updateAsync
public Observable<WorkflowInner> updateAsync(String resourceGroupName, String workflowName, WorkflowInner workflow) { return updateWithServiceResponseAsync(resourceGroupName, workflowName, workflow).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() { @Override public WorkflowInner call(ServiceResponse<WorkflowInner> response) { return response.body(); } }); }
java
public Observable<WorkflowInner> updateAsync(String resourceGroupName, String workflowName, WorkflowInner workflow) { return updateWithServiceResponseAsync(resourceGroupName, workflowName, workflow).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() { @Override public WorkflowInner call(ServiceResponse<WorkflowInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkflowInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "WorkflowInner", "workflow", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ",...
Updates a workflow. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param workflow The workflow. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowInner object
[ "Updates", "a", "workflow", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L816-L823
kiegroup/drools
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionServiceCompiler.java
DecisionServiceCompiler.inputQualifiedNamePrefix
private static String inputQualifiedNamePrefix(DMNNode input, DMNModelImpl model) { if (input.getModelNamespace().equals(model.getNamespace())) { return null; } else { Optional<String> importAlias = model.getImportAliasFor(input.getModelNamespace(), input.getModelName()); if (!importAlias.isPresent()) { MsgUtil.reportMessage(LOG, DMNMessage.Severity.ERROR, ((DMNBaseNode)input).getSource(), model, null, null, Msg.IMPORT_NOT_FOUND_FOR_NODE_MISSING_ALIAS, new QName(input.getModelNamespace(), input.getModelName()), ((DMNBaseNode)input).getSource()); return null; } return importAlias.get(); } }
java
private static String inputQualifiedNamePrefix(DMNNode input, DMNModelImpl model) { if (input.getModelNamespace().equals(model.getNamespace())) { return null; } else { Optional<String> importAlias = model.getImportAliasFor(input.getModelNamespace(), input.getModelName()); if (!importAlias.isPresent()) { MsgUtil.reportMessage(LOG, DMNMessage.Severity.ERROR, ((DMNBaseNode)input).getSource(), model, null, null, Msg.IMPORT_NOT_FOUND_FOR_NODE_MISSING_ALIAS, new QName(input.getModelNamespace(), input.getModelName()), ((DMNBaseNode)input).getSource()); return null; } return importAlias.get(); } }
[ "private", "static", "String", "inputQualifiedNamePrefix", "(", "DMNNode", "input", ",", "DMNModelImpl", "model", ")", "{", "if", "(", "input", ".", "getModelNamespace", "(", ")", ".", "equals", "(", "model", ".", "getNamespace", "(", ")", ")", ")", "{", "...
DMN v1.2 specification, chapter "10.4 Execution Semantics of Decision Services" The qualified name of an element named E that is defined in the same decision model as S is simply E. Otherwise, the qualified name is I.E, where I is the name of the import element that refers to the model where E is defined.
[ "DMN", "v1", ".", "2", "specification", "chapter", "10", ".", "4", "Execution", "Semantics", "of", "Decision", "Services", "The", "qualified", "name", "of", "an", "element", "named", "E", "that", "is", "defined", "in", "the", "same", "decision", "model", "...
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionServiceCompiler.java#L88-L107
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.indexOfAny
public static int indexOfAny(final CharSequence cs, final String searchChars) { if (isEmpty(cs) || isEmpty(searchChars)) { return INDEX_NOT_FOUND; } return indexOfAny(cs, searchChars.toCharArray()); }
java
public static int indexOfAny(final CharSequence cs, final String searchChars) { if (isEmpty(cs) || isEmpty(searchChars)) { return INDEX_NOT_FOUND; } return indexOfAny(cs, searchChars.toCharArray()); }
[ "public", "static", "int", "indexOfAny", "(", "final", "CharSequence", "cs", ",", "final", "String", "searchChars", ")", "{", "if", "(", "isEmpty", "(", "cs", ")", "||", "isEmpty", "(", "searchChars", ")", ")", "{", "return", "INDEX_NOT_FOUND", ";", "}", ...
<p>Search a CharSequence to find the first index of any character in the given set of characters.</p> <p>A {@code null} String will return {@code -1}. A {@code null} search string will return {@code -1}.</p> <pre> StringUtils.indexOfAny(null, *) = -1 StringUtils.indexOfAny("", *) = -1 StringUtils.indexOfAny(*, null) = -1 StringUtils.indexOfAny(*, "") = -1 StringUtils.indexOfAny("zzabyycdxx", "za") = 0 StringUtils.indexOfAny("zzabyycdxx", "by") = 3 StringUtils.indexOfAny("aba","z") = -1 </pre> @param cs the CharSequence to check, may be null @param searchChars the chars to search for, may be null @return the index of any of the chars, -1 if no match or null input @since 2.0 @since 3.0 Changed signature from indexOfAny(String, String) to indexOfAny(CharSequence, String)
[ "<p", ">", "Search", "a", "CharSequence", "to", "find", "the", "first", "index", "of", "any", "character", "in", "the", "given", "set", "of", "characters", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L2122-L2127
ganglia/jmxetric
src/main/java/info/ganglia/jmxetric/MBeanSampler.java
MBeanSampler.addMBeanAttribute
public void addMBeanAttribute(String mbean, MBeanAttribute attr) throws Exception { MBeanHolder mbeanHolder = mbeanMap.get(mbean); if (mbeanHolder == null) { mbeanHolder = new MBeanHolder(this, process, mbean); mbeanMap.put(mbean, mbeanHolder); } mbeanHolder.addAttribute(attr); log.info("Added attribute " + attr + " to " + mbean); }
java
public void addMBeanAttribute(String mbean, MBeanAttribute attr) throws Exception { MBeanHolder mbeanHolder = mbeanMap.get(mbean); if (mbeanHolder == null) { mbeanHolder = new MBeanHolder(this, process, mbean); mbeanMap.put(mbean, mbeanHolder); } mbeanHolder.addAttribute(attr); log.info("Added attribute " + attr + " to " + mbean); }
[ "public", "void", "addMBeanAttribute", "(", "String", "mbean", ",", "MBeanAttribute", "attr", ")", "throws", "Exception", "{", "MBeanHolder", "mbeanHolder", "=", "mbeanMap", ".", "get", "(", "mbean", ")", ";", "if", "(", "mbeanHolder", "==", "null", ")", "{"...
Adds an {@link info.ganglia.jmxetric.MBeanAttribute} to be sampled. @param mbean name of the mbean @param attr attribute to be sample @throws Exception
[ "Adds", "an", "{", "@link", "info", ".", "ganglia", ".", "jmxetric", ".", "MBeanAttribute", "}", "to", "be", "sampled", "." ]
train
https://github.com/ganglia/jmxetric/blob/0b21edb9bd75e0b2df8370ad1c77a1ea47f502ca/src/main/java/info/ganglia/jmxetric/MBeanSampler.java#L108-L117
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.getGBConstraints
public GridBagConstraints getGBConstraints() { if (m_gbconstraints == null) { m_gbconstraints = new GridBagConstraints(); m_gbconstraints.insets = new Insets(2, 2, 2, 2); m_gbconstraints.ipadx = 2; m_gbconstraints.ipady = 2; } return m_gbconstraints; }
java
public GridBagConstraints getGBConstraints() { if (m_gbconstraints == null) { m_gbconstraints = new GridBagConstraints(); m_gbconstraints.insets = new Insets(2, 2, 2, 2); m_gbconstraints.ipadx = 2; m_gbconstraints.ipady = 2; } return m_gbconstraints; }
[ "public", "GridBagConstraints", "getGBConstraints", "(", ")", "{", "if", "(", "m_gbconstraints", "==", "null", ")", "{", "m_gbconstraints", "=", "new", "GridBagConstraints", "(", ")", ";", "m_gbconstraints", ".", "insets", "=", "new", "Insets", "(", "2", ",", ...
Get the GridBagConstraints. @return The gridbag constraints object.
[ "Get", "the", "GridBagConstraints", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L182-L192
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonObject.java
JsonObject.put
public JsonObject put(String name, boolean value) throws JsonException { return put(name, new JsonBoolean(value)); }
java
public JsonObject put(String name, boolean value) throws JsonException { return put(name, new JsonBoolean(value)); }
[ "public", "JsonObject", "put", "(", "String", "name", ",", "boolean", "value", ")", "throws", "JsonException", "{", "return", "put", "(", "name", ",", "new", "JsonBoolean", "(", "value", ")", ")", ";", "}" ]
Maps {@code name} to {@code value}, clobbering any existing name/value mapping with the same name. @return this object.
[ "Maps", "{", "@code", "name", "}", "to", "{", "@code", "value", "}", "clobbering", "any", "existing", "name", "/", "value", "mapping", "with", "the", "same", "name", "." ]
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L143-L145
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java
OffsetDateTime.now
public static OffsetDateTime now(Clock clock) { Objects.requireNonNull(clock, "clock"); final Instant now = clock.instant(); // called once return ofInstant(now, clock.getZone().getRules().getOffset(now)); }
java
public static OffsetDateTime now(Clock clock) { Objects.requireNonNull(clock, "clock"); final Instant now = clock.instant(); // called once return ofInstant(now, clock.getZone().getRules().getOffset(now)); }
[ "public", "static", "OffsetDateTime", "now", "(", "Clock", "clock", ")", "{", "Objects", ".", "requireNonNull", "(", "clock", ",", "\"clock\"", ")", ";", "final", "Instant", "now", "=", "clock", ".", "instant", "(", ")", ";", "// called once", "return", "o...
Obtains the current date-time from the specified clock. <p> This will query the specified clock to obtain the current date-time. The offset will be calculated from the time-zone in the clock. <p> Using this method allows the use of an alternate clock for testing. The alternate clock may be introduced using {@link Clock dependency injection}. @param clock the clock to use, not null @return the current date-time, not null
[ "Obtains", "the", "current", "date", "-", "time", "from", "the", "specified", "clock", ".", "<p", ">", "This", "will", "query", "the", "specified", "clock", "to", "obtain", "the", "current", "date", "-", "time", ".", "The", "offset", "will", "be", "calcu...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetDateTime.java#L238-L242
eclipse/xtext-extras
org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java
IndexedJvmTypeAccess.getAccessibleType
protected EObject getAccessibleType(IEObjectDescription description, String fragment, ResourceSet resourceSet) throws UnknownNestedTypeException { EObject typeProxy = description.getEObjectOrProxy(); if (typeProxy.eIsProxy()) { typeProxy = EcoreUtil.resolve(typeProxy, resourceSet); } if (!typeProxy.eIsProxy() && typeProxy instanceof JvmType) { if (fragment != null) { EObject result = resolveJavaObject((JvmType) typeProxy, fragment); if (result != null) return result; } else return typeProxy; } return null; }
java
protected EObject getAccessibleType(IEObjectDescription description, String fragment, ResourceSet resourceSet) throws UnknownNestedTypeException { EObject typeProxy = description.getEObjectOrProxy(); if (typeProxy.eIsProxy()) { typeProxy = EcoreUtil.resolve(typeProxy, resourceSet); } if (!typeProxy.eIsProxy() && typeProxy instanceof JvmType) { if (fragment != null) { EObject result = resolveJavaObject((JvmType) typeProxy, fragment); if (result != null) return result; } else return typeProxy; } return null; }
[ "protected", "EObject", "getAccessibleType", "(", "IEObjectDescription", "description", ",", "String", "fragment", ",", "ResourceSet", "resourceSet", ")", "throws", "UnknownNestedTypeException", "{", "EObject", "typeProxy", "=", "description", ".", "getEObjectOrProxy", "(...
Read and resolve the EObject from the given description and navigate to its children according to the given fragment. @since 2.8
[ "Read", "and", "resolve", "the", "EObject", "from", "the", "given", "description", "and", "navigate", "to", "its", "children", "according", "to", "the", "given", "fragment", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/impl/IndexedJvmTypeAccess.java#L139-L153
tvesalainen/util
util/src/main/java/org/vesalainen/math/CircleFitter.java
CircleFitter.limitDistance
public static void limitDistance(DenseMatrix64F p0, DenseMatrix64F pr, double min, double max) { double x0 = p0.data[0]; double y0 = p0.data[1]; double xr = pr.data[0]; double yr = pr.data[1]; double dx = xr-x0; double dy = yr-y0; double r = Math.sqrt(dx*dx+dy*dy); if (r < min || r > max) { if (r < min) { r = min; } else { r = max; } double m = dy/dx; if (Double.isInfinite(m)) { if (m > 0) { pr.data[1] = y0 + r; } else { pr.data[1] = y0 - r; } } else { double x = Math.sqrt((r*r)/(m*m+1)); double y = m*x; pr.data[0] = x0 + x; pr.data[1] = y0 + y; } } }
java
public static void limitDistance(DenseMatrix64F p0, DenseMatrix64F pr, double min, double max) { double x0 = p0.data[0]; double y0 = p0.data[1]; double xr = pr.data[0]; double yr = pr.data[1]; double dx = xr-x0; double dy = yr-y0; double r = Math.sqrt(dx*dx+dy*dy); if (r < min || r > max) { if (r < min) { r = min; } else { r = max; } double m = dy/dx; if (Double.isInfinite(m)) { if (m > 0) { pr.data[1] = y0 + r; } else { pr.data[1] = y0 - r; } } else { double x = Math.sqrt((r*r)/(m*m+1)); double y = m*x; pr.data[0] = x0 + x; pr.data[1] = y0 + y; } } }
[ "public", "static", "void", "limitDistance", "(", "DenseMatrix64F", "p0", ",", "DenseMatrix64F", "pr", ",", "double", "min", ",", "double", "max", ")", "{", "double", "x0", "=", "p0", ".", "data", "[", "0", "]", ";", "double", "y0", "=", "p0", ".", "...
Changes pr so that distance from p0 is in range min - max. Slope of (p0,pr) remains the same. @param p0 @param pr @param min @param max
[ "Changes", "pr", "so", "that", "distance", "from", "p0", "is", "in", "range", "min", "-", "max", ".", "Slope", "of", "(", "p0", "pr", ")", "remains", "the", "same", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CircleFitter.java#L147-L186
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java
StrictMath.copySign
public static double copySign(double magnitude, double sign) { return Math.copySign(magnitude, (Double.isNaN(sign)?1.0d:sign)); }
java
public static double copySign(double magnitude, double sign) { return Math.copySign(magnitude, (Double.isNaN(sign)?1.0d:sign)); }
[ "public", "static", "double", "copySign", "(", "double", "magnitude", ",", "double", "sign", ")", "{", "return", "Math", ".", "copySign", "(", "magnitude", ",", "(", "Double", ".", "isNaN", "(", "sign", ")", "?", "1.0d", ":", "sign", ")", ")", ";", "...
Returns the first floating-point argument with the sign of the second floating-point argument. For this method, a NaN {@code sign} argument is always treated as if it were positive. @param magnitude the parameter providing the magnitude of the result @param sign the parameter providing the sign of the result @return a value with the magnitude of {@code magnitude} and the sign of {@code sign}. @since 1.6
[ "Returns", "the", "first", "floating", "-", "point", "argument", "with", "the", "sign", "of", "the", "second", "floating", "-", "point", "argument", ".", "For", "this", "method", "a", "NaN", "{", "@code", "sign", "}", "argument", "is", "always", "treated",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java#L1387-L1389
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_automatedBackup_restore_POST
public OvhTask serviceName_automatedBackup_restore_POST(String serviceName, Boolean changePassword, Date restorePoint, OvhRestoreTypeEnum type) throws IOException { String qPath = "/vps/{serviceName}/automatedBackup/restore"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "changePassword", changePassword); addBody(o, "restorePoint", restorePoint); addBody(o, "type", type); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_automatedBackup_restore_POST(String serviceName, Boolean changePassword, Date restorePoint, OvhRestoreTypeEnum type) throws IOException { String qPath = "/vps/{serviceName}/automatedBackup/restore"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "changePassword", changePassword); addBody(o, "restorePoint", restorePoint); addBody(o, "type", type); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_automatedBackup_restore_POST", "(", "String", "serviceName", ",", "Boolean", "changePassword", ",", "Date", "restorePoint", ",", "OvhRestoreTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName...
Creates a VPS.Task that will restore the given restorePoint REST: POST /vps/{serviceName}/automatedBackup/restore @param changePassword [required] [default=0] Only with restore full on VPS Cloud 2014 @param type [required] [default=file] file: Attach/export restored disk to your current VPS - full: Replace your current VPS by the given restorePoint @param restorePoint [required] Restore Point fetched in /automatedBackup/restorePoints @param serviceName [required] The internal name of your VPS offer
[ "Creates", "a", "VPS", ".", "Task", "that", "will", "restore", "the", "given", "restorePoint" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L122-L131
fullcontact/hadoop-sstable
sstable-core/src/main/java/com/fullcontact/cassandra/io/util/RandomAccessReader.java
RandomAccessReader.reBuffer
protected void reBuffer() { resetBuffer(); try { if (bufferOffset >= fs.getFileStatus(inputPath).getLen()) // TODO: is this equivalent? return; input.seek(bufferOffset); int read = 0; while (read < buffer.length) { int n = input.read(buffer, read, buffer.length - read); if (n < 0) break; read += n; } validBufferBytes = read; bytesSinceCacheFlush += read; } catch (IOException e) { throw new FSReadError(e, filePath); } }
java
protected void reBuffer() { resetBuffer(); try { if (bufferOffset >= fs.getFileStatus(inputPath).getLen()) // TODO: is this equivalent? return; input.seek(bufferOffset); int read = 0; while (read < buffer.length) { int n = input.read(buffer, read, buffer.length - read); if (n < 0) break; read += n; } validBufferBytes = read; bytesSinceCacheFlush += read; } catch (IOException e) { throw new FSReadError(e, filePath); } }
[ "protected", "void", "reBuffer", "(", ")", "{", "resetBuffer", "(", ")", ";", "try", "{", "if", "(", "bufferOffset", ">=", "fs", ".", "getFileStatus", "(", "inputPath", ")", ".", "getLen", "(", ")", ")", "// TODO: is this equivalent?", "return", ";", "inpu...
Read data from file starting from current currentOffset to populate buffer.
[ "Read", "data", "from", "file", "starting", "from", "current", "currentOffset", "to", "populate", "buffer", "." ]
train
https://github.com/fullcontact/hadoop-sstable/blob/1189c2cb3a2cbbe03b75fda1cf02698e6283dfb2/sstable-core/src/main/java/com/fullcontact/cassandra/io/util/RandomAccessReader.java#L138-L161
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java
Util.isValidSnapshot
public static boolean isValidSnapshot(File f) throws IOException { if (f==null || Util.getZxidFromName(f.getName(), "snapshot") == -1) return false; // Check for a valid snapshot RandomAccessFile raf = new RandomAccessFile(f, "r"); // including the header and the last / bytes // the snapshot should be atleast 10 bytes if (raf.length() < 10) { return false; } try { raf.seek(raf.length() - 5); byte bytes[] = new byte[5]; int readlen = 0; int l; while(readlen < 5 && (l = raf.read(bytes, readlen, bytes.length - readlen)) >= 0) { readlen += l; } if (readlen != bytes.length) { LOG.info("Invalid snapshot " + f + " too short, len = " + readlen); return false; } ByteBuffer bb = ByteBuffer.wrap(bytes); int len = bb.getInt(); byte b = bb.get(); if (len != 1 || b != '/') { LOG.info("Invalid snapshot " + f + " len = " + len + " byte = " + (b & 0xff)); return false; } } finally { raf.close(); } return true; }
java
public static boolean isValidSnapshot(File f) throws IOException { if (f==null || Util.getZxidFromName(f.getName(), "snapshot") == -1) return false; // Check for a valid snapshot RandomAccessFile raf = new RandomAccessFile(f, "r"); // including the header and the last / bytes // the snapshot should be atleast 10 bytes if (raf.length() < 10) { return false; } try { raf.seek(raf.length() - 5); byte bytes[] = new byte[5]; int readlen = 0; int l; while(readlen < 5 && (l = raf.read(bytes, readlen, bytes.length - readlen)) >= 0) { readlen += l; } if (readlen != bytes.length) { LOG.info("Invalid snapshot " + f + " too short, len = " + readlen); return false; } ByteBuffer bb = ByteBuffer.wrap(bytes); int len = bb.getInt(); byte b = bb.get(); if (len != 1 || b != '/') { LOG.info("Invalid snapshot " + f + " len = " + len + " byte = " + (b & 0xff)); return false; } } finally { raf.close(); } return true; }
[ "public", "static", "boolean", "isValidSnapshot", "(", "File", "f", ")", "throws", "IOException", "{", "if", "(", "f", "==", "null", "||", "Util", ".", "getZxidFromName", "(", "f", ".", "getName", "(", ")", ",", "\"snapshot\"", ")", "==", "-", "1", ")"...
Verifies that the file is a valid snapshot. Snapshot may be invalid if it's incomplete as in a situation when the server dies while in the process of storing a snapshot. Any file that is not a snapshot is also an invalid snapshot. @param f file to verify @return true if the snapshot is valid @throws IOException
[ "Verifies", "that", "the", "file", "is", "a", "valid", "snapshot", ".", "Snapshot", "may", "be", "invalid", "if", "it", "s", "incomplete", "as", "in", "a", "situation", "when", "the", "server", "dies", "while", "in", "the", "process", "of", "storing", "a...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L161-L199
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java
TmdbEpisodes.getEpisodeChanges
public ResultList<ChangeKeyItem> getEpisodeChanges(int episodeID, String startDate, String endDate) throws MovieDbException { return getMediaChanges(episodeID, startDate, endDate); }
java
public ResultList<ChangeKeyItem> getEpisodeChanges(int episodeID, String startDate, String endDate) throws MovieDbException { return getMediaChanges(episodeID, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeKeyItem", ">", "getEpisodeChanges", "(", "int", "episodeID", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "getMediaChanges", "(", "episodeID", ",", "startDate", ",", "en...
Look up a TV episode's changes by episode ID @param episodeID @param startDate @param endDate @return @throws MovieDbException
[ "Look", "up", "a", "TV", "episode", "s", "changes", "by", "episode", "ID" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java#L105-L107
phax/ph-oton
ph-oton-jscode/src/main/java/com/helger/html/jscode/AbstractJSBlock.java
AbstractJSBlock._if
@Nonnull public JSConditional _if (@Nonnull final IJSExpression aTest, @Nullable final IHasJSCode aThen) { return addStatement (new JSConditional (aTest, aThen)); }
java
@Nonnull public JSConditional _if (@Nonnull final IJSExpression aTest, @Nullable final IHasJSCode aThen) { return addStatement (new JSConditional (aTest, aThen)); }
[ "@", "Nonnull", "public", "JSConditional", "_if", "(", "@", "Nonnull", "final", "IJSExpression", "aTest", ",", "@", "Nullable", "final", "IHasJSCode", "aThen", ")", "{", "return", "addStatement", "(", "new", "JSConditional", "(", "aTest", ",", "aThen", ")", ...
Create an If statement and add it to this block @param aTest {@link IJSExpression} to be tested to determine branching @param aThen "then" block content. May be <code>null</code>. @return Newly generated conditional statement
[ "Create", "an", "If", "statement", "and", "add", "it", "to", "this", "block" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-jscode/src/main/java/com/helger/html/jscode/AbstractJSBlock.java#L999-L1003
apache/groovy
src/main/java/org/codehaus/groovy/transform/stc/TypeCheckingExtension.java
TypeCheckingExtension.buildMapType
public ClassNode buildMapType(ClassNode keyType, ClassNode valueType) { return parameterizedType(ClassHelper.MAP_TYPE, keyType, valueType); }
java
public ClassNode buildMapType(ClassNode keyType, ClassNode valueType) { return parameterizedType(ClassHelper.MAP_TYPE, keyType, valueType); }
[ "public", "ClassNode", "buildMapType", "(", "ClassNode", "keyType", ",", "ClassNode", "valueType", ")", "{", "return", "parameterizedType", "(", "ClassHelper", ".", "MAP_TYPE", ",", "keyType", ",", "valueType", ")", ";", "}" ]
Builds a parametrized class node representing the Map&lt;keyType,valueType&gt; type. @param keyType the classnode type of the key @param valueType the classnode type of the value @return a class node for Map&lt;keyType,valueType&gt; @since 2.2.0
[ "Builds", "a", "parametrized", "class", "node", "representing", "the", "Map&lt", ";", "keyType", "valueType&gt", ";", "type", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/TypeCheckingExtension.java#L361-L363
maguro/aunit
junit/src/main/java/com/toolazydogs/aunit/internal/Util.java
Util.validatePrimitiveArray
@SuppressWarnings({"ThrowableInstanceNeverThrown"}) public static void validatePrimitiveArray(Method method, Class type, List<Throwable> errors) { Class returnType = method.getReturnType(); if (!returnType.isArray() || !returnType.getComponentType().equals(type)) { errors.add(new Exception("Method " + method.getName() + "() should return " + type.getName() + "[]")); } }
java
@SuppressWarnings({"ThrowableInstanceNeverThrown"}) public static void validatePrimitiveArray(Method method, Class type, List<Throwable> errors) { Class returnType = method.getReturnType(); if (!returnType.isArray() || !returnType.getComponentType().equals(type)) { errors.add(new Exception("Method " + method.getName() + "() should return " + type.getName() + "[]")); } }
[ "@", "SuppressWarnings", "(", "{", "\"ThrowableInstanceNeverThrown\"", "}", ")", "public", "static", "void", "validatePrimitiveArray", "(", "Method", "method", ",", "Class", "type", ",", "List", "<", "Throwable", ">", "errors", ")", "{", "Class", "returnType", "...
Validate that a method returns primitive array of specific type. @param method the method to be tested @param errors a list to place the errors
[ "Validate", "that", "a", "method", "returns", "primitive", "array", "of", "specific", "type", "." ]
train
https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/internal/Util.java#L69-L77
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/config/CassandraDeepJobConfig.java
CassandraDeepJobConfig.createOutputTableIfNeeded
public void createOutputTableIfNeeded(Tuple2<Cells, Cells> first) { TableMetadata metadata = getSession() .getCluster() .getMetadata() .getKeyspace(this.catalog) .getTable(quote(this.table)); if (metadata == null && !createTableOnWrite) { throw new DeepIOException("Cannot write RDD, output table does not exists and configuration object has " + "'createTableOnWrite' = false"); } if (metadata != null) { return; } if (first._1() == null || first._1().isEmpty()) { throw new DeepNoSuchFieldException("no key structure found on row metadata"); } String createTableQuery = createTableQueryGenerator(first._1(), first._2(), this.catalog, quote(this.table)); getSession().execute(createTableQuery); waitForNewTableMetadata(); }
java
public void createOutputTableIfNeeded(Tuple2<Cells, Cells> first) { TableMetadata metadata = getSession() .getCluster() .getMetadata() .getKeyspace(this.catalog) .getTable(quote(this.table)); if (metadata == null && !createTableOnWrite) { throw new DeepIOException("Cannot write RDD, output table does not exists and configuration object has " + "'createTableOnWrite' = false"); } if (metadata != null) { return; } if (first._1() == null || first._1().isEmpty()) { throw new DeepNoSuchFieldException("no key structure found on row metadata"); } String createTableQuery = createTableQueryGenerator(first._1(), first._2(), this.catalog, quote(this.table)); getSession().execute(createTableQuery); waitForNewTableMetadata(); }
[ "public", "void", "createOutputTableIfNeeded", "(", "Tuple2", "<", "Cells", ",", "Cells", ">", "first", ")", "{", "TableMetadata", "metadata", "=", "getSession", "(", ")", ".", "getCluster", "(", ")", ".", "getMetadata", "(", ")", ".", "getKeyspace", "(", ...
Creates the output column family if not exists. <br/> We first check if the column family exists. <br/> If not, we get the first element from <i>tupleRDD</i> and we use it as a template to get columns metadata. <p> This is a very heavy operation since to obtain the schema we need to get at least one element of the output RDD. </p> @param first the pair RDD.
[ "Creates", "the", "output", "column", "family", "if", "not", "exists", ".", "<br", "/", ">", "We", "first", "check", "if", "the", "column", "family", "exists", ".", "<br", "/", ">", "If", "not", "we", "get", "the", "first", "element", "from", "<i", "...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/config/CassandraDeepJobConfig.java#L232-L256
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java
Validators.validTrustManagerFactory
public static Validator validTrustManagerFactory() { return (s, o) -> { if (!(o instanceof String)) { throw new ConfigException(s, o, "Must be a string."); } String keyStoreType = o.toString(); try { TrustManagerFactory.getInstance(keyStoreType); } catch (NoSuchAlgorithmException e) { ConfigException exception = new ConfigException(s, o, "Invalid Algorithm"); exception.initCause(e); throw exception; } }; }
java
public static Validator validTrustManagerFactory() { return (s, o) -> { if (!(o instanceof String)) { throw new ConfigException(s, o, "Must be a string."); } String keyStoreType = o.toString(); try { TrustManagerFactory.getInstance(keyStoreType); } catch (NoSuchAlgorithmException e) { ConfigException exception = new ConfigException(s, o, "Invalid Algorithm"); exception.initCause(e); throw exception; } }; }
[ "public", "static", "Validator", "validTrustManagerFactory", "(", ")", "{", "return", "(", "s", ",", "o", ")", "->", "{", "if", "(", "!", "(", "o", "instanceof", "String", ")", ")", "{", "throw", "new", "ConfigException", "(", "s", ",", "o", ",", "\"...
Validator is used to ensure that the TrustManagerFactory Algorithm specified is valid. @return
[ "Validator", "is", "used", "to", "ensure", "that", "the", "TrustManagerFactory", "Algorithm", "specified", "is", "valid", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/validators/Validators.java#L232-L247
casbin/jcasbin
src/main/java/org/casbin/jcasbin/rbac/GroupRoleManager.java
GroupRoleManager.hasLink
@Override public boolean hasLink(String name1, String name2, String... domain) { if(super.hasLink(name1, name2, domain)) { return true; } // check name1's groups if (domain.length == 1) { try { List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>()); for(String group : groups) { if(hasLink(group, name2, domain)) { return true; } } } catch (Error e) { return false; } } return false; }
java
@Override public boolean hasLink(String name1, String name2, String... domain) { if(super.hasLink(name1, name2, domain)) { return true; } // check name1's groups if (domain.length == 1) { try { List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>()); for(String group : groups) { if(hasLink(group, name2, domain)) { return true; } } } catch (Error e) { return false; } } return false; }
[ "@", "Override", "public", "boolean", "hasLink", "(", "String", "name1", ",", "String", "name2", ",", "String", "...", "domain", ")", "{", "if", "(", "super", ".", "hasLink", "(", "name1", ",", "name2", ",", "domain", ")", ")", "{", "return", "true", ...
hasLink determines whether role: name1 inherits role: name2. domain is a prefix to the roles.
[ "hasLink", "determines", "whether", "role", ":", "name1", "inherits", "role", ":", "name2", ".", "domain", "is", "a", "prefix", "to", "the", "roles", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/GroupRoleManager.java#L49-L68
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java
NodeImpl.setNameNS
static void setNameNS(NodeImpl node, String namespaceURI, String qualifiedName) { if (qualifiedName == null) { throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName); } String prefix = null; int p = qualifiedName.lastIndexOf(":"); if (p != -1) { prefix = validatePrefix(qualifiedName.substring(0, p), true, namespaceURI); qualifiedName = qualifiedName.substring(p + 1); } if (!DocumentImpl.isXMLIdentifier(qualifiedName)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, qualifiedName); } switch (node.getNodeType()) { case ATTRIBUTE_NODE: if ("xmlns".equals(qualifiedName) && !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) { throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName); } AttrImpl attr = (AttrImpl) node; attr.namespaceAware = true; attr.namespaceURI = namespaceURI; attr.prefix = prefix; attr.localName = qualifiedName; break; case ELEMENT_NODE: ElementImpl element = (ElementImpl) node; element.namespaceAware = true; element.namespaceURI = namespaceURI; element.prefix = prefix; element.localName = qualifiedName; break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot rename nodes of type " + node.getNodeType()); } }
java
static void setNameNS(NodeImpl node, String namespaceURI, String qualifiedName) { if (qualifiedName == null) { throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName); } String prefix = null; int p = qualifiedName.lastIndexOf(":"); if (p != -1) { prefix = validatePrefix(qualifiedName.substring(0, p), true, namespaceURI); qualifiedName = qualifiedName.substring(p + 1); } if (!DocumentImpl.isXMLIdentifier(qualifiedName)) { throw new DOMException(DOMException.INVALID_CHARACTER_ERR, qualifiedName); } switch (node.getNodeType()) { case ATTRIBUTE_NODE: if ("xmlns".equals(qualifiedName) && !"http://www.w3.org/2000/xmlns/".equals(namespaceURI)) { throw new DOMException(DOMException.NAMESPACE_ERR, qualifiedName); } AttrImpl attr = (AttrImpl) node; attr.namespaceAware = true; attr.namespaceURI = namespaceURI; attr.prefix = prefix; attr.localName = qualifiedName; break; case ELEMENT_NODE: ElementImpl element = (ElementImpl) node; element.namespaceAware = true; element.namespaceURI = namespaceURI; element.prefix = prefix; element.localName = qualifiedName; break; default: throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Cannot rename nodes of type " + node.getNodeType()); } }
[ "static", "void", "setNameNS", "(", "NodeImpl", "node", ",", "String", "namespaceURI", ",", "String", "qualifiedName", ")", "{", "if", "(", "qualifiedName", "==", "null", ")", "{", "throw", "new", "DOMException", "(", "DOMException", ".", "NAMESPACE_ERR", ",",...
Sets {@code node} to be namespace-aware and assigns its namespace URI and qualified name. @param node an element or attribute node. @param namespaceURI this node's namespace URI. May be null. @param qualifiedName a possibly-prefixed name like "img" or "html:img".
[ "Sets", "{", "@code", "node", "}", "to", "be", "namespace", "-", "aware", "and", "assigns", "its", "namespace", "URI", "and", "qualified", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/NodeImpl.java#L230-L272
alkacon/opencms-core
src/org/opencms/search/CmsSearch.java
CmsSearch.addFieldQuery
public void addFieldQuery(String fieldName, String searchQuery, Occur occur) { addFieldQuery(new CmsSearchParameters.CmsSearchFieldQuery(fieldName, searchQuery, occur)); }
java
public void addFieldQuery(String fieldName, String searchQuery, Occur occur) { addFieldQuery(new CmsSearchParameters.CmsSearchFieldQuery(fieldName, searchQuery, occur)); }
[ "public", "void", "addFieldQuery", "(", "String", "fieldName", ",", "String", "searchQuery", ",", "Occur", "occur", ")", "{", "addFieldQuery", "(", "new", "CmsSearchParameters", ".", "CmsSearchFieldQuery", "(", "fieldName", ",", "searchQuery", ",", "occur", ")", ...
Adds an individual query for a search field.<p> If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])} will be ignored and only the individual field search settings will be used.<p> When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind: All SHOULD clauses will be grouped and wrapped in one query, all MUST and MUST_NOT clauses will be grouped in another query. This means that at least one of the terms which are given as a SHOULD query must occur in the search result.<p> @param fieldName the field name @param searchQuery the search query @param occur the occur parameter for the query in the field @since 7.5.1
[ "Adds", "an", "individual", "query", "for", "a", "search", "field", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearch.java#L165-L168
ppiastucki/recast4j
detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java
PathCorridor.isValid
boolean isValid(int maxLookAhead, NavMeshQuery navquery, QueryFilter filter) { // Check that all polygons still pass query filter. int n = Math.min(m_path.size(), maxLookAhead); for (int i = 0; i < n; ++i) { if (!navquery.isValidPolyRef(m_path.get(i), filter)) { return false; } } return true; }
java
boolean isValid(int maxLookAhead, NavMeshQuery navquery, QueryFilter filter) { // Check that all polygons still pass query filter. int n = Math.min(m_path.size(), maxLookAhead); for (int i = 0; i < n; ++i) { if (!navquery.isValidPolyRef(m_path.get(i), filter)) { return false; } } return true; }
[ "boolean", "isValid", "(", "int", "maxLookAhead", ",", "NavMeshQuery", "navquery", ",", "QueryFilter", "filter", ")", "{", "// Check that all polygons still pass query filter.", "int", "n", "=", "Math", ".", "min", "(", "m_path", ".", "size", "(", ")", ",", "max...
Checks the current corridor path to see if its polygon references remain valid. The path can be invalidated if there are structural changes to the underlying navigation mesh, or the state of a polygon within the path changes resulting in it being filtered out. (E.g. An exclusion or inclusion flag changes.) @param maxLookAhead The number of polygons from the beginning of the corridor to search. @param navquery The query object used to build the corridor. @param filter The filter to apply to the operation. @return
[ "Checks", "the", "current", "corridor", "path", "to", "see", "if", "its", "polygon", "references", "remain", "valid", ".", "The", "path", "can", "be", "invalidated", "if", "there", "are", "structural", "changes", "to", "the", "underlying", "navigation", "mesh"...
train
https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L503-L513
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java
ActiveSyncManager.launchPollingThread
public void launchPollingThread(long mountId, long txId) { LOG.debug("launch polling thread for mount id {}, txId {}", mountId, txId); if (!mPollerMap.containsKey(mountId)) { try (CloseableResource<UnderFileSystem> ufsClient = mMountTable.getUfsClient(mountId).acquireUfsResource()) { ufsClient.get().startActiveSyncPolling(txId); } catch (IOException e) { LOG.warn("IO Exception trying to launch Polling thread {}", e); } ActiveSyncer syncer = new ActiveSyncer(mFileSystemMaster, this, mMountTable, mountId); Future<?> future = getExecutor().submit( new HeartbeatThread(HeartbeatContext.MASTER_ACTIVE_UFS_SYNC, syncer, (int) ServerConfiguration.getMs(PropertyKey.MASTER_ACTIVE_UFS_SYNC_INTERVAL), ServerConfiguration.global())); mPollerMap.put(mountId, future); } }
java
public void launchPollingThread(long mountId, long txId) { LOG.debug("launch polling thread for mount id {}, txId {}", mountId, txId); if (!mPollerMap.containsKey(mountId)) { try (CloseableResource<UnderFileSystem> ufsClient = mMountTable.getUfsClient(mountId).acquireUfsResource()) { ufsClient.get().startActiveSyncPolling(txId); } catch (IOException e) { LOG.warn("IO Exception trying to launch Polling thread {}", e); } ActiveSyncer syncer = new ActiveSyncer(mFileSystemMaster, this, mMountTable, mountId); Future<?> future = getExecutor().submit( new HeartbeatThread(HeartbeatContext.MASTER_ACTIVE_UFS_SYNC, syncer, (int) ServerConfiguration.getMs(PropertyKey.MASTER_ACTIVE_UFS_SYNC_INTERVAL), ServerConfiguration.global())); mPollerMap.put(mountId, future); } }
[ "public", "void", "launchPollingThread", "(", "long", "mountId", ",", "long", "txId", ")", "{", "LOG", ".", "debug", "(", "\"launch polling thread for mount id {}, txId {}\"", ",", "mountId", ",", "txId", ")", ";", "if", "(", "!", "mPollerMap", ".", "containsKey...
Launches polling thread on a particular mount point with starting txId. @param mountId launch polling thread on a mount id @param txId specifies the transaction id to initialize the pollling thread
[ "Launches", "polling", "thread", "on", "a", "particular", "mount", "point", "with", "starting", "txId", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L209-L225
gocd/gocd
base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java
DirectoryScanner.scandir
protected void scandir(File dir, String vpath, boolean fast) { if (dir == null) { throw new RuntimeException("dir must not be null."); } String[] newfiles = dir.list(); if (newfiles == null) { if (!dir.exists()) { throw new RuntimeException(dir + " doesn't exist."); } else if (!dir.isDirectory()) { throw new RuntimeException(dir + " is not a directory."); } else { throw new RuntimeException("IO error scanning directory '" + dir.getAbsolutePath() + "'"); } } scandir(dir, vpath, fast, newfiles); }
java
protected void scandir(File dir, String vpath, boolean fast) { if (dir == null) { throw new RuntimeException("dir must not be null."); } String[] newfiles = dir.list(); if (newfiles == null) { if (!dir.exists()) { throw new RuntimeException(dir + " doesn't exist."); } else if (!dir.isDirectory()) { throw new RuntimeException(dir + " is not a directory."); } else { throw new RuntimeException("IO error scanning directory '" + dir.getAbsolutePath() + "'"); } } scandir(dir, vpath, fast, newfiles); }
[ "protected", "void", "scandir", "(", "File", "dir", ",", "String", "vpath", ",", "boolean", "fast", ")", "{", "if", "(", "dir", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"dir must not be null.\"", ")", ";", "}", "String", "[", "]...
Scan the given directory for files and directories. Found files and directories are placed in their respective collections, based on the matching of includes, excludes, and the selectors. When a directory is found, it is scanned recursively. @param dir The directory to scan. Must not be <code>null</code>. @param vpath The path relative to the base directory (needed to prevent problems with an absolute path when using dir). Must not be <code>null</code>. @param fast Whether or not this call is part of a fast scan. @see #filesIncluded @see #filesNotIncluded @see #filesExcluded @see #dirsIncluded @see #dirsNotIncluded @see #dirsExcluded @see #slowScan
[ "Scan", "the", "given", "directory", "for", "files", "and", "directories", ".", "Found", "files", "and", "directories", "are", "placed", "in", "their", "respective", "collections", "based", "on", "the", "matching", "of", "includes", "excludes", "and", "the", "...
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1051-L1067
rundeck/rundeck
rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java
PathUtil.hasRoot
public static boolean hasRoot(String path, String root) { String p = cleanPath(path); String r = cleanPath(root); return p.equals(r) || r.equals(cleanPath(ROOT.getPath())) || p.startsWith(r + SEPARATOR); }
java
public static boolean hasRoot(String path, String root) { String p = cleanPath(path); String r = cleanPath(root); return p.equals(r) || r.equals(cleanPath(ROOT.getPath())) || p.startsWith(r + SEPARATOR); }
[ "public", "static", "boolean", "hasRoot", "(", "String", "path", ",", "String", "root", ")", "{", "String", "p", "=", "cleanPath", "(", "path", ")", ";", "String", "r", "=", "cleanPath", "(", "root", ")", ";", "return", "p", ".", "equals", "(", "r", ...
@return true if the given path starts with the given root @param path test path @param root root
[ "@return", "true", "if", "the", "given", "path", "starts", "with", "the", "given", "root" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java#L148-L154
bit3/jsass
src/main/java/io/bit3/jsass/Compiler.java
Compiler.compileString
public Output compileString(String string, Options options) throws CompilationException { return compileString(string, null, null, options); }
java
public Output compileString(String string, Options options) throws CompilationException { return compileString(string, null, null, options); }
[ "public", "Output", "compileString", "(", "String", "string", ",", "Options", "options", ")", "throws", "CompilationException", "{", "return", "compileString", "(", "string", ",", "null", ",", "null", ",", "options", ")", ";", "}" ]
Compile string. @param string The input string. @param options The compile options. @return The compilation output. @throws CompilationException If the compilation failed.
[ "Compile", "string", "." ]
train
https://github.com/bit3/jsass/blob/fba91d5cb1eb507c7cfde5a261e04b1d328cb1ef/src/main/java/io/bit3/jsass/Compiler.java#L46-L48
box/box-java-sdk
src/main/java/com/box/sdk/BoxRetentionPolicy.java
BoxRetentionPolicy.createFinitePolicy
public static BoxRetentionPolicy.Info createFinitePolicy(BoxAPIConnection api, String name, int length, String action, RetentionPolicyParams optionalParams) { return createRetentionPolicy(api, name, TYPE_FINITE, length, action, optionalParams); }
java
public static BoxRetentionPolicy.Info createFinitePolicy(BoxAPIConnection api, String name, int length, String action, RetentionPolicyParams optionalParams) { return createRetentionPolicy(api, name, TYPE_FINITE, length, action, optionalParams); }
[ "public", "static", "BoxRetentionPolicy", ".", "Info", "createFinitePolicy", "(", "BoxAPIConnection", "api", ",", "String", "name", ",", "int", "length", ",", "String", "action", ",", "RetentionPolicyParams", "optionalParams", ")", "{", "return", "createRetentionPolic...
Used to create a new finite retention policy with optional parameters. @param api the API connection to be used by the created user. @param name the name of the retention policy. @param length the duration in days that the retention policy will be active for after being assigned to content. @param action the disposition action can be "permanently_delete" or "remove_retention". @param optionalParams the optional parameters. @return the created retention policy's info.
[ "Used", "to", "create", "a", "new", "finite", "retention", "policy", "with", "optional", "parameters", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicy.java#L131-L134
alkacon/opencms-core
src/org/opencms/notification/CmsContentNotification.java
CmsContentNotification.buildNotificationListItem
private String buildNotificationListItem(CmsExtendedNotificationCause notificationCause, int row) { StringBuffer result = new StringBuffer("<tr class=\"trow"); result.append(row); result.append("\"><td width=\"100%\">"); String resourcePath = notificationCause.getResource().getRootPath(); String siteRoot = OpenCms.getSiteManager().getSiteRoot(resourcePath); resourcePath = resourcePath.substring(siteRoot.length()); // append link, if page is available if ((notificationCause.getResource().getDateReleased() < System.currentTimeMillis()) && (notificationCause.getResource().getDateExpired() > System.currentTimeMillis())) { Map<String, String[]> params = new HashMap<String, String[]>(); params.put(CmsWorkplace.PARAM_WP_SITE, new String[] {siteRoot}); params.put(CmsDialog.PARAM_RESOURCE, new String[] {resourcePath}); result.append("<a href=\""); result.append( CmsRequestUtil.appendParameters(m_uriWorkplace + "commons/displayresource.jsp", params, false)); result.append("\">"); result.append(resourcePath); result.append("</a>"); } else { result.append(resourcePath); } result.append("</td><td><div style=\"white-space:nowrap;padding-left:10px;padding-right:10px;\">"); result.append(siteRoot); result.append("</td><td><div style=\"white-space:nowrap;padding-left:10px;padding-right:10px;\">"); if (notificationCause.getCause() == CmsExtendedNotificationCause.RESOURCE_EXPIRES) { result.append(m_messages.key(Messages.GUI_EXPIRES_AT_1, new Object[] {notificationCause.getDate()})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendModifyLink(result, notificationCause); } else if (notificationCause.getCause() == CmsExtendedNotificationCause.RESOURCE_RELEASE) { result.append(m_messages.key(Messages.GUI_RELEASE_AT_1, new Object[] {notificationCause.getDate()})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendModifyLink(result, notificationCause); } else if (notificationCause.getCause() == CmsExtendedNotificationCause.RESOURCE_UPDATE_REQUIRED) { result.append(m_messages.key(Messages.GUI_UPDATE_REQUIRED_1, new Object[] {notificationCause.getDate()})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendEditLink(result, notificationCause); } else { result.append( m_messages.key( Messages.GUI_UNCHANGED_SINCE_1, new Object[] {new Integer(CmsDateUtil.getDaysPassedSince(notificationCause.getDate()))})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendEditLink(result, notificationCause); } result.append("</tr>"); return result.toString(); }
java
private String buildNotificationListItem(CmsExtendedNotificationCause notificationCause, int row) { StringBuffer result = new StringBuffer("<tr class=\"trow"); result.append(row); result.append("\"><td width=\"100%\">"); String resourcePath = notificationCause.getResource().getRootPath(); String siteRoot = OpenCms.getSiteManager().getSiteRoot(resourcePath); resourcePath = resourcePath.substring(siteRoot.length()); // append link, if page is available if ((notificationCause.getResource().getDateReleased() < System.currentTimeMillis()) && (notificationCause.getResource().getDateExpired() > System.currentTimeMillis())) { Map<String, String[]> params = new HashMap<String, String[]>(); params.put(CmsWorkplace.PARAM_WP_SITE, new String[] {siteRoot}); params.put(CmsDialog.PARAM_RESOURCE, new String[] {resourcePath}); result.append("<a href=\""); result.append( CmsRequestUtil.appendParameters(m_uriWorkplace + "commons/displayresource.jsp", params, false)); result.append("\">"); result.append(resourcePath); result.append("</a>"); } else { result.append(resourcePath); } result.append("</td><td><div style=\"white-space:nowrap;padding-left:10px;padding-right:10px;\">"); result.append(siteRoot); result.append("</td><td><div style=\"white-space:nowrap;padding-left:10px;padding-right:10px;\">"); if (notificationCause.getCause() == CmsExtendedNotificationCause.RESOURCE_EXPIRES) { result.append(m_messages.key(Messages.GUI_EXPIRES_AT_1, new Object[] {notificationCause.getDate()})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendModifyLink(result, notificationCause); } else if (notificationCause.getCause() == CmsExtendedNotificationCause.RESOURCE_RELEASE) { result.append(m_messages.key(Messages.GUI_RELEASE_AT_1, new Object[] {notificationCause.getDate()})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendModifyLink(result, notificationCause); } else if (notificationCause.getCause() == CmsExtendedNotificationCause.RESOURCE_UPDATE_REQUIRED) { result.append(m_messages.key(Messages.GUI_UPDATE_REQUIRED_1, new Object[] {notificationCause.getDate()})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendEditLink(result, notificationCause); } else { result.append( m_messages.key( Messages.GUI_UNCHANGED_SINCE_1, new Object[] {new Integer(CmsDateUtil.getDaysPassedSince(notificationCause.getDate()))})); result.append("</div></td>"); appendConfirmLink(result, notificationCause); appendEditLink(result, notificationCause); } result.append("</tr>"); return result.toString(); }
[ "private", "String", "buildNotificationListItem", "(", "CmsExtendedNotificationCause", "notificationCause", ",", "int", "row", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "\"<tr class=\\\"trow\"", ")", ";", "result", ".", "append", "(", "row",...
Returns a string representation of this resource info.<p> @param notificationCause the notification cause @param row the row number @return a string representation of this resource info
[ "Returns", "a", "string", "representation", "of", "this", "resource", "info", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/notification/CmsContentNotification.java#L371-L426
stevespringett/CPE-Parser
src/main/java/us/springett/parsers/cpe/CpeParser.java
CpeParser.parse23
protected static Cpe parse23(String cpeString, boolean lenient) throws CpeParsingException { if (cpeString == null || cpeString.isEmpty()) { throw new CpeParsingException("CPE String is null ir enpty - unable to parse"); } CpeBuilder cb = new CpeBuilder(); Cpe23PartIterator cpe = new Cpe23PartIterator(cpeString); try { cb.part(cpe.next()); cb.wfVendor(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfProduct(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfVersion(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfUpdate(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfEdition(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfLanguage(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfSwEdition(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfTargetSw(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfTargetHw(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfOther(Convert.fsToWellFormed(cpe.next(), lenient)); } catch (NoSuchElementException ex) { throw new CpeParsingException("Invalid CPE (too few components): " + cpeString); } if (cpe.hasNext()) { throw new CpeParsingException("Invalid CPE (too many components): " + cpeString); } try { return cb.build(); } catch (CpeValidationException ex) { throw new CpeParsingException(ex.getMessage()); } }
java
protected static Cpe parse23(String cpeString, boolean lenient) throws CpeParsingException { if (cpeString == null || cpeString.isEmpty()) { throw new CpeParsingException("CPE String is null ir enpty - unable to parse"); } CpeBuilder cb = new CpeBuilder(); Cpe23PartIterator cpe = new Cpe23PartIterator(cpeString); try { cb.part(cpe.next()); cb.wfVendor(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfProduct(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfVersion(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfUpdate(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfEdition(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfLanguage(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfSwEdition(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfTargetSw(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfTargetHw(Convert.fsToWellFormed(cpe.next(), lenient)); cb.wfOther(Convert.fsToWellFormed(cpe.next(), lenient)); } catch (NoSuchElementException ex) { throw new CpeParsingException("Invalid CPE (too few components): " + cpeString); } if (cpe.hasNext()) { throw new CpeParsingException("Invalid CPE (too many components): " + cpeString); } try { return cb.build(); } catch (CpeValidationException ex) { throw new CpeParsingException(ex.getMessage()); } }
[ "protected", "static", "Cpe", "parse23", "(", "String", "cpeString", ",", "boolean", "lenient", ")", "throws", "CpeParsingException", "{", "if", "(", "cpeString", "==", "null", "||", "cpeString", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "CpeParsin...
Parses a CPE 2.3 Formatted String. @param cpeString the CPE string to parse @param lenient when <code>true</code> the parser will put in lenient mode attempting to parse invalid CPE values. @return the CPE object represented by the cpeString @throws CpeParsingException thrown if the cpeString is invalid
[ "Parses", "a", "CPE", "2", ".", "3", "Formatted", "String", "." ]
train
https://github.com/stevespringett/CPE-Parser/blob/e6324ca020dc0790097d3d62bb98aabf60e56843/src/main/java/us/springett/parsers/cpe/CpeParser.java#L203-L232
alkacon/opencms-core
src/org/opencms/relations/CmsCategoryService.java
CmsCategoryService.internalCategoryRootPath
private String internalCategoryRootPath(String basePath, String categoryPath) { if (categoryPath.startsWith("/") && basePath.endsWith("/")) { // one slash too much return basePath + categoryPath.substring(1); } else if (!categoryPath.startsWith("/") && !basePath.endsWith("/")) { // one slash too less return basePath + "/" + categoryPath; } else { return basePath + categoryPath; } }
java
private String internalCategoryRootPath(String basePath, String categoryPath) { if (categoryPath.startsWith("/") && basePath.endsWith("/")) { // one slash too much return basePath + categoryPath.substring(1); } else if (!categoryPath.startsWith("/") && !basePath.endsWith("/")) { // one slash too less return basePath + "/" + categoryPath; } else { return basePath + categoryPath; } }
[ "private", "String", "internalCategoryRootPath", "(", "String", "basePath", ",", "String", "categoryPath", ")", "{", "if", "(", "categoryPath", ".", "startsWith", "(", "\"/\"", ")", "&&", "basePath", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "// one slash ...
Composes the category root path by appending the category path to the given category repository path.<p> @param basePath the category repository path @param categoryPath the category path @return the category root path
[ "Composes", "the", "category", "root", "path", "by", "appending", "the", "category", "path", "to", "the", "given", "category", "repository", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L761-L772
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java
Modifiers.setPublic
public static int setPublic(int modifier, boolean b) { if (b) { return (modifier | PUBLIC) & (~PROTECTED & ~PRIVATE); } else { return modifier & ~PUBLIC; } }
java
public static int setPublic(int modifier, boolean b) { if (b) { return (modifier | PUBLIC) & (~PROTECTED & ~PRIVATE); } else { return modifier & ~PUBLIC; } }
[ "public", "static", "int", "setPublic", "(", "int", "modifier", ",", "boolean", "b", ")", "{", "if", "(", "b", ")", "{", "return", "(", "modifier", "|", "PUBLIC", ")", "&", "(", "~", "PROTECTED", "&", "~", "PRIVATE", ")", ";", "}", "else", "{", "...
When set public, the modifier is cleared from being private or protected.
[ "When", "set", "public", "the", "modifier", "is", "cleared", "from", "being", "private", "or", "protected", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java#L34-L41
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RDN.java
AVAComparator.compare
@Override public int compare(AVA a1, AVA a2) { boolean a1Has2253 = a1.hasRFC2253Keyword(); boolean a2Has2253 = a2.hasRFC2253Keyword(); if (a1Has2253) { if (a2Has2253) { return a1.toRFC2253CanonicalString().compareTo (a2.toRFC2253CanonicalString()); } else { return -1; } } else { if (a2Has2253) { return 1; } else { int[] a1Oid = a1.getObjectIdentifier().toIntArray(); int[] a2Oid = a2.getObjectIdentifier().toIntArray(); int pos = 0; int len = (a1Oid.length > a2Oid.length) ? a2Oid.length : a1Oid.length; while (pos < len && a1Oid[pos] == a2Oid[pos]) { ++pos; } return (pos == len) ? a1Oid.length - a2Oid.length : a1Oid[pos] - a2Oid[pos]; } } }
java
@Override public int compare(AVA a1, AVA a2) { boolean a1Has2253 = a1.hasRFC2253Keyword(); boolean a2Has2253 = a2.hasRFC2253Keyword(); if (a1Has2253) { if (a2Has2253) { return a1.toRFC2253CanonicalString().compareTo (a2.toRFC2253CanonicalString()); } else { return -1; } } else { if (a2Has2253) { return 1; } else { int[] a1Oid = a1.getObjectIdentifier().toIntArray(); int[] a2Oid = a2.getObjectIdentifier().toIntArray(); int pos = 0; int len = (a1Oid.length > a2Oid.length) ? a2Oid.length : a1Oid.length; while (pos < len && a1Oid[pos] == a2Oid[pos]) { ++pos; } return (pos == len) ? a1Oid.length - a2Oid.length : a1Oid[pos] - a2Oid[pos]; } } }
[ "@", "Override", "public", "int", "compare", "(", "AVA", "a1", ",", "AVA", "a2", ")", "{", "boolean", "a1Has2253", "=", "a1", ".", "hasRFC2253Keyword", "(", ")", ";", "boolean", "a2Has2253", "=", "a2", ".", "hasRFC2253Keyword", "(", ")", ";", "if", "("...
AVA's containing a standard keyword are ordered alphabetically, followed by AVA's containing an OID keyword, ordered numerically
[ "AVA", "s", "containing", "a", "standard", "keyword", "are", "ordered", "alphabetically", "followed", "by", "AVA", "s", "containing", "an", "OID", "keyword", "ordered", "numerically" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RDN.java#L491-L519
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
Interceptors.doPostIntercept
public static void doPostIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors ) throws InterceptorException { if ( interceptors != null ) { PostInvokeInterceptorChain chain = new PostInvokeInterceptorChain( context, interceptors ); chain.continueChain(); } }
java
public static void doPostIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors ) throws InterceptorException { if ( interceptors != null ) { PostInvokeInterceptorChain chain = new PostInvokeInterceptorChain( context, interceptors ); chain.continueChain(); } }
[ "public", "static", "void", "doPostIntercept", "(", "InterceptorContext", "context", ",", "List", "/*< Interceptor >*/", "interceptors", ")", "throws", "InterceptorException", "{", "if", "(", "interceptors", "!=", "null", ")", "{", "PostInvokeInterceptorChain", "chain",...
Execute a "post" interceptor chain. This will execute the {@link Interceptor#postInvoke(InterceptorContext, InterceptorChain)} method to be invoked on each interceptor in a chain. @param context the context for a set of interceptors @param interceptors the list of interceptors @throws InterceptorException
[ "Execute", "a", "post", "interceptor", "chain", ".", "This", "will", "execute", "the", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java#L58-L66
UrielCh/ovh-java-sdk
ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java
ApiOvhMsServices.serviceName_account_userPrincipalName_sync_POST
public OvhTask serviceName_account_userPrincipalName_sync_POST(String serviceName, String userPrincipalName, OvhSyncLicenseEnum license) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sync"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "license", license); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_account_userPrincipalName_sync_POST(String serviceName, String userPrincipalName, OvhSyncLicenseEnum license) throws IOException { String qPath = "/msServices/{serviceName}/account/{userPrincipalName}/sync"; StringBuilder sb = path(qPath, serviceName, userPrincipalName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "license", license); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_account_userPrincipalName_sync_POST", "(", "String", "serviceName", ",", "String", "userPrincipalName", ",", "OvhSyncLicenseEnum", "license", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/msServices/{serviceName}/account/{userP...
Create new sync account REST: POST /msServices/{serviceName}/account/{userPrincipalName}/sync @param license [required] Sync account license @param serviceName [required] The internal name of your Active Directory organization @param userPrincipalName [required] User Principal Name API beta
[ "Create", "new", "sync", "account" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L173-L180