repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MiniSat.java
MiniSat.miniCard
public static MiniSat miniCard(final FormulaFactory f, final MiniSatConfig config) { return new MiniSat(f, SolverStyle.MINICARD, config, null); }
java
public static MiniSat miniCard(final FormulaFactory f, final MiniSatConfig config) { return new MiniSat(f, SolverStyle.MINICARD, config, null); }
[ "public", "static", "MiniSat", "miniCard", "(", "final", "FormulaFactory", "f", ",", "final", "MiniSatConfig", "config", ")", "{", "return", "new", "MiniSat", "(", "f", ",", "SolverStyle", ".", "MINICARD", ",", "config", ",", "null", ")", ";", "}" ]
Returns a new MiniCard solver with a given configuration. @param f the formula factory @param config the configuration @return the solver
[ "Returns", "a", "new", "MiniCard", "solver", "with", "a", "given", "configuration", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L181-L183
rvs-fluid-it/mvn-fluid-cd
mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java
FreezeHandler.endDocument
public void endDocument() throws SAXException { try { out.flush(); logger.debug("[Freezehandler]: End parsing of pom file"); } catch (IOException e) { throw new SAXException("I/O error", e); } }
java
public void endDocument() throws SAXException { try { out.flush(); logger.debug("[Freezehandler]: End parsing of pom file"); } catch (IOException e) { throw new SAXException("I/O error", e); } }
[ "public", "void", "endDocument", "(", ")", "throws", "SAXException", "{", "try", "{", "out", ".", "flush", "(", ")", ";", "logger", ".", "debug", "(", "\"[Freezehandler]: End parsing of pom file\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", ...
Overrides <code>endDocument()</code> in <code>org.xml.sax.helpers.DefaultHandler</code>, which in turn implements <code>org.xml.sax.ContentHandler</code>. Called once at the end of document processing; no further callbacks will occur.
[ "Overrides", "<code", ">", "endDocument", "()", "<", "/", "code", ">", "in", "<code", ">", "org", ".", "xml", ".", "sax", ".", "helpers", ".", "DefaultHandler<", "/", "code", ">", "which", "in", "turn", "implements", "<code", ">", "org", ".", "xml", ...
train
https://github.com/rvs-fluid-it/mvn-fluid-cd/blob/2aad8ed1cb40f94bd24bad7e6a127956cc277077/mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java#L88-L96
redkale/redkale
src/org/redkale/asm/ModuleVisitor.java
ModuleVisitor.visitOpen
public void visitOpen(String packaze, int access, String... modules) { if (mv != null) { mv.visitOpen(packaze, access, modules); } }
java
public void visitOpen(String packaze, int access, String... modules) { if (mv != null) { mv.visitOpen(packaze, access, modules); } }
[ "public", "void", "visitOpen", "(", "String", "packaze", ",", "int", "access", ",", "String", "...", "modules", ")", "{", "if", "(", "mv", "!=", "null", ")", "{", "mv", ".", "visitOpen", "(", "packaze", ",", "access", ",", "modules", ")", ";", "}", ...
Visit an open package of the current module. @param packaze the qualified name of the opened package. @param access the access flag of the opened package, valid values are among {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}. @param modules the qualified names of the modules that can use deep reflection to the classes of the open package or <tt>null</tt>.
[ "Visit", "an", "open", "package", "of", "the", "current", "module", "." ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ModuleVisitor.java#L179-L183
BellaDati/belladati-sdk-api
src/main/java/com/belladati/sdk/dataset/data/DataTable.java
DataTable.createDetailedInstance
public static DataTable createDetailedInstance(DataColumn firstColumn, DataColumn... otherColumns) { List<DataColumn> list = new ArrayList<DataColumn>(); list.add(firstColumn); for (DataColumn column : otherColumns) { list.add(column); } return createDetailedInstance(list); }
java
public static DataTable createDetailedInstance(DataColumn firstColumn, DataColumn... otherColumns) { List<DataColumn> list = new ArrayList<DataColumn>(); list.add(firstColumn); for (DataColumn column : otherColumns) { list.add(column); } return createDetailedInstance(list); }
[ "public", "static", "DataTable", "createDetailedInstance", "(", "DataColumn", "firstColumn", ",", "DataColumn", "...", "otherColumns", ")", "{", "List", "<", "DataColumn", ">", "list", "=", "new", "ArrayList", "<", "DataColumn", ">", "(", ")", ";", "list", "."...
Creates a new instance with the given column setup. At least one column must be specified in the table. Rows are allowed to be empty. <p> Columns should be unique, but the table doesn't enforce this. @param firstColumn first column @param otherColumns additional, optional columns @return new detailed instance
[ "Creates", "a", "new", "instance", "with", "the", "given", "column", "setup", ".", "At", "least", "one", "column", "must", "be", "specified", "in", "the", "table", ".", "Rows", "are", "allowed", "to", "be", "empty", ".", "<p", ">", "Columns", "should", ...
train
https://github.com/BellaDati/belladati-sdk-api/blob/ec45a42048d8255838ad0200aa6784a8e8a121c1/src/main/java/com/belladati/sdk/dataset/data/DataTable.java#L75-L82
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java
PropertyChangeSupport.firePropertyChange
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { if (oldValue != newValue) { firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); } }
java
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) { if (oldValue != newValue) { firePropertyChange(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); } }
[ "public", "void", "firePropertyChange", "(", "String", "propertyName", ",", "boolean", "oldValue", ",", "boolean", "newValue", ")", "{", "if", "(", "oldValue", "!=", "newValue", ")", "{", "firePropertyChange", "(", "propertyName", ",", "Boolean", ".", "valueOf",...
Reports a boolean bound property update to listeners that have been registered to track updates of all properties or a property with the specified name. <p> No event is fired if old and new values are equal. <p> This is merely a convenience wrapper around the more general {@link #firePropertyChange(String, Object, Object)} method. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property @param newValue the new value of the property
[ "Reports", "a", "boolean", "bound", "property", "update", "to", "listeners", "that", "have", "been", "registered", "to", "track", "updates", "of", "all", "properties", "or", "a", "property", "with", "the", "specified", "name", ".", "<p", ">", "No", "event", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/beans/PropertyChangeSupport.java#L301-L305
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PasswordValidator.java
PasswordValidator.isValid
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString = Objects.toString(pvalue, null); return StringUtils.isEmpty(valueAsString) || countCriteriaMatches(valueAsString) >= minRules && !isBlacklist(pcontext, valueAsString) && !startsWithDisalowedCharacter(pcontext, valueAsString) && !maxRepeatCharacterExceded(pcontext, valueAsString); }
java
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString = Objects.toString(pvalue, null); return StringUtils.isEmpty(valueAsString) || countCriteriaMatches(valueAsString) >= minRules && !isBlacklist(pcontext, valueAsString) && !startsWithDisalowedCharacter(pcontext, valueAsString) && !maxRepeatCharacterExceded(pcontext, valueAsString); }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "Object", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "final", "String", "valueAsString", "=", "Objects", ".", "toString", "(", "pvalue", ",", "null", ")", ...
{@inheritDoc} check if given object is valid. @see javax.validation.ConstraintValidator#isValid(Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "object", "is", "valid", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/PasswordValidator.java#L124-L131
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java
AbstractProperty.decodeField
public void decodeField(GettableData gettableData, ENTITY entity) { final VALUEFROM valuefrom = decodeFromGettable(gettableData); fieldInfo.setter.set(entity, valuefrom); }
java
public void decodeField(GettableData gettableData, ENTITY entity) { final VALUEFROM valuefrom = decodeFromGettable(gettableData); fieldInfo.setter.set(entity, valuefrom); }
[ "public", "void", "decodeField", "(", "GettableData", "gettableData", ",", "ENTITY", "entity", ")", "{", "final", "VALUEFROM", "valuefrom", "=", "decodeFromGettable", "(", "gettableData", ")", ";", "fieldInfo", ".", "setter", ".", "set", "(", "entity", ",", "v...
<ol> <li>First extract the column value from the given GettableData (Row, UDTValue, ...)</li> <li>Then call the setter on the given entity to set the value</li> </ol> @param gettableData @param entity
[ "<ol", ">", "<li", ">", "First", "extract", "the", "column", "value", "from", "the", "given", "GettableData", "(", "Row", "UDTValue", "...", ")", "<", "/", "li", ">", "<li", ">", "Then", "call", "the", "setter", "on", "the", "given", "entity", "to", ...
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L243-L246
nabedge/mixer2
src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java
GetDescendantsUtil.getDescendants
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, String clazz) { return execute(target, resultList, null, clazz); }
java
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, String clazz) { return execute(target, resultList, null, clazz); }
[ "public", "static", "<", "T", "extends", "AbstractJaxb", ">", "List", "<", "T", ">", "getDescendants", "(", "T", "target", ",", "List", "<", "T", ">", "resultList", ",", "String", "clazz", ")", "{", "return", "execute", "(", "target", ",", "resultList", ...
class属性の指定で子孫要素を返す @param target objects for scan @param resultList usually, pass new ArrayList @param clazz class property of tag @return
[ "class属性の指定で子孫要素を返す" ]
train
https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java#L68-L71
line/armeria
core/src/main/java/com/linecorp/armeria/common/metric/DropwizardMeterRegistries.java
DropwizardMeterRegistries.newRegistry
public static DropwizardMeterRegistry newRegistry(HierarchicalNameMapper nameMapper, Clock clock) { return newRegistry(new MetricRegistry(), nameMapper, clock); }
java
public static DropwizardMeterRegistry newRegistry(HierarchicalNameMapper nameMapper, Clock clock) { return newRegistry(new MetricRegistry(), nameMapper, clock); }
[ "public", "static", "DropwizardMeterRegistry", "newRegistry", "(", "HierarchicalNameMapper", "nameMapper", ",", "Clock", "clock", ")", "{", "return", "newRegistry", "(", "new", "MetricRegistry", "(", ")", ",", "nameMapper", ",", "clock", ")", ";", "}" ]
Returns a newly-created {@link DropwizardMeterRegistry} instance with the specified {@link HierarchicalNameMapper} and {@link Clock}.
[ "Returns", "a", "newly", "-", "created", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/metric/DropwizardMeterRegistries.java#L116-L118
Erudika/para
para-core/src/main/java/com/erudika/para/core/User.java
User.isValidPasswordResetToken
public final boolean isValidPasswordResetToken(String token) { Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier); return isValidToken(s, Config._RESET_TOKEN, token); }
java
public final boolean isValidPasswordResetToken(String token) { Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier); return isValidToken(s, Config._RESET_TOKEN, token); }
[ "public", "final", "boolean", "isValidPasswordResetToken", "(", "String", "token", ")", "{", "Sysprop", "s", "=", "CoreUtils", ".", "getInstance", "(", ")", ".", "getDao", "(", ")", ".", "read", "(", "getAppid", "(", ")", ",", "identifier", ")", ";", "re...
Validates a token sent via email for password reset. @param token a token @return true if valid
[ "Validates", "a", "token", "sent", "via", "email", "for", "password", "reset", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/User.java#L718-L721
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsUpdateImpl.java
ItemsUpdateImpl.maybeGrowLevels
static <T> void maybeGrowLevels(final ItemsSketch<T> sketch, final long newN) { // important: newN might not equal n_ final int k = sketch.getK(); final int numLevelsNeeded = Util.computeNumLevelsNeeded(k, newN); if (numLevelsNeeded == 0) { // don't need any levels yet, and might have small base buffer; this can happen during a merge return; } // from here on we need a full-size base buffer and at least one level assert newN >= 2L * k; assert numLevelsNeeded > 0; final int spaceNeeded = (2 + numLevelsNeeded) * k; if (spaceNeeded <= sketch.getCombinedBufferAllocatedCount()) { return; } // copies base buffer plus old levels sketch.combinedBuffer_ = Arrays.copyOf(sketch.getCombinedBuffer(), spaceNeeded); sketch.combinedBufferItemCapacity_ = spaceNeeded; }
java
static <T> void maybeGrowLevels(final ItemsSketch<T> sketch, final long newN) { // important: newN might not equal n_ final int k = sketch.getK(); final int numLevelsNeeded = Util.computeNumLevelsNeeded(k, newN); if (numLevelsNeeded == 0) { // don't need any levels yet, and might have small base buffer; this can happen during a merge return; } // from here on we need a full-size base buffer and at least one level assert newN >= 2L * k; assert numLevelsNeeded > 0; final int spaceNeeded = (2 + numLevelsNeeded) * k; if (spaceNeeded <= sketch.getCombinedBufferAllocatedCount()) { return; } // copies base buffer plus old levels sketch.combinedBuffer_ = Arrays.copyOf(sketch.getCombinedBuffer(), spaceNeeded); sketch.combinedBufferItemCapacity_ = spaceNeeded; }
[ "static", "<", "T", ">", "void", "maybeGrowLevels", "(", "final", "ItemsSketch", "<", "T", ">", "sketch", ",", "final", "long", "newN", ")", "{", "// important: newN might not equal n_", "final", "int", "k", "=", "sketch", ".", "getK", "(", ")", ";", "fina...
This only increases the size and does not touch or move any data.
[ "This", "only", "increases", "the", "size", "and", "does", "not", "touch", "or", "move", "any", "data", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUpdateImpl.java#L17-L35
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/bucket/api/Utils.java
Utils.putIfNotNull
private static void putIfNotNull(final Map<String, Object> map, final String key, final Object value) { if (value != null) { map.put(key, value); } }
java
private static void putIfNotNull(final Map<String, Object> map, final String key, final Object value) { if (value != null) { map.put(key, value); } }
[ "private", "static", "void", "putIfNotNull", "(", "final", "Map", "<", "String", ",", "Object", ">", "map", ",", "final", "String", "key", ",", "final", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "map", ".", "put", "(", ...
Helper method to avoid ugly if/else blocks in {@link #formatTimeout(CouchbaseRequest, long)}.
[ "Helper", "method", "to", "avoid", "ugly", "if", "/", "else", "blocks", "in", "{" ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/api/Utils.java#L94-L98
probedock/probedock-java
src/main/java/io/probedock/client/utils/EnvironmentUtils.java
EnvironmentUtils.getEnvironmentBoolean
public static Boolean getEnvironmentBoolean(String name, Boolean defaultValue) { if (envVars == null) { throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentBoolean."); } String value = getEnvironmentString(name, null); if (value == null) { return defaultValue; } else { return BOOLEAN_PATTERN.matcher(value).matches(); } }
java
public static Boolean getEnvironmentBoolean(String name, Boolean defaultValue) { if (envVars == null) { throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentBoolean."); } String value = getEnvironmentString(name, null); if (value == null) { return defaultValue; } else { return BOOLEAN_PATTERN.matcher(value).matches(); } }
[ "public", "static", "Boolean", "getEnvironmentBoolean", "(", "String", "name", ",", "Boolean", "defaultValue", ")", "{", "if", "(", "envVars", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The environment vars must be provided before calling g...
Retrieve boolean value for the environment variable name @param name The name of the variable without prefix @param defaultValue The default value if not found @return The value found, or the default if not found
[ "Retrieve", "boolean", "value", "for", "the", "environment", "variable", "name" ]
train
https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/utils/EnvironmentUtils.java#L32-L45
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/ReloadableType.java
ReloadableType.getField
public Object getField(Object instance, String fieldname, boolean isStatic) throws IllegalAccessException { FieldReaderWriter fieldReaderWriter = locateField(fieldname); if (isStatic && !fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } else if (!isStatic && fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } Object o = null; if (fieldReaderWriter.isStatic()) { o = fieldReaderWriter.getStaticFieldValue(getClazz(), null); } else { o = fieldReaderWriter.getValue(instance, null); } return o; }
java
public Object getField(Object instance, String fieldname, boolean isStatic) throws IllegalAccessException { FieldReaderWriter fieldReaderWriter = locateField(fieldname); if (isStatic && !fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } else if (!isStatic && fieldReaderWriter.isStatic()) { throw new IncompatibleClassChangeError("Expected non-static field " + fieldReaderWriter.theField.getDeclaringTypeName() + "." + fieldReaderWriter.theField.getName()); } Object o = null; if (fieldReaderWriter.isStatic()) { o = fieldReaderWriter.getStaticFieldValue(getClazz(), null); } else { o = fieldReaderWriter.getValue(instance, null); } return o; }
[ "public", "Object", "getField", "(", "Object", "instance", ",", "String", "fieldname", ",", "boolean", "isStatic", ")", "throws", "IllegalAccessException", "{", "FieldReaderWriter", "fieldReaderWriter", "=", "locateField", "(", "fieldname", ")", ";", "if", "(", "i...
Attempt to set the value of a field on an instance to the specified value. Simply locate the field, which returns an object capable of reading/writing it, then use that to retrieve the value. @param instance the object upon which to set the field (maybe null for static fields) @param fieldname the name of the field @param isStatic whether the field is static or not @return the field value @throws IllegalAccessException if there is a problem accessing the field
[ "Attempt", "to", "set", "the", "value", "of", "a", "field", "on", "an", "instance", "to", "the", "specified", "value", ".", "Simply", "locate", "the", "field", "which", "returns", "an", "object", "capable", "of", "reading", "/", "writing", "it", "then", ...
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ReloadableType.java#L1389-L1410
androidsx/rate-me
LibraryRateMe/src/com/androidsx/rateme/RateMeDialogTimer.java
RateMeDialogTimer.setOptOut
public static void setOptOut(final Context context, boolean optOut) { SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); Editor editor = pref.edit(); editor.putBoolean(KEY_OPT_OUT, optOut); editor.apply(); }
java
public static void setOptOut(final Context context, boolean optOut) { SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); Editor editor = pref.edit(); editor.putBoolean(KEY_OPT_OUT, optOut); editor.apply(); }
[ "public", "static", "void", "setOptOut", "(", "final", "Context", "context", ",", "boolean", "optOut", ")", "{", "SharedPreferences", "pref", "=", "context", ".", "getSharedPreferences", "(", "PREF_NAME", ",", "Context", ".", "MODE_PRIVATE", ")", ";", "Editor", ...
Set opt out flag. If it is true, the rate dialog will never shown unless app data is cleared.
[ "Set", "opt", "out", "flag", ".", "If", "it", "is", "true", "the", "rate", "dialog", "will", "never", "shown", "unless", "app", "data", "is", "cleared", "." ]
train
https://github.com/androidsx/rate-me/blob/a779706454ba585a09110745ac3035f28920524a/LibraryRateMe/src/com/androidsx/rateme/RateMeDialogTimer.java#L97-L102
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/FileMappedKeyDirector.java
FileMappedKeyDirector.constructDocument
public void constructDocument(String filePath, MappedKeyEngineer<K,V> engineer) { //clear cache try { crawl(new File(filePath), engineer); } finally { crawledPaths.clear(); } }
java
public void constructDocument(String filePath, MappedKeyEngineer<K,V> engineer) { //clear cache try { crawl(new File(filePath), engineer); } finally { crawledPaths.clear(); } }
[ "public", "void", "constructDocument", "(", "String", "filePath", ",", "MappedKeyEngineer", "<", "K", ",", "V", ">", "engineer", ")", "{", "//clear cache\t\t\r", "try", "{", "crawl", "(", "new", "File", "(", "filePath", ")", ",", "engineer", ")", ";", "}",...
Director method to construct a document @param filePath the file path the output @param engineer the strategy
[ "Director", "method", "to", "construct", "a", "document" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/FileMappedKeyDirector.java#L23-L34
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_billingAccount_portability_GET
public OvhOrder telephony_billingAccount_portability_GET(String billingAccount, String building, String callNumber, String city, String contactName, String contactNumber, OvhCountriesAvailable country, Date desireDate, Boolean displayUniversalDirectory, String door, Boolean executeAsSoonAsPossible, Boolean fiabilisation, String firstName, Double floor, String lineToRedirectAliasTo, String listNumbers, String mobilePhone, String name, OvhOfferType offer, String rio, String siret, OvhSocialReason socialReason, OvhSpecialNumberCategoryEnum specialNumberCategory, Double stair, String streetName, Double streetNumber, String streetNumberExtra, String streetType, OvhNumberType type, String zip) throws IOException { String qPath = "/order/telephony/{billingAccount}/portability"; StringBuilder sb = path(qPath, billingAccount); query(sb, "building", building); query(sb, "callNumber", callNumber); query(sb, "city", city); query(sb, "contactName", contactName); query(sb, "contactNumber", contactNumber); query(sb, "country", country); query(sb, "desireDate", desireDate); query(sb, "displayUniversalDirectory", displayUniversalDirectory); query(sb, "door", door); query(sb, "executeAsSoonAsPossible", executeAsSoonAsPossible); query(sb, "fiabilisation", fiabilisation); query(sb, "firstName", firstName); query(sb, "floor", floor); query(sb, "lineToRedirectAliasTo", lineToRedirectAliasTo); query(sb, "listNumbers", listNumbers); query(sb, "mobilePhone", mobilePhone); query(sb, "name", name); query(sb, "offer", offer); query(sb, "rio", rio); query(sb, "siret", siret); query(sb, "socialReason", socialReason); query(sb, "specialNumberCategory", specialNumberCategory); query(sb, "stair", stair); query(sb, "streetName", streetName); query(sb, "streetNumber", streetNumber); query(sb, "streetNumberExtra", streetNumberExtra); query(sb, "streetType", streetType); query(sb, "type", type); query(sb, "zip", zip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_billingAccount_portability_GET(String billingAccount, String building, String callNumber, String city, String contactName, String contactNumber, OvhCountriesAvailable country, Date desireDate, Boolean displayUniversalDirectory, String door, Boolean executeAsSoonAsPossible, Boolean fiabilisation, String firstName, Double floor, String lineToRedirectAliasTo, String listNumbers, String mobilePhone, String name, OvhOfferType offer, String rio, String siret, OvhSocialReason socialReason, OvhSpecialNumberCategoryEnum specialNumberCategory, Double stair, String streetName, Double streetNumber, String streetNumberExtra, String streetType, OvhNumberType type, String zip) throws IOException { String qPath = "/order/telephony/{billingAccount}/portability"; StringBuilder sb = path(qPath, billingAccount); query(sb, "building", building); query(sb, "callNumber", callNumber); query(sb, "city", city); query(sb, "contactName", contactName); query(sb, "contactNumber", contactNumber); query(sb, "country", country); query(sb, "desireDate", desireDate); query(sb, "displayUniversalDirectory", displayUniversalDirectory); query(sb, "door", door); query(sb, "executeAsSoonAsPossible", executeAsSoonAsPossible); query(sb, "fiabilisation", fiabilisation); query(sb, "firstName", firstName); query(sb, "floor", floor); query(sb, "lineToRedirectAliasTo", lineToRedirectAliasTo); query(sb, "listNumbers", listNumbers); query(sb, "mobilePhone", mobilePhone); query(sb, "name", name); query(sb, "offer", offer); query(sb, "rio", rio); query(sb, "siret", siret); query(sb, "socialReason", socialReason); query(sb, "specialNumberCategory", specialNumberCategory); query(sb, "stair", stair); query(sb, "streetName", streetName); query(sb, "streetNumber", streetNumber); query(sb, "streetNumberExtra", streetNumberExtra); query(sb, "streetType", streetType); query(sb, "type", type); query(sb, "zip", zip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_billingAccount_portability_GET", "(", "String", "billingAccount", ",", "String", "building", ",", "String", "callNumber", ",", "String", "city", ",", "String", "contactName", ",", "String", "contactNumber", ",", "OvhCountriesAvailable", ...
Get prices and contracts information REST: GET /order/telephony/{billingAccount}/portability @param desireDate [required] The date you want for portability execution. Overridden if flag executeAsSoonAsPossible is set @param type [required] The type of number : landline or special @param callNumber [required] The number you want to port @param streetName [required] Address street name @param firstName [required] Your firstname @param listNumbers [required] Extra numbers to be ported, a comma separated list of numbers @param socialReason [required] Your social reason @param name [required] Your name @param country [required] Country of number @param stair [required] Address stair @param zip [required] Address zip code @param streetNumberExtra [required] Address street number extra : bis, ter, ... @param contactNumber [required] Your contact phone number @param lineToRedirectAliasTo [required] Redirect ported numbers to the specific line @param rio [required] RIO of the number for individual offer @param mobilePhone [required] Mobile phone to use to text portability status @param building [required] Address building @param streetNumber [required] Address street number @param executeAsSoonAsPossible [required] Ask to port the number as soon as possible @param displayUniversalDirectory [required] Publish informations on directory ? (Yellow Pages, 118XXX, ...) @param floor [required] Address floor @param specialNumberCategory [required] The special number category (needed if type is special) @param siret [required] If you port under your society, the SIRET number @param fiabilisation [required] Ask for a fiabilisation or not (FR only) @param streetType [required] Address street type @param contactName [required] Your contact name @param door [required] Address door @param offer [required] The offer : individual or company @param city [required] Address city @param billingAccount [required] The name of your billingAccount
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6455-L6489
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java
CalendarPanel.zApplyBorderPropertiesList
void zApplyBorderPropertiesList() { // Skip this function if the settings have not been applied. if (settings == null) { return; } // Clear the current borders. (Set them to be invisible and black.) CalendarBorderProperties clearBordersProperties = new CalendarBorderProperties( new Point(1, 1), new Point(5, 5), Color.black, 0); zApplyBorderPropertiesInstance(clearBordersProperties); // Apply the current borderPropertiesList settings. for (CalendarBorderProperties borderProperties : settings.getBorderPropertiesList()) { zApplyBorderPropertiesInstance(borderProperties); } if (!(settings.getWeekNumbersDisplayed())) { CalendarBorderProperties hideWeekNumberBorders = new CalendarBorderProperties( new Point(1, 1), new Point(2, 5), Color.black, 0); zApplyBorderPropertiesInstance(hideWeekNumberBorders); } drawCalendar(); }
java
void zApplyBorderPropertiesList() { // Skip this function if the settings have not been applied. if (settings == null) { return; } // Clear the current borders. (Set them to be invisible and black.) CalendarBorderProperties clearBordersProperties = new CalendarBorderProperties( new Point(1, 1), new Point(5, 5), Color.black, 0); zApplyBorderPropertiesInstance(clearBordersProperties); // Apply the current borderPropertiesList settings. for (CalendarBorderProperties borderProperties : settings.getBorderPropertiesList()) { zApplyBorderPropertiesInstance(borderProperties); } if (!(settings.getWeekNumbersDisplayed())) { CalendarBorderProperties hideWeekNumberBorders = new CalendarBorderProperties( new Point(1, 1), new Point(2, 5), Color.black, 0); zApplyBorderPropertiesInstance(hideWeekNumberBorders); } drawCalendar(); }
[ "void", "zApplyBorderPropertiesList", "(", ")", "{", "// Skip this function if the settings have not been applied.", "if", "(", "settings", "==", "null", ")", "{", "return", ";", "}", "// Clear the current borders. (Set them to be invisible and black.)", "CalendarBorderProperties",...
zApplyBorderPropertiesList, This applies the currently stored border property list to this calendar. The border property list is retrieved from the current date picker settings. Before the Borders properties list is applied, the existing border labels will be cleared. "Clearing" the labels means that the JLabel properties are set as follows: visible = false, color = black, minimumSize = (1,1). Note: If weekNumbersDisplayed is set to false, then the borders located in the week number columns (Columns 1 and 2) will always be set to be hidden.
[ "zApplyBorderPropertiesList", "This", "applies", "the", "currently", "stored", "border", "property", "list", "to", "this", "calendar", ".", "The", "border", "property", "list", "is", "retrieved", "from", "the", "current", "date", "picker", "settings", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java#L1636-L1655
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.createClient
public Client createClient(Client client, AccessToken accessToken) { return getAuthService().createClient(client, accessToken); }
java
public Client createClient(Client client, AccessToken accessToken) { return getAuthService().createClient(client, accessToken); }
[ "public", "Client", "createClient", "(", "Client", "client", ",", "AccessToken", "accessToken", ")", "{", "return", "getAuthService", "(", ")", ".", "createClient", "(", "client", ",", "accessToken", ")", ";", "}" ]
Create a client. @param client the client to create @param accessToken the access token used to access the service @return The created client @throws UnauthorizedException if the accessToken is not valid @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws ClientAlreadyExistsException if the client with the clientId already exists @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "Create", "a", "client", "." ]
train
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L665-L667
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.getJobAsync
public ServiceFuture<JobResponseInner> getJobAsync(String resourceGroupName, String resourceName, String jobId, final ServiceCallback<JobResponseInner> serviceCallback) { return ServiceFuture.fromResponse(getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId), serviceCallback); }
java
public ServiceFuture<JobResponseInner> getJobAsync(String resourceGroupName, String resourceName, String jobId, final ServiceCallback<JobResponseInner> serviceCallback) { return ServiceFuture.fromResponse(getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId), serviceCallback); }
[ "public", "ServiceFuture", "<", "JobResponseInner", ">", "getJobAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "jobId", ",", "final", "ServiceCallback", "<", "JobResponseInner", ">", "serviceCallback", ")", "{", "return", "...
Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param jobId The job identifier. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Get", "the", "details", "of", "a", "job", "from", "an", "IoT", "hub", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "de...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2223-L2225
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JTiledImage.java
JTiledImage.calcOffset
public void calcOffset(Container compAnchor, Point offset) { offset.x = 0; offset.y = 0; Container parent = this; while (parent != null) { offset.x -= parent.getLocation().x; offset.y -= parent.getLocation().y; parent = parent.getParent(); if (parent == compAnchor) return; // Success } // Failure - comp not found. offset.x = 0; offset.y = 0; }
java
public void calcOffset(Container compAnchor, Point offset) { offset.x = 0; offset.y = 0; Container parent = this; while (parent != null) { offset.x -= parent.getLocation().x; offset.y -= parent.getLocation().y; parent = parent.getParent(); if (parent == compAnchor) return; // Success } // Failure - comp not found. offset.x = 0; offset.y = 0; }
[ "public", "void", "calcOffset", "(", "Container", "compAnchor", ",", "Point", "offset", ")", "{", "offset", ".", "x", "=", "0", ";", "offset", ".", "y", "=", "0", ";", "Container", "parent", "=", "this", ";", "while", "(", "parent", "!=", "null", ")"...
Calculate the offset from the component to this component. @param compAnchor The component that would be the upper left hand of this screen. @param offset The offset to set for return.
[ "Calculate", "the", "offset", "from", "the", "component", "to", "this", "component", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JTiledImage.java#L122-L138
zaproxy/zaproxy
src/org/zaproxy/zap/view/TabbedPanel2.java
TabbedPanel2.addTab
public void addTab(String title, Icon icon, final Component c, boolean hideable, boolean visible, int index) { addTab(title, icon, c, hideable, visible, index, true); }
java
public void addTab(String title, Icon icon, final Component c, boolean hideable, boolean visible, int index) { addTab(title, icon, c, hideable, visible, index, true); }
[ "public", "void", "addTab", "(", "String", "title", ",", "Icon", "icon", ",", "final", "Component", "c", ",", "boolean", "hideable", ",", "boolean", "visible", ",", "int", "index", ")", "{", "addTab", "(", "title", ",", "icon", ",", "c", ",", "hideable...
Adds a tab with the given component. @param title the title of the tab. @param icon the icon of the tab. @param c the component of the tab. @param hideable {@code true} if the tab can be hidden, {@code false} otherwise. @param visible {@code true} if the tab should be visible, {@code false} otherwise. @param index the index of the tab.
[ "Adds", "a", "tab", "with", "the", "given", "component", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/TabbedPanel2.java#L342-L344
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java
ProbeMethodAdapter.setProbeListeners
protected void setProbeListeners(ProbeImpl probe, Collection<ProbeListener> listeners) { Set<ProbeListener> enabled = enabledProbes.get(probe); if (enabled == null) { enabled = new HashSet<ProbeListener>(); enabledProbes.put(probe, enabled); } enabled.addAll(listeners); }
java
protected void setProbeListeners(ProbeImpl probe, Collection<ProbeListener> listeners) { Set<ProbeListener> enabled = enabledProbes.get(probe); if (enabled == null) { enabled = new HashSet<ProbeListener>(); enabledProbes.put(probe, enabled); } enabled.addAll(listeners); }
[ "protected", "void", "setProbeListeners", "(", "ProbeImpl", "probe", ",", "Collection", "<", "ProbeListener", ">", "listeners", ")", "{", "Set", "<", "ProbeListener", ">", "enabled", "=", "enabledProbes", ".", "get", "(", "probe", ")", ";", "if", "(", "enabl...
Associate a collection of listeners with the specified probe. @param probe the injected probe @param listeners the listeners that will receive events from the injected probe
[ "Associate", "a", "collection", "of", "listeners", "with", "the", "specified", "probe", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ProbeMethodAdapter.java#L216-L223
EdwardRaff/JSAT
JSAT/src/jsat/text/tokenizer/NaiveTokenizer.java
NaiveTokenizer.setMaxTokenLength
public void setMaxTokenLength(int maxTokenLength) { if(maxTokenLength < 1) throw new IllegalArgumentException("Max token length must be positive, not " + maxTokenLength); if(maxTokenLength <= minTokenLength) throw new IllegalArgumentException("Max token length must be larger than the min token length"); this.maxTokenLength = maxTokenLength; }
java
public void setMaxTokenLength(int maxTokenLength) { if(maxTokenLength < 1) throw new IllegalArgumentException("Max token length must be positive, not " + maxTokenLength); if(maxTokenLength <= minTokenLength) throw new IllegalArgumentException("Max token length must be larger than the min token length"); this.maxTokenLength = maxTokenLength; }
[ "public", "void", "setMaxTokenLength", "(", "int", "maxTokenLength", ")", "{", "if", "(", "maxTokenLength", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Max token length must be positive, not \"", "+", "maxTokenLength", ")", ";", "if", "(", "ma...
Sets the maximum allowed length for any token. Any token discovered exceeding the length will not be accepted and skipped over. The default is unbounded. @param maxTokenLength the maximum token length to accept as a valid token
[ "Sets", "the", "maximum", "allowed", "length", "for", "any", "token", ".", "Any", "token", "discovered", "exceeding", "the", "length", "will", "not", "be", "accepted", "and", "skipped", "over", ".", "The", "default", "is", "unbounded", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/tokenizer/NaiveTokenizer.java#L137-L144
rosette-api/java
api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java
HttpRosetteAPI.getSupportedLanguages
@Override public SupportedLanguagesResponse getSupportedLanguages(String endpoint) throws HttpRosetteAPIException { if (DOC_ENDPOINTS.contains(endpoint) || NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) { return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, SupportedLanguagesResponse.class); } else { return null; } }
java
@Override public SupportedLanguagesResponse getSupportedLanguages(String endpoint) throws HttpRosetteAPIException { if (DOC_ENDPOINTS.contains(endpoint) || NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) { return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, SupportedLanguagesResponse.class); } else { return null; } }
[ "@", "Override", "public", "SupportedLanguagesResponse", "getSupportedLanguages", "(", "String", "endpoint", ")", "throws", "HttpRosetteAPIException", "{", "if", "(", "DOC_ENDPOINTS", ".", "contains", "(", "endpoint", ")", "||", "NAME_DEDUPLICATION_SERVICE_PATH", ".", "...
Gets the set of language and script codes supported by the specified Rosette API endpoint. @return SupportedLanguagesResponse @throws HttpRosetteAPIException for an error returned from the Rosette API.
[ "Gets", "the", "set", "of", "language", "and", "script", "codes", "supported", "by", "the", "specified", "Rosette", "API", "endpoint", "." ]
train
https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L240-L247
killbill/killbill
util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java
InternalCallContextFactory.createInternalTenantContextWithoutAccountRecordId
public InternalTenantContext createInternalTenantContextWithoutAccountRecordId(final TenantContext context) { // If tenant id is null, this will default to the default tenant record id (multi-tenancy disabled) final Long tenantRecordId = getTenantRecordIdSafe(context); return createInternalTenantContext(tenantRecordId, null); }
java
public InternalTenantContext createInternalTenantContextWithoutAccountRecordId(final TenantContext context) { // If tenant id is null, this will default to the default tenant record id (multi-tenancy disabled) final Long tenantRecordId = getTenantRecordIdSafe(context); return createInternalTenantContext(tenantRecordId, null); }
[ "public", "InternalTenantContext", "createInternalTenantContextWithoutAccountRecordId", "(", "final", "TenantContext", "context", ")", "{", "// If tenant id is null, this will default to the default tenant record id (multi-tenancy disabled)", "final", "Long", "tenantRecordId", "=", "getT...
Create an internal tenant callcontext from a tenant callcontext <p/> This is used for r/o operations - we don't need the account id in that case. You should almost never use that one, you always want to populate the accountRecordId @param context tenant callcontext (tenantId can be null only if multi-tenancy is disabled) @return internal tenant callcontext
[ "Create", "an", "internal", "tenant", "callcontext", "from", "a", "tenant", "callcontext", "<p", "/", ">", "This", "is", "used", "for", "r", "/", "o", "operations", "-", "we", "don", "t", "need", "the", "account", "id", "in", "that", "case", ".", "You"...
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java#L114-L118
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/util/Util.java
Util.findScrollBar
public static ScrollBar findScrollBar(Parent parent, Orientation orientation) { for (Node node : parent.getChildrenUnmodifiable()) { if (node instanceof ScrollBar) { ScrollBar b = (ScrollBar) node; if (b.getOrientation().equals(orientation)) { return b; } } if (node instanceof Parent) { ScrollBar b = findScrollBar((Parent) node, orientation); if (b != null) { return b; } } } return null; }
java
public static ScrollBar findScrollBar(Parent parent, Orientation orientation) { for (Node node : parent.getChildrenUnmodifiable()) { if (node instanceof ScrollBar) { ScrollBar b = (ScrollBar) node; if (b.getOrientation().equals(orientation)) { return b; } } if (node instanceof Parent) { ScrollBar b = findScrollBar((Parent) node, orientation); if (b != null) { return b; } } } return null; }
[ "public", "static", "ScrollBar", "findScrollBar", "(", "Parent", "parent", ",", "Orientation", "orientation", ")", "{", "for", "(", "Node", "node", ":", "parent", ".", "getChildrenUnmodifiable", "(", ")", ")", "{", "if", "(", "node", "instanceof", "ScrollBar",...
Searches for a {@link ScrollBar} of the given orientation (vertical, horizontal) somewhere in the containment hierarchy of the given parent node. @param parent the parent node @param orientation the orientation (horizontal, vertical) @return a scrollbar or null if none can be found
[ "Searches", "for", "a", "{", "@link", "ScrollBar", "}", "of", "the", "given", "orientation", "(", "vertical", "horizontal", ")", "somewhere", "in", "the", "containment", "hierarchy", "of", "the", "given", "parent", "node", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/util/Util.java#L240-L258
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Collectors.java
Collectors.toSet
@NotNull public static <T> Collector<T, ?, Set<T>> toSet() { return new CollectorsImpl<T, Set<T>, Set<T>>( new Supplier<Set<T>>() { @NotNull @Override public Set<T> get() { return new HashSet<T>(); } }, new BiConsumer<Set<T>, T>() { @Override public void accept(@NotNull Set<T> set, T t) { set.add(t); } } ); }
java
@NotNull public static <T> Collector<T, ?, Set<T>> toSet() { return new CollectorsImpl<T, Set<T>, Set<T>>( new Supplier<Set<T>>() { @NotNull @Override public Set<T> get() { return new HashSet<T>(); } }, new BiConsumer<Set<T>, T>() { @Override public void accept(@NotNull Set<T> set, T t) { set.add(t); } } ); }
[ "@", "NotNull", "public", "static", "<", "T", ">", "Collector", "<", "T", ",", "?", ",", "Set", "<", "T", ">", ">", "toSet", "(", ")", "{", "return", "new", "CollectorsImpl", "<", "T", ",", "Set", "<", "T", ">", ",", "Set", "<", "T", ">", ">"...
Returns a {@code Collector} that fills new {@code Set} with input elements. @param <T> the type of the input elements @return a {@code Collector}
[ "Returns", "a", "{", "@code", "Collector", "}", "that", "fills", "new", "{", "@code", "Set", "}", "with", "input", "elements", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L122-L141
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java
MapComposedElement.addPoint
public final int addPoint(Point2D<?, ?> point, int indexGroup) { return addPoint(point.getX(), point.getY(), indexGroup); }
java
public final int addPoint(Point2D<?, ?> point, int indexGroup) { return addPoint(point.getX(), point.getY(), indexGroup); }
[ "public", "final", "int", "addPoint", "(", "Point2D", "<", "?", ",", "?", ">", "point", ",", "int", "indexGroup", ")", "{", "return", "addPoint", "(", "point", ".", "getX", "(", ")", ",", "point", ".", "getY", "(", ")", ",", "indexGroup", ")", ";",...
Add the specified point at the end of the specified group. @param point the new point. @param indexGroup the index of the group. @return the index of the point in the element. @throws IndexOutOfBoundsException in case of error.
[ "Add", "the", "specified", "point", "at", "the", "end", "of", "the", "specified", "group", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L592-L594
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Console.java
Console.error
public static void error(Throwable t, String template, Object... values) { err.println(StrUtil.format(template, values)); if (null != t) { t.printStackTrace(err); err.flush(); } }
java
public static void error(Throwable t, String template, Object... values) { err.println(StrUtil.format(template, values)); if (null != t) { t.printStackTrace(err); err.flush(); } }
[ "public", "static", "void", "error", "(", "Throwable", "t", ",", "String", "template", ",", "Object", "...", "values", ")", "{", "err", ".", "println", "(", "StrUtil", ".", "format", "(", "template", ",", "values", ")", ")", ";", "if", "(", "null", "...
同 System.err.println()方法,打印控制台日志 @param t 异常对象 @param template 文本模板,被替换的部分用 {} 表示 @param values 值
[ "同", "System", ".", "err", ".", "println", "()", "方法,打印控制台日志" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Console.java#L154-L160
GerdHolz/TOVAL
src/de/invation/code/toval/misc/valuegeneration/StochasticValueGenerator.java
StochasticValueGenerator.addProbability
public boolean addProbability(E o, Double p) throws InconsistencyException, ParameterException { if(isValid()) return false; Validate.probability(p); if(keys.isEmpty()){ keys.add(o); limits.add(p); } else { if((getSum() + p) > 1.0+tolerance){ throw new InconsistencyException("Probabilities must sum up to 1 ("+(getSum() + p)+" instead)."); } keys.add(o); limits.add(getSum() + p); } isValid = (1.0-getSum()) <= tolerance; probabilities.put(o, p); return true; }
java
public boolean addProbability(E o, Double p) throws InconsistencyException, ParameterException { if(isValid()) return false; Validate.probability(p); if(keys.isEmpty()){ keys.add(o); limits.add(p); } else { if((getSum() + p) > 1.0+tolerance){ throw new InconsistencyException("Probabilities must sum up to 1 ("+(getSum() + p)+" instead)."); } keys.add(o); limits.add(getSum() + p); } isValid = (1.0-getSum()) <= tolerance; probabilities.put(o, p); return true; }
[ "public", "boolean", "addProbability", "(", "E", "o", ",", "Double", "p", ")", "throws", "InconsistencyException", ",", "ParameterException", "{", "if", "(", "isValid", "(", ")", ")", "return", "false", ";", "Validate", ".", "probability", "(", "p", ")", "...
Adds a new element together with its occurrence probability.<br> The method checks and sets the validity state of the chooser. Once valid, no more probabilities are accepted. @param o Element to add. @param p Occurrence probability of the given element. @throws InconsistencyException Thrown if the sum of all maintained probabilities is greater than 1.
[ "Adds", "a", "new", "element", "together", "with", "its", "occurrence", "probability", ".", "<br", ">", "The", "method", "checks", "and", "sets", "the", "validity", "state", "of", "the", "chooser", ".", "Once", "valid", "no", "more", "probabilities", "are", ...
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/valuegeneration/StochasticValueGenerator.java#L75-L94
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.tryGetJsiiAnnotation
static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); } if (ann.length == 0) { return null; } return ann[0]; }
java
static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); } if (ann.length == 0) { return null; } return ann[0]; }
[ "static", "Jsii", "tryGetJsiiAnnotation", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "boolean", "inherited", ")", "{", "Jsii", "[", "]", "ann", ";", "if", "(", "inherited", ")", "{", "ann", "=", "(", "Jsii", "[", "]", ")", "type", ...
Attempts to find the @Jsii annotation from a type. @param type The type. @param inherited If 'true' will look for the annotation up the class hierarchy. @return The annotation or null.
[ "Attempts", "to", "find", "the" ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L532-L546
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java
JBlinkLabel.getTableCellRendererComponent
public java.awt.Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (m_table == null) { // Cache this for later. m_table = table; // The following code is here because the column of this component is sometimes different from the column in the model: TableColumnModel columnModel = table.getColumnModel(); for (int iColumn = 0; iColumn < columnModel.getColumnCount(); iColumn++) { TableColumn tableColumn = columnModel.getColumn(iColumn); TableCellRenderer renderer = tableColumn.getCellRenderer(); if (renderer == this) m_iThisColumn = column; } } m_iThisRow = row; ImageIcon icon = this.getImageIcon(value); this.setIcon(icon); return this; }
java
public java.awt.Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (m_table == null) { // Cache this for later. m_table = table; // The following code is here because the column of this component is sometimes different from the column in the model: TableColumnModel columnModel = table.getColumnModel(); for (int iColumn = 0; iColumn < columnModel.getColumnCount(); iColumn++) { TableColumn tableColumn = columnModel.getColumn(iColumn); TableCellRenderer renderer = tableColumn.getCellRenderer(); if (renderer == this) m_iThisColumn = column; } } m_iThisRow = row; ImageIcon icon = this.getImageIcon(value); this.setIcon(icon); return this; }
[ "public", "java", ".", "awt", ".", "Component", "getTableCellRendererComponent", "(", "JTable", "table", ",", "Object", "value", ",", "boolean", "isSelected", ",", "boolean", "hasFocus", ",", "int", "row", ",", "int", "column", ")", "{", "if", "(", "m_table"...
If this control is in a JTable, this is how to render it. @param table The table this component is in. @param value The value of this cell. @param isSelected True if selected. @param hasFocus True if focused. @param row The table row. @param column The table column. @return This component (after updating for blink).
[ "If", "this", "control", "is", "in", "a", "JTable", "this", "is", "how", "to", "render", "it", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java#L128-L147
matthewhorridge/owlexplanation
src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java
LaconicExplanationGeneratorBasedOnOPlus.getExplanations
public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment) throws ExplanationException { return getExplanations(entailment, Integer.MAX_VALUE); }
java
public Set<Explanation<OWLAxiom>> getExplanations(OWLAxiom entailment) throws ExplanationException { return getExplanations(entailment, Integer.MAX_VALUE); }
[ "public", "Set", "<", "Explanation", "<", "OWLAxiom", ">", ">", "getExplanations", "(", "OWLAxiom", "entailment", ")", "throws", "ExplanationException", "{", "return", "getExplanations", "(", "entailment", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Gets explanations for an entailment. All explanations for the entailment will be returned. @param entailment The entailment for which explanations will be generated. @return A set containing all of the explanations. The set will be empty if the entailment does not hold. @throws org.semanticweb.owl.explanation.api.ExplanationException if there was a problem generating the explanation.
[ "Gets", "explanations", "for", "an", "entailment", ".", "All", "explanations", "for", "the", "entailment", "will", "be", "returned", "." ]
train
https://github.com/matthewhorridge/owlexplanation/blob/439c5ca67835f5e421adde725e4e8a3bcd760ac8/src/main/java/org/semanticweb/owl/explanation/impl/laconic/LaconicExplanationGeneratorBasedOnOPlus.java#L47-L49
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/FrameworkManager.java
FrameworkManager.registerLibertyProcessService
private void registerLibertyProcessService(BundleContext systemBundleCtx, BootstrapConfig config) { List<String> cmds = config.getCmdArgs(); if (cmds == null) cmds = new ArrayList<String>(); LibertyProcessImpl processImpl = new LibertyProcessImpl(cmds, this); systemBundleCtx.registerService(LibertyProcess.class.getName(), processImpl, processImpl.getServiceProps()); }
java
private void registerLibertyProcessService(BundleContext systemBundleCtx, BootstrapConfig config) { List<String> cmds = config.getCmdArgs(); if (cmds == null) cmds = new ArrayList<String>(); LibertyProcessImpl processImpl = new LibertyProcessImpl(cmds, this); systemBundleCtx.registerService(LibertyProcess.class.getName(), processImpl, processImpl.getServiceProps()); }
[ "private", "void", "registerLibertyProcessService", "(", "BundleContext", "systemBundleCtx", ",", "BootstrapConfig", "config", ")", "{", "List", "<", "String", ">", "cmds", "=", "config", ".", "getCmdArgs", "(", ")", ";", "if", "(", "cmds", "==", "null", ")", ...
Register the command line service with the OSGi framework service registry. This gives service consumers access to the command line used to launch the platform/runtime. @param systemBundleCtx The framework system bundle context @param config The active bootstrap config
[ "Register", "the", "command", "line", "service", "with", "the", "OSGi", "framework", "service", "registry", ".", "This", "gives", "service", "consumers", "access", "to", "the", "command", "line", "used", "to", "launch", "the", "platform", "/", "runtime", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/FrameworkManager.java#L472-L479
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java
IPAddress.toNormalizedString
public static void toNormalizedString(IPAddressValueProvider provider, StringBuilder builder) { IPVersion version = provider.getIPVersion(); if(version.isIPv4()) { toNormalizedString(IPv4Address.defaultIpv4Network().getPrefixConfiguration(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength(), IPv4Address.SEGMENT_COUNT, IPv4Address.BYTES_PER_SEGMENT, IPv4Address.BITS_PER_SEGMENT, IPv4Address.MAX_VALUE_PER_SEGMENT, IPv4Address.SEGMENT_SEPARATOR, IPv4Address.DEFAULT_TEXTUAL_RADIX, null, builder); } else if(version.isIPv6()) { toNormalizedString(IPv4Address.defaultIpv6Network().getPrefixConfiguration(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength(), IPv6Address.SEGMENT_COUNT, IPv6Address.BYTES_PER_SEGMENT, IPv6Address.BITS_PER_SEGMENT, IPv6Address.MAX_VALUE_PER_SEGMENT, IPv6Address.SEGMENT_SEPARATOR, IPv6Address.DEFAULT_TEXTUAL_RADIX, provider.getZone(), builder); } else { throw new IllegalArgumentException(); } }
java
public static void toNormalizedString(IPAddressValueProvider provider, StringBuilder builder) { IPVersion version = provider.getIPVersion(); if(version.isIPv4()) { toNormalizedString(IPv4Address.defaultIpv4Network().getPrefixConfiguration(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength(), IPv4Address.SEGMENT_COUNT, IPv4Address.BYTES_PER_SEGMENT, IPv4Address.BITS_PER_SEGMENT, IPv4Address.MAX_VALUE_PER_SEGMENT, IPv4Address.SEGMENT_SEPARATOR, IPv4Address.DEFAULT_TEXTUAL_RADIX, null, builder); } else if(version.isIPv6()) { toNormalizedString(IPv4Address.defaultIpv6Network().getPrefixConfiguration(), provider.getValues(), provider.getUpperValues(), provider.getPrefixLength(), IPv6Address.SEGMENT_COUNT, IPv6Address.BYTES_PER_SEGMENT, IPv6Address.BITS_PER_SEGMENT, IPv6Address.MAX_VALUE_PER_SEGMENT, IPv6Address.SEGMENT_SEPARATOR, IPv6Address.DEFAULT_TEXTUAL_RADIX, provider.getZone(), builder); } else { throw new IllegalArgumentException(); } }
[ "public", "static", "void", "toNormalizedString", "(", "IPAddressValueProvider", "provider", ",", "StringBuilder", "builder", ")", "{", "IPVersion", "version", "=", "provider", ".", "getIPVersion", "(", ")", ";", "if", "(", "version", ".", "isIPv4", "(", ")", ...
Allows for the creation of a normalized string without creating a full IP address object first. Instead you can implement the {@link IPAddressValueProvider} interface in whatever way is most efficient. The string is appended to the provided {@link StringBuilder} instance. @param provider @param builder
[ "Allows", "for", "the", "creation", "of", "a", "normalized", "string", "without", "creating", "a", "full", "IP", "address", "object", "first", ".", "Instead", "you", "can", "implement", "the", "{", "@link", "IPAddressValueProvider", "}", "interface", "in", "wh...
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java#L606-L615
sarl/sarl
main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/SREutils.java
SREutils.getSreSpecificData
@Pure public static <S> S getSreSpecificData(SRESpecificDataContainer container, Class<S> type) { assert container != null; return container.$getSreSpecificData(type); }
java
@Pure public static <S> S getSreSpecificData(SRESpecificDataContainer container, Class<S> type) { assert container != null; return container.$getSreSpecificData(type); }
[ "@", "Pure", "public", "static", "<", "S", ">", "S", "getSreSpecificData", "(", "SRESpecificDataContainer", "container", ",", "Class", "<", "S", ">", "type", ")", "{", "assert", "container", "!=", "null", ";", "return", "container", ".", "$", "getSreSpecific...
Replies the data associated to the container by the SRE. @param <S> the type of the data. @param type the type of the data. @param container the container. @return the SRE-specific data.
[ "Replies", "the", "data", "associated", "to", "the", "container", "by", "the", "SRE", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/SREutils.java#L69-L73
roboconf/roboconf-platform
core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2IaasHandler.java
Ec2IaasHandler.parseProperties
static void parseProperties( Map<String, String> targetProperties ) throws TargetException { // Quick check String[] properties = { Ec2Constants.EC2_ENDPOINT, Ec2Constants.EC2_ACCESS_KEY, Ec2Constants.EC2_SECRET_KEY, Ec2Constants.AMI_VM_NODE, Ec2Constants.VM_INSTANCE_TYPE, Ec2Constants.SSH_KEY_NAME, Ec2Constants.SECURITY_GROUP_NAME }; for( String property : properties ) { if( StringUtils.isBlank( targetProperties.get( property ))) throw new TargetException( "The value for " + property + " cannot be null or empty." ); } }
java
static void parseProperties( Map<String, String> targetProperties ) throws TargetException { // Quick check String[] properties = { Ec2Constants.EC2_ENDPOINT, Ec2Constants.EC2_ACCESS_KEY, Ec2Constants.EC2_SECRET_KEY, Ec2Constants.AMI_VM_NODE, Ec2Constants.VM_INSTANCE_TYPE, Ec2Constants.SSH_KEY_NAME, Ec2Constants.SECURITY_GROUP_NAME }; for( String property : properties ) { if( StringUtils.isBlank( targetProperties.get( property ))) throw new TargetException( "The value for " + property + " cannot be null or empty." ); } }
[ "static", "void", "parseProperties", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ")", "throws", "TargetException", "{", "// Quick check", "String", "[", "]", "properties", "=", "{", "Ec2Constants", ".", "EC2_ENDPOINT", ",", "Ec2Constants", ...
Parses the properties and saves them in a Java bean. @param targetProperties the IaaS properties @throws TargetException
[ "Parses", "the", "properties", "and", "saves", "them", "in", "a", "Java", "bean", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2IaasHandler.java#L242-L259
restfb/restfb
src/main/java/com/restfb/util/ObjectUtil.java
ObjectUtil.requireNotEmpty
public static String requireNotEmpty(String obj, String errorText) { if (isBlank(obj)) { throw new IllegalArgumentException(errorText); } return obj; }
java
public static String requireNotEmpty(String obj, String errorText) { if (isBlank(obj)) { throw new IllegalArgumentException(errorText); } return obj; }
[ "public", "static", "String", "requireNotEmpty", "(", "String", "obj", ",", "String", "errorText", ")", "{", "if", "(", "isBlank", "(", "obj", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "errorText", ")", ";", "}", "return", "obj", ";",...
Ensures that {@code obj} isn't {@code null} or an empty string. @param obj The parameter to check. @param errorText The exception message. @throws IllegalArgumentException If {@code obj} is {@code null} or an empty string.
[ "Ensures", "that", "{", "@code", "obj", "}", "isn", "t", "{", "@code", "null", "}", "or", "an", "empty", "string", "." ]
train
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/ObjectUtil.java#L45-L50
treelogic-swe/aws-mock
src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java
MockEC2QueryHandler.isVolumeIdExists
private boolean isVolumeIdExists(final List<String> volumeIds, final String volumeId) { if (volumeIds != null && volumeIds.size() > 0) { for (String volId : volumeIds) { if (volId.equals(volumeId)) { return true; } } } return false; }
java
private boolean isVolumeIdExists(final List<String> volumeIds, final String volumeId) { if (volumeIds != null && volumeIds.size() > 0) { for (String volId : volumeIds) { if (volId.equals(volumeId)) { return true; } } } return false; }
[ "private", "boolean", "isVolumeIdExists", "(", "final", "List", "<", "String", ">", "volumeIds", ",", "final", "String", "volumeId", ")", "{", "if", "(", "volumeIds", "!=", "null", "&&", "volumeIds", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(...
Check whether volumeId exists in list. @param volumeIds List of volume Ids. @param volumeId to check in the list. @return true if volumeId is valid.
[ "Check", "whether", "volumeId", "exists", "in", "list", "." ]
train
https://github.com/treelogic-swe/aws-mock/blob/1d1058c0ebbd0615efa28695481e36ae3ffc58a0/src/main/java/com/tlswe/awsmock/ec2/control/MockEC2QueryHandler.java#L1730-L1740
alkacon/opencms-core
src/org/opencms/relations/CmsCategoryService.java
CmsCategoryService.readCategory
public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException { // iterate all possible category repositories, starting with the most global one Iterator<String> it = getCategoryRepositories(cms, referencePath).iterator(); while (it.hasNext()) { String repository = it.next(); try { return getCategory(cms, internalCategoryRootPath(repository, categoryPath)); } catch (CmsVfsResourceNotFoundException e) { // throw the exception if no repository left if (!it.hasNext()) { throw e; } } } // this will never be executed return null; }
java
public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException { // iterate all possible category repositories, starting with the most global one Iterator<String> it = getCategoryRepositories(cms, referencePath).iterator(); while (it.hasNext()) { String repository = it.next(); try { return getCategory(cms, internalCategoryRootPath(repository, categoryPath)); } catch (CmsVfsResourceNotFoundException e) { // throw the exception if no repository left if (!it.hasNext()) { throw e; } } } // this will never be executed return null; }
[ "public", "CmsCategory", "readCategory", "(", "CmsObject", "cms", ",", "String", "categoryPath", ",", "String", "referencePath", ")", "throws", "CmsException", "{", "// iterate all possible category repositories, starting with the most global one", "Iterator", "<", "String", ...
Reads all categories identified by the given category path for the given reference path.<p> @param cms the current cms context @param categoryPath the path of the category to read @param referencePath the reference path to find all the category repositories @return a list of matching categories, could also be empty, if no category exists with the given path @throws CmsException if something goes wrong
[ "Reads", "all", "categories", "identified", "by", "the", "given", "category", "path", "for", "the", "given", "reference", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L552-L569
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.initTextBox
public static TextBox initTextBox (TextBox box, String text, int maxLength, int visibleLength) { if (text != null) { box.setText(text); } box.setMaxLength(maxLength > 0 ? maxLength : 255); if (visibleLength > 0) { box.setVisibleLength(visibleLength); } return box; }
java
public static TextBox initTextBox (TextBox box, String text, int maxLength, int visibleLength) { if (text != null) { box.setText(text); } box.setMaxLength(maxLength > 0 ? maxLength : 255); if (visibleLength > 0) { box.setVisibleLength(visibleLength); } return box; }
[ "public", "static", "TextBox", "initTextBox", "(", "TextBox", "box", ",", "String", "text", ",", "int", "maxLength", ",", "int", "visibleLength", ")", "{", "if", "(", "text", "!=", "null", ")", "{", "box", ".", "setText", "(", "text", ")", ";", "}", ...
Configures a text box with all of the configuration that you're bound to want to do. This is useful for configuring a PasswordTextBox.
[ "Configures", "a", "text", "box", "with", "all", "of", "the", "configuration", "that", "you", "re", "bound", "to", "want", "to", "do", ".", "This", "is", "useful", "for", "configuring", "a", "PasswordTextBox", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L356-L366
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPropertyAdvanced.java
CmsPropertyAdvanced.actionDeleteResource
public void actionDeleteResource() throws JspException { if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // only delete resource if dialog mode is a wizard mode try { getCms().deleteResource(getParamResource(), CmsResource.DELETE_PRESERVE_SIBLINGS); } catch (Throwable e) { // error deleting the resource, show error dialog includeErrorpage(this, e); } } }
java
public void actionDeleteResource() throws JspException { if ((getParamDialogmode() != null) && getParamDialogmode().startsWith(MODE_WIZARD)) { // only delete resource if dialog mode is a wizard mode try { getCms().deleteResource(getParamResource(), CmsResource.DELETE_PRESERVE_SIBLINGS); } catch (Throwable e) { // error deleting the resource, show error dialog includeErrorpage(this, e); } } }
[ "public", "void", "actionDeleteResource", "(", ")", "throws", "JspException", "{", "if", "(", "(", "getParamDialogmode", "(", ")", "!=", "null", ")", "&&", "getParamDialogmode", "(", ")", ".", "startsWith", "(", "MODE_WIZARD", ")", ")", "{", "// only delete re...
Deletes the current resource if the dialog is in wizard mode.<p> If the dialog is not in wizard mode, the resource is not deleted.<p> @throws JspException if including the error page fails
[ "Deletes", "the", "current", "resource", "if", "the", "dialog", "is", "in", "wizard", "mode", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPropertyAdvanced.java#L354-L365
kiswanij/jk-util
src/main/java/com/jk/util/context/JKAbstractContext.java
JKAbstractContext.setApplicationMap
public void setApplicationMap(final Map<String, Object> applicationMap) { JKThreadLocal.setValue(JKContextConstants.APPLICATION_MAP, applicationMap); }
java
public void setApplicationMap(final Map<String, Object> applicationMap) { JKThreadLocal.setValue(JKContextConstants.APPLICATION_MAP, applicationMap); }
[ "public", "void", "setApplicationMap", "(", "final", "Map", "<", "String", ",", "Object", ">", "applicationMap", ")", "{", "JKThreadLocal", ".", "setValue", "(", "JKContextConstants", ".", "APPLICATION_MAP", ",", "applicationMap", ")", ";", "}" ]
Sets the application map. @param applicationMap the application map
[ "Sets", "the", "application", "map", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/context/JKAbstractContext.java#L145-L147
googleads/googleads-java-lib
modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java
DateTimes.toDateTime
public static DateTime toDateTime(Instant instant, String timeZoneId) { return dateTimesHelper.toDateTime(instant, timeZoneId); }
java
public static DateTime toDateTime(Instant instant, String timeZoneId) { return dateTimesHelper.toDateTime(instant, timeZoneId); }
[ "public", "static", "DateTime", "toDateTime", "(", "Instant", "instant", ",", "String", "timeZoneId", ")", "{", "return", "dateTimesHelper", ".", "toDateTime", "(", "instant", ",", "timeZoneId", ")", ";", "}" ]
Converts an {@code Instant} object to an API date time in the time zone supplied.
[ "Converts", "an", "{" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java#L39-L41
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java
FoxHttpClientBuilder.addFoxHttpAuthorization
public FoxHttpClientBuilder addFoxHttpAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) { foxHttpClient.getFoxHttpAuthorizationStrategy().addAuthorization(foxHttpAuthorizationScope, foxHttpAuthorization); return this; }
java
public FoxHttpClientBuilder addFoxHttpAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) { foxHttpClient.getFoxHttpAuthorizationStrategy().addAuthorization(foxHttpAuthorizationScope, foxHttpAuthorization); return this; }
[ "public", "FoxHttpClientBuilder", "addFoxHttpAuthorization", "(", "FoxHttpAuthorizationScope", "foxHttpAuthorizationScope", ",", "FoxHttpAuthorization", "foxHttpAuthorization", ")", "{", "foxHttpClient", ".", "getFoxHttpAuthorizationStrategy", "(", ")", ".", "addAuthorization", "...
Add a Authorization to the AuthorizationStrategy @param foxHttpAuthorizationScope Scope of the authorization @param foxHttpAuthorization Authorization itself @return FoxHttpClientBuilder (this)
[ "Add", "a", "Authorization", "to", "the", "AuthorizationStrategy" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java#L213-L216
threerings/narya
core/src/main/java/com/threerings/presents/dobj/DObject.java
DObject.requestEntryRemove
protected <T extends DSet.Entry> void requestEntryRemove ( String name, DSet<T> set, Comparable<?> key) { // if we're on the authoritative server, we update the set immediately T oldEntry = null; if (isAuthoritative()) { oldEntry = set.removeKey(key); if (oldEntry == null) { log.warning("Requested to remove non-element", "set", name, "key", key, new Exception()); } } // dispatch an entry removed event postEvent(new EntryRemovedEvent<T>(_oid, name, key).setOldEntry(oldEntry)); }
java
protected <T extends DSet.Entry> void requestEntryRemove ( String name, DSet<T> set, Comparable<?> key) { // if we're on the authoritative server, we update the set immediately T oldEntry = null; if (isAuthoritative()) { oldEntry = set.removeKey(key); if (oldEntry == null) { log.warning("Requested to remove non-element", "set", name, "key", key, new Exception()); } } // dispatch an entry removed event postEvent(new EntryRemovedEvent<T>(_oid, name, key).setOldEntry(oldEntry)); }
[ "protected", "<", "T", "extends", "DSet", ".", "Entry", ">", "void", "requestEntryRemove", "(", "String", "name", ",", "DSet", "<", "T", ">", "set", ",", "Comparable", "<", "?", ">", "key", ")", "{", "// if we're on the authoritative server, we update the set im...
Calls by derived instances when a set remover method was called.
[ "Calls", "by", "derived", "instances", "when", "a", "set", "remover", "method", "was", "called", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L904-L918
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java
GeometryUtil.translate2DCentreOfMassTo
public static void translate2DCentreOfMassTo(IAtomContainer atomCon, Point2d p) { Point2d com = get2DCentreOfMass(atomCon); Vector2d translation = new Vector2d(p.x - com.x, p.y - com.y); for (IAtom atom : atomCon.atoms()) { if (atom.getPoint2d() != null) { atom.getPoint2d().add(translation); } } }
java
public static void translate2DCentreOfMassTo(IAtomContainer atomCon, Point2d p) { Point2d com = get2DCentreOfMass(atomCon); Vector2d translation = new Vector2d(p.x - com.x, p.y - com.y); for (IAtom atom : atomCon.atoms()) { if (atom.getPoint2d() != null) { atom.getPoint2d().add(translation); } } }
[ "public", "static", "void", "translate2DCentreOfMassTo", "(", "IAtomContainer", "atomCon", ",", "Point2d", "p", ")", "{", "Point2d", "com", "=", "get2DCentreOfMass", "(", "atomCon", ")", ";", "Vector2d", "translation", "=", "new", "Vector2d", "(", "p", ".", "x...
Translates a molecule from the origin to a new point denoted by a vector. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param atomCon molecule to be translated @param p Description of the Parameter
[ "Translates", "a", "molecule", "from", "the", "origin", "to", "a", "new", "point", "denoted", "by", "a", "vector", ".", "See", "comment", "for", "center", "(", "IAtomContainer", "atomCon", "Dimension", "areaDim", "HashMap", "renderingCoordinates", ")", "for", ...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java#L387-L395
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.describeImage
public ImageDescription describeImage(String url, DescribeImageOptionalParameter describeImageOptionalParameter) { return describeImageWithServiceResponseAsync(url, describeImageOptionalParameter).toBlocking().single().body(); }
java
public ImageDescription describeImage(String url, DescribeImageOptionalParameter describeImageOptionalParameter) { return describeImageWithServiceResponseAsync(url, describeImageOptionalParameter).toBlocking().single().body(); }
[ "public", "ImageDescription", "describeImage", "(", "String", "url", ",", "DescribeImageOptionalParameter", "describeImageOptionalParameter", ")", "{", "return", "describeImageWithServiceResponseAsync", "(", "url", ",", "describeImageOptionalParameter", ")", ".", "toBlocking", ...
This operation generates a description of an image in human readable language with complete sentences. The description is based on a collection of content tags, which are also returned by the operation. More than one description can be generated for each image. Descriptions are ordered by their confidence score. All descriptions are in English. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL.A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param url Publicly reachable URL of an image @param describeImageOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ComputerVisionErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImageDescription object if successful.
[ "This", "operation", "generates", "a", "description", "of", "an", "image", "in", "human", "readable", "language", "with", "complete", "sentences", ".", "The", "description", "is", "based", "on", "a", "collection", "of", "content", "tags", "which", "are", "also...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1737-L1739
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.count
public static <T> int count(Iterable<T> iterable, Matcher<T> matcher) { int count = 0; if (null != iterable) { for (T t : iterable) { if (null == matcher || matcher.match(t)) { count++; } } } return count; }
java
public static <T> int count(Iterable<T> iterable, Matcher<T> matcher) { int count = 0; if (null != iterable) { for (T t : iterable) { if (null == matcher || matcher.match(t)) { count++; } } } return count; }
[ "public", "static", "<", "T", ">", "int", "count", "(", "Iterable", "<", "T", ">", "iterable", ",", "Matcher", "<", "T", ">", "matcher", ")", "{", "int", "count", "=", "0", ";", "if", "(", "null", "!=", "iterable", ")", "{", "for", "(", "T", "t...
集合中匹配规则的数量 @param <T> 集合元素类型 @param iterable {@link Iterable} @param matcher 匹配器,为空则全部匹配 @return 匹配数量
[ "集合中匹配规则的数量" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1301-L1311
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCircuitPeeringsInner.java
ExpressRouteCircuitPeeringsInner.getAsync
public Observable<ExpressRouteCircuitPeeringInner> getAsync(String resourceGroupName, String circuitName, String peeringName) { return getWithServiceResponseAsync(resourceGroupName, circuitName, peeringName).map(new Func1<ServiceResponse<ExpressRouteCircuitPeeringInner>, ExpressRouteCircuitPeeringInner>() { @Override public ExpressRouteCircuitPeeringInner call(ServiceResponse<ExpressRouteCircuitPeeringInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitPeeringInner> getAsync(String resourceGroupName, String circuitName, String peeringName) { return getWithServiceResponseAsync(resourceGroupName, circuitName, peeringName).map(new Func1<ServiceResponse<ExpressRouteCircuitPeeringInner>, ExpressRouteCircuitPeeringInner>() { @Override public ExpressRouteCircuitPeeringInner call(ServiceResponse<ExpressRouteCircuitPeeringInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitPeeringInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName"...
Gets the specified peering for the express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitPeeringInner object
[ "Gets", "the", "specified", "peering", "for", "the", "express", "route", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCircuitPeeringsInner.java#L297-L304
relayrides/pushy
pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java
BaseHttp2ServerBuilder.setServerCredentials
public BaseHttp2ServerBuilder setServerCredentials(final InputStream certificatePemInputStream, final InputStream privateKeyPkcs8InputStream, final String privateKeyPassword) { this.certificateChain = null; this.privateKey = null; this.certificateChainPemFile = null; this.privateKeyPkcs8File = null; this.certificateChainInputStream = certificatePemInputStream; this.privateKeyPkcs8InputStream = privateKeyPkcs8InputStream; this.privateKeyPassword = privateKeyPassword; return this; }
java
public BaseHttp2ServerBuilder setServerCredentials(final InputStream certificatePemInputStream, final InputStream privateKeyPkcs8InputStream, final String privateKeyPassword) { this.certificateChain = null; this.privateKey = null; this.certificateChainPemFile = null; this.privateKeyPkcs8File = null; this.certificateChainInputStream = certificatePemInputStream; this.privateKeyPkcs8InputStream = privateKeyPkcs8InputStream; this.privateKeyPassword = privateKeyPassword; return this; }
[ "public", "BaseHttp2ServerBuilder", "setServerCredentials", "(", "final", "InputStream", "certificatePemInputStream", ",", "final", "InputStream", "privateKeyPkcs8InputStream", ",", "final", "String", "privateKeyPassword", ")", "{", "this", ".", "certificateChain", "=", "nu...
<p>Sets the credentials for the server under construction using the certificates in the given PEM input stream and the private key in the given PKCS#8 input stream.</p> @param certificatePemInputStream a PEM input stream containing the certificate chain for the server under construction @param privateKeyPkcs8InputStream a PKCS#8 input stream containing the private key for the server under construction @param privateKeyPassword the password for the given private key, or {@code null} if the key is not password-protected @return a reference to this builder @since 0.8
[ "<p", ">", "Sets", "the", "credentials", "for", "the", "server", "under", "construction", "using", "the", "certificates", "in", "the", "given", "PEM", "input", "stream", "and", "the", "private", "key", "in", "the", "given", "PKCS#8", "input", "stream", ".", ...
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java#L112-L125
h2oai/h2o-2
src/main/java/hex/gbm/DTreeUtils.java
DTreeUtils.scoreTree
public static void scoreTree(double data[], float preds[], CompressedTree[] ts) { for( int c=0; c<ts.length; c++ ) if( ts[c] != null ) preds[ts.length==1?0:c+1] += ts[c].score(data); }
java
public static void scoreTree(double data[], float preds[], CompressedTree[] ts) { for( int c=0; c<ts.length; c++ ) if( ts[c] != null ) preds[ts.length==1?0:c+1] += ts[c].score(data); }
[ "public", "static", "void", "scoreTree", "(", "double", "data", "[", "]", ",", "float", "preds", "[", "]", ",", "CompressedTree", "[", "]", "ts", ")", "{", "for", "(", "int", "c", "=", "0", ";", "c", "<", "ts", ".", "length", ";", "c", "++", ")...
Score given tree on the row of data. @param data row of data @param preds array to hold resulting prediction @param ts a tree representation (single regression tree, or multi tree)
[ "Score", "given", "tree", "on", "the", "row", "of", "data", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/gbm/DTreeUtils.java#L15-L19
pwall567/jsonutil
src/main/java/net/pwall/json/JSONObject.java
JSONObject.putValue
public JSONObject putValue(String key, float value) { put(key, JSONFloat.valueOf(value)); return this; }
java
public JSONObject putValue(String key, float value) { put(key, JSONFloat.valueOf(value)); return this; }
[ "public", "JSONObject", "putValue", "(", "String", "key", ",", "float", "value", ")", "{", "put", "(", "key", ",", "JSONFloat", ".", "valueOf", "(", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add a {@link JSONFloat} representing the supplied {@code float} to the {@code JSONObject}. @param key the key to use when storing the value @param value the value @return {@code this} (for chaining) @throws NullPointerException if key is {@code null}
[ "Add", "a", "{", "@link", "JSONFloat", "}", "representing", "the", "supplied", "{", "@code", "float", "}", "to", "the", "{", "@code", "JSONObject", "}", "." ]
train
https://github.com/pwall567/jsonutil/blob/dd5960b9b0bcc9acfe6c52b884fffd9ee5f422fe/src/main/java/net/pwall/json/JSONObject.java#L144-L147
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java
KMLWriterDriver.writeSimpleField
private void writeSimpleField(XMLStreamWriter xmlOut, String columnName, String columnType) throws XMLStreamException { xmlOut.writeStartElement("SimpleField"); xmlOut.writeAttribute("name", columnName); xmlOut.writeAttribute("type", columnType); xmlOut.writeEndElement();//Write schema }
java
private void writeSimpleField(XMLStreamWriter xmlOut, String columnName, String columnType) throws XMLStreamException { xmlOut.writeStartElement("SimpleField"); xmlOut.writeAttribute("name", columnName); xmlOut.writeAttribute("type", columnType); xmlOut.writeEndElement();//Write schema }
[ "private", "void", "writeSimpleField", "(", "XMLStreamWriter", "xmlOut", ",", "String", "columnName", ",", "String", "columnType", ")", "throws", "XMLStreamException", "{", "xmlOut", ".", "writeStartElement", "(", "\"SimpleField\"", ")", ";", "xmlOut", ".", "writeAt...
The declaration of the custom field, which must specify both the type and the name of this field. If either the type or the name is omitted, the field is ignored. The type can be one of the following : string, int, uint, short, ushort, float, double, bool. Syntax : <SimpleField type="string" name="string"> @param xmlOut @param columnName @param columnType @throws XMLStreamException
[ "The", "declaration", "of", "the", "custom", "field", "which", "must", "specify", "both", "the", "type", "and", "the", "name", "of", "this", "field", ".", "If", "either", "the", "type", "or", "the", "name", "is", "omitted", "the", "field", "is", "ignored...
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWriterDriver.java#L257-L262
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/ServerRedirectService.java
ServerRedirectService.setGroupName
public void setGroupName(String name, int id) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SERVER_GROUPS + " SET " + Constants.GENERIC_NAME + " = ?" + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, name); statement.setInt(2, id); statement.executeUpdate(); statement.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void setGroupName(String name, int id) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SERVER_GROUPS + " SET " + Constants.GENERIC_NAME + " = ?" + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, name); statement.setInt(2, id); statement.executeUpdate(); statement.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "setGroupName", "(", "String", "name", ",", "int", "id", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection", "(", ")", ")", "{", "statement", "=",...
Set the group name @param name new name of server group @param id ID of group
[ "Set", "the", "group", "name" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/ServerRedirectService.java#L413-L436
revapi/revapi
revapi/src/main/java/org/revapi/Revapi.java
Revapi.analyze
@SuppressWarnings("unchecked") public AnalysisResult analyze(@Nonnull AnalysisContext analysisContext) { TIMING_LOG.debug("Analysis starts"); AnalysisResult.Extensions extensions = prepareAnalysis(analysisContext); if (extensions.getAnalyzers().isEmpty()) { throw new IllegalArgumentException("At least one analyzer needs to be present. Make sure there is at" + " least one on the classpath and that the extension filters do not exclude all of them."); } StreamSupport.stream(extensions.spliterator(), false) .map(e -> (Map.Entry<ExtensionInstance<? extends Configurable>, AnalysisContext>) (Map.Entry) e) .forEach(e -> e.getKey().getInstance().initialize(e.getValue())); AnalysisProgress progress = new AnalysisProgress(extensions, pipelineConfiguration); TIMING_LOG.debug("Initialization complete."); matchingTransformsCache.clear(); Exception error = null; try { for (ExtensionInstance<ApiAnalyzer> ia : extensions.getAnalyzers().keySet()) { analyzeWith(ia.getInstance(), analysisContext.getOldApi(), analysisContext.getNewApi(), progress); } } catch (Exception t) { error = t; } return new AnalysisResult(error, extensions); }
java
@SuppressWarnings("unchecked") public AnalysisResult analyze(@Nonnull AnalysisContext analysisContext) { TIMING_LOG.debug("Analysis starts"); AnalysisResult.Extensions extensions = prepareAnalysis(analysisContext); if (extensions.getAnalyzers().isEmpty()) { throw new IllegalArgumentException("At least one analyzer needs to be present. Make sure there is at" + " least one on the classpath and that the extension filters do not exclude all of them."); } StreamSupport.stream(extensions.spliterator(), false) .map(e -> (Map.Entry<ExtensionInstance<? extends Configurable>, AnalysisContext>) (Map.Entry) e) .forEach(e -> e.getKey().getInstance().initialize(e.getValue())); AnalysisProgress progress = new AnalysisProgress(extensions, pipelineConfiguration); TIMING_LOG.debug("Initialization complete."); matchingTransformsCache.clear(); Exception error = null; try { for (ExtensionInstance<ApiAnalyzer> ia : extensions.getAnalyzers().keySet()) { analyzeWith(ia.getInstance(), analysisContext.getOldApi(), analysisContext.getNewApi(), progress); } } catch (Exception t) { error = t; } return new AnalysisResult(error, extensions); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "AnalysisResult", "analyze", "(", "@", "Nonnull", "AnalysisContext", "analysisContext", ")", "{", "TIMING_LOG", ".", "debug", "(", "\"Analysis starts\"", ")", ";", "AnalysisResult", ".", "Extensions", "ex...
Performs the analysis configured by the given analysis context. <p> Make sure to call the {@link AnalysisResult#close()} method (or perform the analysis in try-with-resources block). @param analysisContext describes the analysis to be performed @return a result object that has to be closed for the analysis to conclude
[ "Performs", "the", "analysis", "configured", "by", "the", "given", "analysis", "context", ".", "<p", ">", "Make", "sure", "to", "call", "the", "{", "@link", "AnalysisResult#close", "()", "}", "method", "(", "or", "perform", "the", "analysis", "in", "try", ...
train
https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/Revapi.java#L138-L169
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java
WikipediaInfo.getOverlapping
public void getOverlapping(Wikipedia pWiki, CategoryGraph catGraph) throws WikiApiException { double startTime = System.currentTimeMillis(); int articlesWithOverlappingCategories = getArticlesWithOverlappingCategories(pWiki, catGraph); double overlappingCategoriesRatio = (double) articlesWithOverlappingCategories / (double) pWiki.getMetaData().getNumberOfPages(); logger.info(articlesWithOverlappingCategories + " - " + pWiki.getMetaData().getNumberOfPages() + " - " + overlappingCategoriesRatio); double endTime = (System.currentTimeMillis() - startTime) / 1000.0; logger.debug("{} ms", endTime); }
java
public void getOverlapping(Wikipedia pWiki, CategoryGraph catGraph) throws WikiApiException { double startTime = System.currentTimeMillis(); int articlesWithOverlappingCategories = getArticlesWithOverlappingCategories(pWiki, catGraph); double overlappingCategoriesRatio = (double) articlesWithOverlappingCategories / (double) pWiki.getMetaData().getNumberOfPages(); logger.info(articlesWithOverlappingCategories + " - " + pWiki.getMetaData().getNumberOfPages() + " - " + overlappingCategoriesRatio); double endTime = (System.currentTimeMillis() - startTime) / 1000.0; logger.debug("{} ms", endTime); }
[ "public", "void", "getOverlapping", "(", "Wikipedia", "pWiki", ",", "CategoryGraph", "catGraph", ")", "throws", "WikiApiException", "{", "double", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "int", "articlesWithOverlappingCategories", "=", "...
Articles in wikipedia may be tagged with multiple categories. It may be interesting to know how many articles have at least one category in common. Such articles would have a very high semantic relatedness even if they share a quite secondary category. @param pWiki The wikipedia object. @param catGraph The category graph. @throws WikiApiException
[ "Articles", "in", "wikipedia", "may", "be", "tagged", "with", "multiple", "categories", ".", "It", "may", "be", "interesting", "to", "know", "how", "many", "articles", "have", "at", "least", "one", "category", "in", "common", ".", "Such", "articles", "would"...
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/WikipediaInfo.java#L195-L204
Netflix/conductor
mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/Query.java
Query.executeScalarList
public <V> List<V> executeScalarList(Class<V> returnType) { try (ResultSet rs = executeQuery()) { List<V> values = new ArrayList<>(); while (rs.next()) { values.add(getScalarFromResultSet(rs, returnType)); } return values; } catch (SQLException ex) { throw new ApplicationException(Code.BACKEND_ERROR, ex); } }
java
public <V> List<V> executeScalarList(Class<V> returnType) { try (ResultSet rs = executeQuery()) { List<V> values = new ArrayList<>(); while (rs.next()) { values.add(getScalarFromResultSet(rs, returnType)); } return values; } catch (SQLException ex) { throw new ApplicationException(Code.BACKEND_ERROR, ex); } }
[ "public", "<", "V", ">", "List", "<", "V", ">", "executeScalarList", "(", "Class", "<", "V", ">", "returnType", ")", "{", "try", "(", "ResultSet", "rs", "=", "executeQuery", "(", ")", ")", "{", "List", "<", "V", ">", "values", "=", "new", "ArrayLis...
Execute the PreparedStatement and return a List of 'primitive' values from the ResultSet. @param returnType The type Class return a List of. @param <V> The type parameter to return a List of. @return A {@code List<returnType>}. @throws ApplicationException {@literal returnType} is unsupported, cannot be cast to from the result, or any SQL errors occur.
[ "Execute", "the", "PreparedStatement", "and", "return", "a", "List", "of", "primitive", "values", "from", "the", "ResultSet", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/Query.java#L362-L372
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
WorkspacePersistentDataManager.doUpdate
protected void doUpdate(final ItemData item, final WorkspaceStorageConnection con, ChangedSizeHandler sizeHandler) throws RepositoryException, InvalidItemStateException { if (item.isNode()) { con.update((NodeData)item); } else { con.update((PropertyData)item, sizeHandler); } }
java
protected void doUpdate(final ItemData item, final WorkspaceStorageConnection con, ChangedSizeHandler sizeHandler) throws RepositoryException, InvalidItemStateException { if (item.isNode()) { con.update((NodeData)item); } else { con.update((PropertyData)item, sizeHandler); } }
[ "protected", "void", "doUpdate", "(", "final", "ItemData", "item", ",", "final", "WorkspaceStorageConnection", "con", ",", "ChangedSizeHandler", "sizeHandler", ")", "throws", "RepositoryException", ",", "InvalidItemStateException", "{", "if", "(", "item", ".", "isNode...
Performs actual item data updating. @param item to update @param con connection @param sizeHandler @throws RepositoryException @throws InvalidItemStateException if the item not found
[ "Performs", "actual", "item", "data", "updating", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java#L1163-L1175
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java
SynchronizedIO.writeFile
public void writeFile(String aFilePath, byte[] aData, boolean append) throws IOException { Object lock = retrieveLock(aFilePath); synchronized (lock) { IO.writeFile(aFilePath, aData,append); } }
java
public void writeFile(String aFilePath, byte[] aData, boolean append) throws IOException { Object lock = retrieveLock(aFilePath); synchronized (lock) { IO.writeFile(aFilePath, aData,append); } }
[ "public", "void", "writeFile", "(", "String", "aFilePath", ",", "byte", "[", "]", "aData", ",", "boolean", "append", ")", "throws", "IOException", "{", "Object", "lock", "=", "retrieveLock", "(", "aFilePath", ")", ";", "synchronized", "(", "lock", ")", "{"...
Write binary file data @param aFilePath the file path to write @param aData the data to write @param append to append or not @throws IOException when an IO error occurs
[ "Write", "binary", "file", "data" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java#L102-L110
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_outlookAvailability_GET
public ArrayList<OvhOutlookVersions> organizationName_service_exchangeService_outlookAvailability_GET(String organizationName, String exchangeService, OvhLanguageEnum outlookLanguage, OvhOutlookVersionEnum outlookVersion) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/outlookAvailability"; StringBuilder sb = path(qPath, organizationName, exchangeService); query(sb, "outlookLanguage", outlookLanguage); query(sb, "outlookVersion", outlookVersion); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
java
public ArrayList<OvhOutlookVersions> organizationName_service_exchangeService_outlookAvailability_GET(String organizationName, String exchangeService, OvhLanguageEnum outlookLanguage, OvhOutlookVersionEnum outlookVersion) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/outlookAvailability"; StringBuilder sb = path(qPath, organizationName, exchangeService); query(sb, "outlookLanguage", outlookLanguage); query(sb, "outlookVersion", outlookVersion); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "OvhOutlookVersions", ">", "organizationName_service_exchangeService_outlookAvailability_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "OvhLanguageEnum", "outlookLanguage", ",", "OvhOutlookVersionEnum", "outlookVersion",...
Show available outlooks REST: GET /email/exchange/{organizationName}/service/{exchangeService}/outlookAvailability @param outlookLanguage [required] Language version of outlook @param outlookVersion [required] OS version of outlook @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Show", "available", "outlooks" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2387-L2394
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java
TorqueDBHandling.addDBDefinitionFiles
public void addDBDefinitionFiles(String srcDir, String listOfFilenames) throws IOException { StringTokenizer tokenizer = new StringTokenizer(listOfFilenames, ","); File dir = new File(srcDir); String filename; while (tokenizer.hasMoreTokens()) { filename = tokenizer.nextToken().trim(); if (filename.length() > 0) { _torqueSchemata.put("schema"+_torqueSchemata.size()+".xml", readTextCompressed(new File(dir, filename))); } } }
java
public void addDBDefinitionFiles(String srcDir, String listOfFilenames) throws IOException { StringTokenizer tokenizer = new StringTokenizer(listOfFilenames, ","); File dir = new File(srcDir); String filename; while (tokenizer.hasMoreTokens()) { filename = tokenizer.nextToken().trim(); if (filename.length() > 0) { _torqueSchemata.put("schema"+_torqueSchemata.size()+".xml", readTextCompressed(new File(dir, filename))); } } }
[ "public", "void", "addDBDefinitionFiles", "(", "String", "srcDir", ",", "String", "listOfFilenames", ")", "throws", "IOException", "{", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "listOfFilenames", ",", "\",\"", ")", ";", "File", "dir", "=...
Adds the input files (in our case torque schema files) to use. @param srcDir The directory containing the files @param listOfFilenames The filenames in a comma-separated list
[ "Adds", "the", "input", "files", "(", "in", "our", "case", "torque", "schema", "files", ")", "to", "use", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java#L146-L161
sagiegurari/fax4j
src/main/java/org/fax4j/common/AbstractLogger.java
AbstractLogger.logError
public void logError(Object[] message,Throwable throwable) { this.log(LogLevel.ERROR,message,throwable); }
java
public void logError(Object[] message,Throwable throwable) { this.log(LogLevel.ERROR,message,throwable); }
[ "public", "void", "logError", "(", "Object", "[", "]", "message", ",", "Throwable", "throwable", ")", "{", "this", ".", "log", "(", "LogLevel", ".", "ERROR", ",", "message", ",", "throwable", ")", ";", "}" ]
Logs the provided data at the error level. @param message The message parts (may be null) @param throwable The error (may be null)
[ "Logs", "the", "provided", "data", "at", "the", "error", "level", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/common/AbstractLogger.java#L196-L199
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/SybaseHelper.java
SybaseHelper.setReadOnly
@Override public void setReadOnly(WSRdbManagedConnectionImpl managedConn, boolean readOnly, boolean externalCall) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setReadOnly", managedConn, readOnly, externalCall); if (!externalCall) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setReadOnly ignored for internal call"); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Method setReadOnly() is ignored by WebSphere. Sybase does not honor the setReadOnly method."); } }
java
@Override public void setReadOnly(WSRdbManagedConnectionImpl managedConn, boolean readOnly, boolean externalCall) throws SQLException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setReadOnly", managedConn, readOnly, externalCall); if (!externalCall) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "setReadOnly ignored for internal call"); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Method setReadOnly() is ignored by WebSphere. Sybase does not honor the setReadOnly method."); } }
[ "@", "Override", "public", "void", "setReadOnly", "(", "WSRdbManagedConnectionImpl", "managedConn", ",", "boolean", "readOnly", ",", "boolean", "externalCall", ")", "throws", "SQLException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&...
<p>This method is used to do special handling when method setReadOnly is called. If setReadOnly is called, we ignore it and log an informational message.</p> @param managedConn WSRdbManagedConnectionImpl object @param readOnly The readOnly value going to be set @param externalCall indicates if the call is done by WAS, or by the user application.
[ "<p", ">", "This", "method", "is", "used", "to", "do", "special", "handling", "when", "method", "setReadOnly", "is", "called", ".", "If", "setReadOnly", "is", "called", "we", "ignore", "it", "and", "log", "an", "informational", "message", ".", "<", "/", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/SybaseHelper.java#L245-L262
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java
GVRContext.startDebugServer
public synchronized DebugServer startDebugServer(int port, int maxClients) { if (mDebugServer != null) { Log.e(TAG, "Debug server has already been started."); return mDebugServer; } mDebugServer = new DebugServer(this, port, maxClients); Threads.spawn(mDebugServer); return mDebugServer; }
java
public synchronized DebugServer startDebugServer(int port, int maxClients) { if (mDebugServer != null) { Log.e(TAG, "Debug server has already been started."); return mDebugServer; } mDebugServer = new DebugServer(this, port, maxClients); Threads.spawn(mDebugServer); return mDebugServer; }
[ "public", "synchronized", "DebugServer", "startDebugServer", "(", "int", "port", ",", "int", "maxClients", ")", "{", "if", "(", "mDebugServer", "!=", "null", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"Debug server has already been started.\"", ")", ";", "r...
Start a debug server on a specified TCP/IP port, allowing a specified number of concurrent clients. @param port The port number for the TCP/IP server. @param maxClients The maximum number of concurrent clients.
[ "Start", "a", "debug", "server", "on", "a", "specified", "TCP", "/", "IP", "port", "allowing", "a", "specified", "number", "of", "concurrent", "clients", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRContext.java#L331-L340
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarZooKeeperClient.java
AvatarZooKeeperClient.getPrimaryLastTxId
public ZookeeperTxId getPrimaryLastTxId(String address, boolean sync) throws IOException, KeeperException, InterruptedException, ClassNotFoundException { Stat stat = new Stat(); String node = getLastTxIdNode(address); byte[] data = getNodeData(node, stat, false, sync); if (data == null) { return null; } return ZookeeperTxId.getFromBytes(data); }
java
public ZookeeperTxId getPrimaryLastTxId(String address, boolean sync) throws IOException, KeeperException, InterruptedException, ClassNotFoundException { Stat stat = new Stat(); String node = getLastTxIdNode(address); byte[] data = getNodeData(node, stat, false, sync); if (data == null) { return null; } return ZookeeperTxId.getFromBytes(data); }
[ "public", "ZookeeperTxId", "getPrimaryLastTxId", "(", "String", "address", ",", "boolean", "sync", ")", "throws", "IOException", ",", "KeeperException", ",", "InterruptedException", ",", "ClassNotFoundException", "{", "Stat", "stat", "=", "new", "Stat", "(", ")", ...
Retrieves the last transaction id of the primary from zookeeper. @param address the address of the cluster @param sync whether or not to perform a sync before read @throws IOException @throws KeeperException @throws InterruptedException
[ "Retrieves", "the", "last", "transaction", "id", "of", "the", "primary", "from", "zookeeper", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarZooKeeperClient.java#L351-L361
vincentk/joptimizer
src/main/java/com/joptimizer/functions/SOCPLogarithmicBarrier.java
SOCPLogarithmicBarrier.calculatePhase1InitialFeasiblePoint
@Override public double calculatePhase1InitialFeasiblePoint(double[] originalNotFeasiblePoint, double tolerance){ double s = -Double.MAX_VALUE; RealVector x = new ArrayRealVector(originalNotFeasiblePoint); for(int i=0; i<socpConstraintParametersList.size(); i++){ SOCPConstraintParameters param = socpConstraintParametersList.get(i); RealMatrix A = param.getA(); RealVector b = param.getB(); RealVector c = param.getC(); double d = param.getD(); s = Math.max(s, (A.operate(x).subtract(b).getNorm() - (c.dotProduct(x)+d))*Math.pow(tolerance,-0.5)); } if(Double.compare(0., s)==0){ //for the point to be feasible, we must have s<0. //s==0 is an ambiguous value the is better to avoid s = 2 * tolerance; } return s; }
java
@Override public double calculatePhase1InitialFeasiblePoint(double[] originalNotFeasiblePoint, double tolerance){ double s = -Double.MAX_VALUE; RealVector x = new ArrayRealVector(originalNotFeasiblePoint); for(int i=0; i<socpConstraintParametersList.size(); i++){ SOCPConstraintParameters param = socpConstraintParametersList.get(i); RealMatrix A = param.getA(); RealVector b = param.getB(); RealVector c = param.getC(); double d = param.getD(); s = Math.max(s, (A.operate(x).subtract(b).getNorm() - (c.dotProduct(x)+d))*Math.pow(tolerance,-0.5)); } if(Double.compare(0., s)==0){ //for the point to be feasible, we must have s<0. //s==0 is an ambiguous value the is better to avoid s = 2 * tolerance; } return s; }
[ "@", "Override", "public", "double", "calculatePhase1InitialFeasiblePoint", "(", "double", "[", "]", "originalNotFeasiblePoint", ",", "double", "tolerance", ")", "{", "double", "s", "=", "-", "Double", ".", "MAX_VALUE", ";", "RealVector", "x", "=", "new", "Array...
Calculates the initial value for the s parameter in Phase I. Return s = max(||Ai.x+bi|| - (ci.x+di)) @see "S.Boyd and L.Vandenberghe, Convex Optimization, 11.6.2"
[ "Calculates", "the", "initial", "value", "for", "the", "s", "parameter", "in", "Phase", "I", ".", "Return", "s", "=", "max", "(", "||Ai", ".", "x", "+", "bi||", "-", "(", "ci", ".", "x", "+", "di", "))" ]
train
https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/functions/SOCPLogarithmicBarrier.java#L158-L176
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.noNullValue
@Nullable @CodingStyleguideUnaware public static <T extends Map <?, ?>> T noNullValue (final T aValue, final String sName) { if (isEnabled ()) return noNullValue (aValue, () -> sName); return aValue; }
java
@Nullable @CodingStyleguideUnaware public static <T extends Map <?, ?>> T noNullValue (final T aValue, final String sName) { if (isEnabled ()) return noNullValue (aValue, () -> sName); return aValue; }
[ "@", "Nullable", "@", "CodingStyleguideUnaware", "public", "static", "<", "T", "extends", "Map", "<", "?", ",", "?", ">", ">", "T", "noNullValue", "(", "final", "T", "aValue", ",", "final", "String", "sName", ")", "{", "if", "(", "isEnabled", "(", ")",...
Check that the passed map is neither <code>null</code> nor empty and that no <code>null</code> key or value is contained. @param <T> Type to be checked and returned @param aValue The map to check. May be <code>null</code>. @param sName The name of the value (e.g. the parameter name) @return The passed value. Maybe <code>null</code>. @throws IllegalArgumentException if the passed value is not empty and a <code>null</code> key or <code>null</code> value is contained
[ "Check", "that", "the", "passed", "map", "is", "neither", "<code", ">", "null<", "/", "code", ">", "nor", "empty", "and", "that", "no", "<code", ">", "null<", "/", "code", ">", "key", "or", "value", "is", "contained", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L987-L994
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.plusMonths
public Period plusMonths(int months) { if (months == 0) { return this; } int[] values = getValues(); // cloned getPeriodType().addIndexedField(this, PeriodType.MONTH_INDEX, values, months); return new Period(values, getPeriodType()); }
java
public Period plusMonths(int months) { if (months == 0) { return this; } int[] values = getValues(); // cloned getPeriodType().addIndexedField(this, PeriodType.MONTH_INDEX, values, months); return new Period(values, getPeriodType()); }
[ "public", "Period", "plusMonths", "(", "int", "months", ")", "{", "if", "(", "months", "==", "0", ")", "{", "return", "this", ";", "}", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "addIndex...
Returns a new period plus the specified number of months added. <p> This period instance is immutable and unaffected by this method call. @param months the amount of months to add, may be negative @return the new period plus the increased months @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "plus", "the", "specified", "number", "of", "months", "added", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1087-L1094
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java
TemplateMatching.setTemplate
public void setTemplate(T template, T mask , int maxMatches) { this.template = template; this.mask = mask; this.maxMatches = maxMatches; }
java
public void setTemplate(T template, T mask , int maxMatches) { this.template = template; this.mask = mask; this.maxMatches = maxMatches; }
[ "public", "void", "setTemplate", "(", "T", "template", ",", "T", "mask", ",", "int", "maxMatches", ")", "{", "this", ".", "template", "=", "template", ";", "this", ".", "mask", "=", "mask", ";", "this", ".", "maxMatches", "=", "maxMatches", ";", "}" ]
Specifies the template to search for and the maximum number of matches to return. @param template Template being searched for @param mask Optional mask. Same size as template. 0 = pixel is transparent, values larger than zero determine how influential the pixel is. Can be null. @param maxMatches The maximum number of matches it will return
[ "Specifies", "the", "template", "to", "search", "for", "and", "the", "maximum", "number", "of", "matches", "to", "return", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/template/TemplateMatching.java#L92-L96
soi-toolkit/soi-toolkit-mule
tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java
OptionSet.addOption
public OptionSet addOption(String key, Options.Separator separator, Options.Multiplicity multiplicity) { return addOption(key, false, separator, true, multiplicity); }
java
public OptionSet addOption(String key, Options.Separator separator, Options.Multiplicity multiplicity) { return addOption(key, false, separator, true, multiplicity); }
[ "public", "OptionSet", "addOption", "(", "String", "key", ",", "Options", ".", "Separator", "separator", ",", "Options", ".", "Multiplicity", "multiplicity", ")", "{", "return", "addOption", "(", "key", ",", "false", ",", "separator", ",", "true", ",", "mult...
Add a value option with the given key, separator, and multiplicity, no details, and the default prefix <p> @param key The key for the option @param separator The separator for the option @param multiplicity The multiplicity for the option <p> @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods) <p> @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined or if <code>separator</code> or <code>multiplicity</code> are <code>null</code>
[ "Add", "a", "value", "option", "with", "the", "given", "key", "separator", "and", "multiplicity", "no", "details", "and", "the", "default", "prefix", "<p", ">" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/cli/util/OptionSet.java#L225-L227
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/util/ExpandableStringEnum.java
ExpandableStringEnum.fromString
@SuppressWarnings("unchecked") protected static <T extends ExpandableStringEnum<T>> T fromString(String name, Class<T> clazz) { if (name == null) { return null; } else if (valuesByName != null) { T value = (T) valuesByName.get(uniqueKey(clazz, name)); if (value != null) { return value; } } try { T value = clazz.newInstance(); return value.withNameValue(name, value, clazz); } catch (InstantiationException | IllegalAccessException e) { return null; } }
java
@SuppressWarnings("unchecked") protected static <T extends ExpandableStringEnum<T>> T fromString(String name, Class<T> clazz) { if (name == null) { return null; } else if (valuesByName != null) { T value = (T) valuesByName.get(uniqueKey(clazz, name)); if (value != null) { return value; } } try { T value = clazz.newInstance(); return value.withNameValue(name, value, clazz); } catch (InstantiationException | IllegalAccessException e) { return null; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "static", "<", "T", "extends", "ExpandableStringEnum", "<", "T", ">", ">", "T", "fromString", "(", "String", "name", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "name", "==",...
Creates an instance of the specific expandable string enum from a String. @param name the value to create the instance from @param clazz the class of the expandable string enum @param <T> the class of the expandable string enum @return the expandable string enum instance
[ "Creates", "an", "instance", "of", "the", "specific", "expandable", "string", "enum", "from", "a", "String", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/util/ExpandableStringEnum.java#L48-L65
JodaOrg/joda-convert
src/main/java/org/joda/convert/StringConvert.java
StringConvert.registerMethodConstructor
public <T> void registerMethodConstructor(final Class<T> cls, String toStringMethodName) { if (cls == null) { throw new IllegalArgumentException("Class must not be null"); } if (toStringMethodName == null) { throw new IllegalArgumentException("Method name must not be null"); } if (this == INSTANCE) { throw new IllegalStateException("Global singleton cannot be extended"); } Method toString = findToStringMethod(cls, toStringMethodName); Constructor<T> fromString = findFromStringConstructorByType(cls); MethodConstructorStringConverter<T> converter = new MethodConstructorStringConverter<T>(cls, toString, fromString); registered.putIfAbsent(cls, converter); }
java
public <T> void registerMethodConstructor(final Class<T> cls, String toStringMethodName) { if (cls == null) { throw new IllegalArgumentException("Class must not be null"); } if (toStringMethodName == null) { throw new IllegalArgumentException("Method name must not be null"); } if (this == INSTANCE) { throw new IllegalStateException("Global singleton cannot be extended"); } Method toString = findToStringMethod(cls, toStringMethodName); Constructor<T> fromString = findFromStringConstructorByType(cls); MethodConstructorStringConverter<T> converter = new MethodConstructorStringConverter<T>(cls, toString, fromString); registered.putIfAbsent(cls, converter); }
[ "public", "<", "T", ">", "void", "registerMethodConstructor", "(", "final", "Class", "<", "T", ">", "cls", ",", "String", "toStringMethodName", ")", "{", "if", "(", "cls", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Class must...
Registers a converter for a specific type by method and constructor. <p> This method allows the converter to be used when the target class cannot have annotations added. The two method name and constructor must obey the same rules as defined by the annotations {@link ToString} and {@link FromString}. The converter will be used for subclasses unless overidden. <p> No new converters may be registered for the global singleton. <p> For example, {@code convert.registerMethodConstructor(Distance.class, "toString");} @param <T> the type of the converter @param cls the class to register a converter for, not null @param toStringMethodName the name of the method converting to a string, not null @throws IllegalArgumentException if the class or method name are null or invalid @throws IllegalStateException if trying to alter the global singleton
[ "Registers", "a", "converter", "for", "a", "specific", "type", "by", "method", "and", "constructor", ".", "<p", ">", "This", "method", "allows", "the", "converter", "to", "be", "used", "when", "the", "target", "class", "cannot", "have", "annotations", "added...
train
https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/StringConvert.java#L773-L787
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java
JobsInner.listOutputFilesWithServiceResponseAsync
public Observable<ServiceResponse<Page<FileInner>>> listOutputFilesWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final String jobName, final JobsListOutputFilesOptions jobsListOutputFilesOptions) { return listOutputFilesSinglePageAsync(resourceGroupName, workspaceName, experimentName, jobName, jobsListOutputFilesOptions) .concatMap(new Func1<ServiceResponse<Page<FileInner>>, Observable<ServiceResponse<Page<FileInner>>>>() { @Override public Observable<ServiceResponse<Page<FileInner>>> call(ServiceResponse<Page<FileInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listOutputFilesNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<FileInner>>> listOutputFilesWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final String jobName, final JobsListOutputFilesOptions jobsListOutputFilesOptions) { return listOutputFilesSinglePageAsync(resourceGroupName, workspaceName, experimentName, jobName, jobsListOutputFilesOptions) .concatMap(new Func1<ServiceResponse<Page<FileInner>>, Observable<ServiceResponse<Page<FileInner>>>>() { @Override public Observable<ServiceResponse<Page<FileInner>>> call(ServiceResponse<Page<FileInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listOutputFilesNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "FileInner", ">", ">", ">", "listOutputFilesWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "workspaceName", ",", "final", "String", "experimentName", ","...
List all directories and files inside the given directory of the Job's output directory (if the output directory is on Azure File Share or Azure Storage Container). @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param jobsListOutputFilesOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;FileInner&gt; object
[ "List", "all", "directories", "and", "files", "inside", "the", "given", "directory", "of", "the", "Job", "s", "output", "directory", "(", "if", "the", "output", "directory", "is", "on", "Azure", "File", "Share", "or", "Azure", "Storage", "Container", ")", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L951-L963
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/core/internal/registry/ResourceRegistryImpl.java
ResourceRegistryImpl.addEntry
public RegistryEntry addEntry(Class<?> resource, RegistryEntry registryEntry) { resources.put(resource, registryEntry); registryEntry.initialize(moduleRegistry); logger.debug("Added resource {} to ResourceRegistry", resource.getName()); return registryEntry; }
java
public RegistryEntry addEntry(Class<?> resource, RegistryEntry registryEntry) { resources.put(resource, registryEntry); registryEntry.initialize(moduleRegistry); logger.debug("Added resource {} to ResourceRegistry", resource.getName()); return registryEntry; }
[ "public", "RegistryEntry", "addEntry", "(", "Class", "<", "?", ">", "resource", ",", "RegistryEntry", "registryEntry", ")", "{", "resources", ".", "put", "(", "resource", ",", "registryEntry", ")", ";", "registryEntry", ".", "initialize", "(", "moduleRegistry", ...
Adds a new resource definition to a registry. @param resource class of a resource @param registryEntry resource information @param <T> type of a resource
[ "Adds", "a", "new", "resource", "definition", "to", "a", "registry", "." ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/registry/ResourceRegistryImpl.java#L45-L50
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/platform/TenantDataUrl.java
TenantDataUrl.getDBValueUrl
public static MozuUrl getDBValueUrl(String dbEntryQuery, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/tenantdata/{dbEntryQuery}?responseFields={responseFields}"); formatter.formatUrl("dbEntryQuery", dbEntryQuery); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getDBValueUrl(String dbEntryQuery, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/tenantdata/{dbEntryQuery}?responseFields={responseFields}"); formatter.formatUrl("dbEntryQuery", dbEntryQuery); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getDBValueUrl", "(", "String", "dbEntryQuery", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/tenantdata/{dbEntryQuery}?responseFields={responseFields}\"", ")", ";", "...
Get Resource Url for GetDBValue @param dbEntryQuery The database entry string to create. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetDBValue" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/TenantDataUrl.java#L22-L28
j-a-w-r/jawr
jawr-core/src/main/java/net/jawr/web/util/ReflectionUtils.java
ReflectionUtils.methodBelongsTo
public static boolean methodBelongsTo(Method m, Method[] methods){ boolean result = false; for (int i = 0; i < methods.length && !result; i++) { if(methodEquals (methods [i], m)){ result = true; } } return result; }
java
public static boolean methodBelongsTo(Method m, Method[] methods){ boolean result = false; for (int i = 0; i < methods.length && !result; i++) { if(methodEquals (methods [i], m)){ result = true; } } return result; }
[ "public", "static", "boolean", "methodBelongsTo", "(", "Method", "m", ",", "Method", "[", "]", "methods", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", "&&", "!", "result"...
Returns true if the method is in the method array. @param m the method @param methods the method array @return true if the method is in the method array.
[ "Returns", "true", "if", "the", "method", "is", "in", "the", "method", "array", "." ]
train
https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/util/ReflectionUtils.java#L31-L41
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/AppUtil.java
AppUtil.startWebBrowser
public static void startWebBrowser(@NonNull final Context context, @NonNull final String uri) { Condition.INSTANCE.ensureNotNull(uri, "The URI may not be null"); Condition.INSTANCE.ensureNotEmpty(uri, "The URI may not be empty"); startWebBrowser(context, Uri.parse( (uri.startsWith("http://") || uri.startsWith("https://")) ? uri : ("http://" + uri))); }
java
public static void startWebBrowser(@NonNull final Context context, @NonNull final String uri) { Condition.INSTANCE.ensureNotNull(uri, "The URI may not be null"); Condition.INSTANCE.ensureNotEmpty(uri, "The URI may not be empty"); startWebBrowser(context, Uri.parse( (uri.startsWith("http://") || uri.startsWith("https://")) ? uri : ("http://" + uri))); }
[ "public", "static", "void", "startWebBrowser", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "NonNull", "final", "String", "uri", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "uri", ",", "\"The URI may not be null\"", ")", ...
Starts the web browser in order to show a specific URI. If an error occurs while starting the web browser an {@link ActivityNotFoundException} will be thrown. @param context The context, the web browser should be started from, as an instance of the class {@link Context}. The context may not be null @param uri The URI, which should be shown, as a {@link String}. The URI may neither be null, nor empty
[ "Starts", "the", "web", "browser", "in", "order", "to", "show", "a", "specific", "URI", ".", "If", "an", "error", "occurs", "while", "starting", "the", "web", "browser", "an", "{", "@link", "ActivityNotFoundException", "}", "will", "be", "thrown", "." ]
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/AppUtil.java#L178-L184
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/EventHelper.java
EventHelper.addDelayedStyler
public void addDelayedStyler(String tag, Collection<Advanced> advanced, Chunk chunk) { addDelayedStyler(tag, advanced, chunk, null); }
java
public void addDelayedStyler(String tag, Collection<Advanced> advanced, Chunk chunk) { addDelayedStyler(tag, advanced, chunk, null); }
[ "public", "void", "addDelayedStyler", "(", "String", "tag", ",", "Collection", "<", "Advanced", ">", "advanced", ",", "Chunk", "chunk", ")", "{", "addDelayedStyler", "(", "tag", ",", "advanced", ",", "chunk", ",", "null", ")", ";", "}" ]
add a styler that will do its styling in {@link #onGenericTag(com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document, com.itextpdf.text.Rectangle, java.lang.String) }. @param tag @param advanced @param chunk used when debugging, for placing debug info at the right position in the pdf @see Chunk#Chunk(com.itextpdf.text.Image, float, float, boolean)
[ "add", "a", "styler", "that", "will", "do", "its", "styling", "in", "{", "@link", "#onGenericTag", "(", "com", ".", "itextpdf", ".", "text", ".", "pdf", ".", "PdfWriter", "com", ".", "itextpdf", ".", "text", ".", "Document", "com", ".", "itextpdf", "."...
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L572-L574
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateGeneralWithChinese
public static <T extends CharSequence> T validateGeneralWithChinese(T value, String errorMsg) throws ValidateException { if (false == isGeneralWithChinese(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateGeneralWithChinese(T value, String errorMsg) throws ValidateException { if (false == isGeneralWithChinese(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateGeneralWithChinese", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isGeneralWithChinese", "(", "value", ")", ")", "{...
验证是否为中文字、英文字母、数字和下划线 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为中文字、英文字母、数字和下划线" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L974-L979
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLAgentMainLaunchConfigurationTab.java
SARLAgentMainLaunchConfigurationTab.createAgentNameEditor
protected void createAgentNameEditor(Composite parent, String text) { final Group group = SWTFactory.createGroup(parent, text, 2, 1, GridData.FILL_HORIZONTAL); this.agentNameTextField = SWTFactory.createSingleText(group, 1); this.agentNameTextField.addModifyListener(new ModifyListener() { @SuppressWarnings("synthetic-access") @Override public void modifyText(ModifyEvent event) { SARLAgentMainLaunchConfigurationTab.this.lastAgentNameError = null; updateLaunchConfigurationDialog(); } }); ControlAccessibleListener.addListener(this.agentNameTextField, group.getText()); this.agentNameSearchButton = createPushButton(group, Messages.MainLaunchConfigurationTab_1, null); this.agentNameSearchButton.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent event) { // } @Override public void widgetSelected(SelectionEvent event) { handleAgentNameSearchButtonSelected(); } }); }
java
protected void createAgentNameEditor(Composite parent, String text) { final Group group = SWTFactory.createGroup(parent, text, 2, 1, GridData.FILL_HORIZONTAL); this.agentNameTextField = SWTFactory.createSingleText(group, 1); this.agentNameTextField.addModifyListener(new ModifyListener() { @SuppressWarnings("synthetic-access") @Override public void modifyText(ModifyEvent event) { SARLAgentMainLaunchConfigurationTab.this.lastAgentNameError = null; updateLaunchConfigurationDialog(); } }); ControlAccessibleListener.addListener(this.agentNameTextField, group.getText()); this.agentNameSearchButton = createPushButton(group, Messages.MainLaunchConfigurationTab_1, null); this.agentNameSearchButton.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent event) { // } @Override public void widgetSelected(SelectionEvent event) { handleAgentNameSearchButtonSelected(); } }); }
[ "protected", "void", "createAgentNameEditor", "(", "Composite", "parent", ",", "String", "text", ")", "{", "final", "Group", "group", "=", "SWTFactory", ".", "createGroup", "(", "parent", ",", "text", ",", "2", ",", "1", ",", "GridData", ".", "FILL_HORIZONTA...
Creates the widgets for specifying a agent name. @param parent the parent composite. @param text the label of the group.
[ "Creates", "the", "widgets", "for", "specifying", "a", "agent", "name", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLAgentMainLaunchConfigurationTab.java#L164-L188
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbooksInner.java
RunbooksInner.getAsync
public Observable<RunbookInner> getAsync(String resourceGroupName, String automationAccountName, String runbookName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).map(new Func1<ServiceResponse<RunbookInner>, RunbookInner>() { @Override public RunbookInner call(ServiceResponse<RunbookInner> response) { return response.body(); } }); }
java
public Observable<RunbookInner> getAsync(String resourceGroupName, String automationAccountName, String runbookName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName).map(new Func1<ServiceResponse<RunbookInner>, RunbookInner>() { @Override public RunbookInner call(ServiceResponse<RunbookInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RunbookInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "runbookName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName...
Retrieve the runbook identified by runbook name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param runbookName The runbook name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RunbookInner object
[ "Retrieve", "the", "runbook", "identified", "by", "runbook", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbooksInner.java#L227-L234
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java
BlockDrawingHelper.placeItem
public void placeItem(ItemStack stack, BlockPos pos, World world, boolean centreItem) { EntityItem entityitem = createItem(stack, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), world, centreItem); // Set the motions to zero to prevent random movement. entityitem.motionX = 0; entityitem.motionY = 0; entityitem.motionZ = 0; entityitem.setDefaultPickupDelay(); world.spawnEntity(entityitem); }
java
public void placeItem(ItemStack stack, BlockPos pos, World world, boolean centreItem) { EntityItem entityitem = createItem(stack, (double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), world, centreItem); // Set the motions to zero to prevent random movement. entityitem.motionX = 0; entityitem.motionY = 0; entityitem.motionZ = 0; entityitem.setDefaultPickupDelay(); world.spawnEntity(entityitem); }
[ "public", "void", "placeItem", "(", "ItemStack", "stack", ",", "BlockPos", "pos", ",", "World", "world", ",", "boolean", "centreItem", ")", "{", "EntityItem", "entityitem", "=", "createItem", "(", "stack", ",", "(", "double", ")", "pos", ".", "getX", "(", ...
Spawn a single item at the specified position. @param item the actual item to be spawned. @param pos the position at which to spawn it. @param world the world in which to spawn the item.
[ "Spawn", "a", "single", "item", "at", "the", "specified", "position", "." ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/BlockDrawingHelper.java#L486-L495
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java
RouteFiltersInner.getByResourceGroupAsync
public Observable<RouteFilterInner> getByResourceGroupAsync(String resourceGroupName, String routeFilterName, String expand) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeFilterName, expand).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() { @Override public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) { return response.body(); } }); }
java
public Observable<RouteFilterInner> getByResourceGroupAsync(String resourceGroupName, String routeFilterName, String expand) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeFilterName, expand).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() { @Override public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteFilterInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ",", "String", "expand", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Gets the specified route filter. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param expand Expands referenced express route bgp peering resources. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteFilterInner object
[ "Gets", "the", "specified", "route", "filter", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java#L382-L389
google/truth
core/src/main/java/com/google/common/truth/IterableSubject.java
IterableSubject.isStrictlyOrdered
@SuppressWarnings({"unchecked"}) public final void isStrictlyOrdered(final Comparator<?> comparator) { checkNotNull(comparator); pairwiseCheck( "expected to be strictly ordered", new PairwiseChecker() { @Override public boolean check(Object prev, Object next) { return ((Comparator<Object>) comparator).compare(prev, next) < 0; } }); }
java
@SuppressWarnings({"unchecked"}) public final void isStrictlyOrdered(final Comparator<?> comparator) { checkNotNull(comparator); pairwiseCheck( "expected to be strictly ordered", new PairwiseChecker() { @Override public boolean check(Object prev, Object next) { return ((Comparator<Object>) comparator).compare(prev, next) < 0; } }); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "final", "void", "isStrictlyOrdered", "(", "final", "Comparator", "<", "?", ">", "comparator", ")", "{", "checkNotNull", "(", "comparator", ")", ";", "pairwiseCheck", "(", "\"expected to be ...
Fails if the iterable is not strictly ordered, according to the given comparator. Strictly ordered means that each element in the iterable is <i>strictly</i> greater than the element that preceded it. @throws ClassCastException if any pair of elements is not mutually Comparable
[ "Fails", "if", "the", "iterable", "is", "not", "strictly", "ordered", "according", "to", "the", "given", "comparator", ".", "Strictly", "ordered", "means", "that", "each", "element", "in", "the", "iterable", "is", "<i", ">", "strictly<", "/", "i", ">", "gr...
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/IterableSubject.java#L800-L811
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/graph/GrPropertyContainer.java
GrPropertyContainer.addProperty
public GrProperty addProperty(String name, Object value) { GrProperty prop = GrAccess.createProperty(name); prop.setValue(value); return getPropertiesContainer().addElement(prop); }
java
public GrProperty addProperty(String name, Object value) { GrProperty prop = GrAccess.createProperty(name); prop.setValue(value); return getPropertiesContainer().addElement(prop); }
[ "public", "GrProperty", "addProperty", "(", "String", "name", ",", "Object", "value", ")", "{", "GrProperty", "prop", "=", "GrAccess", ".", "createProperty", "(", "name", ")", ";", "prop", ".", "setValue", "(", "value", ")", ";", "return", "getPropertiesCont...
add a new property, throw a RuntimeException if the property already exists @param name of the property @param value of the property @return the added property
[ "add", "a", "new", "property", "throw", "a", "RuntimeException", "if", "the", "property", "already", "exists" ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/graph/GrPropertyContainer.java#L73-L77
elki-project/elki
elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/configurator/ConfiguratorPanel.java
ConfiguratorPanel.addParameter
public void addParameter(Object owner, Parameter<?> param, TrackParameters track) { this.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); ParameterConfigurator cfg = null; { // Find Object cur = owner; while(cur != null) { cfg = childconfig.get(cur); if(cfg != null) { break; } cur = track.getParent(cur); } } if(cfg != null) { cfg.addParameter(owner, param, track); return; } else { cfg = makeConfigurator(param); cfg.addChangeListener(this); children.add(cfg); } }
java
public void addParameter(Object owner, Parameter<?> param, TrackParameters track) { this.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); ParameterConfigurator cfg = null; { // Find Object cur = owner; while(cur != null) { cfg = childconfig.get(cur); if(cfg != null) { break; } cur = track.getParent(cur); } } if(cfg != null) { cfg.addParameter(owner, param, track); return; } else { cfg = makeConfigurator(param); cfg.addChangeListener(this); children.add(cfg); } }
[ "public", "void", "addParameter", "(", "Object", "owner", ",", "Parameter", "<", "?", ">", "param", ",", "TrackParameters", "track", ")", "{", "this", ".", "setBorder", "(", "new", "SoftBevelBorder", "(", "SoftBevelBorder", ".", "LOWERED", ")", ")", ";", "...
Add parameter to this panel. @param param Parameter to add @param track Parameter tracking object
[ "Add", "parameter", "to", "this", "panel", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/configurator/ConfiguratorPanel.java#L87-L109
primefaces/primefaces
src/main/java/org/primefaces/component/inputmask/InputMaskRenderer.java
InputMaskRenderer.translateMaskIntoRegex
protected Pattern translateMaskIntoRegex(FacesContext context, String mask) { StringBuilder regex = SharedStringBuilder.get(context, SB_PATTERN); boolean optionalFound = false; for (char c : mask.toCharArray()) { if (c == '?') { optionalFound = true; } else { regex.append(translateMaskCharIntoRegex(c, optionalFound)); } } return Pattern.compile(regex.toString()); }
java
protected Pattern translateMaskIntoRegex(FacesContext context, String mask) { StringBuilder regex = SharedStringBuilder.get(context, SB_PATTERN); boolean optionalFound = false; for (char c : mask.toCharArray()) { if (c == '?') { optionalFound = true; } else { regex.append(translateMaskCharIntoRegex(c, optionalFound)); } } return Pattern.compile(regex.toString()); }
[ "protected", "Pattern", "translateMaskIntoRegex", "(", "FacesContext", "context", ",", "String", "mask", ")", "{", "StringBuilder", "regex", "=", "SharedStringBuilder", ".", "get", "(", "context", ",", "SB_PATTERN", ")", ";", "boolean", "optionalFound", "=", "fals...
Translates the client side mask to to a {@link Pattern} base on: https://github.com/digitalBush/jquery.maskedinput a - Represents an alpha character (A-Z,a-z) 9 - Represents a numeric character (0-9) * - Represents an alphanumeric character (A-Z,a-z,0-9) ? - Makes the following input optional @param context The {@link FacesContext} @param mask The mask value of component @return The generated {@link Pattern}
[ "Translates", "the", "client", "side", "mask", "to", "to", "a", "{", "@link", "Pattern", "}", "base", "on", ":", "https", ":", "//", "github", ".", "com", "/", "digitalBush", "/", "jquery", ".", "maskedinput", "a", "-", "Represents", "an", "alpha", "ch...
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/component/inputmask/InputMaskRenderer.java#L81-L94
Alluxio/alluxio
core/base/src/main/java/alluxio/util/URIUtils.java
URIUtils.generateQueryString
@Nullable public static String generateQueryString(Map<String, String> queryMap) { if (queryMap == null || queryMap.isEmpty()) { return null; } ArrayList<String> pairs = new ArrayList<>(queryMap.size()); try { for (Map.Entry<String, String> entry : queryMap.entrySet()) { pairs.add( URLEncoder.encode(entry.getKey(), "UTF-8") + QUERY_KEY_VALUE_SEPARATOR + URLEncoder .encode(entry.getValue(), "UTF-8")); } } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } Joiner joiner = Joiner.on(QUERY_SEPARATOR); return joiner.join(pairs); }
java
@Nullable public static String generateQueryString(Map<String, String> queryMap) { if (queryMap == null || queryMap.isEmpty()) { return null; } ArrayList<String> pairs = new ArrayList<>(queryMap.size()); try { for (Map.Entry<String, String> entry : queryMap.entrySet()) { pairs.add( URLEncoder.encode(entry.getKey(), "UTF-8") + QUERY_KEY_VALUE_SEPARATOR + URLEncoder .encode(entry.getValue(), "UTF-8")); } } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } Joiner joiner = Joiner.on(QUERY_SEPARATOR); return joiner.join(pairs); }
[ "@", "Nullable", "public", "static", "String", "generateQueryString", "(", "Map", "<", "String", ",", "String", ">", "queryMap", ")", "{", "if", "(", "queryMap", "==", "null", "||", "queryMap", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", ...
Generates a query string from a {@link Map <String, String>} of key/value pairs. @param queryMap the map of query key/value pairs @return the generated query string, null if the input map is null or empty
[ "Generates", "a", "query", "string", "from", "a", "{", "@link", "Map", "<String", "String", ">", "}", "of", "key", "/", "value", "pairs", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/URIUtils.java#L77-L95
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ThemeServlet.java
ThemeServlet.doGet
@Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { ServletUtil.handleThemeResourceRequest(req, resp); }
java
@Override protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { ServletUtil.handleThemeResourceRequest(req, resp); }
[ "@", "Override", "protected", "void", "doGet", "(", "final", "HttpServletRequest", "req", ",", "final", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "ServletUtil", ".", "handleThemeResourceRequest", "(", "req", ",", "res...
Serves up a file from the theme. @param req the request with the file name in parameter "f", or following the servlet path. @param resp the response to write to. @throws ServletException on error. @throws IOException if there is an error reading the file / writing the response.
[ "Serves", "up", "a", "file", "from", "the", "theme", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ThemeServlet.java#L46-L51
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.deleteSubListAsync
public Observable<OperationStatus> deleteSubListAsync(UUID appId, String versionId, UUID clEntityId, int subListId) { return deleteSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteSubListAsync(UUID appId, String versionId, UUID clEntityId, int subListId) { return deleteSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteSubListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "int", "subListId", ")", "{", "return", "deleteSubListWithServiceResponseAsync", "(", "appId", ",", "versionI...
Deletes a sublist of a specific closed list model. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list entity extractor ID. @param subListId The sublist ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "a", "sublist", "of", "a", "specific", "closed", "list", "model", "." ]
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#L4901-L4908
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java
CommerceOrderItemPersistenceImpl.findByCProductId
@Override public List<CommerceOrderItem> findByCProductId(long CProductId, int start, int end) { return findByCProductId(CProductId, start, end, null); }
java
@Override public List<CommerceOrderItem> findByCProductId(long CProductId, int start, int end) { return findByCProductId(CProductId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrderItem", ">", "findByCProductId", "(", "long", "CProductId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCProductId", "(", "CProductId", ",", "start", ",", "end", ",", "null", ")", ...
Returns a range of all the commerce order items where CProductId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CProductId the c product ID @param start the lower bound of the range of commerce order items @param end the upper bound of the range of commerce order items (not inclusive) @return the range of matching commerce order items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "order", "items", "where", "CProductId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L663-L667
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/ReturnValueIgnored.java
ReturnValueIgnored.methodReturnsSameTypeAsReceiver
private static Matcher<ExpressionTree> methodReturnsSameTypeAsReceiver() { return new Matcher<ExpressionTree>() { @Override public boolean matches(ExpressionTree expressionTree, VisitorState state) { return isSameType( ASTHelpers.getReceiverType(expressionTree), ASTHelpers.getReturnType(expressionTree), state); } }; }
java
private static Matcher<ExpressionTree> methodReturnsSameTypeAsReceiver() { return new Matcher<ExpressionTree>() { @Override public boolean matches(ExpressionTree expressionTree, VisitorState state) { return isSameType( ASTHelpers.getReceiverType(expressionTree), ASTHelpers.getReturnType(expressionTree), state); } }; }
[ "private", "static", "Matcher", "<", "ExpressionTree", ">", "methodReturnsSameTypeAsReceiver", "(", ")", "{", "return", "new", "Matcher", "<", "ExpressionTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "ExpressionTree", "expression...
Matches method invocations that return the same type as the receiver object.
[ "Matches", "method", "invocations", "that", "return", "the", "same", "type", "as", "the", "receiver", "object", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ReturnValueIgnored.java#L161-L171
lievendoclo/Valkyrie-RCP
valkyrie-rcp-samples/valkyrie-rcp-simple-sample/src/main/java/org/valkyriercp/sample/simple/domain/SimpleValidationRulesSource.java
SimpleValidationRulesSource.createContactRules
private Rules createContactRules() { // Construct a Rules object that contains all the constraints we need to apply // to our domain object. The Rules class offers a lot of convenience methods // for creating constraints on named properties. return new Rules(Contact.class) { protected void initRules() { add("firstName", NAME_CONSTRAINT); add("lastName", NAME_CONSTRAINT); add(not(eqProperty("firstName", "lastName"))); // If a DOB is specified, it must be in the past add("dateOfBirth", lt(new Date())); add("emailAddress", EMAIL_CONSTRAINT); add("homePhone", PHONE_CONSTRAINT); add("workPhone", PHONE_CONSTRAINT); add("contactType", required()); // Note that you can define constraints on nested properties. // This is useful when the nested object is not displayed in // a form of its own. add("address.address1", required()); add("address.city", required()); add("address.state", required()); add("address.zip", ZIPCODE_CONSTRAINT); add("memo", required()); } }; }
java
private Rules createContactRules() { // Construct a Rules object that contains all the constraints we need to apply // to our domain object. The Rules class offers a lot of convenience methods // for creating constraints on named properties. return new Rules(Contact.class) { protected void initRules() { add("firstName", NAME_CONSTRAINT); add("lastName", NAME_CONSTRAINT); add(not(eqProperty("firstName", "lastName"))); // If a DOB is specified, it must be in the past add("dateOfBirth", lt(new Date())); add("emailAddress", EMAIL_CONSTRAINT); add("homePhone", PHONE_CONSTRAINT); add("workPhone", PHONE_CONSTRAINT); add("contactType", required()); // Note that you can define constraints on nested properties. // This is useful when the nested object is not displayed in // a form of its own. add("address.address1", required()); add("address.city", required()); add("address.state", required()); add("address.zip", ZIPCODE_CONSTRAINT); add("memo", required()); } }; }
[ "private", "Rules", "createContactRules", "(", ")", "{", "// Construct a Rules object that contains all the constraints we need to apply", "// to our domain object. The Rules class offers a lot of convenience methods", "// for creating constraints on named properties.", "return", "new", "Rules...
Construct the rules that are used to validate a Contact domain object. @return validation rules @see Rules
[ "Construct", "the", "rules", "that", "are", "used", "to", "validate", "a", "Contact", "domain", "object", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-samples/valkyrie-rcp-simple-sample/src/main/java/org/valkyriercp/sample/simple/domain/SimpleValidationRulesSource.java#L73-L104
teknux-org/jetty-bootstrap
jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrap.java
JettyBootstrap.addExplodedWarAppFromClasspath
public WebAppContext addExplodedWarAppFromClasspath(String explodedWar, String descriptor, String contextPath) throws JettyBootstrapException { ExplodedWarAppJettyHandler explodedWarAppJettyHandler = new ExplodedWarAppJettyHandler(getInitializedConfiguration()); explodedWarAppJettyHandler.setWebAppBaseFromClasspath(explodedWar); explodedWarAppJettyHandler.setDescriptor(descriptor); explodedWarAppJettyHandler.setContextPath(contextPath); WebAppContext webAppContext = explodedWarAppJettyHandler.getHandler(); handlers.addHandler(webAppContext); return webAppContext; }
java
public WebAppContext addExplodedWarAppFromClasspath(String explodedWar, String descriptor, String contextPath) throws JettyBootstrapException { ExplodedWarAppJettyHandler explodedWarAppJettyHandler = new ExplodedWarAppJettyHandler(getInitializedConfiguration()); explodedWarAppJettyHandler.setWebAppBaseFromClasspath(explodedWar); explodedWarAppJettyHandler.setDescriptor(descriptor); explodedWarAppJettyHandler.setContextPath(contextPath); WebAppContext webAppContext = explodedWarAppJettyHandler.getHandler(); handlers.addHandler(webAppContext); return webAppContext; }
[ "public", "WebAppContext", "addExplodedWarAppFromClasspath", "(", "String", "explodedWar", ",", "String", "descriptor", ",", "String", "contextPath", ")", "throws", "JettyBootstrapException", "{", "ExplodedWarAppJettyHandler", "explodedWarAppJettyHandler", "=", "new", "Explod...
Add an exploded (not packaged) War application from the current classpath, specifying the context path. @param explodedWar the exploded war path @param descriptor the web.xml descriptor path @param contextPath the path (base URL) to make the resource available @return WebAppContext @throws JettyBootstrapException on failed
[ "Add", "an", "exploded", "(", "not", "packaged", ")", "War", "application", "from", "the", "current", "classpath", "specifying", "the", "context", "path", "." ]
train
https://github.com/teknux-org/jetty-bootstrap/blob/c16e710b833084c650fce35aa8c1ccaf83cd93ef/jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/JettyBootstrap.java#L375-L385
cdk/cdk
legacy/src/main/java/org/openscience/cdk/io/inchi/INChIHandler.java
INChIHandler.startElement
@Override public void startElement(String uri, String local, String raw, Attributes atts) { currentChars = ""; logger.debug("startElement: ", raw); logger.debug("uri: ", uri); logger.debug("local: ", local); logger.debug("raw: ", raw); if ("INChI".equals(local)) { // check version for (int i = 0; i < atts.getLength(); i++) { if (atts.getQName(i).equals("version")) logger.info("INChI version: ", atts.getValue(i)); } } else if ("structure".equals(local)) { tautomer = new AtomContainer(); } else { // skip all other elements } }
java
@Override public void startElement(String uri, String local, String raw, Attributes atts) { currentChars = ""; logger.debug("startElement: ", raw); logger.debug("uri: ", uri); logger.debug("local: ", local); logger.debug("raw: ", raw); if ("INChI".equals(local)) { // check version for (int i = 0; i < atts.getLength(); i++) { if (atts.getQName(i).equals("version")) logger.info("INChI version: ", atts.getValue(i)); } } else if ("structure".equals(local)) { tautomer = new AtomContainer(); } else { // skip all other elements } }
[ "@", "Override", "public", "void", "startElement", "(", "String", "uri", ",", "String", "local", ",", "String", "raw", ",", "Attributes", "atts", ")", "{", "currentChars", "=", "\"\"", ";", "logger", ".", "debug", "(", "\"startElement: \"", ",", "raw", ")"...
Implementation of the startElement() procedure overwriting the DefaultHandler interface. @param uri the Universal Resource Identifier @param local the local name (without namespace part) @param raw the complete element name (with namespace part) @param atts the attributes of this element
[ "Implementation", "of", "the", "startElement", "()", "procedure", "overwriting", "the", "DefaultHandler", "interface", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/io/inchi/INChIHandler.java#L131-L148
osglworks/java-mvc
src/main/java/org/osgl/mvc/result/TooManyRequests.java
TooManyRequests.of
public static TooManyRequests of(int errorCode) { if (_localizedErrorMsg()) { return of(errorCode, defaultMessage(TOO_MANY_REQUESTS)); } else { touchPayload().errorCode(errorCode); return _INSTANCE; } }
java
public static TooManyRequests of(int errorCode) { if (_localizedErrorMsg()) { return of(errorCode, defaultMessage(TOO_MANY_REQUESTS)); } else { touchPayload().errorCode(errorCode); return _INSTANCE; } }
[ "public", "static", "TooManyRequests", "of", "(", "int", "errorCode", ")", "{", "if", "(", "_localizedErrorMsg", "(", ")", ")", "{", "return", "of", "(", "errorCode", ",", "defaultMessage", "(", "TOO_MANY_REQUESTS", ")", ")", ";", "}", "else", "{", "touchP...
Returns a static TooManyRequests instance and set the {@link #payload} thread local with error code and default message. When calling the instance on {@link #getMessage()} method, it will return whatever stored in the {@link #payload} thread local @param errorCode the app defined error code @return a static TooManyRequests instance as described above
[ "Returns", "a", "static", "TooManyRequests", "instance", "and", "set", "the", "{", "@link", "#payload", "}", "thread", "local", "with", "error", "code", "and", "default", "message", "." ]
train
https://github.com/osglworks/java-mvc/blob/4d2b2ec40498ac6ee7040c0424377cbeacab124b/src/main/java/org/osgl/mvc/result/TooManyRequests.java#L164-L171
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/TemplatesApi.java
TemplatesApi.getDocument
public byte[] getDocument(String accountId, String templateId, String documentId) throws ApiException { return getDocument(accountId, templateId, documentId, null); }
java
public byte[] getDocument(String accountId, String templateId, String documentId) throws ApiException { return getDocument(accountId, templateId, documentId, null); }
[ "public", "byte", "[", "]", "getDocument", "(", "String", "accountId", ",", "String", "templateId", ",", "String", "documentId", ")", "throws", "ApiException", "{", "return", "getDocument", "(", "accountId", ",", "templateId", ",", "documentId", ",", "null", "...
Gets PDF documents from a template. Retrieves one or more PDF documents from the specified template. You can specify the ID of the document to retrieve or can specify &#x60;combined&#x60; to retrieve all documents in the template as one pdf. @param accountId The external account number (int) or account ID Guid. (required) @param templateId The ID of the template being accessed. (required) @param documentId The ID of the document being accessed. (required) @return byte[]
[ "Gets", "PDF", "documents", "from", "a", "template", ".", "Retrieves", "one", "or", "more", "PDF", "documents", "from", "the", "specified", "template", ".", "You", "can", "specify", "the", "ID", "of", "the", "document", "to", "retrieve", "or", "can", "spec...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L1245-L1247
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.checkParentFolders
private void checkParentFolders(CmsDbContext dbc, CmsPublishList publishList) throws CmsVfsException { boolean directPublish = publishList.isDirectPublish(); // if we direct publish a file, check if all parent folders are already published if (directPublish) { // first get the names of all parent folders Iterator<CmsResource> it = publishList.getDirectPublishResources().iterator(); List<String> parentFolderNames = new ArrayList<String>(); while (it.hasNext()) { CmsResource res = it.next(); String parentFolderName = CmsResource.getParentFolder(res.getRootPath()); if (parentFolderName != null) { parentFolderNames.add(parentFolderName); } } // remove duplicate parent folder names parentFolderNames = CmsFileUtil.removeRedundancies(parentFolderNames); String parentFolderName = null; try { I_CmsVfsDriver vfsDriver = getVfsDriver(dbc); // now check all folders if they exist in the online project Iterator<String> parentIt = parentFolderNames.iterator(); while (parentIt.hasNext()) { parentFolderName = parentIt.next(); vfsDriver.readFolder(dbc, CmsProject.ONLINE_PROJECT_ID, parentFolderName); } } catch (CmsException e) { throw new CmsVfsException( Messages.get().container(Messages.RPT_PARENT_FOLDER_NOT_PUBLISHED_1, parentFolderName)); } } }
java
private void checkParentFolders(CmsDbContext dbc, CmsPublishList publishList) throws CmsVfsException { boolean directPublish = publishList.isDirectPublish(); // if we direct publish a file, check if all parent folders are already published if (directPublish) { // first get the names of all parent folders Iterator<CmsResource> it = publishList.getDirectPublishResources().iterator(); List<String> parentFolderNames = new ArrayList<String>(); while (it.hasNext()) { CmsResource res = it.next(); String parentFolderName = CmsResource.getParentFolder(res.getRootPath()); if (parentFolderName != null) { parentFolderNames.add(parentFolderName); } } // remove duplicate parent folder names parentFolderNames = CmsFileUtil.removeRedundancies(parentFolderNames); String parentFolderName = null; try { I_CmsVfsDriver vfsDriver = getVfsDriver(dbc); // now check all folders if they exist in the online project Iterator<String> parentIt = parentFolderNames.iterator(); while (parentIt.hasNext()) { parentFolderName = parentIt.next(); vfsDriver.readFolder(dbc, CmsProject.ONLINE_PROJECT_ID, parentFolderName); } } catch (CmsException e) { throw new CmsVfsException( Messages.get().container(Messages.RPT_PARENT_FOLDER_NOT_PUBLISHED_1, parentFolderName)); } } }
[ "private", "void", "checkParentFolders", "(", "CmsDbContext", "dbc", ",", "CmsPublishList", "publishList", ")", "throws", "CmsVfsException", "{", "boolean", "directPublish", "=", "publishList", ".", "isDirectPublish", "(", ")", ";", "// if we direct publish a file, check ...
Checks that no one of the resources to be published has a 'new' parent (that has not been published yet).<p> @param dbc the db context @param publishList the publish list to check @throws CmsVfsException if there is a resource to be published with a 'new' parent
[ "Checks", "that", "no", "one", "of", "the", "resources", "to", "be", "published", "has", "a", "new", "parent", "(", "that", "has", "not", "been", "published", "yet", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10771-L10802