repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/ConfigValidation.java | ConfigValidation.mapFv | public static NestableFieldValidator mapFv(final NestableFieldValidator key,
final NestableFieldValidator val, final boolean nullAllowed) {
return new NestableFieldValidator() {
@SuppressWarnings("unchecked")
@Override
public void validateField(String pd, String name, Object field) throws IllegalArgumentException {
if (nullAllowed && field == null) {
return;
}
if (field instanceof Map) {
for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) field).entrySet()) {
key.validateField("Each key of the map ", name, entry.getKey());
val.validateField("Each value in the map ", name, entry.getValue());
}
return;
}
throw new IllegalArgumentException("Field " + name + " must be a Map");
}
};
} | java | public static NestableFieldValidator mapFv(final NestableFieldValidator key,
final NestableFieldValidator val, final boolean nullAllowed) {
return new NestableFieldValidator() {
@SuppressWarnings("unchecked")
@Override
public void validateField(String pd, String name, Object field) throws IllegalArgumentException {
if (nullAllowed && field == null) {
return;
}
if (field instanceof Map) {
for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) field).entrySet()) {
key.validateField("Each key of the map ", name, entry.getKey());
val.validateField("Each value in the map ", name, entry.getValue());
}
return;
}
throw new IllegalArgumentException("Field " + name + " must be a Map");
}
};
} | [
"public",
"static",
"NestableFieldValidator",
"mapFv",
"(",
"final",
"NestableFieldValidator",
"key",
",",
"final",
"NestableFieldValidator",
"val",
",",
"final",
"boolean",
"nullAllowed",
")",
"{",
"return",
"new",
"NestableFieldValidator",
"(",
")",
"{",
"@",
"Sup... | Returns a new NestableFieldValidator for a Map.
@param key a validator for the keys in the map
@param val a validator for the values in the map
@param nullAllowed whether or not a value of null is valid
@return a NestableFieldValidator for a Map | [
"Returns",
"a",
"new",
"NestableFieldValidator",
"for",
"a",
"Map",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/ConfigValidation.java#L138-L157 |
mapbox/mapbox-navigation-android | libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java | ThemeSwitcher.retrieveNavigationViewStyle | public static int retrieveNavigationViewStyle(Context context, int styleResId) {
TypedValue outValue = resolveAttributeFromId(context, styleResId);
return outValue.resourceId;
} | java | public static int retrieveNavigationViewStyle(Context context, int styleResId) {
TypedValue outValue = resolveAttributeFromId(context, styleResId);
return outValue.resourceId;
} | [
"public",
"static",
"int",
"retrieveNavigationViewStyle",
"(",
"Context",
"context",
",",
"int",
"styleResId",
")",
"{",
"TypedValue",
"outValue",
"=",
"resolveAttributeFromId",
"(",
"context",
",",
"styleResId",
")",
";",
"return",
"outValue",
".",
"resourceId",
... | Looks are current theme and retrieves the style
for the given resId set in the theme.
@param context to retrieve the resolved attribute
@param styleResId for the given style
@return resolved style resource Id | [
"Looks",
"are",
"current",
"theme",
"and",
"retrieves",
"the",
"style",
"for",
"the",
"given",
"resId",
"set",
"in",
"the",
"theme",
"."
] | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/ThemeSwitcher.java#L74-L77 |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getWork | public Duration getWork(Date date, TimeUnit format)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, null);
long time = getTotalTime(ranges);
return convertFormat(time, format);
} | java | public Duration getWork(Date date, TimeUnit format)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, null);
long time = getTotalTime(ranges);
return convertFormat(time, format);
} | [
"public",
"Duration",
"getWork",
"(",
"Date",
"date",
",",
"TimeUnit",
"format",
")",
"{",
"ProjectCalendarDateRanges",
"ranges",
"=",
"getRanges",
"(",
"date",
",",
"null",
",",
"null",
")",
";",
"long",
"time",
"=",
"getTotalTime",
"(",
"ranges",
")",
";... | Retrieves the amount of work on a given day, and
returns it in the specified format.
@param date target date
@param format required format
@return work duration | [
"Retrieves",
"the",
"amount",
"of",
"work",
"on",
"a",
"given",
"day",
"and",
"returns",
"it",
"in",
"the",
"specified",
"format",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L1186-L1191 |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java | MetadataProviderImpl.getMetadata | private <T extends TypeMetadata> T getMetadata(Class<?> type, Class<T> metadataType) {
TypeMetadata typeMetadata = metadataByType.get(type);
if (typeMetadata == null) {
throw new XOException("Cannot resolve metadata for type " + type.getName() + ".");
}
if (!metadataType.isAssignableFrom(typeMetadata.getClass())) {
throw new XOException(
"Expected metadata of type '" + metadataType.getName() + "' but got '" + typeMetadata.getClass() + "' for type '" + type + "'");
}
return metadataType.cast(typeMetadata);
} | java | private <T extends TypeMetadata> T getMetadata(Class<?> type, Class<T> metadataType) {
TypeMetadata typeMetadata = metadataByType.get(type);
if (typeMetadata == null) {
throw new XOException("Cannot resolve metadata for type " + type.getName() + ".");
}
if (!metadataType.isAssignableFrom(typeMetadata.getClass())) {
throw new XOException(
"Expected metadata of type '" + metadataType.getName() + "' but got '" + typeMetadata.getClass() + "' for type '" + type + "'");
}
return metadataType.cast(typeMetadata);
} | [
"private",
"<",
"T",
"extends",
"TypeMetadata",
">",
"T",
"getMetadata",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"T",
">",
"metadataType",
")",
"{",
"TypeMetadata",
"typeMetadata",
"=",
"metadataByType",
".",
"get",
"(",
"type",
")",
";",... | Return the {@link TypeMetadata} instance representing the given type.
@param type
The type.
@param metadataType
The expected metadata type.
@param <T>
The metadata type.
@return The {@link TypeMetadata} instance. | [
"Return",
"the",
"{",
"@link",
"TypeMetadata",
"}",
"instance",
"representing",
"the",
"given",
"type",
"."
] | train | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java#L612-L622 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java | RowReaderDefaultImpl.readObjectFrom | public Object readObjectFrom(Map row) throws PersistenceBrokerException
{
// allow to select a specific classdescriptor
ClassDescriptor cld = selectClassDescriptor(row);
return buildOrRefreshObject(row, cld, null);
} | java | public Object readObjectFrom(Map row) throws PersistenceBrokerException
{
// allow to select a specific classdescriptor
ClassDescriptor cld = selectClassDescriptor(row);
return buildOrRefreshObject(row, cld, null);
} | [
"public",
"Object",
"readObjectFrom",
"(",
"Map",
"row",
")",
"throws",
"PersistenceBrokerException",
"{",
"// allow to select a specific classdescriptor\r",
"ClassDescriptor",
"cld",
"=",
"selectClassDescriptor",
"(",
"row",
")",
";",
"return",
"buildOrRefreshObject",
"(",... | materialize a single object, described by cld,
from the first row of the ResultSet rs.
There are two possible strategies:
1. The persistent class defines a public constructor with arguments matching the persistent
primitive attributes of the class. In this case we build an array args of arguments from rs
and call Constructor.newInstance(args) to build an object.
2. The persistent class does not provide such a constructor, but only a public default
constructor. In this case we create an empty instance with Class.newInstance().
This empty instance is then filled by calling Field::set(obj,getObject(matchingColumn))
for each attribute.
The second strategy needs n calls to Field::set() which are much more expensive
than the filling of the args array in the first strategy.
client applications should therefore define adequate constructors to benefit from
performance gain of the first strategy.
MBAIRD: The rowreader is told what type of object to materialize, so we have to trust
it is asked for the right type. It is possible someone marked an extent in the repository,
but not in java, or vice versa and this could cause problems in what is returned.
we *have* to be able to materialize an object from a row that has a objConcreteClass, as we
retrieve ALL rows belonging to that table. The objects using the rowReader will make sure they
know what they are asking for, so we don't have to make sure a descriptor is assignable from the
selectClassDescriptor. This allows us to map both inherited classes and unrelated classes to the
same table. | [
"materialize",
"a",
"single",
"object",
"described",
"by",
"cld",
"from",
"the",
"first",
"row",
"of",
"the",
"ResultSet",
"rs",
".",
"There",
"are",
"two",
"possible",
"strategies",
":",
"1",
".",
"The",
"persistent",
"class",
"defines",
"a",
"public",
"c... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java#L80-L85 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java | AbstractIndex.getIndexWriter | protected synchronized IndexWriter getIndexWriter() throws IOException
{
if (indexReader != null)
{
indexReader.close();
log.debug("closing IndexReader.");
indexReader = null;
}
if (indexWriter == null)
{
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_36, analyzer);
config.setSimilarity(similarity);
if (config.getMergePolicy() instanceof LogMergePolicy)
{
((LogMergePolicy)config.getMergePolicy()).setUseCompoundFile(useCompoundFile);
}
else if (config.getMergePolicy() instanceof TieredMergePolicy)
{
((TieredMergePolicy)config.getMergePolicy()).setUseCompoundFile(useCompoundFile);
}
else
{
log.error("Can't set \"UseCompoundFile\". Merge policy is not an instance of LogMergePolicy. ");
}
indexWriter = new IndexWriter(directory, config);
setUseCompoundFile(useCompoundFile);
indexWriter.setInfoStream(STREAM_LOGGER);
}
return indexWriter;
} | java | protected synchronized IndexWriter getIndexWriter() throws IOException
{
if (indexReader != null)
{
indexReader.close();
log.debug("closing IndexReader.");
indexReader = null;
}
if (indexWriter == null)
{
IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_36, analyzer);
config.setSimilarity(similarity);
if (config.getMergePolicy() instanceof LogMergePolicy)
{
((LogMergePolicy)config.getMergePolicy()).setUseCompoundFile(useCompoundFile);
}
else if (config.getMergePolicy() instanceof TieredMergePolicy)
{
((TieredMergePolicy)config.getMergePolicy()).setUseCompoundFile(useCompoundFile);
}
else
{
log.error("Can't set \"UseCompoundFile\". Merge policy is not an instance of LogMergePolicy. ");
}
indexWriter = new IndexWriter(directory, config);
setUseCompoundFile(useCompoundFile);
indexWriter.setInfoStream(STREAM_LOGGER);
}
return indexWriter;
} | [
"protected",
"synchronized",
"IndexWriter",
"getIndexWriter",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"indexReader",
"!=",
"null",
")",
"{",
"indexReader",
".",
"close",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"closing IndexReader.\"",
")",
";",
... | Returns an <code>IndexWriter</code> on this index.
@return an <code>IndexWriter</code> on this index.
@throws IOException if the writer cannot be obtained. | [
"Returns",
"an",
"<code",
">",
"IndexWriter<",
"/",
"code",
">",
"on",
"this",
"index",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java#L348-L377 |
Red5/red5-server-common | src/main/java/org/red5/server/scope/Scope.java | Scope.getBasicScope | public IBasicScope getBasicScope(ScopeType type, String name) {
return children.getBasicScope(type, name);
} | java | public IBasicScope getBasicScope(ScopeType type, String name) {
return children.getBasicScope(type, name);
} | [
"public",
"IBasicScope",
"getBasicScope",
"(",
"ScopeType",
"type",
",",
"String",
"name",
")",
"{",
"return",
"children",
".",
"getBasicScope",
"(",
"type",
",",
"name",
")",
";",
"}"
] | Return base scope of given type with given name
@param type Scope type
@param name Scope name
@return Basic scope object | [
"Return",
"base",
"scope",
"of",
"given",
"type",
"with",
"given",
"name"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/scope/Scope.java#L455-L457 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationMain.java | DatabaseInformationMain.createBlankTable | protected final Table createBlankTable(HsqlName name) {
Table table = new Table(database, name, TableBase.SYSTEM_TABLE);
return table;
} | java | protected final Table createBlankTable(HsqlName name) {
Table table = new Table(database, name, TableBase.SYSTEM_TABLE);
return table;
} | [
"protected",
"final",
"Table",
"createBlankTable",
"(",
"HsqlName",
"name",
")",
"{",
"Table",
"table",
"=",
"new",
"Table",
"(",
"database",
",",
"name",
",",
"TableBase",
".",
"SYSTEM_TABLE",
")",
";",
"return",
"table",
";",
"}"
] | Creates a new primoidal system table with the specified name. <p>
@return a new system table
@param name of the table | [
"Creates",
"a",
"new",
"primoidal",
"system",
"table",
"with",
"the",
"specified",
"name",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/dbinfo/DatabaseInformationMain.java#L464-L469 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java | GerritQueryHandler.queryCurrentPatchSets | public List<JSONObject> queryCurrentPatchSets(String queryString) throws
SshException, IOException, GerritQueryException {
return queryJava(queryString, false, true, false, false);
} | java | public List<JSONObject> queryCurrentPatchSets(String queryString) throws
SshException, IOException, GerritQueryException {
return queryJava(queryString, false, true, false, false);
} | [
"public",
"List",
"<",
"JSONObject",
">",
"queryCurrentPatchSets",
"(",
"String",
"queryString",
")",
"throws",
"SshException",
",",
"IOException",
",",
"GerritQueryException",
"{",
"return",
"queryJava",
"(",
"queryString",
",",
"false",
",",
"true",
",",
"false"... | Runs the query and returns the result as a list of Java JSONObjects.
@param queryString the query.
@return the query result as a List of JSONObjects.
@throws GerritQueryException if Gerrit reports an error with the query.
@throws SshException if there is an error in the SSH Connection.
@throws IOException for some other IO problem. | [
"Runs",
"the",
"query",
"and",
"returns",
"the",
"result",
"as",
"a",
"list",
"of",
"Java",
"JSONObjects",
"."
] | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L255-L258 |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/AppController.java | AppController.actionSupportsHttpMethod | public boolean actionSupportsHttpMethod(String actionMethodName, HttpMethod httpMethod) {
if (restful()) {
return restfulActionSupportsHttpMethod(actionMethodName, httpMethod) || standardActionSupportsHttpMethod(actionMethodName, httpMethod);
} else {
return standardActionSupportsHttpMethod(actionMethodName, httpMethod);
}
} | java | public boolean actionSupportsHttpMethod(String actionMethodName, HttpMethod httpMethod) {
if (restful()) {
return restfulActionSupportsHttpMethod(actionMethodName, httpMethod) || standardActionSupportsHttpMethod(actionMethodName, httpMethod);
} else {
return standardActionSupportsHttpMethod(actionMethodName, httpMethod);
}
} | [
"public",
"boolean",
"actionSupportsHttpMethod",
"(",
"String",
"actionMethodName",
",",
"HttpMethod",
"httpMethod",
")",
"{",
"if",
"(",
"restful",
"(",
")",
")",
"{",
"return",
"restfulActionSupportsHttpMethod",
"(",
"actionMethodName",
",",
"httpMethod",
")",
"||... | Checks if the action supports an HTTP method, according to its configuration.
@param actionMethodName name of action method.
@param httpMethod http method
@return true if supports, false if does not. | [
"Checks",
"if",
"the",
"action",
"supports",
"an",
"HTTP",
"method",
"according",
"to",
"its",
"configuration",
"."
] | train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/AppController.java#L111-L117 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java | MsgDestEncodingUtilsImpl.addToMaps | private final static void addToMaps(PropertyCoder propCoder, int intValue, Class type, Object defaultVal, Class<? extends JmsDestinationImpl> suppressIfDefaultInJNDI) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addToMaps", new Object[]{propCoder, intValue, type, defaultVal, suppressIfDefaultInJNDI});
// Extract the long & short names from the PropertyCoder. (We do this, rather than
// passing them in separately, so that the names only have to be coded once).
String longName = propCoder.getLongName();
String shortName = propCoder.getShortName();
// Create the PropertyEntry which holds all the information we could possibly want, & put it in the Master Poperty Map
PropertyEntry propEntry = new PropertyEntry(intValue, type, defaultVal, propCoder);
propertyMap.put(longName, propEntry);
// Add the appropriate reverse mapping to the Reverse Map which is used for decoding
if (shortName != null) {
reverseMap.put(shortName, longName);
}
else {
reverseMap.put(longName, longName);
}
// If this property is to suppressed in JNDI, add it to defaultJNDIProperties map
if (suppressIfDefaultInJNDI != null) {
Map<String,Object> map = defaultJNDIProperties.get(suppressIfDefaultInJNDI);
if (map == null) {
map = new HashMap<String,Object>();
defaultJNDIProperties.put(suppressIfDefaultInJNDI,map);
}
map.put(longName,defaultVal);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addToMaps");
} | java | private final static void addToMaps(PropertyCoder propCoder, int intValue, Class type, Object defaultVal, Class<? extends JmsDestinationImpl> suppressIfDefaultInJNDI) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addToMaps", new Object[]{propCoder, intValue, type, defaultVal, suppressIfDefaultInJNDI});
// Extract the long & short names from the PropertyCoder. (We do this, rather than
// passing them in separately, so that the names only have to be coded once).
String longName = propCoder.getLongName();
String shortName = propCoder.getShortName();
// Create the PropertyEntry which holds all the information we could possibly want, & put it in the Master Poperty Map
PropertyEntry propEntry = new PropertyEntry(intValue, type, defaultVal, propCoder);
propertyMap.put(longName, propEntry);
// Add the appropriate reverse mapping to the Reverse Map which is used for decoding
if (shortName != null) {
reverseMap.put(shortName, longName);
}
else {
reverseMap.put(longName, longName);
}
// If this property is to suppressed in JNDI, add it to defaultJNDIProperties map
if (suppressIfDefaultInJNDI != null) {
Map<String,Object> map = defaultJNDIProperties.get(suppressIfDefaultInJNDI);
if (map == null) {
map = new HashMap<String,Object>();
defaultJNDIProperties.put(suppressIfDefaultInJNDI,map);
}
map.put(longName,defaultVal);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addToMaps");
} | [
"private",
"final",
"static",
"void",
"addToMaps",
"(",
"PropertyCoder",
"propCoder",
",",
"int",
"intValue",
",",
"Class",
"type",
",",
"Object",
"defaultVal",
",",
"Class",
"<",
"?",
"extends",
"JmsDestinationImpl",
">",
"suppressIfDefaultInJNDI",
")",
"{",
"i... | addToMaps
Add an entry to the PropertyMap, mapping the longName of the property to a
PropertyEntry which holds everything else we need to know. Also add an entry
to the reverseMap to allow us to map back from the shortName (if the is one)
to the longName.
@param propCoder The coder to be used for encoding & decoding this property, or null
@param intValue The int for this property, to be used in case statements
@param type The class of the values for this property
@param defaultVal The default value for the property, or null
@param suppressIfDefaultInJNDI If non-null, the class of JMS Objects for which this property should be suppressed in JNDI | [
"addToMaps",
"Add",
"an",
"entry",
"to",
"the",
"PropertyMap",
"mapping",
"the",
"longName",
"of",
"the",
"property",
"to",
"a",
"PropertyEntry",
"which",
"holds",
"everything",
"else",
"we",
"need",
"to",
"know",
".",
"Also",
"add",
"an",
"entry",
"to",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L475-L507 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java | HystrixPropertiesFactory.getCollapserProperties | public static HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey key, HystrixCollapserProperties.Setter builder) {
HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy();
String cacheKey = hystrixPropertiesStrategy.getCollapserPropertiesCacheKey(key, builder);
if (cacheKey != null) {
HystrixCollapserProperties properties = collapserProperties.get(cacheKey);
if (properties != null) {
return properties;
} else {
if (builder == null) {
builder = HystrixCollapserProperties.Setter();
}
// create new instance
properties = hystrixPropertiesStrategy.getCollapserProperties(key, builder);
// cache and return
HystrixCollapserProperties existing = collapserProperties.putIfAbsent(cacheKey, properties);
if (existing == null) {
return properties;
} else {
return existing;
}
}
} else {
// no cacheKey so we generate it with caching
return hystrixPropertiesStrategy.getCollapserProperties(key, builder);
}
} | java | public static HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey key, HystrixCollapserProperties.Setter builder) {
HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy();
String cacheKey = hystrixPropertiesStrategy.getCollapserPropertiesCacheKey(key, builder);
if (cacheKey != null) {
HystrixCollapserProperties properties = collapserProperties.get(cacheKey);
if (properties != null) {
return properties;
} else {
if (builder == null) {
builder = HystrixCollapserProperties.Setter();
}
// create new instance
properties = hystrixPropertiesStrategy.getCollapserProperties(key, builder);
// cache and return
HystrixCollapserProperties existing = collapserProperties.putIfAbsent(cacheKey, properties);
if (existing == null) {
return properties;
} else {
return existing;
}
}
} else {
// no cacheKey so we generate it with caching
return hystrixPropertiesStrategy.getCollapserProperties(key, builder);
}
} | [
"public",
"static",
"HystrixCollapserProperties",
"getCollapserProperties",
"(",
"HystrixCollapserKey",
"key",
",",
"HystrixCollapserProperties",
".",
"Setter",
"builder",
")",
"{",
"HystrixPropertiesStrategy",
"hystrixPropertiesStrategy",
"=",
"HystrixPlugins",
".",
"getInstan... | Get an instance of {@link HystrixCollapserProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixCollapserKey} instance.
@param key
Pass-thru to {@link HystrixPropertiesStrategy#getCollapserProperties} implementation.
@param builder
Pass-thru to {@link HystrixPropertiesStrategy#getCollapserProperties} implementation.
@return {@link HystrixCollapserProperties} instance | [
"Get",
"an",
"instance",
"of",
"{",
"@link",
"HystrixCollapserProperties",
"}",
"with",
"the",
"given",
"factory",
"{",
"@link",
"HystrixPropertiesStrategy",
"}",
"implementation",
"for",
"each",
"{",
"@link",
"HystrixCollapserKey",
"}",
"instance",
"."
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java#L139-L164 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java | OmemoService.getMuc | private static MultiUserChat getMuc(XMPPConnection connection, Jid jid) {
EntityBareJid ebj = jid.asEntityBareJidIfPossible();
if (ebj == null) {
return null;
}
MultiUserChatManager mucm = MultiUserChatManager.getInstanceFor(connection);
Set<EntityBareJid> joinedRooms = mucm.getJoinedRooms();
if (joinedRooms.contains(ebj)) {
return mucm.getMultiUserChat(ebj);
}
return null;
} | java | private static MultiUserChat getMuc(XMPPConnection connection, Jid jid) {
EntityBareJid ebj = jid.asEntityBareJidIfPossible();
if (ebj == null) {
return null;
}
MultiUserChatManager mucm = MultiUserChatManager.getInstanceFor(connection);
Set<EntityBareJid> joinedRooms = mucm.getJoinedRooms();
if (joinedRooms.contains(ebj)) {
return mucm.getMultiUserChat(ebj);
}
return null;
} | [
"private",
"static",
"MultiUserChat",
"getMuc",
"(",
"XMPPConnection",
"connection",
",",
"Jid",
"jid",
")",
"{",
"EntityBareJid",
"ebj",
"=",
"jid",
".",
"asEntityBareJidIfPossible",
"(",
")",
";",
"if",
"(",
"ebj",
"==",
"null",
")",
"{",
"return",
"null",... | Return the joined MUC with EntityBareJid jid, or null if its not a room and/or not joined.
@param connection xmpp connection
@param jid jid (presumably) of the MUC
@return MultiUserChat or null if not a MUC. | [
"Return",
"the",
"joined",
"MUC",
"with",
"EntityBareJid",
"jid",
"or",
"null",
"if",
"its",
"not",
"a",
"room",
"and",
"/",
"or",
"not",
"joined",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L1336-L1349 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobClient.java | JobClient.submitJob | public RunningJob submitJob(JobConf job) throws FileNotFoundException,
IOException {
try {
return submitJobInternal(job);
} catch (InterruptedException ie) {
throw new IOException("interrupted", ie);
} catch (ClassNotFoundException cnfe) {
throw new IOException("class not found", cnfe);
}
} | java | public RunningJob submitJob(JobConf job) throws FileNotFoundException,
IOException {
try {
return submitJobInternal(job);
} catch (InterruptedException ie) {
throw new IOException("interrupted", ie);
} catch (ClassNotFoundException cnfe) {
throw new IOException("class not found", cnfe);
}
} | [
"public",
"RunningJob",
"submitJob",
"(",
"JobConf",
"job",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"try",
"{",
"return",
"submitJobInternal",
"(",
"job",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"throw",
"n... | Submit a job to the MR system.
This returns a handle to the {@link RunningJob} which can be used to track
the running-job.
@param job the job configuration.
@return a handle to the {@link RunningJob} which can be used to track the
running-job.
@throws FileNotFoundException
@throws IOException | [
"Submit",
"a",
"job",
"to",
"the",
"MR",
"system",
".",
"This",
"returns",
"a",
"handle",
"to",
"the",
"{",
"@link",
"RunningJob",
"}",
"which",
"can",
"be",
"used",
"to",
"track",
"the",
"running",
"-",
"job",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobClient.java#L1155-L1164 |
Ekryd/sortpom | sorter/src/main/java/sortpom/util/FileUtil.java | FileUtil.getPomFileContent | public String getPomFileContent() {
try (InputStream inputStream = new FileInputStream(pomFile)) {
return IOUtils.toString(inputStream, encoding);
} catch (UnsupportedCharsetException ex) {
throw new FailureException("Could not handle encoding: " + encoding, ex);
} catch (IOException ex) {
throw new FailureException("Could not read pom file: " + pomFile.getAbsolutePath(), ex);
}
} | java | public String getPomFileContent() {
try (InputStream inputStream = new FileInputStream(pomFile)) {
return IOUtils.toString(inputStream, encoding);
} catch (UnsupportedCharsetException ex) {
throw new FailureException("Could not handle encoding: " + encoding, ex);
} catch (IOException ex) {
throw new FailureException("Could not read pom file: " + pomFile.getAbsolutePath(), ex);
}
} | [
"public",
"String",
"getPomFileContent",
"(",
")",
"{",
"try",
"(",
"InputStream",
"inputStream",
"=",
"new",
"FileInputStream",
"(",
"pomFile",
")",
")",
"{",
"return",
"IOUtils",
".",
"toString",
"(",
"inputStream",
",",
"encoding",
")",
";",
"}",
"catch",... | Loads the pom file that will be sorted.
@return Content of the file | [
"Loads",
"the",
"pom",
"file",
"that",
"will",
"be",
"sorted",
"."
] | train | https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/FileUtil.java#L72-L80 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/StatsTraceContext.java | StatsTraceContext.serverCallStarted | public void serverCallStarted(ServerCallInfo<?, ?> callInfo) {
for (StreamTracer tracer : tracers) {
((ServerStreamTracer) tracer).serverCallStarted(callInfo);
}
} | java | public void serverCallStarted(ServerCallInfo<?, ?> callInfo) {
for (StreamTracer tracer : tracers) {
((ServerStreamTracer) tracer).serverCallStarted(callInfo);
}
} | [
"public",
"void",
"serverCallStarted",
"(",
"ServerCallInfo",
"<",
"?",
",",
"?",
">",
"callInfo",
")",
"{",
"for",
"(",
"StreamTracer",
"tracer",
":",
"tracers",
")",
"{",
"(",
"(",
"ServerStreamTracer",
")",
"tracer",
")",
".",
"serverCallStarted",
"(",
... | See {@link ServerStreamTracer#serverCallStarted}. For server-side only.
<p>Called from {@link io.grpc.internal.ServerImpl}. | [
"See",
"{",
"@link",
"ServerStreamTracer#serverCallStarted",
"}",
".",
"For",
"server",
"-",
"side",
"only",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/StatsTraceContext.java#L150-L154 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.prependIfMissing | private static String prependIfMissing(final String str, final CharSequence prefix, final boolean ignoreCase, final CharSequence... prefixes) {
if (str == null || isEmpty(prefix) || startsWith(str, prefix, ignoreCase)) {
return str;
}
if (prefixes != null && prefixes.length > 0) {
for (final CharSequence p : prefixes) {
if (startsWith(str, p, ignoreCase)) {
return str;
}
}
}
return prefix.toString() + str;
} | java | private static String prependIfMissing(final String str, final CharSequence prefix, final boolean ignoreCase, final CharSequence... prefixes) {
if (str == null || isEmpty(prefix) || startsWith(str, prefix, ignoreCase)) {
return str;
}
if (prefixes != null && prefixes.length > 0) {
for (final CharSequence p : prefixes) {
if (startsWith(str, p, ignoreCase)) {
return str;
}
}
}
return prefix.toString() + str;
} | [
"private",
"static",
"String",
"prependIfMissing",
"(",
"final",
"String",
"str",
",",
"final",
"CharSequence",
"prefix",
",",
"final",
"boolean",
"ignoreCase",
",",
"final",
"CharSequence",
"...",
"prefixes",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
... | Prepends the prefix to the start of the string if the string does not
already start with any of the prefixes.
@param str The string.
@param prefix The prefix to prepend to the start of the string.
@param ignoreCase Indicates whether the compare should ignore case.
@param prefixes Additional prefixes that are valid (optional).
@return A new String if prefix was prepended, the same string otherwise. | [
"Prepends",
"the",
"prefix",
"to",
"the",
"start",
"of",
"the",
"string",
"if",
"the",
"string",
"does",
"not",
"already",
"start",
"with",
"any",
"of",
"the",
"prefixes",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8867-L8879 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.deleteUserDataPair | public void deleteUserDataPair(String connId, String key) throws WorkspaceApiException {
try {
VoicecallsiddeleteuserdatapairData deletePairData =
new VoicecallsiddeleteuserdatapairData();
deletePairData.setKey(key);
KeyData data = new KeyData();
data.data(deletePairData);
ApiSuccessResponse response = this.voiceApi.deleteUserDataPair(connId, data);
throwIfNotOk("deleteUserDataPair", response);
} catch (ApiException e) {
throw new WorkspaceApiException("deleteUserDataPair failed.", e);
}
} | java | public void deleteUserDataPair(String connId, String key) throws WorkspaceApiException {
try {
VoicecallsiddeleteuserdatapairData deletePairData =
new VoicecallsiddeleteuserdatapairData();
deletePairData.setKey(key);
KeyData data = new KeyData();
data.data(deletePairData);
ApiSuccessResponse response = this.voiceApi.deleteUserDataPair(connId, data);
throwIfNotOk("deleteUserDataPair", response);
} catch (ApiException e) {
throw new WorkspaceApiException("deleteUserDataPair failed.", e);
}
} | [
"public",
"void",
"deleteUserDataPair",
"(",
"String",
"connId",
",",
"String",
"key",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsiddeleteuserdatapairData",
"deletePairData",
"=",
"new",
"VoicecallsiddeleteuserdatapairData",
"(",
")",
";",
"dele... | Delete data with the specified key from the call's user data.
@param connId The connection ID of the call.
@param key The key of the data to remove. | [
"Delete",
"data",
"with",
"the",
"specified",
"key",
"from",
"the",
"call",
"s",
"user",
"data",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1104-L1117 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java | CPDisplayLayoutPersistenceImpl.findAll | @Override
public List<CPDisplayLayout> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPDisplayLayout> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDisplayLayout",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp display layouts.
@return the cp display layouts | [
"Returns",
"all",
"the",
"cp",
"display",
"layouts",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L2332-L2335 |
michel-kraemer/citeproc-java | citeproc-java/src/main/java/de/undercouch/citeproc/helper/json/JsonLexer.java | JsonLexer.readNumber | public Number readNumber() throws IOException {
//there should be a character left from readNextToken!
if (currentCharacter < 0) {
throw new IllegalStateException("Missed first digit");
}
//read sign
boolean negative = false;
if (currentCharacter == '-') {
negative = true;
currentCharacter = r.read();
}
//try to real an integer first
long result = 0;
while (currentCharacter >= 0) {
if (currentCharacter >= '0' && currentCharacter <= '9') {
result = result * 10 + currentCharacter - '0';
} else if (currentCharacter == '.') {
//there is a dot. read real number
return readReal(result, negative);
} else {
break;
}
currentCharacter = r.read();
}
return negative ? -result : result;
} | java | public Number readNumber() throws IOException {
//there should be a character left from readNextToken!
if (currentCharacter < 0) {
throw new IllegalStateException("Missed first digit");
}
//read sign
boolean negative = false;
if (currentCharacter == '-') {
negative = true;
currentCharacter = r.read();
}
//try to real an integer first
long result = 0;
while (currentCharacter >= 0) {
if (currentCharacter >= '0' && currentCharacter <= '9') {
result = result * 10 + currentCharacter - '0';
} else if (currentCharacter == '.') {
//there is a dot. read real number
return readReal(result, negative);
} else {
break;
}
currentCharacter = r.read();
}
return negative ? -result : result;
} | [
"public",
"Number",
"readNumber",
"(",
")",
"throws",
"IOException",
"{",
"//there should be a character left from readNextToken!",
"if",
"(",
"currentCharacter",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Missed first digit\"",
")",
";",
"}",
... | Reads a number from the stream
@return the number
@throws IOException if the stream could not be read | [
"Reads",
"a",
"number",
"from",
"the",
"stream"
] | train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/helper/json/JsonLexer.java#L264-L292 |
eclipse/xtext-core | org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java | IdeContentProposalCreator.createProposal | public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) {
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null);
} | java | public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) {
return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null);
} | [
"public",
"ContentAssistEntry",
"createProposal",
"(",
"final",
"String",
"proposal",
",",
"final",
"ContentAssistContext",
"context",
")",
"{",
"return",
"this",
".",
"createProposal",
"(",
"proposal",
",",
"context",
".",
"getPrefix",
"(",
")",
",",
"context",
... | Returns an entry with the given proposal and the prefix from the context, or null if the proposal is not valid. | [
"Returns",
"an",
"entry",
"with",
"the",
"given",
"proposal",
"and",
"the",
"prefix",
"from",
"the",
"context",
"or",
"null",
"if",
"the",
"proposal",
"is",
"not",
"valid",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java#L36-L38 |
apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.getStaticProperty | public static PropertyNode getStaticProperty(ClassNode cNode, String propName) {
ClassNode classNode = cNode;
while (classNode != null) {
for (PropertyNode pn : classNode.getProperties()) {
if (pn.getName().equals(propName) && pn.isStatic()) return pn;
}
classNode = classNode.getSuperClass();
}
return null;
} | java | public static PropertyNode getStaticProperty(ClassNode cNode, String propName) {
ClassNode classNode = cNode;
while (classNode != null) {
for (PropertyNode pn : classNode.getProperties()) {
if (pn.getName().equals(propName) && pn.isStatic()) return pn;
}
classNode = classNode.getSuperClass();
}
return null;
} | [
"public",
"static",
"PropertyNode",
"getStaticProperty",
"(",
"ClassNode",
"cNode",
",",
"String",
"propName",
")",
"{",
"ClassNode",
"classNode",
"=",
"cNode",
";",
"while",
"(",
"classNode",
"!=",
"null",
")",
"{",
"for",
"(",
"PropertyNode",
"pn",
":",
"c... | Detect whether a static property with the given name is within the class
or a super class.
@param cNode the ClassNode of interest
@param propName the property name
@return the static property if found or else null | [
"Detect",
"whether",
"a",
"static",
"property",
"with",
"the",
"given",
"name",
"is",
"within",
"the",
"class",
"or",
"a",
"super",
"class",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L319-L328 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/writer/BeanDefinitionWriter.java | BeanDefinitionWriter.visitBeanDefinitionConstructor | @Override
public void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata,
boolean requiresReflection) {
if (constructorVisitor == null) {
// first build the constructor
visitBeanDefinitionConstructorInternal(annotationMetadata, requiresReflection, Collections.emptyMap(), null, null);
// now prepare the implementation of the build method. See BeanFactory interface
visitBuildMethodDefinition(annotationMetadata, Collections.emptyMap(), Collections.emptyMap());
// now override the injectBean method
visitInjectMethodDefinition();
}
} | java | @Override
public void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata,
boolean requiresReflection) {
if (constructorVisitor == null) {
// first build the constructor
visitBeanDefinitionConstructorInternal(annotationMetadata, requiresReflection, Collections.emptyMap(), null, null);
// now prepare the implementation of the build method. See BeanFactory interface
visitBuildMethodDefinition(annotationMetadata, Collections.emptyMap(), Collections.emptyMap());
// now override the injectBean method
visitInjectMethodDefinition();
}
} | [
"@",
"Override",
"public",
"void",
"visitBeanDefinitionConstructor",
"(",
"AnnotationMetadata",
"annotationMetadata",
",",
"boolean",
"requiresReflection",
")",
"{",
"if",
"(",
"constructorVisitor",
"==",
"null",
")",
"{",
"// first build the constructor",
"visitBeanDefinit... | Visits a no-args constructor used to create the bean definition. | [
"Visits",
"a",
"no",
"-",
"args",
"constructor",
"used",
"to",
"create",
"the",
"bean",
"definition",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/BeanDefinitionWriter.java#L438-L451 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java | Gradient.setKnotPosition | public void setKnotPosition(int n, int x) {
xKnots[n] = ImageMath.clamp(x, 0, 255);
sortKnots();
rebuildGradient();
} | java | public void setKnotPosition(int n, int x) {
xKnots[n] = ImageMath.clamp(x, 0, 255);
sortKnots();
rebuildGradient();
} | [
"public",
"void",
"setKnotPosition",
"(",
"int",
"n",
",",
"int",
"x",
")",
"{",
"xKnots",
"[",
"n",
"]",
"=",
"ImageMath",
".",
"clamp",
"(",
"x",
",",
"0",
",",
"255",
")",
";",
"sortKnots",
"(",
")",
";",
"rebuildGradient",
"(",
")",
";",
"}"
... | Set a knot position.
@param n the knot index
@param x the knot position
@see #setKnotPosition | [
"Set",
"a",
"knot",
"position",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L344-L348 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java | MsgPackOutput.writeExtensionString | void writeExtensionString(int extensionType, String str) throws IOException {
byte[] bytes = str.getBytes(UTF_8);
if (bytes.length > 256) {
throw new IllegalArgumentException("String too long");
}
output.write(EXT_8);
output.write(bytes.length);
output.write(extensionType);
output.write(bytes);
} | java | void writeExtensionString(int extensionType, String str) throws IOException {
byte[] bytes = str.getBytes(UTF_8);
if (bytes.length > 256) {
throw new IllegalArgumentException("String too long");
}
output.write(EXT_8);
output.write(bytes.length);
output.write(extensionType);
output.write(bytes);
} | [
"void",
"writeExtensionString",
"(",
"int",
"extensionType",
",",
"String",
"str",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"str",
".",
"getBytes",
"(",
"UTF_8",
")",
";",
"if",
"(",
"bytes",
".",
"length",
">",
"256",
")",
"{... | Writes an extension string using EXT_8.
@param extensionType the type
@param str the string to write as the data
@throws IOException if an error occurs | [
"Writes",
"an",
"extension",
"string",
"using",
"EXT_8",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java#L292-L301 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/FindIdentifiers.java | FindIdentifiers.findIdent | public static Symbol findIdent(String name, VisitorState state) {
return findIdent(name, state, KindSelector.VAR);
} | java | public static Symbol findIdent(String name, VisitorState state) {
return findIdent(name, state, KindSelector.VAR);
} | [
"public",
"static",
"Symbol",
"findIdent",
"(",
"String",
"name",
",",
"VisitorState",
"state",
")",
"{",
"return",
"findIdent",
"(",
"name",
",",
"state",
",",
"KindSelector",
".",
"VAR",
")",
";",
"}"
] | Finds a variable declaration with the given name that is in scope at the current location. | [
"Finds",
"a",
"variable",
"declaration",
"with",
"the",
"given",
"name",
"that",
"is",
"in",
"scope",
"at",
"the",
"current",
"location",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/FindIdentifiers.java#L80-L82 |
kejunxia/AndroidMvc | library/poke/src/main/java/com/shipdream/lib/poke/util/ReflectUtils.java | ReflectUtils.getFieldValue | public static Object getFieldValue(Object obj, Field field) {
Object value = null;
boolean accessible = field.isAccessible();
//hack accessibility
if (!accessible) {
field.setAccessible(true);
}
try {
value = field.get(obj);
} catch (IllegalAccessException e) {
//ignore should not happen as accessibility has been updated to suit assignment
e.printStackTrace(); // $COVERAGE-IGNORE$
}
//restore accessibility
field.setAccessible(accessible);
return value;
} | java | public static Object getFieldValue(Object obj, Field field) {
Object value = null;
boolean accessible = field.isAccessible();
//hack accessibility
if (!accessible) {
field.setAccessible(true);
}
try {
value = field.get(obj);
} catch (IllegalAccessException e) {
//ignore should not happen as accessibility has been updated to suit assignment
e.printStackTrace(); // $COVERAGE-IGNORE$
}
//restore accessibility
field.setAccessible(accessible);
return value;
} | [
"public",
"static",
"Object",
"getFieldValue",
"(",
"Object",
"obj",
",",
"Field",
"field",
")",
"{",
"Object",
"value",
"=",
"null",
";",
"boolean",
"accessible",
"=",
"field",
".",
"isAccessible",
"(",
")",
";",
"//hack accessibility",
"if",
"(",
"!",
"a... | Gets value of the field of the given object.
@param obj The object
@param field The field | [
"Gets",
"value",
"of",
"the",
"field",
"of",
"the",
"given",
"object",
"."
] | train | https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/poke/src/main/java/com/shipdream/lib/poke/util/ReflectUtils.java#L112-L128 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br/br_snmpmanager.java | br_snmpmanager.addmanager | public static br_snmpmanager addmanager(nitro_service client, br_snmpmanager resource) throws Exception
{
return ((br_snmpmanager[]) resource.perform_operation(client, "addmanager"))[0];
} | java | public static br_snmpmanager addmanager(nitro_service client, br_snmpmanager resource) throws Exception
{
return ((br_snmpmanager[]) resource.perform_operation(client, "addmanager"))[0];
} | [
"public",
"static",
"br_snmpmanager",
"addmanager",
"(",
"nitro_service",
"client",
",",
"br_snmpmanager",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"br_snmpmanager",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
... | <pre>
Use this operation to add snmp manager to Repeater Instances.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"add",
"snmp",
"manager",
"to",
"Repeater",
"Instances",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_snmpmanager.java#L147-L150 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/DeltaCollectionValuedMap.java | DeltaCollectionValuedMap.addAll | @Override
public void addAll(Map<K, V> m) {
for (Map.Entry<K, V> e : m.entrySet()) {
add(e.getKey(), e.getValue());
}
} | java | @Override
public void addAll(Map<K, V> m) {
for (Map.Entry<K, V> e : m.entrySet()) {
add(e.getKey(), e.getValue());
}
} | [
"@",
"Override",
"public",
"void",
"addAll",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"m",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
"e",
":",
"m",
".",
"entrySet",
"(",
")",
")",
"{",
"add",
"(",
"e",
".",
"getKey",
... | Adds all of the mappings in m to this CollectionValuedMap.
If m is a CollectionValuedMap, it will behave strangely. Use the constructor instead. | [
"Adds",
"all",
"of",
"the",
"mappings",
"in",
"m",
"to",
"this",
"CollectionValuedMap",
".",
"If",
"m",
"is",
"a",
"CollectionValuedMap",
"it",
"will",
"behave",
"strangely",
".",
"Use",
"the",
"constructor",
"instead",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/DeltaCollectionValuedMap.java#L126-L131 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.deleteUserDataPair | public ApiSuccessResponse deleteUserDataPair(String id, KeyData keyData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = deleteUserDataPairWithHttpInfo(id, keyData);
return resp.getData();
} | java | public ApiSuccessResponse deleteUserDataPair(String id, KeyData keyData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = deleteUserDataPairWithHttpInfo(id, keyData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"deleteUserDataPair",
"(",
"String",
"id",
",",
"KeyData",
"keyData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"deleteUserDataPairWithHttpInfo",
"(",
"id",
",",
"keyData",
")",
";... | Remove a key/value pair from user data
Delete data with the specified key from the call's user data.
@param id The connection ID of the call. (required)
@param keyData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Remove",
"a",
"key",
"/",
"value",
"pair",
"from",
"user",
"data",
"Delete",
"data",
"with",
"the",
"specified",
"key",
"from",
"the",
"call'",
";",
"s",
"user",
"data",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L1343-L1346 |
r0adkll/PostOffice | library/src/main/java/com/r0adkll/postoffice/PostOffice.java | PostOffice.newProgressMail | public static Delivery newProgressMail(@NotNull Context ctx, CharSequence title, String suffix, boolean indeterminate){
Delivery.Builder builder = new Delivery.Builder(ctx)
.setTitle(title)
.setStyle(new ProgressStyle.Builder(ctx)
.setIndeterminate(indeterminate)
.setCloseOnFinish(true)
.setPercentageMode(false)
.setSuffix(suffix)
.build());
// Override some defaults
return builder.setCancelable(false)
.setCanceledOnTouchOutside(false)
.build();
} | java | public static Delivery newProgressMail(@NotNull Context ctx, CharSequence title, String suffix, boolean indeterminate){
Delivery.Builder builder = new Delivery.Builder(ctx)
.setTitle(title)
.setStyle(new ProgressStyle.Builder(ctx)
.setIndeterminate(indeterminate)
.setCloseOnFinish(true)
.setPercentageMode(false)
.setSuffix(suffix)
.build());
// Override some defaults
return builder.setCancelable(false)
.setCanceledOnTouchOutside(false)
.build();
} | [
"public",
"static",
"Delivery",
"newProgressMail",
"(",
"@",
"NotNull",
"Context",
"ctx",
",",
"CharSequence",
"title",
",",
"String",
"suffix",
",",
"boolean",
"indeterminate",
")",
"{",
"Delivery",
".",
"Builder",
"builder",
"=",
"new",
"Delivery",
".",
"Bui... | Create a new ProgressDialog 'Mail' delivery to display
@param ctx the application context
@param title the dialog title
@param suffix the progress text suffix
@param indeterminate the progress indeterminate flag
@return the new Delivery | [
"Create",
"a",
"new",
"ProgressDialog",
"Mail",
"delivery",
"to",
"display"
] | train | https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/PostOffice.java#L369-L383 |
threerings/nenya | tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundlerTask.java | TileSetBundlerTask.getTargetPath | protected String getTargetPath (File fromDir, String path)
{
return path.substring(0, path.length()-4) + ".jar";
} | java | protected String getTargetPath (File fromDir, String path)
{
return path.substring(0, path.length()-4) + ".jar";
} | [
"protected",
"String",
"getTargetPath",
"(",
"File",
"fromDir",
",",
"String",
"path",
")",
"{",
"return",
"path",
".",
"substring",
"(",
"0",
",",
"path",
".",
"length",
"(",
")",
"-",
"4",
")",
"+",
"\".jar\"",
";",
"}"
] | Returns the target path in which our bundler will write the tile set. | [
"Returns",
"the",
"target",
"path",
"in",
"which",
"our",
"bundler",
"will",
"write",
"the",
"tile",
"set",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundlerTask.java#L162-L165 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java | DynamoDBMapper.setValue | private <T> void setValue(final T toReturn, final Method getter, AttributeValue value) {
Method setter = reflector.getSetter(getter);
ArgumentUnmarshaller unmarhsaller = reflector.getArgumentUnmarshaller(toReturn, getter, setter);
unmarhsaller.typeCheck(value, setter);
Object argument;
try {
argument = unmarhsaller.unmarshall(value);
} catch ( IllegalArgumentException e ) {
throw new DynamoDBMappingException("Couldn't unmarshall value " + value + " for " + setter, e);
} catch ( ParseException e ) {
throw new DynamoDBMappingException("Error attempting to parse date string " + value + " for "+ setter, e);
}
safeInvoke(setter, toReturn, argument);
} | java | private <T> void setValue(final T toReturn, final Method getter, AttributeValue value) {
Method setter = reflector.getSetter(getter);
ArgumentUnmarshaller unmarhsaller = reflector.getArgumentUnmarshaller(toReturn, getter, setter);
unmarhsaller.typeCheck(value, setter);
Object argument;
try {
argument = unmarhsaller.unmarshall(value);
} catch ( IllegalArgumentException e ) {
throw new DynamoDBMappingException("Couldn't unmarshall value " + value + " for " + setter, e);
} catch ( ParseException e ) {
throw new DynamoDBMappingException("Error attempting to parse date string " + value + " for "+ setter, e);
}
safeInvoke(setter, toReturn, argument);
} | [
"private",
"<",
"T",
">",
"void",
"setValue",
"(",
"final",
"T",
"toReturn",
",",
"final",
"Method",
"getter",
",",
"AttributeValue",
"value",
")",
"{",
"Method",
"setter",
"=",
"reflector",
".",
"getSetter",
"(",
"getter",
")",
";",
"ArgumentUnmarshaller",
... | Sets the value in the return object corresponding to the service result. | [
"Sets",
"the",
"value",
"in",
"the",
"return",
"object",
"corresponding",
"to",
"the",
"service",
"result",
"."
] | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L339-L355 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java | HadoopJobUtils.loadHadoopSecurityManager | public static HadoopSecurityManager loadHadoopSecurityManager(Props props, Logger log)
throws RuntimeException {
Class<?> hadoopSecurityManagerClass = props.getClass(HADOOP_SECURITY_MANAGER_CLASS_PARAM, true,
HadoopJobUtils.class.getClassLoader());
log.info("Loading hadoop security manager " + hadoopSecurityManagerClass.getName());
HadoopSecurityManager hadoopSecurityManager = null;
try {
Method getInstanceMethod = hadoopSecurityManagerClass.getMethod("getInstance", Props.class);
hadoopSecurityManager = (HadoopSecurityManager) getInstanceMethod.invoke(
hadoopSecurityManagerClass, props);
} catch (InvocationTargetException e) {
String errMsg = "Could not instantiate Hadoop Security Manager "
+ hadoopSecurityManagerClass.getName() + e.getCause();
log.error(errMsg);
throw new RuntimeException(errMsg, e);
} catch (Exception e) {
throw new RuntimeException(e);
}
return hadoopSecurityManager;
} | java | public static HadoopSecurityManager loadHadoopSecurityManager(Props props, Logger log)
throws RuntimeException {
Class<?> hadoopSecurityManagerClass = props.getClass(HADOOP_SECURITY_MANAGER_CLASS_PARAM, true,
HadoopJobUtils.class.getClassLoader());
log.info("Loading hadoop security manager " + hadoopSecurityManagerClass.getName());
HadoopSecurityManager hadoopSecurityManager = null;
try {
Method getInstanceMethod = hadoopSecurityManagerClass.getMethod("getInstance", Props.class);
hadoopSecurityManager = (HadoopSecurityManager) getInstanceMethod.invoke(
hadoopSecurityManagerClass, props);
} catch (InvocationTargetException e) {
String errMsg = "Could not instantiate Hadoop Security Manager "
+ hadoopSecurityManagerClass.getName() + e.getCause();
log.error(errMsg);
throw new RuntimeException(errMsg, e);
} catch (Exception e) {
throw new RuntimeException(e);
}
return hadoopSecurityManager;
} | [
"public",
"static",
"HadoopSecurityManager",
"loadHadoopSecurityManager",
"(",
"Props",
"props",
",",
"Logger",
"log",
")",
"throws",
"RuntimeException",
"{",
"Class",
"<",
"?",
">",
"hadoopSecurityManagerClass",
"=",
"props",
".",
"getClass",
"(",
"HADOOP_SECURITY_MA... | Based on the HADOOP_SECURITY_MANAGER_CLASS_PARAM setting in the incoming props, finds the
correct HadoopSecurityManager Java class
@return a HadoopSecurityManager object. Will throw exception if any errors occur (including not
finding a class)
@throws RuntimeException : If any errors happen along the way. | [
"Based",
"on",
"the",
"HADOOP_SECURITY_MANAGER_CLASS_PARAM",
"setting",
"in",
"the",
"incoming",
"props",
"finds",
"the",
"correct",
"HadoopSecurityManager",
"Java",
"class"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java#L119-L141 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetUtils.java | NetUtils.getOutputStream | public static OutputStream getOutputStream(Socket socket, long timeout)
throws IOException {
return (socket.getChannel() == null) ?
socket.getOutputStream() : new SocketOutputStream(socket, timeout);
} | java | public static OutputStream getOutputStream(Socket socket, long timeout)
throws IOException {
return (socket.getChannel() == null) ?
socket.getOutputStream() : new SocketOutputStream(socket, timeout);
} | [
"public",
"static",
"OutputStream",
"getOutputStream",
"(",
"Socket",
"socket",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"return",
"(",
"socket",
".",
"getChannel",
"(",
")",
"==",
"null",
")",
"?",
"socket",
".",
"getOutputStream",
"(",
")... | Returns OutputStream for the socket. If the socket has an associated
SocketChannel then it returns a
{@link SocketOutputStream} with the given timeout. If the socket does not
have a channel, {@link Socket#getOutputStream()} is returned. In the later
case, the timeout argument is ignored and the write will wait until
data is available.<br><br>
Any socket created using socket factories returned by {@link #NetUtils},
must use this interface instead of {@link Socket#getOutputStream()}.
@see Socket#getChannel()
@param socket
@param timeout timeout in milliseconds. This may not always apply. zero
for waiting as long as necessary.
@return OutputStream for writing to the socket.
@throws IOException | [
"Returns",
"OutputStream",
"for",
"the",
"socket",
".",
"If",
"the",
"socket",
"has",
"an",
"associated",
"SocketChannel",
"then",
"it",
"returns",
"a",
"{",
"@link",
"SocketOutputStream",
"}",
"with",
"the",
"given",
"timeout",
".",
"If",
"the",
"socket",
"... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L390-L394 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/I18nUtil.java | I18nUtil.getResourceBundle | public static ResourceBundle getResourceBundle(String bundleName, Locale locale)
{
return ResourceBundle.getBundle(bundleName, locale);
} | java | public static ResourceBundle getResourceBundle(String bundleName, Locale locale)
{
return ResourceBundle.getBundle(bundleName, locale);
} | [
"public",
"static",
"ResourceBundle",
"getResourceBundle",
"(",
"String",
"bundleName",
",",
"Locale",
"locale",
")",
"{",
"return",
"ResourceBundle",
".",
"getBundle",
"(",
"bundleName",
",",
"locale",
")",
";",
"}"
] | <p>getResourceBundle.</p>
@param bundleName a {@link java.lang.String} object.
@param locale a {@link java.util.Locale} object.
@return a {@link java.util.ResourceBundle} object. | [
"<p",
">",
"getResourceBundle",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/I18nUtil.java#L69-L72 |
groupon/robo-remote | RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java | Solo2.waitForActivity | public boolean waitForActivity(ComponentName name, int retryTime) {
final int retryPeriod = 250;
int retryNum = retryTime / retryPeriod;
for (int i = 0; i < retryNum; i++) {
if (this.getCurrentActivity().getComponentName().equals(name)) {
break;
}
if (i == retryNum - 1) {
return false;
}
this.sleep(retryPeriod);
}
return true;
} | java | public boolean waitForActivity(ComponentName name, int retryTime) {
final int retryPeriod = 250;
int retryNum = retryTime / retryPeriod;
for (int i = 0; i < retryNum; i++) {
if (this.getCurrentActivity().getComponentName().equals(name)) {
break;
}
if (i == retryNum - 1) {
return false;
}
this.sleep(retryPeriod);
}
return true;
} | [
"public",
"boolean",
"waitForActivity",
"(",
"ComponentName",
"name",
",",
"int",
"retryTime",
")",
"{",
"final",
"int",
"retryPeriod",
"=",
"250",
";",
"int",
"retryNum",
"=",
"retryTime",
"/",
"retryPeriod",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Wait for activity to become active (by component name)
@param name
@param retryTime | [
"Wait",
"for",
"activity",
"to",
"become",
"active",
"(",
"by",
"component",
"name",
")"
] | train | https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L191-L204 |
Axway/Grapes | commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java | DataModelFactory.createDependency | public static Dependency createDependency(final Artifact artifact, final String scope) throws UnsupportedScopeException{
try{
final Scope depScope = Scope.valueOf(scope.toUpperCase());
return createDependency(artifact, depScope);
}
catch(IllegalArgumentException e){
LOG.log(Level.SEVERE, String.format("Cannot identify scope for string %s. Details: %s", scope, e.getMessage()), e);
throw new UnsupportedScopeException();
}
} | java | public static Dependency createDependency(final Artifact artifact, final String scope) throws UnsupportedScopeException{
try{
final Scope depScope = Scope.valueOf(scope.toUpperCase());
return createDependency(artifact, depScope);
}
catch(IllegalArgumentException e){
LOG.log(Level.SEVERE, String.format("Cannot identify scope for string %s. Details: %s", scope, e.getMessage()), e);
throw new UnsupportedScopeException();
}
} | [
"public",
"static",
"Dependency",
"createDependency",
"(",
"final",
"Artifact",
"artifact",
",",
"final",
"String",
"scope",
")",
"throws",
"UnsupportedScopeException",
"{",
"try",
"{",
"final",
"Scope",
"depScope",
"=",
"Scope",
".",
"valueOf",
"(",
"scope",
".... | Generates a dependency regarding the parameters.
@param artifact Artifact
@param scope String
@return Dependency
@throws UnsupportedScopeException | [
"Generates",
"a",
"dependency",
"regarding",
"the",
"parameters",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L159-L168 |
HubSpot/Singularity | SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java | SingularityMesosSchedulerClient.frameworkMessage | public void frameworkMessage(ExecutorID executorId, AgentID agentId, byte[] data) {
Builder message = build()
.setMessage(Message.newBuilder().setAgentId(agentId).setExecutorId(executorId).setData(ByteString.copyFrom(data)));
sendCall(message, Type.MESSAGE);
} | java | public void frameworkMessage(ExecutorID executorId, AgentID agentId, byte[] data) {
Builder message = build()
.setMessage(Message.newBuilder().setAgentId(agentId).setExecutorId(executorId).setData(ByteString.copyFrom(data)));
sendCall(message, Type.MESSAGE);
} | [
"public",
"void",
"frameworkMessage",
"(",
"ExecutorID",
"executorId",
",",
"AgentID",
"agentId",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"Builder",
"message",
"=",
"build",
"(",
")",
".",
"setMessage",
"(",
"Message",
".",
"newBuilder",
"(",
")",
".",
... | Sent by the scheduler to send arbitrary binary data to the executor. Mesos neither interprets this data nor
makes any guarantees about the delivery of this message to the executor. data is raw bytes encoded in Base64.
@param executorId
@param agentId
@param data | [
"Sent",
"by",
"the",
"scheduler",
"to",
"send",
"arbitrary",
"binary",
"data",
"to",
"the",
"executor",
".",
"Mesos",
"neither",
"interprets",
"this",
"data",
"nor",
"makes",
"any",
"guarantees",
"about",
"the",
"delivery",
"of",
"this",
"message",
"to",
"th... | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityService/src/main/java/com/hubspot/singularity/mesos/SingularityMesosSchedulerClient.java#L410-L414 |
zeromq/jeromq | src/main/java/org/zeromq/util/ZData.java | ZData.streq | public static boolean streq(byte[] data, String str)
{
if (data == null) {
return false;
}
return new String(data, ZMQ.CHARSET).compareTo(str) == 0;
} | java | public static boolean streq(byte[] data, String str)
{
if (data == null) {
return false;
}
return new String(data, ZMQ.CHARSET).compareTo(str) == 0;
} | [
"public",
"static",
"boolean",
"streq",
"(",
"byte",
"[",
"]",
"data",
",",
"String",
"str",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"new",
"String",
"(",
"data",
",",
"ZMQ",
".",
"CHARSET",
")",
... | String equals.
Uses String compareTo for the comparison (lexigraphical)
@param str String to compare with data
@param data the binary data to compare
@return True if data matches given string | [
"String",
"equals",
".",
"Uses",
"String",
"compareTo",
"for",
"the",
"comparison",
"(",
"lexigraphical",
")"
] | train | https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/util/ZData.java#L37-L43 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java | CmsAttributeHandler.createNestedEntitiesForChoicePath | public void createNestedEntitiesForChoicePath(CmsEntity value, List<String> choicePath) {
CmsEntity parentValue = value;
for (String attributeChoice : choicePath) {
CmsType choiceType = m_entityBackEnd.getType(parentValue.getTypeName()).getAttributeType(
CmsType.CHOICE_ATTRIBUTE_NAME);
CmsEntity choice = m_entityBackEnd.createEntity(null, choiceType.getId());
parentValue.addAttributeValue(CmsType.CHOICE_ATTRIBUTE_NAME, choice);
CmsType choiceOptionType = choiceType.getAttributeType(attributeChoice);
if (choiceOptionType.isSimpleType()) {
String choiceValue = m_widgetService.getDefaultAttributeValue(attributeChoice, getSimplePath(0));
choice.addAttributeValue(attributeChoice, choiceValue);
break;
} else {
CmsEntity choiceValue = m_entityBackEnd.createEntity(null, choiceOptionType.getId());
choice.addAttributeValue(attributeChoice, choiceValue);
parentValue = choiceValue;
}
}
} | java | public void createNestedEntitiesForChoicePath(CmsEntity value, List<String> choicePath) {
CmsEntity parentValue = value;
for (String attributeChoice : choicePath) {
CmsType choiceType = m_entityBackEnd.getType(parentValue.getTypeName()).getAttributeType(
CmsType.CHOICE_ATTRIBUTE_NAME);
CmsEntity choice = m_entityBackEnd.createEntity(null, choiceType.getId());
parentValue.addAttributeValue(CmsType.CHOICE_ATTRIBUTE_NAME, choice);
CmsType choiceOptionType = choiceType.getAttributeType(attributeChoice);
if (choiceOptionType.isSimpleType()) {
String choiceValue = m_widgetService.getDefaultAttributeValue(attributeChoice, getSimplePath(0));
choice.addAttributeValue(attributeChoice, choiceValue);
break;
} else {
CmsEntity choiceValue = m_entityBackEnd.createEntity(null, choiceOptionType.getId());
choice.addAttributeValue(attributeChoice, choiceValue);
parentValue = choiceValue;
}
}
} | [
"public",
"void",
"createNestedEntitiesForChoicePath",
"(",
"CmsEntity",
"value",
",",
"List",
"<",
"String",
">",
"choicePath",
")",
"{",
"CmsEntity",
"parentValue",
"=",
"value",
";",
"for",
"(",
"String",
"attributeChoice",
":",
"choicePath",
")",
"{",
"CmsTy... | Creates a sequence of nested entities according to a given path of choice attribute names.<p>
@param value the entity into which the new entities for the given path should be inserted
@param choicePath the path of choice attributes | [
"Creates",
"a",
"sequence",
"of",
"nested",
"entities",
"according",
"to",
"a",
"given",
"path",
"of",
"choice",
"attribute",
"names",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L422-L441 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java | XpathMappingDataDictionary.containsNode | private boolean containsNode(NodeList findings, Node node) {
for (int i = 0; i < findings.getLength(); i++) {
if (findings.item(i).equals(node)) {
return true;
}
}
return false;
} | java | private boolean containsNode(NodeList findings, Node node) {
for (int i = 0; i < findings.getLength(); i++) {
if (findings.item(i).equals(node)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"containsNode",
"(",
"NodeList",
"findings",
",",
"Node",
"node",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"findings",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"findings",
".",
"item",... | Checks if given node set contains node.
@param findings
@param node
@return | [
"Checks",
"if",
"given",
"node",
"set",
"contains",
"node",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java#L75-L83 |
umano/AndroidSlidingUpPanel | library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java | ViewDragHelper.isViewUnder | public boolean isViewUnder(View view, int x, int y) {
if (view == null) {
return false;
}
return x >= view.getLeft() &&
x < view.getRight() &&
y >= view.getTop() &&
y < view.getBottom();
} | java | public boolean isViewUnder(View view, int x, int y) {
if (view == null) {
return false;
}
return x >= view.getLeft() &&
x < view.getRight() &&
y >= view.getTop() &&
y < view.getBottom();
} | [
"public",
"boolean",
"isViewUnder",
"(",
"View",
"view",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"view",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"x",
">=",
"view",
".",
"getLeft",
"(",
")",
"&&",
"x",
"<",
... | Determine if the supplied view is under the given point in the
parent view's coordinate system.
@param view Child view of the parent to hit test
@param x X position to test in the parent's coordinate system
@param y Y position to test in the parent's coordinate system
@return true if the supplied view is under the given point, false otherwise | [
"Determine",
"if",
"the",
"supplied",
"view",
"is",
"under",
"the",
"given",
"point",
"in",
"the",
"parent",
"view",
"s",
"coordinate",
"system",
"."
] | train | https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L1462-L1470 |
joniles/mpxj | src/main/java/net/sf/mpxj/json/JsonWriter.java | JsonWriter.writeField | private void writeField(FieldType field, Object value) throws IOException
{
String fieldName = field.name().toLowerCase();
writeField(fieldName, field.getDataType(), value);
} | java | private void writeField(FieldType field, Object value) throws IOException
{
String fieldName = field.name().toLowerCase();
writeField(fieldName, field.getDataType(), value);
} | [
"private",
"void",
"writeField",
"(",
"FieldType",
"field",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"String",
"fieldName",
"=",
"field",
".",
"name",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"writeField",
"(",
"fieldName",
",",
"fiel... | Write the appropriate data for a field to the JSON file based on its type.
@param field field type
@param value field value | [
"Write",
"the",
"appropriate",
"data",
"for",
"a",
"field",
"to",
"the",
"JSON",
"file",
"based",
"on",
"its",
"type",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L275-L279 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java | AbstractRenderer.convertToDiagramBounds | protected Rectangle convertToDiagramBounds(Rectangle2D modelBounds) {
double xCenter = modelBounds.getCenterX();
double yCenter = modelBounds.getCenterY();
double modelWidth = modelBounds.getWidth();
double modelHeight = modelBounds.getHeight();
double scale = rendererModel.getParameter(Scale.class).getValue();
double zoom = rendererModel.getParameter(ZoomFactor.class).getValue();
Point2d screenCoord = this.toScreenCoordinates(xCenter, yCenter);
// special case for 0 or 1 atoms
if (modelWidth == 0 && modelHeight == 0) {
return new Rectangle((int) screenCoord.x, (int) screenCoord.y, 0, 0);
}
double margin = rendererModel.getParameter(Margin.class).getValue();
int width = (int) ((scale * zoom * modelWidth) + (2 * margin));
int height = (int) ((scale * zoom * modelHeight) + (2 * margin));
int xCoord = (int) (screenCoord.x - width / 2);
int yCoord = (int) (screenCoord.y - height / 2);
return new Rectangle(xCoord, yCoord, width, height);
} | java | protected Rectangle convertToDiagramBounds(Rectangle2D modelBounds) {
double xCenter = modelBounds.getCenterX();
double yCenter = modelBounds.getCenterY();
double modelWidth = modelBounds.getWidth();
double modelHeight = modelBounds.getHeight();
double scale = rendererModel.getParameter(Scale.class).getValue();
double zoom = rendererModel.getParameter(ZoomFactor.class).getValue();
Point2d screenCoord = this.toScreenCoordinates(xCenter, yCenter);
// special case for 0 or 1 atoms
if (modelWidth == 0 && modelHeight == 0) {
return new Rectangle((int) screenCoord.x, (int) screenCoord.y, 0, 0);
}
double margin = rendererModel.getParameter(Margin.class).getValue();
int width = (int) ((scale * zoom * modelWidth) + (2 * margin));
int height = (int) ((scale * zoom * modelHeight) + (2 * margin));
int xCoord = (int) (screenCoord.x - width / 2);
int yCoord = (int) (screenCoord.y - height / 2);
return new Rectangle(xCoord, yCoord, width, height);
} | [
"protected",
"Rectangle",
"convertToDiagramBounds",
"(",
"Rectangle2D",
"modelBounds",
")",
"{",
"double",
"xCenter",
"=",
"modelBounds",
".",
"getCenterX",
"(",
")",
";",
"double",
"yCenter",
"=",
"modelBounds",
".",
"getCenterY",
"(",
")",
";",
"double",
"mode... | Calculate the bounds of the diagram on screen, given the current scale,
zoom, and margin.
@param modelBounds the bounds in model space of the chem object
@return the bounds in screen space of the drawn diagram | [
"Calculate",
"the",
"bounds",
"of",
"the",
"diagram",
"on",
"screen",
"given",
"the",
"current",
"scale",
"zoom",
"and",
"margin",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java#L411-L434 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java | GrailsHibernateUtil.populateArgumentsForCriteria | @Deprecated
@SuppressWarnings("rawtypes")
public static void populateArgumentsForCriteria(Class<?> targetClass, Criteria c, Map argMap, ConversionService conversionService) {
populateArgumentsForCriteria(null, targetClass, c, argMap, conversionService);
} | java | @Deprecated
@SuppressWarnings("rawtypes")
public static void populateArgumentsForCriteria(Class<?> targetClass, Criteria c, Map argMap, ConversionService conversionService) {
populateArgumentsForCriteria(null, targetClass, c, argMap, conversionService);
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"void",
"populateArgumentsForCriteria",
"(",
"Class",
"<",
"?",
">",
"targetClass",
",",
"Criteria",
"c",
",",
"Map",
"argMap",
",",
"ConversionService",
"conversionService",
... | Populates criteria arguments for the given target class and arguments map
@param targetClass The target class
@param c The criteria instance
@param argMap The arguments map | [
"Populates",
"criteria",
"arguments",
"for",
"the",
"given",
"target",
"class",
"and",
"arguments",
"map"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L182-L186 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java | TermOfUsePanel.newGeneralTermsAndConditionsPanel | protected Component newGeneralTermsAndConditionsPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new GeneralTermsAndConditionsPanel(id, Model.of(model.getObject()));
} | java | protected Component newGeneralTermsAndConditionsPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new GeneralTermsAndConditionsPanel(id, Model.of(model.getObject()));
} | [
"protected",
"Component",
"newGeneralTermsAndConditionsPanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"HeaderContentListModelBean",
">",
"model",
")",
"{",
"return",
"new",
"GeneralTermsAndConditionsPanel",
"(",
"id",
",",
"Model",
".",
"of",
"("... | Factory method for creating the new {@link Component} for the general terms and conditions.
This method is invoked in the constructor from the derived classes and can be overridden so
users can provide their own version of a new {@link Component} for the general terms and
conditions.
@param id
the id
@param model
the model
@return the new {@link Component} for the general terms and conditions | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"general",
"terms",
"and",
"conditions",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can"... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L278-L282 |
thrau/jarchivelib | src/main/java/org/rauschig/jarchivelib/ArchiverFactory.java | ArchiverFactory.createArchiver | public static Archiver createArchiver(ArchiveFormat archiveFormat, CompressionType compression) {
CommonsArchiver archiver = new CommonsArchiver(archiveFormat);
CommonsCompressor compressor = new CommonsCompressor(compression);
return new ArchiverCompressorDecorator(archiver, compressor);
} | java | public static Archiver createArchiver(ArchiveFormat archiveFormat, CompressionType compression) {
CommonsArchiver archiver = new CommonsArchiver(archiveFormat);
CommonsCompressor compressor = new CommonsCompressor(compression);
return new ArchiverCompressorDecorator(archiver, compressor);
} | [
"public",
"static",
"Archiver",
"createArchiver",
"(",
"ArchiveFormat",
"archiveFormat",
",",
"CompressionType",
"compression",
")",
"{",
"CommonsArchiver",
"archiver",
"=",
"new",
"CommonsArchiver",
"(",
"archiveFormat",
")",
";",
"CommonsCompressor",
"compressor",
"="... | Creates an Archiver for the given archive format that uses compression.
@param archiveFormat the archive format
@param compression the compression algorithm
@return a new Archiver instance that also handles compression | [
"Creates",
"an",
"Archiver",
"for",
"the",
"given",
"archive",
"format",
"that",
"uses",
"compression",
"."
] | train | https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/ArchiverFactory.java#L96-L101 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_user_userId_right_rightId_PUT | public void serviceName_user_userId_right_rightId_PUT(String serviceName, Long userId, Long rightId, OvhRight body) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}";
StringBuilder sb = path(qPath, serviceName, userId, rightId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_user_userId_right_rightId_PUT(String serviceName, Long userId, Long rightId, OvhRight body) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}";
StringBuilder sb = path(qPath, serviceName, userId, rightId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_user_userId_right_rightId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"userId",
",",
"Long",
"rightId",
",",
"OvhRight",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/user/{userId}/r... | Alter this object properties
REST: PUT /dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}
@param body [required] New object properties
@param serviceName [required] Domain of the service
@param userId [required]
@param rightId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L746-L750 |
j-a-w-r/jawr | jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/ClassLoaderResourceUtils.java | ClassLoaderResourceUtils.buildObjectInstance | public static Object buildObjectInstance(String classname, Object[] params) {
Object rets = null;
Class<?>[] paramTypes = new Class[params.length];
for (int x = 0; x < params.length; x++) {
paramTypes[x] = params[x].getClass();
}
try {
Class<?> clazz = getClass(classname);
rets = clazz.getConstructor(paramTypes).newInstance(params);
} catch (Exception e) {
throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname
+ " could not be instantiated, check wether it is available on the classpath and"
+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
+ e.getClass().getName() + ":" + e.getMessage(), e);
}
return rets;
} | java | public static Object buildObjectInstance(String classname, Object[] params) {
Object rets = null;
Class<?>[] paramTypes = new Class[params.length];
for (int x = 0; x < params.length; x++) {
paramTypes[x] = params[x].getClass();
}
try {
Class<?> clazz = getClass(classname);
rets = clazz.getConstructor(paramTypes).newInstance(params);
} catch (Exception e) {
throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname
+ " could not be instantiated, check wether it is available on the classpath and"
+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
+ e.getClass().getName() + ":" + e.getMessage(), e);
}
return rets;
} | [
"public",
"static",
"Object",
"buildObjectInstance",
"(",
"String",
"classname",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"Object",
"rets",
"=",
"null",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
"=",
"new",
"Class",
"[",
"params",
".",
"... | Builds a class instance using reflection, by using its classname. The
class must have a zero-arg constructor.
@param classname
the class to build an instance of.
@param params
the parameters
@return the class instance | [
"Builds",
"a",
"class",
"instance",
"using",
"reflection",
"by",
"using",
"its",
"classname",
".",
"The",
"class",
"must",
"have",
"a",
"zero",
"-",
"arg",
"constructor",
"."
] | train | https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/ClassLoaderResourceUtils.java#L322-L341 |
Waikato/moa | moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java | KDTree.buildKDTree | protected void buildKDTree(Instances instances) throws Exception {
checkMissing(instances);
if (m_EuclideanDistance == null)
m_DistanceFunction = m_EuclideanDistance = new EuclideanDistance(
instances);
else
m_EuclideanDistance.setInstances(instances);
m_Instances = instances;
int numInst = m_Instances.numInstances();
// Make the global index list
m_InstList = new int[numInst];
for (int i = 0; i < numInst; i++) {
m_InstList[i] = i;
}
double[][] universe = m_EuclideanDistance.getRanges();
// initializing internal fields of KDTreeSplitter
m_Splitter.setInstances(m_Instances);
m_Splitter.setInstanceList(m_InstList);
m_Splitter.setEuclideanDistanceFunction(m_EuclideanDistance);
m_Splitter.setNodeWidthNormalization(m_NormalizeNodeWidth);
// building tree
m_NumNodes = m_NumLeaves = 1;
m_MaxDepth = 0;
m_Root = new KDTreeNode(m_NumNodes, 0, m_Instances.numInstances() - 1,
universe);
splitNodes(m_Root, universe, m_MaxDepth + 1);
} | java | protected void buildKDTree(Instances instances) throws Exception {
checkMissing(instances);
if (m_EuclideanDistance == null)
m_DistanceFunction = m_EuclideanDistance = new EuclideanDistance(
instances);
else
m_EuclideanDistance.setInstances(instances);
m_Instances = instances;
int numInst = m_Instances.numInstances();
// Make the global index list
m_InstList = new int[numInst];
for (int i = 0; i < numInst; i++) {
m_InstList[i] = i;
}
double[][] universe = m_EuclideanDistance.getRanges();
// initializing internal fields of KDTreeSplitter
m_Splitter.setInstances(m_Instances);
m_Splitter.setInstanceList(m_InstList);
m_Splitter.setEuclideanDistanceFunction(m_EuclideanDistance);
m_Splitter.setNodeWidthNormalization(m_NormalizeNodeWidth);
// building tree
m_NumNodes = m_NumLeaves = 1;
m_MaxDepth = 0;
m_Root = new KDTreeNode(m_NumNodes, 0, m_Instances.numInstances() - 1,
universe);
splitNodes(m_Root, universe, m_MaxDepth + 1);
} | [
"protected",
"void",
"buildKDTree",
"(",
"Instances",
"instances",
")",
"throws",
"Exception",
"{",
"checkMissing",
"(",
"instances",
")",
";",
"if",
"(",
"m_EuclideanDistance",
"==",
"null",
")",
"m_DistanceFunction",
"=",
"m_EuclideanDistance",
"=",
"new",
"Eucl... | Builds the KDTree on the supplied set of instances/points. It
is adviseable to run the replace missing attributes filter
on the passed instances first.
NOTE: This method should not be called from outside this
class. Outside classes should call setInstances(Instances)
instead.
@param instances The instances to build the tree on
@throws Exception if something goes wrong | [
"Builds",
"the",
"KDTree",
"on",
"the",
"supplied",
"set",
"of",
"instances",
"/",
"points",
".",
"It",
"is",
"adviseable",
"to",
"run",
"the",
"replace",
"missing",
"attributes",
"filter",
"on",
"the",
"passed",
"instances",
"first",
".",
"NOTE",
":",
"Th... | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L169-L203 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parsePurgeRemainingResponseBody | private void parsePurgeRemainingResponseBody(Map<?, ?> props) {
String purgeRemainingResponseProperty = AccessController.doPrivileged(new java.security.PrivilegedAction<String>() {
@Override
public String run() {
return (System.getProperty(HttpConfigConstants.PROPNAME_PURGE_REMAINING_RESPONSE));
}
});
if (purgeRemainingResponseProperty != null) {
this.purgeRemainingResponseBody = convertBoolean(purgeRemainingResponseProperty);
if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) {
Tr.event(tc, "Config: PurgeRemainingResponseBody is " + shouldPurgeRemainingResponseBody());
}
}
} | java | private void parsePurgeRemainingResponseBody(Map<?, ?> props) {
String purgeRemainingResponseProperty = AccessController.doPrivileged(new java.security.PrivilegedAction<String>() {
@Override
public String run() {
return (System.getProperty(HttpConfigConstants.PROPNAME_PURGE_REMAINING_RESPONSE));
}
});
if (purgeRemainingResponseProperty != null) {
this.purgeRemainingResponseBody = convertBoolean(purgeRemainingResponseProperty);
if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) {
Tr.event(tc, "Config: PurgeRemainingResponseBody is " + shouldPurgeRemainingResponseBody());
}
}
} | [
"private",
"void",
"parsePurgeRemainingResponseBody",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"props",
")",
"{",
"String",
"purgeRemainingResponseProperty",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"java",
".",
"security",
".",
"PrivilegedAction",
"<... | Check the configuration if we should purge the remaining response data
This is a JVM custom property as it's intended for outbound scenarios
PI81572
@ param props | [
"Check",
"the",
"configuration",
"if",
"we",
"should",
"purge",
"the",
"remaining",
"response",
"data",
"This",
"is",
"a",
"JVM",
"custom",
"property",
"as",
"it",
"s",
"intended",
"for",
"outbound",
"scenarios"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1388-L1403 |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/TFileParser.java | TFileParser.parseOneFile | void parseOneFile(final Path inputPath, final Writer outputWriter) throws IOException {
try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
while (!scanner.atEnd()) {
new LogFileEntry(scanner.entry()).write(outputWriter);
scanner.advance();
}
}
} | java | void parseOneFile(final Path inputPath, final Writer outputWriter) throws IOException {
try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
while (!scanner.atEnd()) {
new LogFileEntry(scanner.entry()).write(outputWriter);
scanner.advance();
}
}
} | [
"void",
"parseOneFile",
"(",
"final",
"Path",
"inputPath",
",",
"final",
"Writer",
"outputWriter",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"TFile",
".",
"Reader",
".",
"Scanner",
"scanner",
"=",
"this",
".",
"getScanner",
"(",
"inputPath",
")... | Parses the given file and writes its contents into the outputWriter for all logs in it.
@param inputPath
@param outputWriter
@throws IOException | [
"Parses",
"the",
"given",
"file",
"and",
"writes",
"its",
"contents",
"into",
"the",
"outputWriter",
"for",
"all",
"logs",
"in",
"it",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/TFileParser.java#L52-L59 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/partition/ToolBarData.java | ToolBarData.addYear | public static Date addYear(Date date, int amt) {
return addDateField(date,Calendar.YEAR,amt);
} | java | public static Date addYear(Date date, int amt) {
return addDateField(date,Calendar.YEAR,amt);
} | [
"public",
"static",
"Date",
"addYear",
"(",
"Date",
"date",
",",
"int",
"amt",
")",
"{",
"return",
"addDateField",
"(",
"date",
",",
"Calendar",
".",
"YEAR",
",",
"amt",
")",
";",
"}"
] | Increment a Date object by +/- some years
@param date Date to +/- some years from
@param amt number of years to add/remove
@return new Date object offset by the indicated years | [
"Increment",
"a",
"Date",
"object",
"by",
"+",
"/",
"-",
"some",
"years"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/partition/ToolBarData.java#L164-L166 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsyncThrowing | public static <T1, R> Func1<T1, Observable<R>> toAsyncThrowing(final ThrowingFunc1<? super T1, ? extends R> func, final Scheduler scheduler) {
return new Func1<T1, Observable<R>>() {
@Override
public Observable<R> call(T1 t1) {
return startCallable(ThrowingFunctions.toCallable(func, t1), scheduler);
}
};
} | java | public static <T1, R> Func1<T1, Observable<R>> toAsyncThrowing(final ThrowingFunc1<? super T1, ? extends R> func, final Scheduler scheduler) {
return new Func1<T1, Observable<R>>() {
@Override
public Observable<R> call(T1 t1) {
return startCallable(ThrowingFunctions.toCallable(func, t1), scheduler);
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"R",
">",
"Func1",
"<",
"T1",
",",
"Observable",
"<",
"R",
">",
">",
"toAsyncThrowing",
"(",
"final",
"ThrowingFunc1",
"<",
"?",
"super",
"T1",
",",
"?",
"extends",
"R",
">",
"func",
",",
"final",
"Scheduler",
"sch... | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <T1> the first parameter type
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229731.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L878-L885 |
osmdroid/osmdroid | OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/AsyncTaskDemoFragment.java | AsyncTaskDemoFragment.reloadMarker | private void reloadMarker(BoundingBox latLonArea, double zoom) {
Log.d(TAG,"reloadMarker " + latLonArea + ", zoom " + zoom);
this.mCurrentBackgroundMarkerLoaderTask = new BackgroundMarkerLoaderTask();
this.mCurrentBackgroundMarkerLoaderTask.execute(
latLonArea.getLatSouth(), latLonArea.getLatNorth(),
latLonArea.getLonEast(), latLonArea.getLonWest(), zoom);
} | java | private void reloadMarker(BoundingBox latLonArea, double zoom) {
Log.d(TAG,"reloadMarker " + latLonArea + ", zoom " + zoom);
this.mCurrentBackgroundMarkerLoaderTask = new BackgroundMarkerLoaderTask();
this.mCurrentBackgroundMarkerLoaderTask.execute(
latLonArea.getLatSouth(), latLonArea.getLatNorth(),
latLonArea.getLonEast(), latLonArea.getLonWest(), zoom);
} | [
"private",
"void",
"reloadMarker",
"(",
"BoundingBox",
"latLonArea",
",",
"double",
"zoom",
")",
"{",
"Log",
".",
"d",
"(",
"TAG",
",",
"\"reloadMarker \"",
"+",
"latLonArea",
"+",
"\", zoom \"",
"+",
"zoom",
")",
";",
"this",
".",
"mCurrentBackgroundMarkerLoa... | called by MapView if zoom or scroll has changed to reload marker for new visible region | [
"called",
"by",
"MapView",
"if",
"zoom",
"or",
"scroll",
"has",
"changed",
"to",
"reload",
"marker",
"for",
"new",
"visible",
"region"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/AsyncTaskDemoFragment.java#L163-L169 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.removeAllLocalesExcept | private void removeAllLocalesExcept(CmsXmlContainerPage page, Locale localeToKeep) throws CmsXmlException {
List<Locale> locales = page.getLocales();
for (Locale locale : locales) {
if (!locale.equals(localeToKeep)) {
page.removeLocale(locale);
}
}
} | java | private void removeAllLocalesExcept(CmsXmlContainerPage page, Locale localeToKeep) throws CmsXmlException {
List<Locale> locales = page.getLocales();
for (Locale locale : locales) {
if (!locale.equals(localeToKeep)) {
page.removeLocale(locale);
}
}
} | [
"private",
"void",
"removeAllLocalesExcept",
"(",
"CmsXmlContainerPage",
"page",
",",
"Locale",
"localeToKeep",
")",
"throws",
"CmsXmlException",
"{",
"List",
"<",
"Locale",
">",
"locales",
"=",
"page",
".",
"getLocales",
"(",
")",
";",
"for",
"(",
"Locale",
"... | Helper method for removing all locales except one from a container page.<p>
@param page the container page to proces
@param localeToKeep the locale which should be kept
@throws CmsXmlException if something goes wrong | [
"Helper",
"method",
"for",
"removing",
"all",
"locales",
"except",
"one",
"from",
"a",
"container",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L2963-L2971 |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/api/impl/URLTemplateSourceLoader.java | URLTemplateSourceLoader.find | @Override
public TemplateSource find(String path) throws IOException {
return new URLTemplateSource(new URL("file", null, path));
} | java | @Override
public TemplateSource find(String path) throws IOException {
return new URLTemplateSource(new URL("file", null, path));
} | [
"@",
"Override",
"public",
"TemplateSource",
"find",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"return",
"new",
"URLTemplateSource",
"(",
"new",
"URL",
"(",
"\"file\"",
",",
"null",
",",
"path",
")",
")",
";",
"}"
] | Maps the given path to a file URL and builds a URLTemplateSource for
it.
@return URLTemplateSource for the path
@see URLTemplateSource | [
"Maps",
"the",
"given",
"path",
"to",
"a",
"file",
"URL",
"and",
"builds",
"a",
"URLTemplateSource",
"for",
"it",
"."
] | train | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/api/impl/URLTemplateSourceLoader.java#L23-L26 |
biojava/biojava | biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java | Location.fromBio | public static Location fromBio( int start, int end, char strand )
{
int s= start - 1;
int e= end;
if( !( strand == '-' || strand == '+' || strand == '.' ))
{
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
}
if( strand == '-' )
{
//negate
s= - end;
e= - ( start - 1);
}
return new Location( s, e );
} | java | public static Location fromBio( int start, int end, char strand )
{
int s= start - 1;
int e= end;
if( !( strand == '-' || strand == '+' || strand == '.' ))
{
throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" );
}
if( strand == '-' )
{
//negate
s= - end;
e= - ( start - 1);
}
return new Location( s, e );
} | [
"public",
"static",
"Location",
"fromBio",
"(",
"int",
"start",
",",
"int",
"end",
",",
"char",
"strand",
")",
"{",
"int",
"s",
"=",
"start",
"-",
"1",
";",
"int",
"e",
"=",
"end",
";",
"if",
"(",
"!",
"(",
"strand",
"==",
"'",
"'",
"||",
"stra... | Create location from "biocoordinates", as in GFF file. In biocoordinates,
the start index of a range is represented in origin 1 (ie the very first index is 1, not 0),
and end= start + length - 1.
@param start Origin 1 index of first symbol.
@param end Origin 1 index of last symbol.
@param strand '+' or '-' or '.' ('.' is interpreted as '+').
@return Created location.
@throws IllegalArgumentException strand must be '+', '-' or '.' | [
"Create",
"location",
"from",
"biocoordinates",
"as",
"in",
"GFF",
"file",
".",
"In",
"biocoordinates",
"the",
"start",
"index",
"of",
"a",
"range",
"is",
"represented",
"in",
"origin",
"1",
"(",
"ie",
"the",
"very",
"first",
"index",
"is",
"1",
"not",
"... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L133-L151 |
netty/netty | common/src/main/java/io/netty/util/internal/PlatformDependent.java | PlatformDependent.reallocateDirectNoCleaner | public static ByteBuffer reallocateDirectNoCleaner(ByteBuffer buffer, int capacity) {
assert USE_DIRECT_BUFFER_NO_CLEANER;
int len = capacity - buffer.capacity();
incrementMemoryCounter(len);
try {
return PlatformDependent0.reallocateDirectNoCleaner(buffer, capacity);
} catch (Throwable e) {
decrementMemoryCounter(len);
throwException(e);
return null;
}
} | java | public static ByteBuffer reallocateDirectNoCleaner(ByteBuffer buffer, int capacity) {
assert USE_DIRECT_BUFFER_NO_CLEANER;
int len = capacity - buffer.capacity();
incrementMemoryCounter(len);
try {
return PlatformDependent0.reallocateDirectNoCleaner(buffer, capacity);
} catch (Throwable e) {
decrementMemoryCounter(len);
throwException(e);
return null;
}
} | [
"public",
"static",
"ByteBuffer",
"reallocateDirectNoCleaner",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"capacity",
")",
"{",
"assert",
"USE_DIRECT_BUFFER_NO_CLEANER",
";",
"int",
"len",
"=",
"capacity",
"-",
"buffer",
".",
"capacity",
"(",
")",
";",
"incrementMem... | Reallocate a new {@link ByteBuffer} with the given {@code capacity}. {@link ByteBuffer}s reallocated with
this method <strong>MUST</strong> be deallocated via {@link #freeDirectNoCleaner(ByteBuffer)}. | [
"Reallocate",
"a",
"new",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L636-L648 |
RuedigerMoeller/kontraktor | modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/impl/KxPublisherActor.java | KxPublisherActor._subscribe | public IPromise<KSubscription> _subscribe( Callback subscriber ) {
if ( subscribers == null )
subscribers = new HashMap<>();
int id = subsIdCount++;
KSubscription subs = new KSubscription(self(), id);
subscribers.put( id, new SubscriberEntry(id, subs, subscriber) );
return new Promise<>(subs);
} | java | public IPromise<KSubscription> _subscribe( Callback subscriber ) {
if ( subscribers == null )
subscribers = new HashMap<>();
int id = subsIdCount++;
KSubscription subs = new KSubscription(self(), id);
subscribers.put( id, new SubscriberEntry(id, subs, subscriber) );
return new Promise<>(subs);
} | [
"public",
"IPromise",
"<",
"KSubscription",
">",
"_subscribe",
"(",
"Callback",
"subscriber",
")",
"{",
"if",
"(",
"subscribers",
"==",
"null",
")",
"subscribers",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"int",
"id",
"=",
"subsIdCount",
"++",
";",
"K... | private / as validation needs to be done synchronously, its on callerside. This is the async part of impl | [
"private",
"/",
"as",
"validation",
"needs",
"to",
"be",
"done",
"synchronously",
"its",
"on",
"callerside",
".",
"This",
"is",
"the",
"async",
"part",
"of",
"impl"
] | train | https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/impl/KxPublisherActor.java#L144-L151 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/RepositoryException.java | RepositoryException.backoff | public static <E extends Throwable> int backoff(E e, int retryCount, int milliseconds)
throws E
{
if (retryCount <= 0) {
// Workaround apparent compiler bug.
org.cojen.util.ThrowUnchecked.fire(e);
}
if (milliseconds > 0) {
Random rnd = cRandom;
if (rnd == null) {
cRandom = rnd = new Random();
}
if ((milliseconds = rnd.nextInt(milliseconds)) > 0) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e2) {
}
return retryCount - 1;
}
}
Thread.yield();
return retryCount - 1;
} | java | public static <E extends Throwable> int backoff(E e, int retryCount, int milliseconds)
throws E
{
if (retryCount <= 0) {
// Workaround apparent compiler bug.
org.cojen.util.ThrowUnchecked.fire(e);
}
if (milliseconds > 0) {
Random rnd = cRandom;
if (rnd == null) {
cRandom = rnd = new Random();
}
if ((milliseconds = rnd.nextInt(milliseconds)) > 0) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e2) {
}
return retryCount - 1;
}
}
Thread.yield();
return retryCount - 1;
} | [
"public",
"static",
"<",
"E",
"extends",
"Throwable",
">",
"int",
"backoff",
"(",
"E",
"e",
",",
"int",
"retryCount",
",",
"int",
"milliseconds",
")",
"throws",
"E",
"{",
"if",
"(",
"retryCount",
"<=",
"0",
")",
"{",
"// Workaround apparent compiler bug.\r",... | One strategy for resolving an optimistic lock failure is to try the
operation again, after waiting some bounded random amount of time. This
method is provided as a convenience, to support such a random wait.
<p>
A retry count is required as well, which is decremented and returned by
this method. If the retry count is zero (or less) when this method is
called, then this exception is thrown again, indicating retry failure.
@param retryCount current retry count, if zero, throw this exception again
@param milliseconds upper bound on the random amount of time to wait
@return retryCount minus one
@throws E if retry count is zero | [
"One",
"strategy",
"for",
"resolving",
"an",
"optimistic",
"lock",
"failure",
"is",
"to",
"try",
"the",
"operation",
"again",
"after",
"waiting",
"some",
"bounded",
"random",
"amount",
"of",
"time",
".",
"This",
"method",
"is",
"provided",
"as",
"a",
"conven... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/RepositoryException.java#L71-L93 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/encoder/PDF417ErrorCorrection.java | PDF417ErrorCorrection.generateErrorCorrection | static String generateErrorCorrection(CharSequence dataCodewords, int errorCorrectionLevel) {
int k = getErrorCorrectionCodewordCount(errorCorrectionLevel);
char[] e = new char[k];
int sld = dataCodewords.length();
for (int i = 0; i < sld; i++) {
int t1 = (dataCodewords.charAt(i) + e[e.length - 1]) % 929;
int t2;
int t3;
for (int j = k - 1; j >= 1; j--) {
t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929;
t3 = 929 - t2;
e[j] = (char) ((e[j - 1] + t3) % 929);
}
t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929;
t3 = 929 - t2;
e[0] = (char) (t3 % 929);
}
StringBuilder sb = new StringBuilder(k);
for (int j = k - 1; j >= 0; j--) {
if (e[j] != 0) {
e[j] = (char) (929 - e[j]);
}
sb.append(e[j]);
}
return sb.toString();
} | java | static String generateErrorCorrection(CharSequence dataCodewords, int errorCorrectionLevel) {
int k = getErrorCorrectionCodewordCount(errorCorrectionLevel);
char[] e = new char[k];
int sld = dataCodewords.length();
for (int i = 0; i < sld; i++) {
int t1 = (dataCodewords.charAt(i) + e[e.length - 1]) % 929;
int t2;
int t3;
for (int j = k - 1; j >= 1; j--) {
t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929;
t3 = 929 - t2;
e[j] = (char) ((e[j - 1] + t3) % 929);
}
t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929;
t3 = 929 - t2;
e[0] = (char) (t3 % 929);
}
StringBuilder sb = new StringBuilder(k);
for (int j = k - 1; j >= 0; j--) {
if (e[j] != 0) {
e[j] = (char) (929 - e[j]);
}
sb.append(e[j]);
}
return sb.toString();
} | [
"static",
"String",
"generateErrorCorrection",
"(",
"CharSequence",
"dataCodewords",
",",
"int",
"errorCorrectionLevel",
")",
"{",
"int",
"k",
"=",
"getErrorCorrectionCodewordCount",
"(",
"errorCorrectionLevel",
")",
";",
"char",
"[",
"]",
"e",
"=",
"new",
"char",
... | Generates the error correction codewords according to 4.10 in ISO/IEC 15438:2001(E).
@param dataCodewords the data codewords
@param errorCorrectionLevel the error correction level (0-8)
@return the String representing the error correction codewords | [
"Generates",
"the",
"error",
"correction",
"codewords",
"according",
"to",
"4",
".",
"10",
"in",
"ISO",
"/",
"IEC",
"15438",
":",
"2001",
"(",
"E",
")",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417ErrorCorrection.java#L177-L202 |
alkacon/opencms-core | src/org/opencms/db/CmsLoginManager.java | CmsLoginManager.setLoginMessage | public void setLoginMessage(CmsObject cms, CmsLoginMessage message) throws CmsRoleViolationException {
if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) {
// during configuration phase no permission check id required
OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN);
}
m_loginMessage = message;
if (m_loginMessage != null) {
m_loginMessage.setFrozen();
}
} | java | public void setLoginMessage(CmsObject cms, CmsLoginMessage message) throws CmsRoleViolationException {
if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) {
// during configuration phase no permission check id required
OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN);
}
m_loginMessage = message;
if (m_loginMessage != null) {
m_loginMessage.setFrozen();
}
} | [
"public",
"void",
"setLoginMessage",
"(",
"CmsObject",
"cms",
",",
"CmsLoginMessage",
"message",
")",
"throws",
"CmsRoleViolationException",
"{",
"if",
"(",
"OpenCms",
".",
"getRunLevel",
"(",
")",
">=",
"OpenCms",
".",
"RUNLEVEL_3_SHELL_ACCESS",
")",
"{",
"// dur... | Sets the login message to display if a user logs in.<p>
This operation requires that the current user has role permissions of <code>{@link CmsRole#ROOT_ADMIN}</code>.<p>
@param cms the current OpenCms user context
@param message the message to set
@throws CmsRoleViolationException in case the current user does not have the required role permissions | [
"Sets",
"the",
"login",
"message",
"to",
"display",
"if",
"a",
"user",
"logs",
"in",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L679-L689 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java | CassandraDataHandlerBase.onDiscriminatorColumn | private void onDiscriminatorColumn(ThriftRow tr, long timestamp, EntityType entityType)
{
String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();
// No need to check for empty or blank, as considering it as valid name
// for nosql!
if (discrColumn != null && discrValue != null)
{
Column column = prepareColumn(PropertyAccessorHelper.getBytes(discrValue),
PropertyAccessorHelper.getBytes(discrColumn), timestamp, 0);
tr.addColumn(column);
}
} | java | private void onDiscriminatorColumn(ThriftRow tr, long timestamp, EntityType entityType)
{
String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();
// No need to check for empty or blank, as considering it as valid name
// for nosql!
if (discrColumn != null && discrValue != null)
{
Column column = prepareColumn(PropertyAccessorHelper.getBytes(discrValue),
PropertyAccessorHelper.getBytes(discrColumn), timestamp, 0);
tr.addColumn(column);
}
} | [
"private",
"void",
"onDiscriminatorColumn",
"(",
"ThriftRow",
"tr",
",",
"long",
"timestamp",
",",
"EntityType",
"entityType",
")",
"{",
"String",
"discrColumn",
"=",
"(",
"(",
"AbstractManagedType",
")",
"entityType",
")",
".",
"getDiscriminatorColumn",
"(",
")",... | On discriminator column.
@param tr
the tr
@param timestamp
the timestamp
@param entityType
the entity type | [
"On",
"discriminator",
"column",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L1948-L1961 |
apereo/cas | support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java | SamlRegisteredServiceServiceProviderMetadataFacade.get | public static Optional<SamlRegisteredServiceServiceProviderMetadataFacade> get(final SamlRegisteredServiceCachingMetadataResolver resolver,
final SamlRegisteredService registeredService,
final RequestAbstractType request) {
return get(resolver, registeredService, SamlIdPUtils.getIssuerFromSamlObject(request));
} | java | public static Optional<SamlRegisteredServiceServiceProviderMetadataFacade> get(final SamlRegisteredServiceCachingMetadataResolver resolver,
final SamlRegisteredService registeredService,
final RequestAbstractType request) {
return get(resolver, registeredService, SamlIdPUtils.getIssuerFromSamlObject(request));
} | [
"public",
"static",
"Optional",
"<",
"SamlRegisteredServiceServiceProviderMetadataFacade",
">",
"get",
"(",
"final",
"SamlRegisteredServiceCachingMetadataResolver",
"resolver",
",",
"final",
"SamlRegisteredService",
"registeredService",
",",
"final",
"RequestAbstractType",
"reque... | Adapt saml metadata and parse. Acts as a facade.
@param resolver the resolver
@param registeredService the service
@param request the request
@return the saml metadata adaptor | [
"Adapt",
"saml",
"metadata",
"and",
"parse",
".",
"Acts",
"as",
"a",
"facade",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java#L79-L83 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java | DirectoryLookupService.removeNotificationHandler | public void removeNotificationHandler(String serviceName, NotificationHandler handler){
if(handler == null || serviceName == null || serviceName.isEmpty()){
throw new IllegalArgumentException();
}
synchronized(notificationHandlers){
if(notificationHandlers.containsKey(serviceName)){
List<NotificationHandler> list = notificationHandlers.get(serviceName);
if(list.contains(handler)){
list.remove(handler);
}
if(list.size() == 0){
notificationHandlers.remove(serviceName);
}
}
}
} | java | public void removeNotificationHandler(String serviceName, NotificationHandler handler){
if(handler == null || serviceName == null || serviceName.isEmpty()){
throw new IllegalArgumentException();
}
synchronized(notificationHandlers){
if(notificationHandlers.containsKey(serviceName)){
List<NotificationHandler> list = notificationHandlers.get(serviceName);
if(list.contains(handler)){
list.remove(handler);
}
if(list.size() == 0){
notificationHandlers.remove(serviceName);
}
}
}
} | [
"public",
"void",
"removeNotificationHandler",
"(",
"String",
"serviceName",
",",
"NotificationHandler",
"handler",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
"||",
"serviceName",
"==",
"null",
"||",
"serviceName",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw... | Remove the NotificationHandler from the Service.
@param serviceName
the service name.
@param handler
the NotificationHandler for the service. | [
"Remove",
"the",
"NotificationHandler",
"from",
"the",
"Service",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java#L243-L259 |
overturetool/overture | core/interpreter/src/main/java/org/overture/interpreter/runtime/Interpreter.java | Interpreter.getSourceLine | public String getSourceLine(File file, int line, String sep)
{
SourceFile source = sourceFiles.get(file);
if (source == null)
{
try
{
source = new SourceFile(file);
sourceFiles.put(file, source);
} catch (IOException e)
{
return "Cannot open source file: " + file;
}
}
return line + sep + source.getLine(line);
} | java | public String getSourceLine(File file, int line, String sep)
{
SourceFile source = sourceFiles.get(file);
if (source == null)
{
try
{
source = new SourceFile(file);
sourceFiles.put(file, source);
} catch (IOException e)
{
return "Cannot open source file: " + file;
}
}
return line + sep + source.getLine(line);
} | [
"public",
"String",
"getSourceLine",
"(",
"File",
"file",
",",
"int",
"line",
",",
"String",
"sep",
")",
"{",
"SourceFile",
"source",
"=",
"sourceFiles",
".",
"get",
"(",
"file",
")",
";",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"try",
"{",
"sou... | Get a line of a source file by its location.
@param file
@param line
@param sep
@return | [
"Get",
"a",
"line",
"of",
"a",
"source",
"file",
"by",
"its",
"location",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/Interpreter.java#L319-L336 |
auth0/Lock.Android | lib/src/main/java/com/auth0/android/lock/internal/configuration/Connection.java | Connection.newConnectionFor | static Connection newConnectionFor(@NonNull String strategy, Map<String, Object> values) {
return new Connection(strategy, values);
} | java | static Connection newConnectionFor(@NonNull String strategy, Map<String, Object> values) {
return new Connection(strategy, values);
} | [
"static",
"Connection",
"newConnectionFor",
"(",
"@",
"NonNull",
"String",
"strategy",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
")",
"{",
"return",
"new",
"Connection",
"(",
"strategy",
",",
"values",
")",
";",
"}"
] | Creates a new Connection given a Strategy name and the map of values.
@param strategy strategy name for this connection
@param values additional values associated to this connection
@return a new instance of Connection. Can be either DatabaseConnection, PasswordlessConnection or OAuthConnection. | [
"Creates",
"a",
"new",
"Connection",
"given",
"a",
"Strategy",
"name",
"and",
"the",
"map",
"of",
"values",
"."
] | train | https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/internal/configuration/Connection.java#L181-L183 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java | BoxApiUser.getDownloadAvatarRequest | public BoxRequestsFile.DownloadAvatar getDownloadAvatarRequest(File target, String userId) throws IOException{
if (!target.exists()){
throw new FileNotFoundException();
}
BoxRequestsFile.DownloadAvatar request = new BoxRequestsFile.DownloadAvatar(userId, target, getAvatarDownloadUrl(userId), mSession)
.setAvatarType(BoxRequestsFile.DownloadAvatar.LARGE);
return request;
} | java | public BoxRequestsFile.DownloadAvatar getDownloadAvatarRequest(File target, String userId) throws IOException{
if (!target.exists()){
throw new FileNotFoundException();
}
BoxRequestsFile.DownloadAvatar request = new BoxRequestsFile.DownloadAvatar(userId, target, getAvatarDownloadUrl(userId), mSession)
.setAvatarType(BoxRequestsFile.DownloadAvatar.LARGE);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"DownloadAvatar",
"getDownloadAvatarRequest",
"(",
"File",
"target",
",",
"String",
"userId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"target",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException... | Gets a request that downloads an avatar of the target user id.
@param target target file to download to, target can be either a directory or a file
@param userId id of user to download avatar of
@return request to download a thumbnail to a target file
@throws IOException throws FileNotFoundException if target file does not exist. | [
"Gets",
"a",
"request",
"that",
"downloads",
"an",
"avatar",
"of",
"the",
"target",
"user",
"id",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java#L117-L124 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/publisher/TimestampDataPublisher.java | TimestampDataPublisher.movePath | @Override
protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId)
throws IOException {
String outputDir = dst.getParent().toString();
String schemaName = dst.getName();
Path newDst = new Path(new Path(outputDir, getDbTableName(schemaName)), timestamp);
if (!this.publisherFileSystemByBranches.get(branchId).exists(newDst)) {
WriterUtils.mkdirsWithRecursivePermissionWithRetry(this.publisherFileSystemByBranches.get(branchId),
newDst.getParent(), this.permissions.get(branchId), this.retrierConfig);
}
super.movePath(parallelRunner, state, src, newDst, branchId);
} | java | @Override
protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId)
throws IOException {
String outputDir = dst.getParent().toString();
String schemaName = dst.getName();
Path newDst = new Path(new Path(outputDir, getDbTableName(schemaName)), timestamp);
if (!this.publisherFileSystemByBranches.get(branchId).exists(newDst)) {
WriterUtils.mkdirsWithRecursivePermissionWithRetry(this.publisherFileSystemByBranches.get(branchId),
newDst.getParent(), this.permissions.get(branchId), this.retrierConfig);
}
super.movePath(parallelRunner, state, src, newDst, branchId);
} | [
"@",
"Override",
"protected",
"void",
"movePath",
"(",
"ParallelRunner",
"parallelRunner",
",",
"State",
"state",
",",
"Path",
"src",
",",
"Path",
"dst",
",",
"int",
"branchId",
")",
"throws",
"IOException",
"{",
"String",
"outputDir",
"=",
"dst",
".",
"getP... | Update destination path to put db and table name in format "dbname.tablename" using {@link #getDbTableName(String)}
and include timestamp
Input dst format: {finaldir}/{schemaName}
Output dst format: {finaldir}/{dbname.tablename}/{currenttimestamp} | [
"Update",
"destination",
"path",
"to",
"put",
"db",
"and",
"table",
"name",
"in",
"format",
"dbname",
".",
"tablename",
"using",
"{",
"@link",
"#getDbTableName",
"(",
"String",
")",
"}",
"and",
"include",
"timestamp"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/TimestampDataPublisher.java#L68-L82 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java | Matchers.sequence | public static Matcher<MultiResult> sequence(final Matcher<?>... matchers) {
checkNotEmpty(matchers);
return new Matcher<MultiResult>() {
@Override
public MultiResult matches(String input, boolean isEof) {
int matchCount = 0;
Result[] results = new Result[matchers.length];
Arrays.fill(results, failure(input, false));
int beginIndex = 0;
for (int i = 0; i < matchers.length; i++) {
Result result = matchers[i].matches(input.substring(beginIndex), isEof);
if (result.isSuccessful()) {
beginIndex += result.end();
results[i] = result;
if (++matchCount == matchers.length) {
String group = result.group();
Result finalResult = new SimpleResult(
true,
input,
input.substring(0, beginIndex - group.length()),
group,
result.canStopMatching());
return new MultiResultImpl(finalResult, Arrays.asList(results));
}
} else {
break;
}
}
final List<Result> resultList = Arrays.asList(results);
boolean canStopMatching = MultiResultImpl.canStopMatching(resultList);
return new MultiResultImpl(failure(input, canStopMatching), resultList);
}
@Override
public String toString() {
return String.format("sequence(%s)", MultiMatcher.matchersToString(matchers));
}
};
} | java | public static Matcher<MultiResult> sequence(final Matcher<?>... matchers) {
checkNotEmpty(matchers);
return new Matcher<MultiResult>() {
@Override
public MultiResult matches(String input, boolean isEof) {
int matchCount = 0;
Result[] results = new Result[matchers.length];
Arrays.fill(results, failure(input, false));
int beginIndex = 0;
for (int i = 0; i < matchers.length; i++) {
Result result = matchers[i].matches(input.substring(beginIndex), isEof);
if (result.isSuccessful()) {
beginIndex += result.end();
results[i] = result;
if (++matchCount == matchers.length) {
String group = result.group();
Result finalResult = new SimpleResult(
true,
input,
input.substring(0, beginIndex - group.length()),
group,
result.canStopMatching());
return new MultiResultImpl(finalResult, Arrays.asList(results));
}
} else {
break;
}
}
final List<Result> resultList = Arrays.asList(results);
boolean canStopMatching = MultiResultImpl.canStopMatching(resultList);
return new MultiResultImpl(failure(input, canStopMatching), resultList);
}
@Override
public String toString() {
return String.format("sequence(%s)", MultiMatcher.matchersToString(matchers));
}
};
} | [
"public",
"static",
"Matcher",
"<",
"MultiResult",
">",
"sequence",
"(",
"final",
"Matcher",
"<",
"?",
">",
"...",
"matchers",
")",
"{",
"checkNotEmpty",
"(",
"matchers",
")",
";",
"return",
"new",
"Matcher",
"<",
"MultiResult",
">",
"(",
")",
"{",
"@",
... | Matches the given matchers one by one. Every successful matches updates the internal
buffer. The consequent
match operation is performed after the previous match has succeeded.
@param matchers the collection of matchers.
@return the matcher. | [
"Matches",
"the",
"given",
"matchers",
"one",
"by",
"one",
".",
"Every",
"successful",
"matches",
"updates",
"the",
"internal",
"buffer",
".",
"The",
"consequent",
"match",
"operation",
"is",
"performed",
"after",
"the",
"previous",
"match",
"has",
"succeeded",
... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L247-L285 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/BuildMojo.java | BuildMojo.processImageConfig | private void processImageConfig(ServiceHub hub, ImageConfiguration aImageConfig) throws IOException, MojoExecutionException {
BuildImageConfiguration buildConfig = aImageConfig.getBuildConfiguration();
if (buildConfig != null) {
if(buildConfig.skip()) {
log.info("%s : Skipped building", aImageConfig.getDescription());
} else {
buildAndTag(hub, aImageConfig);
}
}
} | java | private void processImageConfig(ServiceHub hub, ImageConfiguration aImageConfig) throws IOException, MojoExecutionException {
BuildImageConfiguration buildConfig = aImageConfig.getBuildConfiguration();
if (buildConfig != null) {
if(buildConfig.skip()) {
log.info("%s : Skipped building", aImageConfig.getDescription());
} else {
buildAndTag(hub, aImageConfig);
}
}
} | [
"private",
"void",
"processImageConfig",
"(",
"ServiceHub",
"hub",
",",
"ImageConfiguration",
"aImageConfig",
")",
"throws",
"IOException",
",",
"MojoExecutionException",
"{",
"BuildImageConfiguration",
"buildConfig",
"=",
"aImageConfig",
".",
"getBuildConfiguration",
"(",
... | Helper method to process an ImageConfiguration.
@param hub ServiceHub
@param aImageConfig ImageConfiguration that would be forwarded to build and tag
@throws DockerAccessException
@throws MojoExecutionException | [
"Helper",
"method",
"to",
"process",
"an",
"ImageConfiguration",
"."
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/BuildMojo.java#L98-L108 |
bi-geek/flink-connector-ethereum | src/main/java/com/bigeek/flink/utils/EthereumUtils.java | EthereumUtils.generateClient | public static Web3j generateClient(String clientAddress, Long timeoutSeconds) {
if (isEmpty(clientAddress)) {
throw new IllegalArgumentException("You have to define client address, use constructor or environment variable 'web3j.clientAddress'");
}
Web3jService web3jService;
if (clientAddress.startsWith("http")) {
web3jService = new HttpService(clientAddress, createOkHttpClient(timeoutSeconds), false);
} else if (clientAddress.startsWith("wss")) {
try {
web3jService = new WebSocketService(clientAddress, true);
((WebSocketService) web3jService).connect();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} else if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
web3jService = new WindowsIpcService(clientAddress);
} else {
web3jService = new UnixIpcService(clientAddress);
}
return Web3j.build(web3jService);
} | java | public static Web3j generateClient(String clientAddress, Long timeoutSeconds) {
if (isEmpty(clientAddress)) {
throw new IllegalArgumentException("You have to define client address, use constructor or environment variable 'web3j.clientAddress'");
}
Web3jService web3jService;
if (clientAddress.startsWith("http")) {
web3jService = new HttpService(clientAddress, createOkHttpClient(timeoutSeconds), false);
} else if (clientAddress.startsWith("wss")) {
try {
web3jService = new WebSocketService(clientAddress, true);
((WebSocketService) web3jService).connect();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} else if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
web3jService = new WindowsIpcService(clientAddress);
} else {
web3jService = new UnixIpcService(clientAddress);
}
return Web3j.build(web3jService);
} | [
"public",
"static",
"Web3j",
"generateClient",
"(",
"String",
"clientAddress",
",",
"Long",
"timeoutSeconds",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"clientAddress",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"You have to define client address, us... | Generate Ethereum client.
@param clientAddress
@param timeoutSeconds
@return Web3j client | [
"Generate",
"Ethereum",
"client",
"."
] | train | https://github.com/bi-geek/flink-connector-ethereum/blob/9ecedbf999fc410e50225c3f69b5041df4c61a33/src/main/java/com/bigeek/flink/utils/EthereumUtils.java#L46-L68 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java | DestinationUrl.getDestinationUrl | public static MozuUrl getDestinationUrl(String checkoutId, String destinationId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}?responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("destinationId", destinationId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getDestinationUrl(String checkoutId, String destinationId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/checkouts/{checkoutId}/destinations/{destinationId}?responseFields={responseFields}");
formatter.formatUrl("checkoutId", checkoutId);
formatter.formatUrl("destinationId", destinationId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getDestinationUrl",
"(",
"String",
"checkoutId",
",",
"String",
"destinationId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/checkouts/{checkoutId}/destinations/{de... | Get Resource Url for GetDestination
@param checkoutId The unique identifier of the checkout.
@param destinationId The unique identifier of the destination.
@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",
"GetDestination"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/checkouts/DestinationUrl.java#L35-L42 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/PropertiesUtils.java | PropertiesUtils.getInt | public static int getInt(Properties props, String key, int defaultValue) {
String value = props.getProperty(key);
if (value != null) {
return Integer.parseInt(value);
} else {
return defaultValue;
}
} | java | public static int getInt(Properties props, String key, int defaultValue) {
String value = props.getProperty(key);
if (value != null) {
return Integer.parseInt(value);
} else {
return defaultValue;
}
} | [
"public",
"static",
"int",
"getInt",
"(",
"Properties",
"props",
",",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"props",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return"... | Load an integer property. If the key is not present, returns defaultValue. | [
"Load",
"an",
"integer",
"property",
".",
"If",
"the",
"key",
"is",
"not",
"present",
"returns",
"defaultValue",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/PropertiesUtils.java#L129-L136 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.createWorldToPixel | public static WorldToCameraToPixel createWorldToPixel(LensDistortionNarrowFOV distortion , Se3_F64 worldToCamera )
{
WorldToCameraToPixel alg = new WorldToCameraToPixel();
alg.configure(distortion,worldToCamera);
return alg;
} | java | public static WorldToCameraToPixel createWorldToPixel(LensDistortionNarrowFOV distortion , Se3_F64 worldToCamera )
{
WorldToCameraToPixel alg = new WorldToCameraToPixel();
alg.configure(distortion,worldToCamera);
return alg;
} | [
"public",
"static",
"WorldToCameraToPixel",
"createWorldToPixel",
"(",
"LensDistortionNarrowFOV",
"distortion",
",",
"Se3_F64",
"worldToCamera",
")",
"{",
"WorldToCameraToPixel",
"alg",
"=",
"new",
"WorldToCameraToPixel",
"(",
")",
";",
"alg",
".",
"configure",
"(",
"... | Creates a transform from world coordinates into pixel coordinates. can handle lens distortion | [
"Creates",
"a",
"transform",
"from",
"world",
"coordinates",
"into",
"pixel",
"coordinates",
".",
"can",
"handle",
"lens",
"distortion"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L697-L702 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/UserApi.java | UserApi.addSshKey | public SshKey addSshKey(Integer userId, String title, String key) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("userId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key);
Response response = post(Response.Status.CREATED, formData, "users", userId, "keys");
SshKey sshKey = response.readEntity(SshKey.class);
if (sshKey != null) {
sshKey.setUserId(userId);
}
return (sshKey);
} | java | public SshKey addSshKey(Integer userId, String title, String key) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("userId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key);
Response response = post(Response.Status.CREATED, formData, "users", userId, "keys");
SshKey sshKey = response.readEntity(SshKey.class);
if (sshKey != null) {
sshKey.setUserId(userId);
}
return (sshKey);
} | [
"public",
"SshKey",
"addSshKey",
"(",
"Integer",
"userId",
",",
"String",
"title",
",",
"String",
"key",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"userId",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"userId cannot be null\"",
... | Create new key owned by specified user. Available only for admin users.
<pre><code>GitLab Endpoint: POST /users/:id/keys</code></pre>
@param userId the ID of the user to add the SSH key for
@param title the new SSH Key's title
@param key the new SSH key
@return an SshKey instance with info on the added SSH key
@throws GitLabApiException if any exception occurs | [
"Create",
"new",
"key",
"owned",
"by",
"specified",
"user",
".",
"Available",
"only",
"for",
"admin",
"users",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L673-L687 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.analyzeImageByDomainAsync | public Observable<DomainModelResults> analyzeImageByDomainAsync(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) {
return analyzeImageByDomainWithServiceResponseAsync(model, url, analyzeImageByDomainOptionalParameter).map(new Func1<ServiceResponse<DomainModelResults>, DomainModelResults>() {
@Override
public DomainModelResults call(ServiceResponse<DomainModelResults> response) {
return response.body();
}
});
} | java | public Observable<DomainModelResults> analyzeImageByDomainAsync(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) {
return analyzeImageByDomainWithServiceResponseAsync(model, url, analyzeImageByDomainOptionalParameter).map(new Func1<ServiceResponse<DomainModelResults>, DomainModelResults>() {
@Override
public DomainModelResults call(ServiceResponse<DomainModelResults> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DomainModelResults",
">",
"analyzeImageByDomainAsync",
"(",
"String",
"model",
",",
"String",
"url",
",",
"AnalyzeImageByDomainOptionalParameter",
"analyzeImageByDomainOptionalParameter",
")",
"{",
"return",
"analyzeImageByDomainWithServiceResponseAs... | This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API only provides a single domain-specific model: celebrities. 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 model The domain-specific content to recognize.
@param url Publicly reachable URL of an image
@param analyzeImageByDomainOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DomainModelResults object | [
"This",
"operation",
"recognizes",
"content",
"within",
"an",
"image",
"by",
"applying",
"a",
"domain",
"-",
"specific",
"model",
".",
"The",
"list",
"of",
"domain",
"-",
"specific",
"models",
"that",
"are",
"supported",
"by",
"the",
"Computer",
"Vision",
"A... | 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#L1441-L1448 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/search/Search.java | Search.computeDelta | protected double computeDelta(Evaluation currentEvaluation, Evaluation previousEvaluation){
if(problem.isMinimizing()){
// minimization: return decrease
return previousEvaluation.getValue() - currentEvaluation.getValue();
} else {
// maximization: return increase
return currentEvaluation.getValue() - previousEvaluation.getValue();
}
} | java | protected double computeDelta(Evaluation currentEvaluation, Evaluation previousEvaluation){
if(problem.isMinimizing()){
// minimization: return decrease
return previousEvaluation.getValue() - currentEvaluation.getValue();
} else {
// maximization: return increase
return currentEvaluation.getValue() - previousEvaluation.getValue();
}
} | [
"protected",
"double",
"computeDelta",
"(",
"Evaluation",
"currentEvaluation",
",",
"Evaluation",
"previousEvaluation",
")",
"{",
"if",
"(",
"problem",
".",
"isMinimizing",
"(",
")",
")",
"{",
"// minimization: return decrease",
"return",
"previousEvaluation",
".",
"g... | Computes the amount of improvement of <code>currentEvaluation</code> over <code>previousEvaluation</code>,
taking into account whether evaluations are being maximized or minimized. Positive deltas indicate improvement.
In case of maximization the amount of increase is returned, which is equal to
<pre> currentEvaluation - previousEvaluation </pre>
while the amount of decrease, equal to
<pre> previousEvaluation - currentEvaluation </pre>
is returned in case of minimization.
@param currentEvaluation evaluation to be compared with previous evaluation
@param previousEvaluation previous evaluation
@return amount of improvement of current evaluation over previous evaluation | [
"Computes",
"the",
"amount",
"of",
"improvement",
"of",
"<code",
">",
"currentEvaluation<",
"/",
"code",
">",
"over",
"<code",
">",
"previousEvaluation<",
"/",
"code",
">",
"taking",
"into",
"account",
"whether",
"evaluations",
"are",
"being",
"maximized",
"or",... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/Search.java#L1182-L1190 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java | QueryReferenceBroker.retrieveCollections | public void retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException
{
doRetrieveCollections(newObj, cld, forced, false);
} | java | public void retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException
{
doRetrieveCollections(newObj, cld, forced, false);
} | [
"public",
"void",
"retrieveCollections",
"(",
"Object",
"newObj",
",",
"ClassDescriptor",
"cld",
",",
"boolean",
"forced",
")",
"throws",
"PersistenceBrokerException",
"{",
"doRetrieveCollections",
"(",
"newObj",
",",
"cld",
",",
"forced",
",",
"false",
")",
";",
... | Retrieve all Collection attributes of a given instance
@param newObj the instance to be loaded or refreshed
@param cld the ClassDescriptor of the instance
@param forced if set to true, loading is forced even if cld differs | [
"Retrieve",
"all",
"Collection",
"attributes",
"of",
"a",
"given",
"instance"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L938-L941 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java | XMLResource.postQuery | @POST
@Consumes(APPLICATION_QUERY_XML)
public Response postQuery(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream input) {
return postQuery(system, input, resource, headers);
} | java | @POST
@Consumes(APPLICATION_QUERY_XML)
public Response postQuery(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream input) {
return postQuery(system, input, resource, headers);
} | [
"@",
"POST",
"@",
"Consumes",
"(",
"APPLICATION_QUERY_XML",
")",
"public",
"Response",
"postQuery",
"(",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"SYSTEM",
")",
"final",
"String",
"system",
",",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"RESOURCE",
")... | This method will be called when a HTTP client sends a POST request to an
existing resource with 'application/query+xml' as Content-Type.
@param system
The implementation system.
@param resource
The resource name.
@param input
The input stream.
@param headers
HTTP header attributes.
@return The {@link Response} which can be empty when no response is
expected. Otherwise it holds the response XML file. | [
"This",
"method",
"will",
"be",
"called",
"when",
"a",
"HTTP",
"client",
"sends",
"a",
"POST",
"request",
"to",
"an",
"existing",
"resource",
"with",
"application",
"/",
"query",
"+",
"xml",
"as",
"Content",
"-",
"Type",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java#L100-L106 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/management/CronUtils.java | CronUtils.unpackSchedule | public static String unpackSchedule(String sauronExpr) {
if (sauronExpr == null) return null;
String[] exprElems = sauronExpr.trim().split("\\s+");
if (exprElems.length == 5) {
// 1. Increase number od days in "days of week"
exprElems[4] = increaseDoW(exprElems[4]);
// 2. Cut right end of an interval in repeating items
exprElems[0] = shrinkRepeating(exprElems[0], "0");
exprElems[1] = shrinkRepeating(exprElems[1], "0");
exprElems[2] = shrinkRepeating(exprElems[2], "1");
exprElems[3] = shrinkRepeating(exprElems[3], "1");
exprElems[4] = shrinkRepeating(exprElems[4], "SUN");
// 3. "Last" processing and question marks inserting
if (!"*".equals(exprElems[4])) {
if (exprElems[2].indexOf('L') >= 0 &&
exprElems[4].indexOf('-') == -1 &&
exprElems[4].indexOf('/') == -1) {
exprElems[4] = exprElems[4] + "L";
}
exprElems[2] = "?";
} else {
exprElems[4] = "?";
}
// 4. Add seconds part
return concat(' ', "0", exprElems[0], exprElems[1], exprElems[2], exprElems[3], exprElems[4]);
} else {
return sauronExpr;
}
} | java | public static String unpackSchedule(String sauronExpr) {
if (sauronExpr == null) return null;
String[] exprElems = sauronExpr.trim().split("\\s+");
if (exprElems.length == 5) {
// 1. Increase number od days in "days of week"
exprElems[4] = increaseDoW(exprElems[4]);
// 2. Cut right end of an interval in repeating items
exprElems[0] = shrinkRepeating(exprElems[0], "0");
exprElems[1] = shrinkRepeating(exprElems[1], "0");
exprElems[2] = shrinkRepeating(exprElems[2], "1");
exprElems[3] = shrinkRepeating(exprElems[3], "1");
exprElems[4] = shrinkRepeating(exprElems[4], "SUN");
// 3. "Last" processing and question marks inserting
if (!"*".equals(exprElems[4])) {
if (exprElems[2].indexOf('L') >= 0 &&
exprElems[4].indexOf('-') == -1 &&
exprElems[4].indexOf('/') == -1) {
exprElems[4] = exprElems[4] + "L";
}
exprElems[2] = "?";
} else {
exprElems[4] = "?";
}
// 4. Add seconds part
return concat(' ', "0", exprElems[0], exprElems[1], exprElems[2], exprElems[3], exprElems[4]);
} else {
return sauronExpr;
}
} | [
"public",
"static",
"String",
"unpackSchedule",
"(",
"String",
"sauronExpr",
")",
"{",
"if",
"(",
"sauronExpr",
"==",
"null",
")",
"return",
"null",
";",
"String",
"[",
"]",
"exprElems",
"=",
"sauronExpr",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\"\\\... | Converting valid SauronSoftware cron expression to valid Quartz one.
The conversions are the following:
<ul><li>add "seconds" part;</li>
<li>numbers in "day of week" started from 1, not from 0 as in Sauron;</li>
<li>"*/interval" items converted to
"/interval" items;</li>
<li>one of date and day of week should be a question mark.</li>
</ul>
@param sauronExpr Valid SauronSoftware cron expression
@return Similar Quartz cron expression | [
"Converting",
"valid",
"SauronSoftware",
"cron",
"expression",
"to",
"valid",
"Quartz",
"one",
".",
"The",
"conversions",
"are",
"the",
"following",
":",
"<ul",
">",
"<li",
">",
"add",
""",
";",
"seconds"",
";",
"part",
";",
"<",
"/",
"li",
">",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/management/CronUtils.java#L95-L123 |
RestComm/mss-arquillian | mss-arquillian-lifecycle-extension/src/main/java/org/jboss/arquillian/container/mss/extension/lifecycle/LifecycleExecuter.java | LifecycleExecuter.executeBeforeDeploy | public void executeBeforeDeploy(@Observes BeforeDeploy event, TestClass testClass)
{
execute(
testClass.getMethods(
org.jboss.arquillian.container.mobicents.api.annotations.BeforeDeploy.class));
} | java | public void executeBeforeDeploy(@Observes BeforeDeploy event, TestClass testClass)
{
execute(
testClass.getMethods(
org.jboss.arquillian.container.mobicents.api.annotations.BeforeDeploy.class));
} | [
"public",
"void",
"executeBeforeDeploy",
"(",
"@",
"Observes",
"BeforeDeploy",
"event",
",",
"TestClass",
"testClass",
")",
"{",
"execute",
"(",
"testClass",
".",
"getMethods",
"(",
"org",
".",
"jboss",
".",
"arquillian",
".",
"container",
".",
"mobicents",
".... | setup with a new configuration and also we have access to the deployment | [
"setup",
"with",
"a",
"new",
"configuration",
"and",
"also",
"we",
"have",
"access",
"to",
"the",
"deployment"
] | train | https://github.com/RestComm/mss-arquillian/blob/d217b4e53701282c6e7176365a03be6f898342be/mss-arquillian-lifecycle-extension/src/main/java/org/jboss/arquillian/container/mss/extension/lifecycle/LifecycleExecuter.java#L62-L67 |
tango-controls/JTango | client/src/main/java/org/tango/client/database/cache/NoCacheDatabase.java | NoCacheDatabase.setDeviceProperties | @Override
public void setDeviceProperties(final String deviceName, final Map<String, String[]> properties) throws DevFailed {
final List<String> args = getArray(properties, deviceName);
final DeviceData argin = new DeviceData();
argin.insert(args.toArray(new String[args.size()]));
database.command_inout("DbPutDeviceProperty", argin);
} | java | @Override
public void setDeviceProperties(final String deviceName, final Map<String, String[]> properties) throws DevFailed {
final List<String> args = getArray(properties, deviceName);
final DeviceData argin = new DeviceData();
argin.insert(args.toArray(new String[args.size()]));
database.command_inout("DbPutDeviceProperty", argin);
} | [
"@",
"Override",
"public",
"void",
"setDeviceProperties",
"(",
"final",
"String",
"deviceName",
",",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"properties",
")",
"throws",
"DevFailed",
"{",
"final",
"List",
"<",
"String",
">",
"args",
"=... | Set values of device properties. (execute DbPutDeviceProperty on DB
device)
@param deviceName
The device name
@param properties
The properties names and their values
@throws DevFailed | [
"Set",
"values",
"of",
"device",
"properties",
".",
"(",
"execute",
"DbPutDeviceProperty",
"on",
"DB",
"device",
")"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/cache/NoCacheDatabase.java#L154-L160 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java | MinecraftTypeHelper.ParseItemType | public static Item ParseItemType( String s, boolean checkBlocks )
{
if (s == null)
return null;
Item item = (Item)Item.REGISTRY.getObject(new ResourceLocation(s)); // Minecraft returns null when it doesn't recognise the string
if (item == null && checkBlocks)
{
// Maybe this is a request for a block item?
IBlockState block = MinecraftTypeHelper.ParseBlockType(s);
item = (block != null && block.getBlock() != null) ? Item.getItemFromBlock(block.getBlock()) : null;
}
return item;
} | java | public static Item ParseItemType( String s, boolean checkBlocks )
{
if (s == null)
return null;
Item item = (Item)Item.REGISTRY.getObject(new ResourceLocation(s)); // Minecraft returns null when it doesn't recognise the string
if (item == null && checkBlocks)
{
// Maybe this is a request for a block item?
IBlockState block = MinecraftTypeHelper.ParseBlockType(s);
item = (block != null && block.getBlock() != null) ? Item.getItemFromBlock(block.getBlock()) : null;
}
return item;
} | [
"public",
"static",
"Item",
"ParseItemType",
"(",
"String",
"s",
",",
"boolean",
"checkBlocks",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"Item",
"item",
"=",
"(",
"Item",
")",
"Item",
".",
"REGISTRY",
".",
"getObject",
"(",
... | Attempts to parse the item type string.
@param s The string to parse.
@param checkBlocks if string can't be parsed as an item, attempt to parse as a block, if checkBlocks is true
@return The item type, or null if the string is not recognised. | [
"Attempts",
"to",
"parse",
"the",
"item",
"type",
"string",
"."
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/Utils/MinecraftTypeHelper.java#L84-L96 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java | FormLayout.insertRow | public void insertRow(int rowIndex, RowSpec rowSpec) {
if (rowIndex < 1 || rowIndex > getRowCount()) {
throw new IndexOutOfBoundsException(
"The row index " + rowIndex
+ " must be in the range [1, " + getRowCount() + "].");
}
rowSpecs.add(rowIndex - 1, rowSpec);
shiftComponentsVertically(rowIndex, false);
adjustGroupIndices(rowGroupIndices, rowIndex, false);
} | java | public void insertRow(int rowIndex, RowSpec rowSpec) {
if (rowIndex < 1 || rowIndex > getRowCount()) {
throw new IndexOutOfBoundsException(
"The row index " + rowIndex
+ " must be in the range [1, " + getRowCount() + "].");
}
rowSpecs.add(rowIndex - 1, rowSpec);
shiftComponentsVertically(rowIndex, false);
adjustGroupIndices(rowGroupIndices, rowIndex, false);
} | [
"public",
"void",
"insertRow",
"(",
"int",
"rowIndex",
",",
"RowSpec",
"rowSpec",
")",
"{",
"if",
"(",
"rowIndex",
"<",
"1",
"||",
"rowIndex",
">",
"getRowCount",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"The row index \"",
"+"... | Inserts the specified column at the specified position. Shifts components that intersect the
new column to the right and readjusts column groups.<p>
The component shift works as follows: components that were located on the right hand side of
the inserted column are shifted one column to the right; component column span is increased
by one if it intersects the new column.<p>
Column group indices that are greater or equal than the given column index will be increased
by one.
@param rowIndex index of the row to be inserted
@param rowSpec specification of the row to be inserted
@throws IndexOutOfBoundsException if the row index is out of range | [
"Inserts",
"the",
"specified",
"column",
"at",
"the",
"specified",
"position",
".",
"Shifts",
"components",
"that",
"intersect",
"the",
"new",
"column",
"to",
"the",
"right",
"and",
"readjusts",
"column",
"groups",
".",
"<p",
">"
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L597-L606 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.addCustomFunction | public void addCustomFunction(String name, int numArgs, CustomFunction function) {
// Create wrapper (also validates arguments).
SQLiteCustomFunction wrapper = new SQLiteCustomFunction(name, numArgs, function);
synchronized (mLock) {
throwIfNotOpenLocked();
mConfigurationLocked.customFunctions.add(wrapper);
try {
mConnectionPoolLocked.reconfigure(mConfigurationLocked);
} catch (RuntimeException ex) {
mConfigurationLocked.customFunctions.remove(wrapper);
throw ex;
}
}
} | java | public void addCustomFunction(String name, int numArgs, CustomFunction function) {
// Create wrapper (also validates arguments).
SQLiteCustomFunction wrapper = new SQLiteCustomFunction(name, numArgs, function);
synchronized (mLock) {
throwIfNotOpenLocked();
mConfigurationLocked.customFunctions.add(wrapper);
try {
mConnectionPoolLocked.reconfigure(mConfigurationLocked);
} catch (RuntimeException ex) {
mConfigurationLocked.customFunctions.remove(wrapper);
throw ex;
}
}
} | [
"public",
"void",
"addCustomFunction",
"(",
"String",
"name",
",",
"int",
"numArgs",
",",
"CustomFunction",
"function",
")",
"{",
"// Create wrapper (also validates arguments).",
"SQLiteCustomFunction",
"wrapper",
"=",
"new",
"SQLiteCustomFunction",
"(",
"name",
",",
"n... | Registers a CustomFunction callback as a function that can be called from
SQLite database triggers.
@param name the name of the sqlite3 function
@param numArgs the number of arguments for the function
@param function callback to call when the function is executed
@hide | [
"Registers",
"a",
"CustomFunction",
"callback",
"as",
"a",
"function",
"that",
"can",
"be",
"called",
"from",
"SQLite",
"database",
"triggers",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L845-L860 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java | TorqueDBHandling.readTextsCompressed | private void readTextsCompressed(File dir, HashMap results) throws IOException
{
if (dir.exists() && dir.isDirectory())
{
File[] files = dir.listFiles();
for (int idx = 0; idx < files.length; idx++)
{
if (files[idx].isDirectory())
{
continue;
}
results.put(files[idx].getName(), readTextCompressed(files[idx]));
}
}
} | java | private void readTextsCompressed(File dir, HashMap results) throws IOException
{
if (dir.exists() && dir.isDirectory())
{
File[] files = dir.listFiles();
for (int idx = 0; idx < files.length; idx++)
{
if (files[idx].isDirectory())
{
continue;
}
results.put(files[idx].getName(), readTextCompressed(files[idx]));
}
}
} | [
"private",
"void",
"readTextsCompressed",
"(",
"File",
"dir",
",",
"HashMap",
"results",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dir",
".",
"exists",
"(",
")",
"&&",
"dir",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"[",
"]",
"files",
"=",
... | Reads the text files in the given directory and puts their content
in the given map after compressing it. Note that this method does not
traverse recursivly into sub-directories.
@param dir The directory to process
@param results Map that will receive the contents (indexed by the relative filenames)
@throws IOException If an error ocurred | [
"Reads",
"the",
"text",
"files",
"in",
"the",
"given",
"directory",
"and",
"puts",
"their",
"content",
"in",
"the",
"given",
"map",
"after",
"compressing",
"it",
".",
"Note",
"that",
"this",
"method",
"does",
"not",
"traverse",
"recursivly",
"into",
"sub",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java#L572-L587 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java | UrlUtils.toViewBaseUrl | public static String toViewBaseUrl(final FolderJob folder, final String name) {
final StringBuilder sb = new StringBuilder(DEFAULT_BUFFER_SIZE);
final String base = UrlUtils.toBaseUrl(folder);
sb.append(base);
if (!base.endsWith("/")) sb.append('/');
sb.append("view/")
.append(EncodingUtils.encode(name));
return sb.toString();
} | java | public static String toViewBaseUrl(final FolderJob folder, final String name) {
final StringBuilder sb = new StringBuilder(DEFAULT_BUFFER_SIZE);
final String base = UrlUtils.toBaseUrl(folder);
sb.append(base);
if (!base.endsWith("/")) sb.append('/');
sb.append("view/")
.append(EncodingUtils.encode(name));
return sb.toString();
} | [
"public",
"static",
"String",
"toViewBaseUrl",
"(",
"final",
"FolderJob",
"folder",
",",
"final",
"String",
"name",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"DEFAULT_BUFFER_SIZE",
")",
";",
"final",
"String",
"base",
"=",
"Ur... | Helper to create the base url for a view, with or without a given folder
@param folder the folder or {@code null}
@param name the of the view.
@return converted view url. | [
"Helper",
"to",
"create",
"the",
"base",
"url",
"for",
"a",
"view",
"with",
"or",
"without",
"a",
"given",
"folder"
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java#L70-L78 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/BooleanUtils.java | BooleanUtils.toInteger | public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) {
if (bool == null) {
return nullValue;
}
return bool.booleanValue() ? trueValue : falseValue;
} | java | public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) {
if (bool == null) {
return nullValue;
}
return bool.booleanValue() ? trueValue : falseValue;
} | [
"public",
"static",
"int",
"toInteger",
"(",
"final",
"Boolean",
"bool",
",",
"final",
"int",
"trueValue",
",",
"final",
"int",
"falseValue",
",",
"final",
"int",
"nullValue",
")",
"{",
"if",
"(",
"bool",
"==",
"null",
")",
"{",
"return",
"nullValue",
";... | <p>Converts a Boolean to an int specifying the conversion values.</p>
<pre>
BooleanUtils.toInteger(Boolean.TRUE, 1, 0, 2) = 1
BooleanUtils.toInteger(Boolean.FALSE, 1, 0, 2) = 0
BooleanUtils.toInteger(null, 1, 0, 2) = 2
</pre>
@param bool the Boolean to convert
@param trueValue the value to return if {@code true}
@param falseValue the value to return if {@code false}
@param nullValue the value to return if {@code null}
@return the appropriate value | [
"<p",
">",
"Converts",
"a",
"Boolean",
"to",
"an",
"int",
"specifying",
"the",
"conversion",
"values",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/BooleanUtils.java#L464-L469 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/AWSRequestMetricsFullSupport.java | AWSRequestMetricsFullSupport.addProperty | @Override
public void addProperty(String propertyName, Object value) {
List<Object> propertyList = properties.get(propertyName);
if (propertyList == null) {
propertyList = new ArrayList<Object>();
properties.put(propertyName, propertyList);
}
propertyList.add(value);
} | java | @Override
public void addProperty(String propertyName, Object value) {
List<Object> propertyList = properties.get(propertyName);
if (propertyList == null) {
propertyList = new ArrayList<Object>();
properties.put(propertyName, propertyList);
}
propertyList.add(value);
} | [
"@",
"Override",
"public",
"void",
"addProperty",
"(",
"String",
"propertyName",
",",
"Object",
"value",
")",
"{",
"List",
"<",
"Object",
">",
"propertyList",
"=",
"properties",
".",
"get",
"(",
"propertyName",
")",
";",
"if",
"(",
"propertyList",
"==",
"n... | Add a property. If you add the same property more than once, it stores
all values a list.
This feature is enabled if the system property
"com.amazonaws.sdk.enableRuntimeProfiling" is set, or if a
{@link RequestMetricCollector} is in use either at the request, web service
client, or AWS SDK level.
@param propertyName
The name of the property
@param value
The property value | [
"Add",
"a",
"property",
".",
"If",
"you",
"add",
"the",
"same",
"property",
"more",
"than",
"once",
"it",
"stores",
"all",
"values",
"a",
"list",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/AWSRequestMetricsFullSupport.java#L171-L180 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementManager.java | StatementManager.bindInsert | public void bindInsert(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws java.sql.SQLException
{
ValueContainer[] values;
cld.updateLockingValues(obj); // BRJ : provide useful defaults for locking fields
if (cld.getInsertProcedure() != null)
{
this.bindProcedure(stmt, cld, obj, cld.getInsertProcedure());
}
else
{
values = getAllValues(cld, obj);
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, i + 1, values[i].getValue(), values[i].getJdbcType().getType());
}
}
} | java | public void bindInsert(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws java.sql.SQLException
{
ValueContainer[] values;
cld.updateLockingValues(obj); // BRJ : provide useful defaults for locking fields
if (cld.getInsertProcedure() != null)
{
this.bindProcedure(stmt, cld, obj, cld.getInsertProcedure());
}
else
{
values = getAllValues(cld, obj);
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, i + 1, values[i].getValue(), values[i].getJdbcType().getType());
}
}
} | [
"public",
"void",
"bindInsert",
"(",
"PreparedStatement",
"stmt",
",",
"ClassDescriptor",
"cld",
",",
"Object",
"obj",
")",
"throws",
"java",
".",
"sql",
".",
"SQLException",
"{",
"ValueContainer",
"[",
"]",
"values",
";",
"cld",
".",
"updateLockingValues",
"(... | binds the values of the object obj to the statements parameters | [
"binds",
"the",
"values",
"of",
"the",
"object",
"obj",
"to",
"the",
"statements",
"parameters"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L432-L449 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java | TimeoutMap.put | public V put(K pKey, V pValue) {
TimedEntry<K, V> entry = (TimedEntry<K, V>) entries.get(pKey);
V oldValue;
if (entry == null) {
oldValue = null;
entry = createEntry(pKey, pValue);
entries.put(pKey, entry);
}
else {
oldValue = entry.mValue;
entry.setValue(pValue);
entry.recordAccess(this);
}
// Need to remove expired objects every now and then
// We do it in the put method, to avoid resource leaks over time.
removeExpiredEntries();
modCount++;
return oldValue;
} | java | public V put(K pKey, V pValue) {
TimedEntry<K, V> entry = (TimedEntry<K, V>) entries.get(pKey);
V oldValue;
if (entry == null) {
oldValue = null;
entry = createEntry(pKey, pValue);
entries.put(pKey, entry);
}
else {
oldValue = entry.mValue;
entry.setValue(pValue);
entry.recordAccess(this);
}
// Need to remove expired objects every now and then
// We do it in the put method, to avoid resource leaks over time.
removeExpiredEntries();
modCount++;
return oldValue;
} | [
"public",
"V",
"put",
"(",
"K",
"pKey",
",",
"V",
"pValue",
")",
"{",
"TimedEntry",
"<",
"K",
",",
"V",
">",
"entry",
"=",
"(",
"TimedEntry",
"<",
"K",
",",
"V",
">",
")",
"entries",
".",
"get",
"(",
"pKey",
")",
";",
"V",
"oldValue",
";",
"i... | Associates the specified pValue with the specified pKey in this map
(optional operation). If the map previously contained a mapping for
this pKey, the old pValue is replaced.
@param pKey pKey with which the specified pValue is to be associated.
@param pValue pValue to be associated with the specified pKey.
@return previous pValue associated with specified pKey, or {@code null}
if there was no mapping for pKey. A {@code null} return can
also indicate that the map previously associated {@code null}
with the specified pKey, if the implementation supports
{@code null} values. | [
"Associates",
"the",
"specified",
"pValue",
"with",
"the",
"specified",
"pKey",
"in",
"this",
"map",
"(",
"optional",
"operation",
")",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"this",
"pKey",
"the",
"old",
"pValue",
"is",
... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java#L235-L258 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/JobScheduler.java | JobScheduler.updateJob | public boolean updateJob(EncodedImage encodedImage, @Consumer.Status int status) {
if (!shouldProcess(encodedImage, status)) {
return false;
}
EncodedImage oldEncodedImage;
synchronized (this) {
oldEncodedImage = mEncodedImage;
mEncodedImage = EncodedImage.cloneOrNull(encodedImage);
mStatus = status;
}
EncodedImage.closeSafely(oldEncodedImage);
return true;
} | java | public boolean updateJob(EncodedImage encodedImage, @Consumer.Status int status) {
if (!shouldProcess(encodedImage, status)) {
return false;
}
EncodedImage oldEncodedImage;
synchronized (this) {
oldEncodedImage = mEncodedImage;
mEncodedImage = EncodedImage.cloneOrNull(encodedImage);
mStatus = status;
}
EncodedImage.closeSafely(oldEncodedImage);
return true;
} | [
"public",
"boolean",
"updateJob",
"(",
"EncodedImage",
"encodedImage",
",",
"@",
"Consumer",
".",
"Status",
"int",
"status",
")",
"{",
"if",
"(",
"!",
"shouldProcess",
"(",
"encodedImage",
",",
"status",
")",
")",
"{",
"return",
"false",
";",
"}",
"Encoded... | Updates the job.
<p> This just updates the job, but it doesn't schedule it. In order to be executed, the job has
to be scheduled after being set. In case there was a previous job scheduled that has not yet
started, this new job will be executed instead.
@return whether the job was successfully updated. | [
"Updates",
"the",
"job",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/JobScheduler.java#L114-L126 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/validation/PatchHistoryValidations.java | PatchHistoryValidations.validateRollbackState | public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException {
final Set<String> validHistory = processRollbackState(patchID, identity);
if (patchID != null && !validHistory.contains(patchID)) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID);
}
} | java | public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException {
final Set<String> validHistory = processRollbackState(patchID, identity);
if (patchID != null && !validHistory.contains(patchID)) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID);
}
} | [
"public",
"static",
"void",
"validateRollbackState",
"(",
"final",
"String",
"patchID",
",",
"final",
"InstalledIdentity",
"identity",
")",
"throws",
"PatchingException",
"{",
"final",
"Set",
"<",
"String",
">",
"validHistory",
"=",
"processRollbackState",
"(",
"pat... | Validate the consistency of patches to the point we rollback.
@param patchID the patch id which gets rolled back
@param identity the installed identity
@throws PatchingException | [
"Validate",
"the",
"consistency",
"of",
"patches",
"to",
"the",
"point",
"we",
"rollback",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/PatchHistoryValidations.java#L54-L59 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/rest/OrientDBHttpAPIResource.java | OrientDBHttpAPIResource.mountOrientDbRestApi | @SuppressWarnings("restriction")
public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource, WebApplication app) {
mountOrientDbRestApi(resource, app, MOUNT_PATH);
} | java | @SuppressWarnings("restriction")
public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource, WebApplication app) {
mountOrientDbRestApi(resource, app, MOUNT_PATH);
} | [
"@",
"SuppressWarnings",
"(",
"\"restriction\"",
")",
"public",
"static",
"void",
"mountOrientDbRestApi",
"(",
"OrientDBHttpAPIResource",
"resource",
",",
"WebApplication",
"app",
")",
"{",
"mountOrientDbRestApi",
"(",
"resource",
",",
"app",
",",
"MOUNT_PATH",
")",
... | Mounts OrientDB REST API Bridge to an app
@param resource {@link OrientDBHttpAPIResource} to mount
@param app {@link WebApplication} to mount to | [
"Mounts",
"OrientDB",
"REST",
"API",
"Bridge",
"to",
"an",
"app"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/rest/OrientDBHttpAPIResource.java#L176-L179 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java | ImportHelpers.addImport | public static void addImport( Instance instance, String componentOrFacetName, Import imp ) {
Collection<Import> imports = instance.getImports().get( componentOrFacetName );
if(imports == null) {
imports = new LinkedHashSet<Import> ();
instance.getImports().put( componentOrFacetName, imports );
}
if( ! imports.contains( imp ))
imports.add( imp );
} | java | public static void addImport( Instance instance, String componentOrFacetName, Import imp ) {
Collection<Import> imports = instance.getImports().get( componentOrFacetName );
if(imports == null) {
imports = new LinkedHashSet<Import> ();
instance.getImports().put( componentOrFacetName, imports );
}
if( ! imports.contains( imp ))
imports.add( imp );
} | [
"public",
"static",
"void",
"addImport",
"(",
"Instance",
"instance",
",",
"String",
"componentOrFacetName",
",",
"Import",
"imp",
")",
"{",
"Collection",
"<",
"Import",
">",
"imports",
"=",
"instance",
".",
"getImports",
"(",
")",
".",
"get",
"(",
"componen... | Adds an import to an instance (provided this import was not already set).
@param instance the instance whose imports must be updated
@param componentOrFacetName the component or facet name associated with the import
@param imp the import to add | [
"Adds",
"an",
"import",
"to",
"an",
"instance",
"(",
"provided",
"this",
"import",
"was",
"not",
"already",
"set",
")",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java#L144-L154 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java | Matchers.allOf | public static Matcher<MultiResult> allOf(final Matcher<?>... matchers) {
checkNotEmpty(matchers);
return new MultiMatcher(true, matchers);
} | java | public static Matcher<MultiResult> allOf(final Matcher<?>... matchers) {
checkNotEmpty(matchers);
return new MultiMatcher(true, matchers);
} | [
"public",
"static",
"Matcher",
"<",
"MultiResult",
">",
"allOf",
"(",
"final",
"Matcher",
"<",
"?",
">",
"...",
"matchers",
")",
"{",
"checkNotEmpty",
"(",
"matchers",
")",
";",
"return",
"new",
"MultiMatcher",
"(",
"true",
",",
"matchers",
")",
";",
"}"... | Creates a matcher that matches if the examined input matches <b>all</b> of the specified
matchers. This method
evaluates all the matchers regardless intermediate results.
<p/>
The match result represents a combination of all match operations. If succeeded,
the match result with the
greatest end position is selected to implement the result {@link Result} instance returned
by this method.
If the result is negative, then the one which fails first is returned.
<p/>
If several matchers the have same end position, then the result from the one with the
smaller argument index is
returned.
@param matchers the vararg array of the matchers
@return the multi match result | [
"Creates",
"a",
"matcher",
"that",
"matches",
"if",
"the",
"examined",
"input",
"matches",
"<b",
">",
"all<",
"/",
"b",
">",
"of",
"the",
"specified",
"matchers",
".",
"This",
"method",
"evaluates",
"all",
"the",
"matchers",
"regardless",
"intermediate",
"re... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L171-L174 |
fernandospr/javapns-jdk16 | src/main/java/javapns/notification/Payload.java | Payload.isEstimatedPayloadSizeAllowedAfterAdding | public boolean isEstimatedPayloadSizeAllowedAfterAdding(String propertyName, Object propertyValue) {
int maximumPayloadSize = getMaximumPayloadSize();
int estimatedPayloadSize = estimatePayloadSizeAfterAdding(propertyName, propertyValue);
boolean estimatedToBeAllowed = estimatedPayloadSize <= maximumPayloadSize;
return estimatedToBeAllowed;
} | java | public boolean isEstimatedPayloadSizeAllowedAfterAdding(String propertyName, Object propertyValue) {
int maximumPayloadSize = getMaximumPayloadSize();
int estimatedPayloadSize = estimatePayloadSizeAfterAdding(propertyName, propertyValue);
boolean estimatedToBeAllowed = estimatedPayloadSize <= maximumPayloadSize;
return estimatedToBeAllowed;
} | [
"public",
"boolean",
"isEstimatedPayloadSizeAllowedAfterAdding",
"(",
"String",
"propertyName",
",",
"Object",
"propertyValue",
")",
"{",
"int",
"maximumPayloadSize",
"=",
"getMaximumPayloadSize",
"(",
")",
";",
"int",
"estimatedPayloadSize",
"=",
"estimatePayloadSizeAfterA... | Validate if the estimated payload size after adding a given property will be allowed.
For performance reasons, this estimate is not as reliable as actually adding
the property and checking the payload size afterwards.
@param propertyName the name of the property to use for calculating the estimation
@param propertyValue the value of the property to use for calculating the estimation
@return true if the payload size is not expected to exceed the maximum allowed, false if it might be too big | [
"Validate",
"if",
"the",
"estimated",
"payload",
"size",
"after",
"adding",
"a",
"given",
"property",
"will",
"be",
"allowed",
".",
"For",
"performance",
"reasons",
"this",
"estimate",
"is",
"not",
"as",
"reliable",
"as",
"actually",
"adding",
"the",
"property... | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/notification/Payload.java#L234-L239 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.