repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java | KltTracker.isFullyOutside | public boolean isFullyOutside(float x, float y) {
if (x < outsideLeft || x > outsideRight)
return true;
if (y < outsideTop || y > outsideBottom)
return true;
return false;
} | java | public boolean isFullyOutside(float x, float y) {
if (x < outsideLeft || x > outsideRight)
return true;
if (y < outsideTop || y > outsideBottom)
return true;
return false;
} | [
"public",
"boolean",
"isFullyOutside",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"if",
"(",
"x",
"<",
"outsideLeft",
"||",
"x",
">",
"outsideRight",
")",
"return",
"true",
";",
"if",
"(",
"y",
"<",
"outsideTop",
"||",
"y",
">",
"outsideBottom",
... | Returns true if the features is entirely outside of the image. A region is entirely outside if not
an entire pixel is contained inside the image. So if only 0.999 of a pixel is inside then the whole
region is considered to be outside. Can't interpolate nothing... | [
"Returns",
"true",
"if",
"the",
"features",
"is",
"entirely",
"outside",
"of",
"the",
"image",
".",
"A",
"region",
"is",
"entirely",
"outside",
"if",
"not",
"an",
"entire",
"pixel",
"is",
"contained",
"inside",
"the",
"image",
".",
"So",
"if",
"only",
"0... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L488-L495 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/search/aggregate/DBEntitySequenceFactory.java | DBEntitySequenceFactory.initializeScalarFields | void initializeScalarFields(DBEntity caller, List<String> scalarFields, DBEntitySequenceOptions options) {
TableDefinition tableDef = caller.getTableDef();
String category = toEntityCategory(tableDef.getTableName(), scalarFields);
LRUCache<ObjectID, Map<String, String>> cache = getScalarCache(category);
Set<ObjectID> idSet = new HashSet<ObjectID>();
List<DBEntity> entities = collectUninitializedEntities(caller, cache, idSet, options.adjustEntityBuffer(cache));
if (idSet.size() == 0){
// all requested scalar values have been found in the cache, no fetching is required
return;
}
Map<ObjectID, Map<String, String>> fetchResult = fetchScalarFields(tableDef, idSet, scalarFields, category);
for (Map.Entry<ObjectID, Map<String, String>> entry: fetchResult.entrySet()) {
cache.put(entry.getKey(), entry.getValue());
}
// Initialize the entities with the cached scalar values
for (DBEntity entity : entities) {
ObjectID key = entity.id();
Map<String, String> values = cache.get(key);
if(values == null) {
values = new HashMap<String, String>();
}
entity.initialize(values);
}
} | java | void initializeScalarFields(DBEntity caller, List<String> scalarFields, DBEntitySequenceOptions options) {
TableDefinition tableDef = caller.getTableDef();
String category = toEntityCategory(tableDef.getTableName(), scalarFields);
LRUCache<ObjectID, Map<String, String>> cache = getScalarCache(category);
Set<ObjectID> idSet = new HashSet<ObjectID>();
List<DBEntity> entities = collectUninitializedEntities(caller, cache, idSet, options.adjustEntityBuffer(cache));
if (idSet.size() == 0){
// all requested scalar values have been found in the cache, no fetching is required
return;
}
Map<ObjectID, Map<String, String>> fetchResult = fetchScalarFields(tableDef, idSet, scalarFields, category);
for (Map.Entry<ObjectID, Map<String, String>> entry: fetchResult.entrySet()) {
cache.put(entry.getKey(), entry.getValue());
}
// Initialize the entities with the cached scalar values
for (DBEntity entity : entities) {
ObjectID key = entity.id();
Map<String, String> values = cache.get(key);
if(values == null) {
values = new HashMap<String, String>();
}
entity.initialize(values);
}
} | [
"void",
"initializeScalarFields",
"(",
"DBEntity",
"caller",
",",
"List",
"<",
"String",
">",
"scalarFields",
",",
"DBEntitySequenceOptions",
"options",
")",
"{",
"TableDefinition",
"tableDef",
"=",
"caller",
".",
"getTableDef",
"(",
")",
";",
"String",
"category"... | Fetches the scalar values of the specified entity.
Also fetches the scalar values of other entities to be returned by the iterators of the same category
Uses {@link #multiget_slice(List, ColumnParent, SlicePredicate)} method with the 'slice list' parameter to perform bulk fetch
@param tableDef entity type
@param caller next entity to be returned by the iterator (must be initialized first)
@param scalarFields list of the fields to be fetched
@param options defines now many entities should be initialized | [
"Fetches",
"the",
"scalar",
"values",
"of",
"the",
"specified",
"entity",
".",
"Also",
"fetches",
"the",
"scalar",
"values",
"of",
"other",
"entities",
"to",
"be",
"returned",
"by",
"the",
"iterators",
"of",
"the",
"same",
"category",
"Uses",
"{",
"@link",
... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/search/aggregate/DBEntitySequenceFactory.java#L130-L159 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceDelegator.java | PersistenceDelegator.findById | public <E> E findById(final Class<E> entityClass, final Object primaryKey)
{
E e = find(entityClass, primaryKey);
if (e == null)
{
return null;
}
// Return a copy of this entity
return (E) (e);
} | java | public <E> E findById(final Class<E> entityClass, final Object primaryKey)
{
E e = find(entityClass, primaryKey);
if (e == null)
{
return null;
}
// Return a copy of this entity
return (E) (e);
} | [
"public",
"<",
"E",
">",
"E",
"findById",
"(",
"final",
"Class",
"<",
"E",
">",
"entityClass",
",",
"final",
"Object",
"primaryKey",
")",
"{",
"E",
"e",
"=",
"find",
"(",
"entityClass",
",",
"primaryKey",
")",
";",
"if",
"(",
"e",
"==",
"null",
")"... | Find object based on primary key either form persistence cache or from
database
@param entityClass
@param primaryKey
@return | [
"Find",
"object",
"based",
"on",
"primary",
"key",
"either",
"form",
"persistence",
"cache",
"or",
"from",
"database"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceDelegator.java#L172-L182 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/SocketOutputStream.java | SocketOutputStream.socketWrite | private void socketWrite(byte b[], int off, int len) throws IOException {
if (len <= 0 || off < 0 || off + len > b.length) {
if (len == 0) {
return;
}
throw new ArrayIndexOutOfBoundsException();
}
Object traceContext = IoTrace.socketWriteBegin();
int bytesWritten = 0;
FileDescriptor fd = impl.acquireFD();
try {
BlockGuard.getThreadPolicy().onNetwork();
socketWrite0(fd, b, off, len);
bytesWritten = len;
} catch (SocketException se) {
if (se instanceof sun.net.ConnectionResetException) {
impl.setConnectionResetPending();
se = new SocketException("Connection reset");
}
if (impl.isClosedOrPending()) {
throw new SocketException("Socket closed");
} else {
throw se;
}
} finally {
IoTrace.socketWriteEnd(traceContext, impl.address, impl.port, bytesWritten);
}
} | java | private void socketWrite(byte b[], int off, int len) throws IOException {
if (len <= 0 || off < 0 || off + len > b.length) {
if (len == 0) {
return;
}
throw new ArrayIndexOutOfBoundsException();
}
Object traceContext = IoTrace.socketWriteBegin();
int bytesWritten = 0;
FileDescriptor fd = impl.acquireFD();
try {
BlockGuard.getThreadPolicy().onNetwork();
socketWrite0(fd, b, off, len);
bytesWritten = len;
} catch (SocketException se) {
if (se instanceof sun.net.ConnectionResetException) {
impl.setConnectionResetPending();
se = new SocketException("Connection reset");
}
if (impl.isClosedOrPending()) {
throw new SocketException("Socket closed");
} else {
throw se;
}
} finally {
IoTrace.socketWriteEnd(traceContext, impl.address, impl.port, bytesWritten);
}
} | [
"private",
"void",
"socketWrite",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
"<=",
"0",
"||",
"off",
"<",
"0",
"||",
"off",
"+",
"len",
">",
"b",
".",
"length",
")",
"{... | Writes to the socket with appropriate locking of the
FileDescriptor.
@param b the data to be written
@param off the start offset in the data
@param len the number of bytes that are written
@exception IOException If an I/O error has occurred. | [
"Writes",
"to",
"the",
"socket",
"with",
"appropriate",
"locking",
"of",
"the",
"FileDescriptor",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/SocketOutputStream.java#L98-L127 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.executePlacesSearchRequestAsync | @Deprecated
public static RequestAsyncTask executePlacesSearchRequestAsync(Session session, Location location,
int radiusInMeters, int resultsLimit, String searchText, GraphPlaceListCallback callback) {
return newPlacesSearchRequest(session, location, radiusInMeters, resultsLimit, searchText, callback)
.executeAsync();
} | java | @Deprecated
public static RequestAsyncTask executePlacesSearchRequestAsync(Session session, Location location,
int radiusInMeters, int resultsLimit, String searchText, GraphPlaceListCallback callback) {
return newPlacesSearchRequest(session, location, radiusInMeters, resultsLimit, searchText, callback)
.executeAsync();
} | [
"@",
"Deprecated",
"public",
"static",
"RequestAsyncTask",
"executePlacesSearchRequestAsync",
"(",
"Session",
"session",
",",
"Location",
"location",
",",
"int",
"radiusInMeters",
",",
"int",
"resultsLimit",
",",
"String",
"searchText",
",",
"GraphPlaceListCallback",
"c... | Starts a new Request that is configured to perform a search for places near a specified location via the Graph
API.
<p/>
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newPlacesSearchRequest(...).executeAsync();
@param session
the Session to use, or null; if non-null, the session must be in an opened state
@param location
the location around which to search; only the latitude and longitude components of the location are
meaningful
@param radiusInMeters
the radius around the location to search, specified in meters
@param resultsLimit
the maximum number of results to return
@param searchText
optional text to search for as part of the name or type of an object
@param callback
a callback that will be called when the request is completed to handle success or error conditions
@return a RequestAsyncTask that is executing the request
@throws FacebookException If neither location nor searchText is specified | [
"Starts",
"a",
"new",
"Request",
"that",
"is",
"configured",
"to",
"perform",
"a",
"search",
"for",
"places",
"near",
"a",
"specified",
"location",
"via",
"the",
"Graph",
"API",
".",
"<p",
"/",
">",
"This",
"should",
"only",
"be",
"called",
"from",
"the"... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1222-L1227 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java | NetworkProfilesInner.createOrUpdateAsync | public Observable<NetworkProfileInner> createOrUpdateAsync(String resourceGroupName, String networkProfileName, NetworkProfileInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkProfileName, parameters).map(new Func1<ServiceResponse<NetworkProfileInner>, NetworkProfileInner>() {
@Override
public NetworkProfileInner call(ServiceResponse<NetworkProfileInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkProfileInner> createOrUpdateAsync(String resourceGroupName, String networkProfileName, NetworkProfileInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkProfileName, parameters).map(new Func1<ServiceResponse<NetworkProfileInner>, NetworkProfileInner>() {
@Override
public NetworkProfileInner call(ServiceResponse<NetworkProfileInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkProfileInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkProfileName",
",",
"NetworkProfileInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroup... | Creates or updates a network profile.
@param resourceGroupName The name of the resource group.
@param networkProfileName The name of the network profile.
@param parameters Parameters supplied to the create or update network profile operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"network",
"profile",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkProfilesInner.java#L374-L381 |
beangle/beangle3 | commons/model/src/main/java/org/beangle/commons/entity/util/HierarchyEntityUtils.java | HierarchyEntityUtils.addParent | public static <T extends HierarchyEntity<T, ?>> void addParent(Collection<T> nodes, T toRoot) {
Set<T> parents = CollectUtils.newHashSet();
for (T node : nodes) {
while (null != node.getParent() && !parents.contains(node.getParent())
&& !Objects.equals(node.getParent(), toRoot)) {
parents.add(node.getParent());
node = node.getParent();
}
}
nodes.addAll(parents);
} | java | public static <T extends HierarchyEntity<T, ?>> void addParent(Collection<T> nodes, T toRoot) {
Set<T> parents = CollectUtils.newHashSet();
for (T node : nodes) {
while (null != node.getParent() && !parents.contains(node.getParent())
&& !Objects.equals(node.getParent(), toRoot)) {
parents.add(node.getParent());
node = node.getParent();
}
}
nodes.addAll(parents);
} | [
"public",
"static",
"<",
"T",
"extends",
"HierarchyEntity",
"<",
"T",
",",
"?",
">",
">",
"void",
"addParent",
"(",
"Collection",
"<",
"T",
">",
"nodes",
",",
"T",
"toRoot",
")",
"{",
"Set",
"<",
"T",
">",
"parents",
"=",
"CollectUtils",
".",
"newHas... | <p>
addParent.
</p>
@param nodes a {@link java.util.Collection} object.
@param toRoot a T object.
@param <T> a T object. | [
"<p",
">",
"addParent",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/entity/util/HierarchyEntityUtils.java#L209-L219 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/NormOps_DDRM.java | NormOps_DDRM.elementP | public static double elementP(DMatrix1Row A , double p ) {
if( p == 1 ) {
return CommonOps_DDRM.elementSumAbs(A);
} if( p == 2 ) {
return normF(A);
} else {
double max = CommonOps_DDRM.elementMaxAbs(A);
if( max == 0.0 )
return 0.0;
double total = 0;
int size = A.getNumElements();
for( int i = 0; i < size; i++ ) {
double a = A.get(i)/max;
total += Math.pow(Math.abs(a),p);
}
return max* Math.pow(total,1.0/p);
}
} | java | public static double elementP(DMatrix1Row A , double p ) {
if( p == 1 ) {
return CommonOps_DDRM.elementSumAbs(A);
} if( p == 2 ) {
return normF(A);
} else {
double max = CommonOps_DDRM.elementMaxAbs(A);
if( max == 0.0 )
return 0.0;
double total = 0;
int size = A.getNumElements();
for( int i = 0; i < size; i++ ) {
double a = A.get(i)/max;
total += Math.pow(Math.abs(a),p);
}
return max* Math.pow(total,1.0/p);
}
} | [
"public",
"static",
"double",
"elementP",
"(",
"DMatrix1Row",
"A",
",",
"double",
"p",
")",
"{",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"return",
"CommonOps_DDRM",
".",
"elementSumAbs",
"(",
"A",
")",
";",
"}",
"if",
"(",
"p",
"==",
"2",
")",
"{",
... | <p>
Element wise p-norm:<br>
<br>
norm = {∑<sub>i=1:m</sub> ∑<sub>j=1:n</sub> { |a<sub>ij</sub>|<sup>p</sup>}}<sup>1/p</sup>
</p>
<p>
This is not the same as the induced p-norm used on matrices, but is the same as the vector p-norm.
</p>
@param A Matrix. Not modified.
@param p p value.
@return The norm's value. | [
"<p",
">",
"Element",
"wise",
"p",
"-",
"norm",
":",
"<br",
">",
"<br",
">",
"norm",
"=",
"{",
"&sum",
";",
"<sub",
">",
"i",
"=",
"1",
":",
"m<",
"/",
"sub",
">",
"&sum",
";",
"<sub",
">",
"j",
"=",
"1",
":",
"n<",
"/",
"sub",
">",
"{",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/NormOps_DDRM.java#L227-L250 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java | Types.POJO | public static <T> TypeInformation<T> POJO(Class<T> pojoClass, Map<String, TypeInformation<?>> fields) {
final List<PojoField> pojoFields = new ArrayList<>(fields.size());
for (Map.Entry<String, TypeInformation<?>> field : fields.entrySet()) {
final Field f = TypeExtractor.getDeclaredField(pojoClass, field.getKey());
if (f == null) {
throw new InvalidTypesException("Field '" + field.getKey() + "'could not be accessed.");
}
pojoFields.add(new PojoField(f, field.getValue()));
}
return new PojoTypeInfo<>(pojoClass, pojoFields);
} | java | public static <T> TypeInformation<T> POJO(Class<T> pojoClass, Map<String, TypeInformation<?>> fields) {
final List<PojoField> pojoFields = new ArrayList<>(fields.size());
for (Map.Entry<String, TypeInformation<?>> field : fields.entrySet()) {
final Field f = TypeExtractor.getDeclaredField(pojoClass, field.getKey());
if (f == null) {
throw new InvalidTypesException("Field '" + field.getKey() + "'could not be accessed.");
}
pojoFields.add(new PojoField(f, field.getValue()));
}
return new PojoTypeInfo<>(pojoClass, pojoFields);
} | [
"public",
"static",
"<",
"T",
">",
"TypeInformation",
"<",
"T",
">",
"POJO",
"(",
"Class",
"<",
"T",
">",
"pojoClass",
",",
"Map",
"<",
"String",
",",
"TypeInformation",
"<",
"?",
">",
">",
"fields",
")",
"{",
"final",
"List",
"<",
"PojoField",
">",
... | Returns type information for a POJO (Plain Old Java Object) and allows to specify all fields manually.
<p>A POJO class is public and standalone (no non-static inner class). It has a public no-argument
constructor. All non-static, non-transient fields in the class (and all superclasses) are either public
(and non-final) or have a public getter and a setter method that follows the Java beans naming
conventions for getters and setters.
<p>A POJO is a fixed-length, null-aware composite type with non-deterministic field order. Every field
can be null independent of the field's type.
<p>The generic types for all fields of the POJO can be defined in a hierarchy of subclasses.
<p>If Flink's type analyzer is unable to extract a POJO field, an
{@link org.apache.flink.api.common.functions.InvalidTypesException} is thrown.
<p><strong>Note:</strong> In most cases the type information of fields can be determined automatically,
we recommend to use {@link Types#POJO(Class)}.
@param pojoClass POJO class
@param fields map of fields that map a name to type information. The map key is the name of
the field and the value is its type. | [
"Returns",
"type",
"information",
"for",
"a",
"POJO",
"(",
"Plain",
"Old",
"Java",
"Object",
")",
"and",
"allows",
"to",
"specify",
"all",
"fields",
"manually",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L312-L323 |
dwdyer/uncommons-maths | core/src/java/main/org/uncommons/maths/binary/BitString.java | BitString.setBit | public void setBit(int index, boolean set)
{
assertValidIndex(index);
int word = index / WORD_LENGTH;
int offset = index % WORD_LENGTH;
if (set)
{
data[word] |= (1 << offset);
}
else // Unset the bit.
{
data[word] &= ~(1 << offset);
}
} | java | public void setBit(int index, boolean set)
{
assertValidIndex(index);
int word = index / WORD_LENGTH;
int offset = index % WORD_LENGTH;
if (set)
{
data[word] |= (1 << offset);
}
else // Unset the bit.
{
data[word] &= ~(1 << offset);
}
} | [
"public",
"void",
"setBit",
"(",
"int",
"index",
",",
"boolean",
"set",
")",
"{",
"assertValidIndex",
"(",
"index",
")",
";",
"int",
"word",
"=",
"index",
"/",
"WORD_LENGTH",
";",
"int",
"offset",
"=",
"index",
"%",
"WORD_LENGTH",
";",
"if",
"(",
"set"... | Sets the bit at the specified index.
@param index The index of the bit to set (0 is the least-significant bit).
@param set A boolean indicating whether the bit should be set or not.
@throws IndexOutOfBoundsException If the specified index is not a bit
position in this bit string. | [
"Sets",
"the",
"bit",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/dwdyer/uncommons-maths/blob/b7ba13aea70625bb7f37c856783a29e17e354964/core/src/java/main/org/uncommons/maths/binary/BitString.java#L145-L158 |
indeedeng/util | util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java | AtomicSharedReference.map | public synchronized @Nullable <Z> Z map(Function<T, Z> f) {
if (ref == null) {
return f.apply(null);
} else {
return f.apply(ref.get());
}
} | java | public synchronized @Nullable <Z> Z map(Function<T, Z> f) {
if (ref == null) {
return f.apply(null);
} else {
return f.apply(ref.get());
}
} | [
"public",
"synchronized",
"@",
"Nullable",
"<",
"Z",
">",
"Z",
"map",
"(",
"Function",
"<",
"T",
",",
"Z",
">",
"f",
")",
"{",
"if",
"(",
"ref",
"==",
"null",
")",
"{",
"return",
"f",
".",
"apply",
"(",
"null",
")",
";",
"}",
"else",
"{",
"re... | Call some function f on the reference we are storing.
Saving the value of T after this call returns is COMPLETELY UNSAFE. Don't do it.
@param f lambda(T x)
@param <Z> Return type; <? extends Object>
@return result of f | [
"Call",
"some",
"function",
"f",
"on",
"the",
"reference",
"we",
"are",
"storing",
".",
"Saving",
"the",
"value",
"of",
"T",
"after",
"this",
"call",
"returns",
"is",
"COMPLETELY",
"UNSAFE",
".",
"Don",
"t",
"do",
"it",
"."
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/reference/AtomicSharedReference.java#L131-L137 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java | ChecksumsManager.registerExistingChecksums | public void registerExistingChecksums(File featureDir, String symbolicName, String fileName) {
ChecksumData checksums = checksumsMap.get(featureDir);
if (checksums == null) {
checksums = new ChecksumData();
checksumsMap.put(featureDir, checksums);
}
checksums.registerExistingChecksums(symbolicName, fileName);
} | java | public void registerExistingChecksums(File featureDir, String symbolicName, String fileName) {
ChecksumData checksums = checksumsMap.get(featureDir);
if (checksums == null) {
checksums = new ChecksumData();
checksumsMap.put(featureDir, checksums);
}
checksums.registerExistingChecksums(symbolicName, fileName);
} | [
"public",
"void",
"registerExistingChecksums",
"(",
"File",
"featureDir",
",",
"String",
"symbolicName",
",",
"String",
"fileName",
")",
"{",
"ChecksumData",
"checksums",
"=",
"checksumsMap",
".",
"get",
"(",
"featureDir",
")",
";",
"if",
"(",
"checksums",
"==",... | Registers an existing feature directory's checksum
@param featureDir the feature directory
@param symbolicName the symbolic name for the file
@param fileName the actual file name | [
"Registers",
"an",
"existing",
"feature",
"directory",
"s",
"checksum"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java#L254-L261 |
kiswanij/jk-util | src/main/java/com/jk/util/reflection/client/ReflectionClient.java | ReflectionClient.callMethod | public void callMethod(final MethodCallInfo info) {
this.logger.info("calling remote method ".concat(info.toString()));
try (Socket socket = new Socket(this.host, this.port)) {
final ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
out.writeObject(info);
final ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
final MethodCallInfo serverCopy = (MethodCallInfo) in.readObject();
info.set(serverCopy);
} catch (final Exception e) {
throw new RemoteReflectionException(e);
}
} | java | public void callMethod(final MethodCallInfo info) {
this.logger.info("calling remote method ".concat(info.toString()));
try (Socket socket = new Socket(this.host, this.port)) {
final ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
out.writeObject(info);
final ObjectInputStream in = new ObjectInputStream(socket.getInputStream());
final MethodCallInfo serverCopy = (MethodCallInfo) in.readObject();
info.set(serverCopy);
} catch (final Exception e) {
throw new RemoteReflectionException(e);
}
} | [
"public",
"void",
"callMethod",
"(",
"final",
"MethodCallInfo",
"info",
")",
"{",
"this",
".",
"logger",
".",
"info",
"(",
"\"calling remote method \"",
".",
"concat",
"(",
"info",
".",
"toString",
"(",
")",
")",
")",
";",
"try",
"(",
"Socket",
"socket",
... | Call the remote method based on the passed MethodCallInfo parameter.
@param info specification of remote method | [
"Call",
"the",
"remote",
"method",
"based",
"on",
"the",
"passed",
"MethodCallInfo",
"parameter",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/reflection/client/ReflectionClient.java#L61-L72 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/PayloadStorage.java | PayloadStorage.getLocation | @Override
public ExternalStorageLocation getLocation(Operation operation, PayloadType payloadType, String path) {
String uri;
switch (payloadType) {
case WORKFLOW_INPUT:
case WORKFLOW_OUTPUT:
uri = "workflow";
break;
case TASK_INPUT:
case TASK_OUTPUT:
uri = "tasks";
break;
default:
throw new ConductorClientException(String.format("Invalid payload type: %s for operation: %s", payloadType.toString(), operation.toString()));
}
return clientBase.getForEntity(String.format("%s/externalstoragelocation", uri), new Object[]{"path", path, "operation", operation.toString(), "payloadType", payloadType.toString()}, ExternalStorageLocation.class);
} | java | @Override
public ExternalStorageLocation getLocation(Operation operation, PayloadType payloadType, String path) {
String uri;
switch (payloadType) {
case WORKFLOW_INPUT:
case WORKFLOW_OUTPUT:
uri = "workflow";
break;
case TASK_INPUT:
case TASK_OUTPUT:
uri = "tasks";
break;
default:
throw new ConductorClientException(String.format("Invalid payload type: %s for operation: %s", payloadType.toString(), operation.toString()));
}
return clientBase.getForEntity(String.format("%s/externalstoragelocation", uri), new Object[]{"path", path, "operation", operation.toString(), "payloadType", payloadType.toString()}, ExternalStorageLocation.class);
} | [
"@",
"Override",
"public",
"ExternalStorageLocation",
"getLocation",
"(",
"Operation",
"operation",
",",
"PayloadType",
"payloadType",
",",
"String",
"path",
")",
"{",
"String",
"uri",
";",
"switch",
"(",
"payloadType",
")",
"{",
"case",
"WORKFLOW_INPUT",
":",
"... | This method is not intended to be used in the client.
The client makes a request to the server to get the {@link ExternalStorageLocation} | [
"This",
"method",
"is",
"not",
"intended",
"to",
"be",
"used",
"in",
"the",
"client",
".",
"The",
"client",
"makes",
"a",
"request",
"to",
"the",
"server",
"to",
"get",
"the",
"{"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/PayloadStorage.java#L51-L67 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java | MutableURI.addParameter | public void addParameter( String name, String value, boolean encoded )
{
if ( name == null )
{
throw new IllegalArgumentException( "A parameter name may not be null." );
}
if ( !encoded )
{
name = encode( name );
value = encode( value );
}
if ( _parameters == null )
{
_parameters = new QueryParameters();
_opaque = false;
setSchemeSpecificPart( null );
}
_parameters.addParameter(name, value);
} | java | public void addParameter( String name, String value, boolean encoded )
{
if ( name == null )
{
throw new IllegalArgumentException( "A parameter name may not be null." );
}
if ( !encoded )
{
name = encode( name );
value = encode( value );
}
if ( _parameters == null )
{
_parameters = new QueryParameters();
_opaque = false;
setSchemeSpecificPart( null );
}
_parameters.addParameter(name, value);
} | [
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"String",
"value",
",",
"boolean",
"encoded",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A parameter name may not be null.\"",
")",
";",
... | Add a parameter for the query string.
<p> If the encoded flag is true then this method assumes that
the name and value do not need encoding or are already encoded
correctly. Otherwise, it translates the name and value with the
character encoding of this URI and adds them to the set of
parameters for the query. If the encoding for this URI has
not been set, then the default encoding used is "UTF-8". </p>
<p> Multiple values for the same parameter can be set by
calling this method multiple times with the same name. </p>
@param name name
@param value value
@param encoded Flag indicating whether the names and values are
already encoded. | [
"Add",
"a",
"parameter",
"for",
"the",
"query",
"string",
".",
"<p",
">",
"If",
"the",
"encoded",
"flag",
"is",
"true",
"then",
"this",
"method",
"assumes",
"that",
"the",
"name",
"and",
"value",
"do",
"not",
"need",
"encoding",
"or",
"are",
"already",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L578-L599 |
mongodb/stitch-android-sdk | core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java | CoreStitchAuth.doAuthenticatedRequest | private synchronized Response doAuthenticatedRequest(
final StitchAuthRequest stitchReq,
final AuthInfo authInfo
) {
try {
return requestClient.doRequest(prepareAuthRequest(stitchReq, authInfo));
} catch (final StitchServiceException ex) {
return handleAuthFailure(ex, stitchReq);
}
} | java | private synchronized Response doAuthenticatedRequest(
final StitchAuthRequest stitchReq,
final AuthInfo authInfo
) {
try {
return requestClient.doRequest(prepareAuthRequest(stitchReq, authInfo));
} catch (final StitchServiceException ex) {
return handleAuthFailure(ex, stitchReq);
}
} | [
"private",
"synchronized",
"Response",
"doAuthenticatedRequest",
"(",
"final",
"StitchAuthRequest",
"stitchReq",
",",
"final",
"AuthInfo",
"authInfo",
")",
"{",
"try",
"{",
"return",
"requestClient",
".",
"doRequest",
"(",
"prepareAuthRequest",
"(",
"stitchReq",
",",
... | Internal method which performs the authenticated request by preparing the auth request with
the provided auth info and request. | [
"Internal",
"method",
"which",
"performs",
"the",
"authenticated",
"request",
"by",
"preparing",
"the",
"auth",
"request",
"with",
"the",
"provided",
"auth",
"info",
"and",
"request",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java#L234-L243 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sharedprefs/BindSharedPreferencesBuilder.java | BindSharedPreferencesBuilder.generateConstructor | private static void generateConstructor(PrefsEntity entity, String sharedPreferenceName, String beanClassName) {
MethodSpec.Builder method = MethodSpec.constructorBuilder().addModifiers(Modifier.PRIVATE).addJavadoc("constructor\n");
method.addStatement("createPrefs()");
if (entity.isImmutablePojo()) {
ImmutableUtility.generateImmutableVariableInit(entity, method);
ImmutableUtility.generateImmutableEntityCreation(entity, method, "defaultBean", false);
} else {
method.addStatement("defaultBean=new $T()", className(beanClassName));
}
builder.addMethod(method.build());
} | java | private static void generateConstructor(PrefsEntity entity, String sharedPreferenceName, String beanClassName) {
MethodSpec.Builder method = MethodSpec.constructorBuilder().addModifiers(Modifier.PRIVATE).addJavadoc("constructor\n");
method.addStatement("createPrefs()");
if (entity.isImmutablePojo()) {
ImmutableUtility.generateImmutableVariableInit(entity, method);
ImmutableUtility.generateImmutableEntityCreation(entity, method, "defaultBean", false);
} else {
method.addStatement("defaultBean=new $T()", className(beanClassName));
}
builder.addMethod(method.build());
} | [
"private",
"static",
"void",
"generateConstructor",
"(",
"PrefsEntity",
"entity",
",",
"String",
"sharedPreferenceName",
",",
"String",
"beanClassName",
")",
"{",
"MethodSpec",
".",
"Builder",
"method",
"=",
"MethodSpec",
".",
"constructorBuilder",
"(",
")",
".",
... | Generate constructor.
@param entity
@param sharedPreferenceName
the shared preference name
@param beanClassName
the bean class name | [
"Generate",
"constructor",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sharedprefs/BindSharedPreferencesBuilder.java#L498-L511 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/FastMathCalc.java | FastMathCalc.quadMult | private static void quadMult(final double a[], final double b[], final double result[]) {
final double xs[] = new double[2];
final double ys[] = new double[2];
final double zs[] = new double[2];
/* a[0] * b[0] */
split(a[0], xs);
split(b[0], ys);
splitMult(xs, ys, zs);
result[0] = zs[0];
result[1] = zs[1];
/* a[0] * b[1] */
split(b[1], ys);
splitMult(xs, ys, zs);
double tmp = result[0] + zs[0];
result[1] = result[1] - (tmp - result[0] - zs[0]);
result[0] = tmp;
tmp = result[0] + zs[1];
result[1] = result[1] - (tmp - result[0] - zs[1]);
result[0] = tmp;
/* a[1] * b[0] */
split(a[1], xs);
split(b[0], ys);
splitMult(xs, ys, zs);
tmp = result[0] + zs[0];
result[1] = result[1] - (tmp - result[0] - zs[0]);
result[0] = tmp;
tmp = result[0] + zs[1];
result[1] = result[1] - (tmp - result[0] - zs[1]);
result[0] = tmp;
/* a[1] * b[0] */
split(a[1], xs);
split(b[1], ys);
splitMult(xs, ys, zs);
tmp = result[0] + zs[0];
result[1] = result[1] - (tmp - result[0] - zs[0]);
result[0] = tmp;
tmp = result[0] + zs[1];
result[1] = result[1] - (tmp - result[0] - zs[1]);
result[0] = tmp;
} | java | private static void quadMult(final double a[], final double b[], final double result[]) {
final double xs[] = new double[2];
final double ys[] = new double[2];
final double zs[] = new double[2];
/* a[0] * b[0] */
split(a[0], xs);
split(b[0], ys);
splitMult(xs, ys, zs);
result[0] = zs[0];
result[1] = zs[1];
/* a[0] * b[1] */
split(b[1], ys);
splitMult(xs, ys, zs);
double tmp = result[0] + zs[0];
result[1] = result[1] - (tmp - result[0] - zs[0]);
result[0] = tmp;
tmp = result[0] + zs[1];
result[1] = result[1] - (tmp - result[0] - zs[1]);
result[0] = tmp;
/* a[1] * b[0] */
split(a[1], xs);
split(b[0], ys);
splitMult(xs, ys, zs);
tmp = result[0] + zs[0];
result[1] = result[1] - (tmp - result[0] - zs[0]);
result[0] = tmp;
tmp = result[0] + zs[1];
result[1] = result[1] - (tmp - result[0] - zs[1]);
result[0] = tmp;
/* a[1] * b[0] */
split(a[1], xs);
split(b[1], ys);
splitMult(xs, ys, zs);
tmp = result[0] + zs[0];
result[1] = result[1] - (tmp - result[0] - zs[0]);
result[0] = tmp;
tmp = result[0] + zs[1];
result[1] = result[1] - (tmp - result[0] - zs[1]);
result[0] = tmp;
} | [
"private",
"static",
"void",
"quadMult",
"(",
"final",
"double",
"a",
"[",
"]",
",",
"final",
"double",
"b",
"[",
"]",
",",
"final",
"double",
"result",
"[",
"]",
")",
"{",
"final",
"double",
"xs",
"[",
"]",
"=",
"new",
"double",
"[",
"2",
"]",
"... | Compute (a[0] + a[1]) * (b[0] + b[1]) in extended precision.
@param a first term of the multiplication
@param b second term of the multiplication
@param result placeholder where to put the result | [
"Compute",
"(",
"a",
"[",
"0",
"]",
"+",
"a",
"[",
"1",
"]",
")",
"*",
"(",
"b",
"[",
"0",
"]",
"+",
"b",
"[",
"1",
"]",
")",
"in",
"extended",
"precision",
"."
] | train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L436-L483 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.asCompressedCharSink | public static CharSink asCompressedCharSink(File f, Charset charSet) throws IOException {
return asCompressedByteSink(f).asCharSink(charSet);
} | java | public static CharSink asCompressedCharSink(File f, Charset charSet) throws IOException {
return asCompressedByteSink(f).asCharSink(charSet);
} | [
"public",
"static",
"CharSink",
"asCompressedCharSink",
"(",
"File",
"f",
",",
"Charset",
"charSet",
")",
"throws",
"IOException",
"{",
"return",
"asCompressedByteSink",
"(",
"f",
")",
".",
"asCharSink",
"(",
"charSet",
")",
";",
"}"
] | Just like {@link Files#asCharSink(java.io.File, java.nio.charset.Charset,
com.google.common.io.FileWriteMode...)}, but decompresses the incoming data using GZIP. | [
"Just",
"like",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L824-L826 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.queryBlockByTransactionID | public BlockInfo queryBlockByTransactionID(Collection<Peer> peers, String txID) throws InvalidArgumentException, ProposalException {
return queryBlockByTransactionID(peers, txID, client.getUserContext());
} | java | public BlockInfo queryBlockByTransactionID(Collection<Peer> peers, String txID) throws InvalidArgumentException, ProposalException {
return queryBlockByTransactionID(peers, txID, client.getUserContext());
} | [
"public",
"BlockInfo",
"queryBlockByTransactionID",
"(",
"Collection",
"<",
"Peer",
">",
"peers",
",",
"String",
"txID",
")",
"throws",
"InvalidArgumentException",
",",
"ProposalException",
"{",
"return",
"queryBlockByTransactionID",
"(",
"peers",
",",
"txID",
",",
... | query a peer in this channel for a Block by a TransactionID contained in the block
<STRONG>This method may not be thread safe if client context is changed!</STRONG>
@param peers the peers to try to send the request to.
@param txID the transactionID to query on
@return the {@link BlockInfo} for the Block containing the transaction
@throws InvalidArgumentException
@throws ProposalException | [
"query",
"a",
"peer",
"in",
"this",
"channel",
"for",
"a",
"Block",
"by",
"a",
"TransactionID",
"contained",
"in",
"the",
"block"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3019-L3021 |
pmwmedia/tinylog | benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java | WritingBenchmark.unbufferedRandomAccessFile | @Benchmark
@BenchmarkMode(Mode.AverageTime)
public void unbufferedRandomAccessFile(final Configuration configuration) throws IOException {
try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) {
for (long i = 0; i < LINES; ++i) {
file.write(DATA);
}
}
} | java | @Benchmark
@BenchmarkMode(Mode.AverageTime)
public void unbufferedRandomAccessFile(final Configuration configuration) throws IOException {
try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) {
for (long i = 0; i < LINES; ++i) {
file.write(DATA);
}
}
} | [
"@",
"Benchmark",
"@",
"BenchmarkMode",
"(",
"Mode",
".",
"AverageTime",
")",
"public",
"void",
"unbufferedRandomAccessFile",
"(",
"final",
"Configuration",
"configuration",
")",
"throws",
"IOException",
"{",
"try",
"(",
"RandomAccessFile",
"file",
"=",
"new",
"Ra... | Benchmarks direct writing via {@link RandomAccessFile} without using any kind of buffering.
@param configuration
Configuration with target file
@throws IOException
Failed to write to target file | [
"Benchmarks",
"direct",
"writing",
"via",
"{",
"@link",
"RandomAccessFile",
"}",
"without",
"using",
"any",
"kind",
"of",
"buffering",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java#L272-L280 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java | ByteConverter.float8 | public static void float8(byte[] target, int idx, double value) {
int8(target, idx, Double.doubleToRawLongBits(value));
} | java | public static void float8(byte[] target, int idx, double value) {
int8(target, idx, Double.doubleToRawLongBits(value));
} | [
"public",
"static",
"void",
"float8",
"(",
"byte",
"[",
"]",
"target",
",",
"int",
"idx",
",",
"double",
"value",
")",
"{",
"int8",
"(",
"target",
",",
"idx",
",",
"Double",
".",
"doubleToRawLongBits",
"(",
"value",
")",
")",
";",
"}"
] | Encodes a int value to the byte array.
@param target The byte array to encode to.
@param idx The starting index in the byte array.
@param value The value to encode. | [
"Encodes",
"a",
"int",
"value",
"to",
"the",
"byte",
"array",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/ByteConverter.java#L175-L177 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java | ResourcesInner.getById | public GenericResourceInner getById(String resourceId, String apiVersion) {
return getByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body();
} | java | public GenericResourceInner getById(String resourceId, String apiVersion) {
return getByIdWithServiceResponseAsync(resourceId, apiVersion).toBlocking().single().body();
} | [
"public",
"GenericResourceInner",
"getById",
"(",
"String",
"resourceId",
",",
"String",
"apiVersion",
")",
"{",
"return",
"getByIdWithServiceResponseAsync",
"(",
"resourceId",
",",
"apiVersion",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"b... | Gets a resource by ID.
@param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}
@param apiVersion The API version to use for the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the GenericResourceInner object if successful. | [
"Gets",
"a",
"resource",
"by",
"ID",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2390-L2392 |
yatechorg/jedis-utils | src/main/java/org/yatech/jedis/utils/lua/LuaScriptBuilder.java | LuaScriptBuilder.endScriptReturn | public LuaScript endScriptReturn(LuaValue value, LuaScriptConfig config) {
add(new LuaAstReturnStatement(argument(value)));
String scriptText = buildScriptText();
return new BasicLuaScript(scriptText, config);
} | java | public LuaScript endScriptReturn(LuaValue value, LuaScriptConfig config) {
add(new LuaAstReturnStatement(argument(value)));
String scriptText = buildScriptText();
return new BasicLuaScript(scriptText, config);
} | [
"public",
"LuaScript",
"endScriptReturn",
"(",
"LuaValue",
"value",
",",
"LuaScriptConfig",
"config",
")",
"{",
"add",
"(",
"new",
"LuaAstReturnStatement",
"(",
"argument",
"(",
"value",
")",
")",
")",
";",
"String",
"scriptText",
"=",
"buildScriptText",
"(",
... | End building the script, adding a return value statement
@param config the configuration for the script to build
@param value the value to return
@return the new {@link LuaScript} instance | [
"End",
"building",
"the",
"script",
"adding",
"a",
"return",
"value",
"statement"
] | train | https://github.com/yatechorg/jedis-utils/blob/1951609fa6697df4f69be76e7d66b9284924bd97/src/main/java/org/yatech/jedis/utils/lua/LuaScriptBuilder.java#L100-L104 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java | ExecutionChain.runOnMainThread | public <T, U> ExecutionChain runOnMainThread(Task<T, U> task) {
runOnThread(Context.Type.MAIN, task);
return this;
} | java | public <T, U> ExecutionChain runOnMainThread(Task<T, U> task) {
runOnThread(Context.Type.MAIN, task);
return this;
} | [
"public",
"<",
"T",
",",
"U",
">",
"ExecutionChain",
"runOnMainThread",
"(",
"Task",
"<",
"T",
",",
"U",
">",
"task",
")",
"{",
"runOnThread",
"(",
"Context",
".",
"Type",
".",
"MAIN",
",",
"task",
")",
";",
"return",
"this",
";",
"}"
] | Add a {@link Task} to be run on the
{@link MainThread#runOnMainThread(Runnable) main thread}. It will be run
after all Tasks added prior to this call.
@param task
{@code Task} to run
@return Reference to the {@code ExecutionChain}.
@throws IllegalStateException
if the chain of execution has already been {@link #execute()
started}. | [
"Add",
"a",
"{",
"@link",
"Task",
"}",
"to",
"be",
"run",
"on",
"the",
"{",
"@link",
"MainThread#runOnMainThread",
"(",
"Runnable",
")",
"main",
"thread",
"}",
".",
"It",
"will",
"be",
"run",
"after",
"all",
"Tasks",
"added",
"prior",
"to",
"this",
"ca... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java#L268-L271 |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java | BatchFraction.defaultThreadPool | public BatchFraction defaultThreadPool(final String name, final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
threadPool(name, maxThreads, keepAliveTime, keepAliveUnits);
return defaultThreadPool(name);
} | java | public BatchFraction defaultThreadPool(final String name, final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
threadPool(name, maxThreads, keepAliveTime, keepAliveUnits);
return defaultThreadPool(name);
} | [
"public",
"BatchFraction",
"defaultThreadPool",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"maxThreads",
",",
"final",
"int",
"keepAliveTime",
",",
"final",
"TimeUnit",
"keepAliveUnits",
")",
"{",
"threadPool",
"(",
"name",
",",
"maxThreads",
",",
"kee... | Creates a new thread-pool and sets the created thread-pool as the default thread-pool for batch jobs.
@param name the maximum number of threads to set the pool to
@param keepAliveTime the time to keep threads alive
@param keepAliveUnits the time unit for the keep alive time
@return this fraction | [
"Creates",
"a",
"new",
"thread",
"-",
"pool",
"and",
"sets",
"the",
"created",
"thread",
"-",
"pool",
"as",
"the",
"default",
"thread",
"-",
"pool",
"for",
"batch",
"jobs",
"."
] | train | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java#L155-L158 |
JohnPersano/SuperToasts | library/src/main/java/com/github/johnpersano/supertoasts/library/SuperToast.java | SuperToast.onCreateView | @SuppressLint("InflateParams")
protected View onCreateView(Context context, LayoutInflater layoutInflater, int type) {
return layoutInflater.inflate(R.layout.supertoast, null);
} | java | @SuppressLint("InflateParams")
protected View onCreateView(Context context, LayoutInflater layoutInflater, int type) {
return layoutInflater.inflate(R.layout.supertoast, null);
} | [
"@",
"SuppressLint",
"(",
"\"InflateParams\"",
")",
"protected",
"View",
"onCreateView",
"(",
"Context",
"context",
",",
"LayoutInflater",
"layoutInflater",
",",
"int",
"type",
")",
"{",
"return",
"layoutInflater",
".",
"inflate",
"(",
"R",
".",
"layout",
".",
... | Protected View that is overridden by the SuperActivityToast class. | [
"Protected",
"View",
"that",
"is",
"overridden",
"by",
"the",
"SuperActivityToast",
"class",
"."
] | train | https://github.com/JohnPersano/SuperToasts/blob/5394db6a2f5c38410586d5d001d61f731da1132a/library/src/main/java/com/github/johnpersano/supertoasts/library/SuperToast.java#L154-L157 |
banq/jdonframework | src/main/java/com/jdon/controller/service/WebServiceFactory.java | WebServiceFactory.getService | public Object getService(TargetMetaDef targetMetaDef, RequestWrapper request) {
userTargetMetaDefFactory.createTargetMetaRequest(targetMetaDef, request.getContextHolder());
return webServiceAccessor.getService(request);
} | java | public Object getService(TargetMetaDef targetMetaDef, RequestWrapper request) {
userTargetMetaDefFactory.createTargetMetaRequest(targetMetaDef, request.getContextHolder());
return webServiceAccessor.getService(request);
} | [
"public",
"Object",
"getService",
"(",
"TargetMetaDef",
"targetMetaDef",
",",
"RequestWrapper",
"request",
")",
"{",
"userTargetMetaDefFactory",
".",
"createTargetMetaRequest",
"(",
"targetMetaDef",
",",
"request",
".",
"getContextHolder",
"(",
")",
")",
";",
"return"... | get a service instance the service must have a interface and implements
it. | [
"get",
"a",
"service",
"instance",
"the",
"service",
"must",
"have",
"a",
"interface",
"and",
"implements",
"it",
"."
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/controller/service/WebServiceFactory.java#L68-L71 |
VoltDB/voltdb | src/frontend/org/voltdb/ClientInterfaceHandleManager.java | ClientInterfaceHandleManager.makeThreadSafeCIHM | public static ClientInterfaceHandleManager makeThreadSafeCIHM(
boolean isAdmin, Connection connection, ClientInterfaceRepairCallback callback, AdmissionControlGroup acg)
{
return new ClientInterfaceHandleManager(isAdmin, connection, callback, acg) {
@Override
synchronized long getHandle(boolean isSinglePartition, int partitionId,
long clientHandle, int messageSize, long creationTimeNanos, String procName, long initiatorHSId,
boolean isShortCircuitRead) {
return super.getHandle(isSinglePartition, partitionId,
clientHandle, messageSize, creationTimeNanos, procName, initiatorHSId, isShortCircuitRead);
}
@Override
synchronized Iv2InFlight findHandle(long ciHandle) {
return super.findHandle(ciHandle);
}
@Override
synchronized Iv2InFlight removeHandle(long ciHandle) {
return super.removeHandle(ciHandle);
}
@Override
synchronized long getOutstandingTxns() {
return super.getOutstandingTxns();
}
@Override
synchronized void freeOutstandingTxns() {
super.freeOutstandingTxns();
}
@Override
synchronized List<Iv2InFlight> removeHandlesForPartitionAndInitiator(Integer partitionId,
Long initiatorHSId) {
return super.removeHandlesForPartitionAndInitiator(partitionId, initiatorHSId);
}
@Override
synchronized boolean shouldCheckThreadIdAssertion()
{
return false;
}
};
} | java | public static ClientInterfaceHandleManager makeThreadSafeCIHM(
boolean isAdmin, Connection connection, ClientInterfaceRepairCallback callback, AdmissionControlGroup acg)
{
return new ClientInterfaceHandleManager(isAdmin, connection, callback, acg) {
@Override
synchronized long getHandle(boolean isSinglePartition, int partitionId,
long clientHandle, int messageSize, long creationTimeNanos, String procName, long initiatorHSId,
boolean isShortCircuitRead) {
return super.getHandle(isSinglePartition, partitionId,
clientHandle, messageSize, creationTimeNanos, procName, initiatorHSId, isShortCircuitRead);
}
@Override
synchronized Iv2InFlight findHandle(long ciHandle) {
return super.findHandle(ciHandle);
}
@Override
synchronized Iv2InFlight removeHandle(long ciHandle) {
return super.removeHandle(ciHandle);
}
@Override
synchronized long getOutstandingTxns() {
return super.getOutstandingTxns();
}
@Override
synchronized void freeOutstandingTxns() {
super.freeOutstandingTxns();
}
@Override
synchronized List<Iv2InFlight> removeHandlesForPartitionAndInitiator(Integer partitionId,
Long initiatorHSId) {
return super.removeHandlesForPartitionAndInitiator(partitionId, initiatorHSId);
}
@Override
synchronized boolean shouldCheckThreadIdAssertion()
{
return false;
}
};
} | [
"public",
"static",
"ClientInterfaceHandleManager",
"makeThreadSafeCIHM",
"(",
"boolean",
"isAdmin",
",",
"Connection",
"connection",
",",
"ClientInterfaceRepairCallback",
"callback",
",",
"AdmissionControlGroup",
"acg",
")",
"{",
"return",
"new",
"ClientInterfaceHandleManage... | Factory to make a threadsafe version of CIHM. This is used
exclusively by some internal CI adapters that don't have
the natural thread-safety protocol/design of VoltNetwork. | [
"Factory",
"to",
"make",
"a",
"threadsafe",
"version",
"of",
"CIHM",
".",
"This",
"is",
"used",
"exclusively",
"by",
"some",
"internal",
"CI",
"adapters",
"that",
"don",
"t",
"have",
"the",
"natural",
"thread",
"-",
"safety",
"protocol",
"/",
"design",
"of... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ClientInterfaceHandleManager.java#L131-L171 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java | SnowflakeFileTransferAgent.compressStreamWithGZIPNoDigest | private static InputStreamWithMetadata compressStreamWithGZIPNoDigest(
InputStream inputStream) throws SnowflakeSQLException
{
try
{
FileBackedOutputStream tempStream =
new FileBackedOutputStream(MAX_BUFFER_SIZE, true);
CountingOutputStream countingStream =
new CountingOutputStream(tempStream);
// construct a gzip stream with sync_flush mode
GZIPOutputStream gzipStream;
gzipStream = new GZIPOutputStream(countingStream, true);
IOUtils.copy(inputStream, gzipStream);
inputStream.close();
gzipStream.finish();
gzipStream.flush();
countingStream.flush();
return new InputStreamWithMetadata(countingStream.getCount(),
null, tempStream);
}
catch (IOException ex)
{
logger.error("Exception compressing input stream", ex);
throw new SnowflakeSQLException(ex, SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
"error encountered for compression");
}
} | java | private static InputStreamWithMetadata compressStreamWithGZIPNoDigest(
InputStream inputStream) throws SnowflakeSQLException
{
try
{
FileBackedOutputStream tempStream =
new FileBackedOutputStream(MAX_BUFFER_SIZE, true);
CountingOutputStream countingStream =
new CountingOutputStream(tempStream);
// construct a gzip stream with sync_flush mode
GZIPOutputStream gzipStream;
gzipStream = new GZIPOutputStream(countingStream, true);
IOUtils.copy(inputStream, gzipStream);
inputStream.close();
gzipStream.finish();
gzipStream.flush();
countingStream.flush();
return new InputStreamWithMetadata(countingStream.getCount(),
null, tempStream);
}
catch (IOException ex)
{
logger.error("Exception compressing input stream", ex);
throw new SnowflakeSQLException(ex, SqlState.INTERNAL_ERROR,
ErrorCode.INTERNAL_ERROR.getMessageCode(),
"error encountered for compression");
}
} | [
"private",
"static",
"InputStreamWithMetadata",
"compressStreamWithGZIPNoDigest",
"(",
"InputStream",
"inputStream",
")",
"throws",
"SnowflakeSQLException",
"{",
"try",
"{",
"FileBackedOutputStream",
"tempStream",
"=",
"new",
"FileBackedOutputStream",
"(",
"MAX_BUFFER_SIZE",
... | Compress an input stream with GZIP and return the result size, digest and
compressed stream.
@param inputStream
@return the compressed stream
@throws SnowflakeSQLException
@deprecated Can be removed when all accounts are encrypted | [
"Compress",
"an",
"input",
"stream",
"with",
"GZIP",
"and",
"return",
"the",
"result",
"size",
"digest",
"and",
"compressed",
"stream",
"."
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/SnowflakeFileTransferAgent.java#L548-L586 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java | CompactDecimalDataCache.calculateDivisor | private static long calculateDivisor(long power10, int numZeros) {
// We craft our divisor such that when we divide by it, we get a
// number with the same number of digits as zeros found in the
// plural variant templates. If our magnitude is 10000 and we have
// two 0's in our plural variants, then we want a divisor of 1000.
// Note that if we have 43560 which is of same magnitude as 10000.
// When we divide by 1000 we a quotient which rounds to 44 (2 digits)
long divisor = power10;
for (int i = 1; i < numZeros; i++) {
divisor /= 10;
}
return divisor;
} | java | private static long calculateDivisor(long power10, int numZeros) {
// We craft our divisor such that when we divide by it, we get a
// number with the same number of digits as zeros found in the
// plural variant templates. If our magnitude is 10000 and we have
// two 0's in our plural variants, then we want a divisor of 1000.
// Note that if we have 43560 which is of same magnitude as 10000.
// When we divide by 1000 we a quotient which rounds to 44 (2 digits)
long divisor = power10;
for (int i = 1; i < numZeros; i++) {
divisor /= 10;
}
return divisor;
} | [
"private",
"static",
"long",
"calculateDivisor",
"(",
"long",
"power10",
",",
"int",
"numZeros",
")",
"{",
"// We craft our divisor such that when we divide by it, we get a",
"// number with the same number of digits as zeros found in the",
"// plural variant templates. If our magnitude ... | Calculate a divisor based on the magnitude and number of zeros in the
template string.
@param power10
@param numZeros
@return | [
"Calculate",
"a",
"divisor",
"based",
"on",
"the",
"magnitude",
"and",
"number",
"of",
"zeros",
"in",
"the",
"template",
"string",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java#L381-L393 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.setShort | public static void setShort(MemorySegment[] segments, int offset, short value) {
if (inFirstSegment(segments, offset, 2)) {
segments[0].putShort(offset, value);
} else {
setShortMultiSegments(segments, offset, value);
}
} | java | public static void setShort(MemorySegment[] segments, int offset, short value) {
if (inFirstSegment(segments, offset, 2)) {
segments[0].putShort(offset, value);
} else {
setShortMultiSegments(segments, offset, value);
}
} | [
"public",
"static",
"void",
"setShort",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
",",
"short",
"value",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"2",
")",
")",
"{",
"segments",
"[",
"0",
"]",
... | set short from segments.
@param segments target segments.
@param offset value offset. | [
"set",
"short",
"from",
"segments",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L826-L832 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java | BDBRepositoryBuilder.setCompressor | public void setCompressor(String type, String compressionType) {
mStorableCodecFactory = null;
compressionType = compressionType.toUpperCase();
if (mCompressionMap == null) {
mCompressionMap = new HashMap<String, CompressionType>();
}
CompressionType compressionEnum = CompressionType.valueOf(compressionType);
if (compressionEnum != null) {
mCompressionMap.put(type, compressionEnum);
}
} | java | public void setCompressor(String type, String compressionType) {
mStorableCodecFactory = null;
compressionType = compressionType.toUpperCase();
if (mCompressionMap == null) {
mCompressionMap = new HashMap<String, CompressionType>();
}
CompressionType compressionEnum = CompressionType.valueOf(compressionType);
if (compressionEnum != null) {
mCompressionMap.put(type, compressionEnum);
}
} | [
"public",
"void",
"setCompressor",
"(",
"String",
"type",
",",
"String",
"compressionType",
")",
"{",
"mStorableCodecFactory",
"=",
"null",
";",
"compressionType",
"=",
"compressionType",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"mCompressionMap",
"==",
"nu... | Set the compressor for the given class, overriding a custom StorableCodecFactory.
@param type Storable to compress.
@param compressionType String representation of type of
compression. Available options are "NONE" for no compression or "GZIP"
for gzip compression | [
"Set",
"the",
"compressor",
"for",
"the",
"given",
"class",
"overriding",
"a",
"custom",
"StorableCodecFactory",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L1061-L1071 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java | CPOptionPersistenceImpl.findByG_K | @Override
public CPOption findByG_K(long groupId, String key)
throws NoSuchCPOptionException {
CPOption cpOption = fetchByG_K(groupId, key);
if (cpOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPOptionException(msg.toString());
}
return cpOption;
} | java | @Override
public CPOption findByG_K(long groupId, String key)
throws NoSuchCPOptionException {
CPOption cpOption = fetchByG_K(groupId, key);
if (cpOption == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("groupId=");
msg.append(groupId);
msg.append(", key=");
msg.append(key);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPOptionException(msg.toString());
}
return cpOption;
} | [
"@",
"Override",
"public",
"CPOption",
"findByG_K",
"(",
"long",
"groupId",
",",
"String",
"key",
")",
"throws",
"NoSuchCPOptionException",
"{",
"CPOption",
"cpOption",
"=",
"fetchByG_K",
"(",
"groupId",
",",
"key",
")",
";",
"if",
"(",
"cpOption",
"==",
"nu... | Returns the cp option where groupId = ? and key = ? or throws a {@link NoSuchCPOptionException} if it could not be found.
@param groupId the group ID
@param key the key
@return the matching cp option
@throws NoSuchCPOptionException if a matching cp option could not be found | [
"Returns",
"the",
"cp",
"option",
"where",
"groupId",
"=",
"?",
";",
"and",
"key",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPOptionException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L1992-L2018 |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/MapcodeCodec.java | MapcodeCodec.decodeToRectangle | @Nonnull
public static Rectangle decodeToRectangle(@Nonnull final String mapcode)
throws UnknownMapcodeException, IllegalArgumentException, UnknownPrecisionFormatException {
return decodeToRectangle(mapcode, Territory.AAA);
} | java | @Nonnull
public static Rectangle decodeToRectangle(@Nonnull final String mapcode)
throws UnknownMapcodeException, IllegalArgumentException, UnknownPrecisionFormatException {
return decodeToRectangle(mapcode, Territory.AAA);
} | [
"@",
"Nonnull",
"public",
"static",
"Rectangle",
"decodeToRectangle",
"(",
"@",
"Nonnull",
"final",
"String",
"mapcode",
")",
"throws",
"UnknownMapcodeException",
",",
"IllegalArgumentException",
",",
"UnknownPrecisionFormatException",
"{",
"return",
"decodeToRectangle",
... | Decode a mapcode to a Rectangle, which defines the valid zone for a mapcode. The boundaries of the
mapcode zone are inclusive for the South and West borders and exclusive for the North and East borders.
This is essentially the same call as a 'decode', except it returns a rectangle, rather than its center point.
@param mapcode Mapcode.
@return Rectangle Mapcode zone. South/West borders are inclusive, North/East borders exclusive.
@throws UnknownMapcodeException Thrown if the mapcode has the correct syntax,
but cannot be decoded into a point.
@throws UnknownPrecisionFormatException Thrown if the precision format is incorrect.
@throws IllegalArgumentException Thrown if arguments are null, or if the syntax of the mapcode is incorrect. | [
"Decode",
"a",
"mapcode",
"to",
"a",
"Rectangle",
"which",
"defines",
"the",
"valid",
"zone",
"for",
"a",
"mapcode",
".",
"The",
"boundaries",
"of",
"the",
"mapcode",
"zone",
"are",
"inclusive",
"for",
"the",
"South",
"and",
"West",
"borders",
"and",
"excl... | train | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/MapcodeCodec.java#L350-L354 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/signer/internal/cms/BcStoreUtils.java | BcStoreUtils.getCertificateProvider | public static CertificateProvider getCertificateProvider(ComponentManager manager,
Collection<CertifiedPublicKey> certificates) throws GeneralSecurityException
{
if (certificates == null || certificates.isEmpty()) {
return null;
}
Collection<X509CertificateHolder> certs = new ArrayList<X509CertificateHolder>(certificates.size());
for (CertifiedPublicKey cert : certificates) {
certs.add(BcUtils.getX509CertificateHolder(cert));
}
return newCertificateProvider(manager, new CollectionStore(certs));
} | java | public static CertificateProvider getCertificateProvider(ComponentManager manager,
Collection<CertifiedPublicKey> certificates) throws GeneralSecurityException
{
if (certificates == null || certificates.isEmpty()) {
return null;
}
Collection<X509CertificateHolder> certs = new ArrayList<X509CertificateHolder>(certificates.size());
for (CertifiedPublicKey cert : certificates) {
certs.add(BcUtils.getX509CertificateHolder(cert));
}
return newCertificateProvider(manager, new CollectionStore(certs));
} | [
"public",
"static",
"CertificateProvider",
"getCertificateProvider",
"(",
"ComponentManager",
"manager",
",",
"Collection",
"<",
"CertifiedPublicKey",
">",
"certificates",
")",
"throws",
"GeneralSecurityException",
"{",
"if",
"(",
"certificates",
"==",
"null",
"||",
"ce... | Create a new store containing the given certificates and return it as a certificate provider.
@param manager the component manager.
@param certificates the certificates.
@return a certificate provider wrapping the collection of certificate.
@throws GeneralSecurityException if unable to initialize the provider. | [
"Create",
"a",
"new",
"store",
"containing",
"the",
"given",
"certificates",
"and",
"return",
"it",
"as",
"a",
"certificate",
"provider",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/signer/internal/cms/BcStoreUtils.java#L102-L116 |
JakeWharton/ActionBarSherlock | actionbarsherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java | SuggestionsAdapter.getDrawableFromResourceValue | private Drawable getDrawableFromResourceValue(String drawableId) {
if (drawableId == null || drawableId.length() == 0 || "0".equals(drawableId)) {
return null;
}
try {
// First, see if it's just an integer
int resourceId = Integer.parseInt(drawableId);
// It's an int, look for it in the cache
String drawableUri = ContentResolver.SCHEME_ANDROID_RESOURCE
+ "://" + mProviderContext.getPackageName() + "/" + resourceId;
// Must use URI as cache key, since ints are app-specific
Drawable drawable = checkIconCache(drawableUri);
if (drawable != null) {
return drawable;
}
// Not cached, find it by resource ID
drawable = mProviderContext.getResources().getDrawable(resourceId);
// Stick it in the cache, using the URI as key
storeInIconCache(drawableUri, drawable);
return drawable;
} catch (NumberFormatException nfe) {
// It's not an integer, use it as a URI
Drawable drawable = checkIconCache(drawableId);
if (drawable != null) {
return drawable;
}
Uri uri = Uri.parse(drawableId);
drawable = getDrawable(uri);
storeInIconCache(drawableId, drawable);
return drawable;
} catch (Resources.NotFoundException nfe) {
// It was an integer, but it couldn't be found, bail out
Log.w(LOG_TAG, "Icon resource not found: " + drawableId);
return null;
}
} | java | private Drawable getDrawableFromResourceValue(String drawableId) {
if (drawableId == null || drawableId.length() == 0 || "0".equals(drawableId)) {
return null;
}
try {
// First, see if it's just an integer
int resourceId = Integer.parseInt(drawableId);
// It's an int, look for it in the cache
String drawableUri = ContentResolver.SCHEME_ANDROID_RESOURCE
+ "://" + mProviderContext.getPackageName() + "/" + resourceId;
// Must use URI as cache key, since ints are app-specific
Drawable drawable = checkIconCache(drawableUri);
if (drawable != null) {
return drawable;
}
// Not cached, find it by resource ID
drawable = mProviderContext.getResources().getDrawable(resourceId);
// Stick it in the cache, using the URI as key
storeInIconCache(drawableUri, drawable);
return drawable;
} catch (NumberFormatException nfe) {
// It's not an integer, use it as a URI
Drawable drawable = checkIconCache(drawableId);
if (drawable != null) {
return drawable;
}
Uri uri = Uri.parse(drawableId);
drawable = getDrawable(uri);
storeInIconCache(drawableId, drawable);
return drawable;
} catch (Resources.NotFoundException nfe) {
// It was an integer, but it couldn't be found, bail out
Log.w(LOG_TAG, "Icon resource not found: " + drawableId);
return null;
}
} | [
"private",
"Drawable",
"getDrawableFromResourceValue",
"(",
"String",
"drawableId",
")",
"{",
"if",
"(",
"drawableId",
"==",
"null",
"||",
"drawableId",
".",
"length",
"(",
")",
"==",
"0",
"||",
"\"0\"",
".",
"equals",
"(",
"drawableId",
")",
")",
"{",
"re... | Gets a drawable given a value provided by a suggestion provider.
This value could be just the string value of a resource id
(e.g., "2130837524"), in which case we will try to retrieve a drawable from
the provider's resources. If the value is not an integer, it is
treated as a Uri and opened with
{@link ContentResolver#openOutputStream(android.net.Uri, String)}.
All resources and URIs are read using the suggestion provider's context.
If the string is not formatted as expected, or no drawable can be found for
the provided value, this method returns null.
@param drawableId a string like "2130837524",
"android.resource://com.android.alarmclock/2130837524",
or "content://contacts/photos/253".
@return a Drawable, or null if none found | [
"Gets",
"a",
"drawable",
"given",
"a",
"value",
"provided",
"by",
"a",
"suggestion",
"provider",
"."
] | train | https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java#L544-L579 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java | ElasticPoolActivitiesInner.listByElasticPool | public List<ElasticPoolActivityInner> listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) {
return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body();
} | java | public List<ElasticPoolActivityInner> listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName) {
return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"ElasticPoolActivityInner",
">",
"listByElasticPool",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"elasticPoolName",
")",
"{",
"return",
"listByElasticPoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Returns elastic pool activities.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param elasticPoolName The name of the elastic pool for which to get the current activity.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<ElasticPoolActivityInner> object if successful. | [
"Returns",
"elastic",
"pool",
"activities",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java#L72-L74 |
kiegroup/jbpm | jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java | QueryCriteriaUtil.getEntityField | protected <T> Expression getEntityField(CriteriaQuery<T> query, String listId, Attribute attr) {
return defaultGetEntityField(query, listId, attr);
} | java | protected <T> Expression getEntityField(CriteriaQuery<T> query, String listId, Attribute attr) {
return defaultGetEntityField(query, listId, attr);
} | [
"protected",
"<",
"T",
">",
"Expression",
"getEntityField",
"(",
"CriteriaQuery",
"<",
"T",
">",
"query",
",",
"String",
"listId",
",",
"Attribute",
"attr",
")",
"{",
"return",
"defaultGetEntityField",
"(",
"query",
",",
"listId",
",",
"attr",
")",
";",
"}... | This method retrieves the entity "field" that can be used as the LHS of a {@link Predicate}
</p>
This method is overridden in some extended {@link QueryCriteriaUtil} implementations
@param query The {@link CriteriaQuery} that we're building
@param listId The list id of the given {@link QueryCriteria}
@return An {@link Expression} with the {@link Path} to the field represented by the {@link QueryCriteria#getListId()} value | [
"This",
"method",
"retrieves",
"the",
"entity",
"field",
"that",
"can",
"be",
"used",
"as",
"the",
"LHS",
"of",
"a",
"{",
"@link",
"Predicate",
"}",
"<",
"/",
"p",
">",
"This",
"method",
"is",
"overridden",
"in",
"some",
"extended",
"{",
"@link",
"Quer... | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java#L443-L445 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getDeviceId | @SuppressLint("HardwareIds")
public static String getDeviceId(Context context) {
String androidId = getString(context.getContentResolver(), ANDROID_ID);
if (!isNullOrEmpty(androidId)
&& !"9774d56d682e549c".equals(androidId)
&& !"unknown".equals(androidId)
&& !"000000000000000".equals(androidId)) {
return androidId;
}
// Serial number, guaranteed to be on all non phones in 2.3+.
if (!isNullOrEmpty(Build.SERIAL)) {
return Build.SERIAL;
}
// Telephony ID, guaranteed to be on all phones, requires READ_PHONE_STATE permission
if (hasPermission(context, READ_PHONE_STATE) && hasFeature(context, FEATURE_TELEPHONY)) {
TelephonyManager telephonyManager = getSystemService(context, TELEPHONY_SERVICE);
@SuppressLint("MissingPermission")
String telephonyId = telephonyManager.getDeviceId();
if (!isNullOrEmpty(telephonyId)) {
return telephonyId;
}
}
// If this still fails, generate random identifier that does not persist across installations
return UUID.randomUUID().toString();
} | java | @SuppressLint("HardwareIds")
public static String getDeviceId(Context context) {
String androidId = getString(context.getContentResolver(), ANDROID_ID);
if (!isNullOrEmpty(androidId)
&& !"9774d56d682e549c".equals(androidId)
&& !"unknown".equals(androidId)
&& !"000000000000000".equals(androidId)) {
return androidId;
}
// Serial number, guaranteed to be on all non phones in 2.3+.
if (!isNullOrEmpty(Build.SERIAL)) {
return Build.SERIAL;
}
// Telephony ID, guaranteed to be on all phones, requires READ_PHONE_STATE permission
if (hasPermission(context, READ_PHONE_STATE) && hasFeature(context, FEATURE_TELEPHONY)) {
TelephonyManager telephonyManager = getSystemService(context, TELEPHONY_SERVICE);
@SuppressLint("MissingPermission")
String telephonyId = telephonyManager.getDeviceId();
if (!isNullOrEmpty(telephonyId)) {
return telephonyId;
}
}
// If this still fails, generate random identifier that does not persist across installations
return UUID.randomUUID().toString();
} | [
"@",
"SuppressLint",
"(",
"\"HardwareIds\"",
")",
"public",
"static",
"String",
"getDeviceId",
"(",
"Context",
"context",
")",
"{",
"String",
"androidId",
"=",
"getString",
"(",
"context",
".",
"getContentResolver",
"(",
")",
",",
"ANDROID_ID",
")",
";",
"if",... | Creates a unique device id. Suppresses `HardwareIds` lint warnings as we don't use this ID for
identifying specific users. This is also what is required by the Segment spec. | [
"Creates",
"a",
"unique",
"device",
"id",
".",
"Suppresses",
"HardwareIds",
"lint",
"warnings",
"as",
"we",
"don",
"t",
"use",
"this",
"ID",
"for",
"identifying",
"specific",
"users",
".",
"This",
"is",
"also",
"what",
"is",
"required",
"by",
"the",
"Segme... | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L254-L281 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/interfaces/PointToPointInterfaceCriteria.java | PointToPointInterfaceCriteria.isAcceptable | @Override
protected InetAddress isAcceptable(NetworkInterface networkInterface, InetAddress address) throws SocketException {
if( networkInterface.isPointToPoint() )
return address;
return null;
} | java | @Override
protected InetAddress isAcceptable(NetworkInterface networkInterface, InetAddress address) throws SocketException {
if( networkInterface.isPointToPoint() )
return address;
return null;
} | [
"@",
"Override",
"protected",
"InetAddress",
"isAcceptable",
"(",
"NetworkInterface",
"networkInterface",
",",
"InetAddress",
"address",
")",
"throws",
"SocketException",
"{",
"if",
"(",
"networkInterface",
".",
"isPointToPoint",
"(",
")",
")",
"return",
"address",
... | {@inheritDoc}
@return <code>address</code> if <code>networkInterface</code> is a
{@link NetworkInterface#isPointToPoint() point-to-point interface}. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/interfaces/PointToPointInterfaceCriteria.java#L53-L59 |
aequologica/geppaequo | geppaequo-cmis/src/main/java/net/aequologica/neo/geppaequo/document/impl/ECMHelperImpl.java | ECMHelperImpl.getOrCreateFolder | private static Folder getOrCreateFolder(final Folder parentFolder, final String folderName) throws IOException {
Folder childFolder = null;
// get existing if any
ItemIterable<CmisObject> children = parentFolder.getChildren();
if (children.iterator().hasNext()) {
for (CmisObject cmisObject : children) {
if (cmisObject instanceof Folder && cmisObject.getName().equals(folderName)) {
log.debug("Found '{}' folder.", folderName);
return childFolder = (Folder)cmisObject;
}
}
}
// Create new folder (requires at least type id and name of the folder)
log.debug("'{}' folder not found, about to create...", folderName);
Map<String, String> folderProps = new HashMap<String, String>();
folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
folderProps.put(PropertyIds.NAME, folderName);
childFolder = parentFolder.createFolder(folderProps);
log.info("'{}' folder created!", folderName);
return childFolder;
} | java | private static Folder getOrCreateFolder(final Folder parentFolder, final String folderName) throws IOException {
Folder childFolder = null;
// get existing if any
ItemIterable<CmisObject> children = parentFolder.getChildren();
if (children.iterator().hasNext()) {
for (CmisObject cmisObject : children) {
if (cmisObject instanceof Folder && cmisObject.getName().equals(folderName)) {
log.debug("Found '{}' folder.", folderName);
return childFolder = (Folder)cmisObject;
}
}
}
// Create new folder (requires at least type id and name of the folder)
log.debug("'{}' folder not found, about to create...", folderName);
Map<String, String> folderProps = new HashMap<String, String>();
folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
folderProps.put(PropertyIds.NAME, folderName);
childFolder = parentFolder.createFolder(folderProps);
log.info("'{}' folder created!", folderName);
return childFolder;
} | [
"private",
"static",
"Folder",
"getOrCreateFolder",
"(",
"final",
"Folder",
"parentFolder",
",",
"final",
"String",
"folderName",
")",
"throws",
"IOException",
"{",
"Folder",
"childFolder",
"=",
"null",
";",
"// get existing if any",
"ItemIterable",
"<",
"CmisObject",... | look for a child folder of the parent folder, if not found, create it and return it. | [
"look",
"for",
"a",
"child",
"folder",
"of",
"the",
"parent",
"folder",
"if",
"not",
"found",
"create",
"it",
"and",
"return",
"it",
"."
] | train | https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-cmis/src/main/java/net/aequologica/neo/geppaequo/document/impl/ECMHelperImpl.java#L583-L611 |
OpenLiberty/open-liberty | dev/com.ibm.ws.org.apache.myfaces.2.3/src/org/apache/myfaces/view/facelets/util/Classpath.java | Classpath._join | private static String _join(String[] tokens, boolean excludeLast)
{
StringBuilder join = new StringBuilder();
int length = tokens.length - (excludeLast ? 1 : 0);
for (int i = 0; i < length; i++)
{
join.append(tokens[i]).append("/");
}
return join.toString();
} | java | private static String _join(String[] tokens, boolean excludeLast)
{
StringBuilder join = new StringBuilder();
int length = tokens.length - (excludeLast ? 1 : 0);
for (int i = 0; i < length; i++)
{
join.append(tokens[i]).append("/");
}
return join.toString();
} | [
"private",
"static",
"String",
"_join",
"(",
"String",
"[",
"]",
"tokens",
",",
"boolean",
"excludeLast",
")",
"{",
"StringBuilder",
"join",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"length",
"=",
"tokens",
".",
"length",
"-",
"(",
"excludeLast",... | Join tokens, exlude last if param equals true.
@param tokens
the tokens
@param excludeLast
do we exclude last token
@return joined tokens | [
"Join",
"tokens",
"exlude",
"last",
"if",
"param",
"equals",
"true",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.myfaces.2.3/src/org/apache/myfaces/view/facelets/util/Classpath.java#L246-L256 |
jtrfp/javamod | src/main/java/de/quippy/mp3/decoder/Bitstream.java | Bitstream.readBytes | private int readBytes(byte[] b, int offs, int len)
throws BitstreamException
{
int totalBytesRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
break;
}
totalBytesRead += bytesread;
offs += bytesread;
len -= bytesread;
}
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
return totalBytesRead;
} | java | private int readBytes(byte[] b, int offs, int len)
throws BitstreamException
{
int totalBytesRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
break;
}
totalBytesRead += bytesread;
offs += bytesread;
len -= bytesread;
}
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR, ex);
}
return totalBytesRead;
} | [
"private",
"int",
"readBytes",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"offs",
",",
"int",
"len",
")",
"throws",
"BitstreamException",
"{",
"int",
"totalBytesRead",
"=",
"0",
";",
"try",
"{",
"while",
"(",
"len",
">",
"0",
")",
"{",
"int",
"bytesread... | Simlar to readFully, but doesn't throw exception when
EOF is reached. | [
"Simlar",
"to",
"readFully",
"but",
"doesn",
"t",
"throw",
"exception",
"when",
"EOF",
"is",
"reached",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Bitstream.java#L638-L661 |
kiegroup/drools | drools-model/drools-canonical-model/src/main/java/org/drools/model/bitmask/OpenBitSet.java | OpenBitSet.unionCount | public static long unionCount(OpenBitSet a, OpenBitSet b) {
long tot = BitUtil.pop_union( a.bits, b.bits, 0, Math.min( a.wlen, b.wlen ) );
if (a.wlen < b.wlen) {
tot += BitUtil.pop_array( b.bits, a.wlen, b.wlen - a.wlen );
} else if (a.wlen > b.wlen) {
tot += BitUtil.pop_array( a.bits, b.wlen, a.wlen - b.wlen );
}
return tot;
} | java | public static long unionCount(OpenBitSet a, OpenBitSet b) {
long tot = BitUtil.pop_union( a.bits, b.bits, 0, Math.min( a.wlen, b.wlen ) );
if (a.wlen < b.wlen) {
tot += BitUtil.pop_array( b.bits, a.wlen, b.wlen - a.wlen );
} else if (a.wlen > b.wlen) {
tot += BitUtil.pop_array( a.bits, b.wlen, a.wlen - b.wlen );
}
return tot;
} | [
"public",
"static",
"long",
"unionCount",
"(",
"OpenBitSet",
"a",
",",
"OpenBitSet",
"b",
")",
"{",
"long",
"tot",
"=",
"BitUtil",
".",
"pop_union",
"(",
"a",
".",
"bits",
",",
"b",
".",
"bits",
",",
"0",
",",
"Math",
".",
"min",
"(",
"a",
".",
"... | Returns the popcount or cardinality of the union of the two sets.
Neither set is modified. | [
"Returns",
"the",
"popcount",
"or",
"cardinality",
"of",
"the",
"union",
"of",
"the",
"two",
"sets",
".",
"Neither",
"set",
"is",
"modified",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-model/drools-canonical-model/src/main/java/org/drools/model/bitmask/OpenBitSet.java#L574-L582 |
structurizr/java | structurizr-core/src/com/structurizr/model/DeploymentNode.java | DeploymentNode.uses | public Relationship uses(DeploymentNode destination, String description, String technology) {
return uses(destination, description, technology, InteractionStyle.Synchronous);
} | java | public Relationship uses(DeploymentNode destination, String description, String technology) {
return uses(destination, description, technology, InteractionStyle.Synchronous);
} | [
"public",
"Relationship",
"uses",
"(",
"DeploymentNode",
"destination",
",",
"String",
"description",
",",
"String",
"technology",
")",
"{",
"return",
"uses",
"(",
"destination",
",",
"description",
",",
"technology",
",",
"InteractionStyle",
".",
"Synchronous",
"... | Adds a relationship between this and another deployment node.
@param destination the destination DeploymentNode
@param description a short description of the relationship
@param technology the technology
@return a Relationship object | [
"Adds",
"a",
"relationship",
"between",
"this",
"and",
"another",
"deployment",
"node",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/DeploymentNode.java#L128-L130 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/utils/JarUrlConnection.java | JarUrlConnection.getSegmentInputStream | protected InputStream getSegmentInputStream(InputStream baseIn, String segment) throws IOException
{
JarInputStream jarIn = new JarInputStream(baseIn);
JarEntry entry = null;
while (jarIn.available() != 0)
{
entry = jarIn.getNextJarEntry();
if (entry == null)
{
break;
}
if (("/" + entry.getName()).equals(segment))
{
return jarIn;
}
}
throw Messages.MESSAGES.jarUrlConnectionUnableToLocateSegment(segment, getURL().toExternalForm());
} | java | protected InputStream getSegmentInputStream(InputStream baseIn, String segment) throws IOException
{
JarInputStream jarIn = new JarInputStream(baseIn);
JarEntry entry = null;
while (jarIn.available() != 0)
{
entry = jarIn.getNextJarEntry();
if (entry == null)
{
break;
}
if (("/" + entry.getName()).equals(segment))
{
return jarIn;
}
}
throw Messages.MESSAGES.jarUrlConnectionUnableToLocateSegment(segment, getURL().toExternalForm());
} | [
"protected",
"InputStream",
"getSegmentInputStream",
"(",
"InputStream",
"baseIn",
",",
"String",
"segment",
")",
"throws",
"IOException",
"{",
"JarInputStream",
"jarIn",
"=",
"new",
"JarInputStream",
"(",
"baseIn",
")",
";",
"JarEntry",
"entry",
"=",
"null",
";",... | Retrieve the <code>InputStream</code> for the nesting
segment relative to a base <code>InputStream</code>.
@param baseIn The base input-stream.
@param segment The nesting segment path.
@return The input-stream to the segment.
@throws java.io.IOException If an I/O error occurs. | [
"Retrieve",
"the",
"<code",
">",
"InputStream<",
"/",
"code",
">",
"for",
"the",
"nesting",
"segment",
"relative",
"to",
"a",
"base",
"<code",
">",
"InputStream<",
"/",
"code",
">",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/JarUrlConnection.java#L199-L220 |
pinterest/secor | src/main/java/com/pinterest/secor/util/ProtobufUtil.java | ProtobufUtil.decodeProtobufMessage | public Message decodeProtobufMessage(String topic, byte[] payload){
Method parseMethod = allTopics ? messageParseMethodForAll : messageParseMethodByTopic.get(topic);
try {
return (Message) parseMethod.invoke(null, payload);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not callable. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not accessible. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (InvocationTargetException e) {
throw new RuntimeException("Error parsing protobuf message", e);
}
} | java | public Message decodeProtobufMessage(String topic, byte[] payload){
Method parseMethod = allTopics ? messageParseMethodForAll : messageParseMethodByTopic.get(topic);
try {
return (Message) parseMethod.invoke(null, payload);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not callable. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not accessible. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (InvocationTargetException e) {
throw new RuntimeException("Error parsing protobuf message", e);
}
} | [
"public",
"Message",
"decodeProtobufMessage",
"(",
"String",
"topic",
",",
"byte",
"[",
"]",
"payload",
")",
"{",
"Method",
"parseMethod",
"=",
"allTopics",
"?",
"messageParseMethodForAll",
":",
"messageParseMethodByTopic",
".",
"get",
"(",
"topic",
")",
";",
"t... | Decodes protobuf message
@param topic
Kafka topic name
@param payload
Byte array containing encoded protobuf
@return protobuf message instance
@throws RuntimeException
when there's problem decoding protobuf | [
"Decodes",
"protobuf",
"message"
] | train | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ProtobufUtil.java#L181-L194 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java | P2sVpnGatewaysInner.beginUpdateTagsAsync | public Observable<P2SVpnGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String gatewayName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() {
@Override
public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<P2SVpnGatewayInner> beginUpdateTagsAsync(String resourceGroupName, String gatewayName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() {
@Override
public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"P2SVpnGatewayInner",
">",
"beginUpdateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"gatewayName",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"gatewayName",
")",
".",
"map",
... | Updates virtual wan p2s vpn gateway tags.
@param resourceGroupName The resource group name of the P2SVpnGateway.
@param gatewayName The name of the gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the P2SVpnGatewayInner object | [
"Updates",
"virtual",
"wan",
"p2s",
"vpn",
"gateway",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java#L558-L565 |
mozilla/rhino | src/org/mozilla/javascript/Context.java | Context.jsToJava | public static Object jsToJava(Object value, Class<?> desiredType)
throws EvaluatorException
{
return NativeJavaObject.coerceTypeImpl(desiredType, value);
} | java | public static Object jsToJava(Object value, Class<?> desiredType)
throws EvaluatorException
{
return NativeJavaObject.coerceTypeImpl(desiredType, value);
} | [
"public",
"static",
"Object",
"jsToJava",
"(",
"Object",
"value",
",",
"Class",
"<",
"?",
">",
"desiredType",
")",
"throws",
"EvaluatorException",
"{",
"return",
"NativeJavaObject",
".",
"coerceTypeImpl",
"(",
"desiredType",
",",
"value",
")",
";",
"}"
] | Convert a JavaScript value into the desired type.
Uses the semantics defined with LiveConnect3 and throws an
Illegal argument exception if the conversion cannot be performed.
@param value the JavaScript value to convert
@param desiredType the Java type to convert to. Primitive Java
types are represented using the TYPE fields in the corresponding
wrapper class in java.lang.
@return the converted value
@throws EvaluatorException if the conversion cannot be performed | [
"Convert",
"a",
"JavaScript",
"value",
"into",
"the",
"desired",
"type",
".",
"Uses",
"the",
"semantics",
"defined",
"with",
"LiveConnect3",
"and",
"throws",
"an",
"Illegal",
"argument",
"exception",
"if",
"the",
"conversion",
"cannot",
"be",
"performed",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1874-L1878 |
wildfly/wildfly-core | elytron/src/main/java/org/wildfly/extension/elytron/ProviderAttributeDefinition.java | ProviderAttributeDefinition.populateProviders | static void populateProviders(final ModelNode response, final Provider[] providers) {
for (Provider current : providers) {
ModelNode providerModel = new ModelNode();
populateProvider(providerModel, current, true);
response.add(providerModel);
}
} | java | static void populateProviders(final ModelNode response, final Provider[] providers) {
for (Provider current : providers) {
ModelNode providerModel = new ModelNode();
populateProvider(providerModel, current, true);
response.add(providerModel);
}
} | [
"static",
"void",
"populateProviders",
"(",
"final",
"ModelNode",
"response",
",",
"final",
"Provider",
"[",
"]",
"providers",
")",
"{",
"for",
"(",
"Provider",
"current",
":",
"providers",
")",
"{",
"ModelNode",
"providerModel",
"=",
"new",
"ModelNode",
"(",
... | Populate the supplied response {@link ModelNode} with information about each {@link Provider} in the included array.
@param response the response to populate.
@param providers the array or {@link Provider} instances to use to populate the response. | [
"Populate",
"the",
"supplied",
"response",
"{",
"@link",
"ModelNode",
"}",
"with",
"information",
"about",
"each",
"{",
"@link",
"Provider",
"}",
"in",
"the",
"included",
"array",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/ProviderAttributeDefinition.java#L180-L186 |
wcm-io-caravan/caravan-hal | resource/src/main/java/io/wcm/caravan/hal/resource/HalResourceFactory.java | HalResourceFactory.createResource | @Deprecated
public static HalResource createResource(ObjectNode model, String href) {
return new HalResource(model, href);
} | java | @Deprecated
public static HalResource createResource(ObjectNode model, String href) {
return new HalResource(model, href);
} | [
"@",
"Deprecated",
"public",
"static",
"HalResource",
"createResource",
"(",
"ObjectNode",
"model",
",",
"String",
"href",
")",
"{",
"return",
"new",
"HalResource",
"(",
"model",
",",
"href",
")",
";",
"}"
] | Creates a HAL resource with state and a self link.
@param model The state of the resource
@param href The self link for the resource
@return New HAL resource
@deprecated just create {@link HalResource} and {@link Link} instances using the new constructors | [
"Creates",
"a",
"HAL",
"resource",
"with",
"state",
"and",
"a",
"self",
"link",
"."
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResourceFactory.java#L91-L94 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.rawQueryWithFactory | public Cursor rawQueryWithFactory(
CursorFactory cursorFactory, String sql, String[] selectionArgs,
String editTable) {
return rawQueryWithFactory(cursorFactory, sql, selectionArgs, editTable, null);
} | java | public Cursor rawQueryWithFactory(
CursorFactory cursorFactory, String sql, String[] selectionArgs,
String editTable) {
return rawQueryWithFactory(cursorFactory, sql, selectionArgs, editTable, null);
} | [
"public",
"Cursor",
"rawQueryWithFactory",
"(",
"CursorFactory",
"cursorFactory",
",",
"String",
"sql",
",",
"String",
"[",
"]",
"selectionArgs",
",",
"String",
"editTable",
")",
"{",
"return",
"rawQueryWithFactory",
"(",
"cursorFactory",
",",
"sql",
",",
"selecti... | Runs the provided SQL and returns a cursor over the result set.
@param cursorFactory the cursor factory to use, or null for the default factory
@param sql the SQL query. The SQL string must not be ; terminated
@param selectionArgs You may include ?s in where clause in the query,
which will be replaced by the values from selectionArgs. The
values will be bound as Strings.
@param editTable the name of the first table, which is editable
@return A {@link Cursor} object, which is positioned before the first entry. Note that
{@link Cursor}s are not synchronized, see the documentation for more details. | [
"Runs",
"the",
"provided",
"SQL",
"and",
"returns",
"a",
"cursor",
"over",
"the",
"result",
"set",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L1292-L1296 |
dhanji/sitebricks | sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/MessageStatusExtractor.java | MessageStatusExtractor.isUnterminatedString | @VisibleForTesting
static boolean isUnterminatedString(String message, boolean alreadyInString) {
boolean escaped = false;
boolean inString = alreadyInString;
for (int i = 0; i < message.length(); i++) {
final char c = message.charAt(i);
if (inString) {
if (c == '\\') {
escaped = !escaped;
} else if (c == '"') {
if (!escaped)
inString = false;
escaped = false;
} else
escaped = false;
} else
inString = c == '"';
}
return inString;
} | java | @VisibleForTesting
static boolean isUnterminatedString(String message, boolean alreadyInString) {
boolean escaped = false;
boolean inString = alreadyInString;
for (int i = 0; i < message.length(); i++) {
final char c = message.charAt(i);
if (inString) {
if (c == '\\') {
escaped = !escaped;
} else if (c == '"') {
if (!escaped)
inString = false;
escaped = false;
} else
escaped = false;
} else
inString = c == '"';
}
return inString;
} | [
"@",
"VisibleForTesting",
"static",
"boolean",
"isUnterminatedString",
"(",
"String",
"message",
",",
"boolean",
"alreadyInString",
")",
"{",
"boolean",
"escaped",
"=",
"false",
";",
"boolean",
"inString",
"=",
"alreadyInString",
";",
"for",
"(",
"int",
"i",
"="... | Check for string termination, will check for quote escaping, but only if it's escaped
within a string... otherwise it's illegal and we'll treat it as a regular quote.
A trailing backslash indicates a \CRLF was received (as envisaged in RFC 822 3.4.5). | [
"Check",
"for",
"string",
"termination",
"will",
"check",
"for",
"quote",
"escaping",
"but",
"only",
"if",
"it",
"s",
"escaped",
"within",
"a",
"string",
"...",
"otherwise",
"it",
"s",
"illegal",
"and",
"we",
"ll",
"treat",
"it",
"as",
"a",
"regular",
"q... | train | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/MessageStatusExtractor.java#L138-L157 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_automaticCall_identifier_GET | public OvhCallsGenerated billingAccount_line_serviceName_automaticCall_identifier_GET(String billingAccount, String serviceName, String identifier) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/automaticCall/{identifier}";
StringBuilder sb = path(qPath, billingAccount, serviceName, identifier);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCallsGenerated.class);
} | java | public OvhCallsGenerated billingAccount_line_serviceName_automaticCall_identifier_GET(String billingAccount, String serviceName, String identifier) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/automaticCall/{identifier}";
StringBuilder sb = path(qPath, billingAccount, serviceName, identifier);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCallsGenerated.class);
} | [
"public",
"OvhCallsGenerated",
"billingAccount_line_serviceName_automaticCall_identifier_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"identifier",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/l... | Get this object properties
REST: GET /telephony/{billingAccount}/line/{serviceName}/automaticCall/{identifier}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param identifier [required] Generated call identifier | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1784-L1789 |
OpenBEL/openbel-framework | org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java | PhaseOneApplication.stage6 | public boolean stage6(final Document doc, final ProtoNetwork pn) {
beginStage(PHASE1_STAGE6_HDR, "6", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
boolean stmtSuccess = false, termSuccess = false;
bldr.append("Expanding statements and terms");
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
boolean stmtExpand = !hasOption(NO_NS_LONG_OPT);
p1.stage6Expansion(doc, pn, stmtExpand);
termSuccess = true;
stmtSuccess = true;
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return stmtSuccess && termSuccess;
} | java | public boolean stage6(final Document doc, final ProtoNetwork pn) {
beginStage(PHASE1_STAGE6_HDR, "6", NUM_PHASES);
final StringBuilder bldr = new StringBuilder();
boolean stmtSuccess = false, termSuccess = false;
bldr.append("Expanding statements and terms");
stageOutput(bldr.toString());
long t1 = currentTimeMillis();
boolean stmtExpand = !hasOption(NO_NS_LONG_OPT);
p1.stage6Expansion(doc, pn, stmtExpand);
termSuccess = true;
stmtSuccess = true;
long t2 = currentTimeMillis();
bldr.setLength(0);
markTime(bldr, t1, t2);
markEndStage(bldr);
stageOutput(bldr.toString());
return stmtSuccess && termSuccess;
} | [
"public",
"boolean",
"stage6",
"(",
"final",
"Document",
"doc",
",",
"final",
"ProtoNetwork",
"pn",
")",
"{",
"beginStage",
"(",
"PHASE1_STAGE6_HDR",
",",
"\"6\"",
",",
"NUM_PHASES",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",... | Stage six expansion of the document.
@param doc the original {@link Document document} needed as a dependency
when using {@link ProtoNetworkBuilder proto network builder}
@param pn the {@link ProtoNetwork proto network} to expand into | [
"Stage",
"six",
"expansion",
"of",
"the",
"document",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseOneApplication.java#L569-L591 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/RNAUtils.java | RNAUtils.areAntiparallel | public static boolean areAntiparallel(PolymerNotation polymerOne, PolymerNotation polymerTwo)
throws RNAUtilsException, HELM2HandledException, ChemistryException, NucleotideLoadingException {
checkRNA(polymerOne);
checkRNA(polymerTwo);
PolymerNotation antiparallel = getAntiparallel(polymerOne);
String sequenceOne = FastaFormat
.generateFastaFromRNA(MethodsMonomerUtils.getListOfHandledMonomers(antiparallel.getListMonomers()));
String sequenceTwo = FastaFormat
.generateFastaFromRNA(MethodsMonomerUtils.getListOfHandledMonomers(polymerTwo.getListMonomers()));
return sequenceOne.equals(sequenceTwo);
} | java | public static boolean areAntiparallel(PolymerNotation polymerOne, PolymerNotation polymerTwo)
throws RNAUtilsException, HELM2HandledException, ChemistryException, NucleotideLoadingException {
checkRNA(polymerOne);
checkRNA(polymerTwo);
PolymerNotation antiparallel = getAntiparallel(polymerOne);
String sequenceOne = FastaFormat
.generateFastaFromRNA(MethodsMonomerUtils.getListOfHandledMonomers(antiparallel.getListMonomers()));
String sequenceTwo = FastaFormat
.generateFastaFromRNA(MethodsMonomerUtils.getListOfHandledMonomers(polymerTwo.getListMonomers()));
return sequenceOne.equals(sequenceTwo);
} | [
"public",
"static",
"boolean",
"areAntiparallel",
"(",
"PolymerNotation",
"polymerOne",
",",
"PolymerNotation",
"polymerTwo",
")",
"throws",
"RNAUtilsException",
",",
"HELM2HandledException",
",",
"ChemistryException",
",",
"NucleotideLoadingException",
"{",
"checkRNA",
"("... | method to check if two given polymers are complement to each other
@param polymerOne
PolymerNotation of the first polymer
@param polymerTwo
PolymerNotation of the second polymer
@return true, if they are opposite to each other, false otherwise
@throws RNAUtilsException
if the polymers are not rna/dna or the antiparallel strand
can not be built from polymerOne
@throws HELM2HandledException
if the polymers contain HELM2 features
@throws ChemistryException
if the Chemistry Engine can not be initialized
@throws NucleotideLoadingException if nucleotides can not be loaded | [
"method",
"to",
"check",
"if",
"two",
"given",
"polymers",
"are",
"complement",
"to",
"each",
"other"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/RNAUtils.java#L147-L157 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/PropertiesField.java | PropertiesField.doSetData | public int doSetData(Object data, boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = super.doSetData(data, bDisplayOption, iMoveMode);
if (this.isJustModified())
m_propertiesCache = null; // Cache is no longer valid
return iErrorCode;
} | java | public int doSetData(Object data, boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = super.doSetData(data, bDisplayOption, iMoveMode);
if (this.isJustModified())
m_propertiesCache = null; // Cache is no longer valid
return iErrorCode;
} | [
"public",
"int",
"doSetData",
"(",
"Object",
"data",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"super",
".",
"doSetData",
"(",
"data",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"if",
"(",
"this"... | Move this physical binary data to this field.
@param data The physical data to move to this field (must be the correct raw data class).
@param bDisplayOption If true, display after setting the data.
@param iMoveMode The type of move.
@return an error code (0 if success). | [
"Move",
"this",
"physical",
"binary",
"data",
"to",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L292-L298 |
infinispan/infinispan | core/src/main/java/org/infinispan/util/AbstractDelegatingIntCacheStream.java | AbstractDelegatingIntCacheStream.mapToDouble | @Override
public DoubleCacheStream mapToDouble(IntToDoubleFunction mapper) {
return new AbstractDelegatingDoubleCacheStream(delegateCacheStream, underlyingStream.mapToDouble(mapper));
} | java | @Override
public DoubleCacheStream mapToDouble(IntToDoubleFunction mapper) {
return new AbstractDelegatingDoubleCacheStream(delegateCacheStream, underlyingStream.mapToDouble(mapper));
} | [
"@",
"Override",
"public",
"DoubleCacheStream",
"mapToDouble",
"(",
"IntToDoubleFunction",
"mapper",
")",
"{",
"return",
"new",
"AbstractDelegatingDoubleCacheStream",
"(",
"delegateCacheStream",
",",
"underlyingStream",
".",
"mapToDouble",
"(",
"mapper",
")",
")",
";",
... | These are methods that convert to a different AbstractDelegating*CacheStream | [
"These",
"are",
"methods",
"that",
"convert",
"to",
"a",
"different",
"AbstractDelegating",
"*",
"CacheStream"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/AbstractDelegatingIntCacheStream.java#L52-L55 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/ToolScreen.java | ToolScreen.isPrintableControl | public boolean isPrintableControl(ScreenField sField, int iPrintOptions)
{
// Override this to break
if ((sField == null) || (sField == this))
{ // Asking about this control
return false; // Tool screens are not printed as a sub-screen.
}
return super.isPrintableControl(sField, iPrintOptions);
} | java | public boolean isPrintableControl(ScreenField sField, int iPrintOptions)
{
// Override this to break
if ((sField == null) || (sField == this))
{ // Asking about this control
return false; // Tool screens are not printed as a sub-screen.
}
return super.isPrintableControl(sField, iPrintOptions);
} | [
"public",
"boolean",
"isPrintableControl",
"(",
"ScreenField",
"sField",
",",
"int",
"iPrintOptions",
")",
"{",
"// Override this to break",
"if",
"(",
"(",
"sField",
"==",
"null",
")",
"||",
"(",
"sField",
"==",
"this",
")",
")",
"{",
"// Asking about this cont... | Display this sub-control in html input format?
@param iPrintOptions The view specific print options.
@return True if this sub-control is printable. | [
"Display",
"this",
"sub",
"-",
"control",
"in",
"html",
"input",
"format?"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ToolScreen.java#L179-L187 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/logging/Redwood.java | Redwood.startTrack | public static void startTrack(final Object... args){
if(isClosed){ return; }
//--Create Record
final int len = args.length == 0 ? 0 : args.length-1;
final Object content = args.length == 0 ? "" : args[len];
final Object[] tags = new Object[len];
final StackTraceElement ste = getStackTrace();
final long timestamp = System.currentTimeMillis();
System.arraycopy(args,0,tags,0,len);
//--Create Task
final long threadID = Thread.currentThread().getId();
final Runnable startTrack = new Runnable(){
public void run(){
assert !isThreaded || control.isHeldByCurrentThread();
Record toPass = new Record(content,tags,depth,ste,timestamp);
depth += 1;
titleStack.push(args.length == 0 ? "" : args[len].toString());
handlers.process(toPass, MessageType.START_TRACK, depth, toPass.timesstamp);
assert !isThreaded || control.isHeldByCurrentThread();
}
};
//--Run Task
if(isThreaded){
//(case: multithreaded)
long threadId = Thread.currentThread().getId();
attemptThreadControl( threadId, startTrack );
} else {
//(case: no threading)
startTrack.run();
}
} | java | public static void startTrack(final Object... args){
if(isClosed){ return; }
//--Create Record
final int len = args.length == 0 ? 0 : args.length-1;
final Object content = args.length == 0 ? "" : args[len];
final Object[] tags = new Object[len];
final StackTraceElement ste = getStackTrace();
final long timestamp = System.currentTimeMillis();
System.arraycopy(args,0,tags,0,len);
//--Create Task
final long threadID = Thread.currentThread().getId();
final Runnable startTrack = new Runnable(){
public void run(){
assert !isThreaded || control.isHeldByCurrentThread();
Record toPass = new Record(content,tags,depth,ste,timestamp);
depth += 1;
titleStack.push(args.length == 0 ? "" : args[len].toString());
handlers.process(toPass, MessageType.START_TRACK, depth, toPass.timesstamp);
assert !isThreaded || control.isHeldByCurrentThread();
}
};
//--Run Task
if(isThreaded){
//(case: multithreaded)
long threadId = Thread.currentThread().getId();
attemptThreadControl( threadId, startTrack );
} else {
//(case: no threading)
startTrack.run();
}
} | [
"public",
"static",
"void",
"startTrack",
"(",
"final",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isClosed",
")",
"{",
"return",
";",
"}",
"//--Create Record\r",
"final",
"int",
"len",
"=",
"args",
".",
"length",
"==",
"0",
"?",
"0",
":",
"args",
... | Begin a "track;" that is, begin logging at one level deeper.
Channels other than the FORCE channel are ignored.
@param args The title of the track to begin, with an optional FORCE flag. | [
"Begin",
"a",
"track",
";",
"that",
"is",
"begin",
"logging",
"at",
"one",
"level",
"deeper",
".",
"Channels",
"other",
"than",
"the",
"FORCE",
"channel",
"are",
"ignored",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/logging/Redwood.java#L468-L498 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchClient.java | JMElasticsearchClient.getAllIdList | public List<String> getAllIdList(String index, String type) {
return extractIdList(searchAll(index, type));
} | java | public List<String> getAllIdList(String index, String type) {
return extractIdList(searchAll(index, type));
} | [
"public",
"List",
"<",
"String",
">",
"getAllIdList",
"(",
"String",
"index",
",",
"String",
"type",
")",
"{",
"return",
"extractIdList",
"(",
"searchAll",
"(",
"index",
",",
"type",
")",
")",
";",
"}"
] | Gets all id list.
@param index the index
@param type the type
@return the all id list | [
"Gets",
"all",
"id",
"list",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchClient.java#L234-L236 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.createOrUpdateFirewallRule | public FirewallRuleInner createOrUpdateFirewallRule(String resourceGroupName, String accountName, String name, FirewallRuleInner parameters) {
return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, name, parameters).toBlocking().single().body();
} | java | public FirewallRuleInner createOrUpdateFirewallRule(String resourceGroupName, String accountName, String name, FirewallRuleInner parameters) {
return createOrUpdateFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, name, parameters).toBlocking().single().body();
} | [
"public",
"FirewallRuleInner",
"createOrUpdateFirewallRule",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"name",
",",
"FirewallRuleInner",
"parameters",
")",
"{",
"return",
"createOrUpdateFirewallRuleWithServiceResponseAsync",
"(",
"resour... | Creates or updates the specified firewall rule.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account.
@param accountName The name of the Data Lake Store account to which to add the firewall rule.
@param name The name of the firewall rule to create or update.
@param parameters Parameters supplied to create the create firewall rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the FirewallRuleInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L460-L462 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java | SARLReentrantTypeResolver.getSarlCapacityFieldType | protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) {
// For capacity call redirection
LightweightTypeReference fieldType = resolvedTypes.getActualType(field);
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapacityFeature.class);
if (capacityAnnotation != null) {
final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0);
fieldType = resolvedTypes.getActualType(ref.getType());
}
return fieldType;
} | java | protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) {
// For capacity call redirection
LightweightTypeReference fieldType = resolvedTypes.getActualType(field);
final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field,
ImportedCapacityFeature.class);
if (capacityAnnotation != null) {
final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0);
fieldType = resolvedTypes.getActualType(ref.getType());
}
return fieldType;
} | [
"protected",
"LightweightTypeReference",
"getSarlCapacityFieldType",
"(",
"IResolvedTypes",
"resolvedTypes",
",",
"JvmField",
"field",
")",
"{",
"// For capacity call redirection",
"LightweightTypeReference",
"fieldType",
"=",
"resolvedTypes",
".",
"getActualType",
"(",
"field"... | Replies the type of the field that represents a SARL capacity buffer.
@param resolvedTypes the resolver of types.
@param field the field.
@return the type, never {@code null}. | [
"Replies",
"the",
"type",
"of",
"the",
"field",
"that",
"represents",
"a",
"SARL",
"capacity",
"buffer",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java#L143-L153 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsNotification.java | CmsNotification.sendDeferred | public void sendDeferred(final Type type, final String message) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
/**
* @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute()
*/
public void execute() {
send(type, message);
}
});
} | java | public void sendDeferred(final Type type, final String message) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
/**
* @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute()
*/
public void execute() {
send(type, message);
}
});
} | [
"public",
"void",
"sendDeferred",
"(",
"final",
"Type",
"type",
",",
"final",
"String",
"message",
")",
"{",
"Scheduler",
".",
"get",
"(",
")",
".",
"scheduleDeferred",
"(",
"new",
"ScheduledCommand",
"(",
")",
"{",
"/**\n * @see com.google.gwt.core.cl... | Sends a new notification after all other events have been processed.<p>
@param type the notification type
@param message the message | [
"Sends",
"a",
"new",
"notification",
"after",
"all",
"other",
"events",
"have",
"been",
"processed",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsNotification.java#L207-L220 |
ManfredTremmel/gwt-commons-lang3 | src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java | GregorianCalendar.compareDate | private int compareDate(Date a, Date b) {
final Date ta = new Date(a.getTime());
final Date tb = new Date(b.getTime());
final long d1 = setHourToZero(ta).getTime();
final long d2 = setHourToZero(tb).getTime();
return (int) Math.round((d2 - d1) / 1000.0 / 60.0 / 60.0 / 24.0);
} | java | private int compareDate(Date a, Date b) {
final Date ta = new Date(a.getTime());
final Date tb = new Date(b.getTime());
final long d1 = setHourToZero(ta).getTime();
final long d2 = setHourToZero(tb).getTime();
return (int) Math.round((d2 - d1) / 1000.0 / 60.0 / 60.0 / 24.0);
} | [
"private",
"int",
"compareDate",
"(",
"Date",
"a",
",",
"Date",
"b",
")",
"{",
"final",
"Date",
"ta",
"=",
"new",
"Date",
"(",
"a",
".",
"getTime",
"(",
")",
")",
";",
"final",
"Date",
"tb",
"=",
"new",
"Date",
"(",
"b",
".",
"getTime",
"(",
")... | Calculate the number of days between two dates
@param a Date
@param b Date
@return the difference in days between b and a (b - a) | [
"Calculate",
"the",
"number",
"of",
"days",
"between",
"two",
"dates"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/resources/org/apache/commons/jre/java/util/GregorianCalendar.java#L365-L371 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java | TypeUtility.className | public static ClassName className(String className) {
int index = className.lastIndexOf(".");
if (index > 0) {
return classNameWithSuffix(className.substring(0, index), className.substring(index + 1), "");
}
return ClassName.get("", className);
} | java | public static ClassName className(String className) {
int index = className.lastIndexOf(".");
if (index > 0) {
return classNameWithSuffix(className.substring(0, index), className.substring(index + 1), "");
}
return ClassName.get("", className);
} | [
"public",
"static",
"ClassName",
"className",
"(",
"String",
"className",
")",
"{",
"int",
"index",
"=",
"className",
".",
"lastIndexOf",
"(",
"\".\"",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"return",
"classNameWithSuffix",
"(",
"className",
"."... | Generate class typeName.
@param className
the class name
@return class typeName generated | [
"Generate",
"class",
"typeName",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java#L205-L212 |
Azure/azure-sdk-for-java | mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java | SpatialAnchorsAccountsInner.getKeys | public SpatialAnchorsAccountKeysInner getKeys(String resourceGroupName, String spatialAnchorsAccountName) {
return getKeysWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName).toBlocking().single().body();
} | java | public SpatialAnchorsAccountKeysInner getKeys(String resourceGroupName, String spatialAnchorsAccountName) {
return getKeysWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName).toBlocking().single().body();
} | [
"public",
"SpatialAnchorsAccountKeysInner",
"getKeys",
"(",
"String",
"resourceGroupName",
",",
"String",
"spatialAnchorsAccountName",
")",
"{",
"return",
"getKeysWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"spatialAnchorsAccountName",
")",
".",
"toBlocking",
"(... | Get Both of the 2 Keys of a Spatial Anchors Account.
@param resourceGroupName Name of an Azure resource group.
@param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SpatialAnchorsAccountKeysInner object if successful. | [
"Get",
"Both",
"of",
"the",
"2",
"Keys",
"of",
"a",
"Spatial",
"Anchors",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L705-L707 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/learning/ConfusionMatrixPanel.java | ConfusionMatrixPanel.renderLabels | private void renderLabels(Graphics2D g2, double fontSize) {
int numCategories = confusion.getNumRows();
int longestLabel = 0;
if(renderLabels) {
for (int i = 0; i < numCategories; i++) {
longestLabel = Math.max(longestLabel,labels.get(i).length());
}
}
Font fontLabel = new Font("monospaced", Font.BOLD, (int)(0.055*longestLabel*fontSize + 0.5));
g2.setFont(fontLabel);
FontMetrics metrics = g2.getFontMetrics(fontLabel);
// clear the background
g2.setColor(Color.WHITE);
g2.fillRect(gridWidth,0,viewWidth-gridWidth,viewHeight);
// draw the text
g2.setColor(Color.BLACK);
for (int i = 0; i < numCategories; i++) {
String label = labels.get(i);
int y0 = i * gridHeight / numCategories;
int y1 = (i + 1) * gridHeight / numCategories;
Rectangle2D r = metrics.getStringBounds(label,null);
float adjX = (float)(r.getX()*2 + r.getWidth())/2.0f;
float adjY = (float)(r.getY()*2 + r.getHeight())/2.0f;
float x = ((viewWidth+gridWidth)/2f-adjX);
float y = ((y1+y0)/2f-adjY);
g2.drawString(label, x, y);
}
} | java | private void renderLabels(Graphics2D g2, double fontSize) {
int numCategories = confusion.getNumRows();
int longestLabel = 0;
if(renderLabels) {
for (int i = 0; i < numCategories; i++) {
longestLabel = Math.max(longestLabel,labels.get(i).length());
}
}
Font fontLabel = new Font("monospaced", Font.BOLD, (int)(0.055*longestLabel*fontSize + 0.5));
g2.setFont(fontLabel);
FontMetrics metrics = g2.getFontMetrics(fontLabel);
// clear the background
g2.setColor(Color.WHITE);
g2.fillRect(gridWidth,0,viewWidth-gridWidth,viewHeight);
// draw the text
g2.setColor(Color.BLACK);
for (int i = 0; i < numCategories; i++) {
String label = labels.get(i);
int y0 = i * gridHeight / numCategories;
int y1 = (i + 1) * gridHeight / numCategories;
Rectangle2D r = metrics.getStringBounds(label,null);
float adjX = (float)(r.getX()*2 + r.getWidth())/2.0f;
float adjY = (float)(r.getY()*2 + r.getHeight())/2.0f;
float x = ((viewWidth+gridWidth)/2f-adjX);
float y = ((y1+y0)/2f-adjY);
g2.drawString(label, x, y);
}
} | [
"private",
"void",
"renderLabels",
"(",
"Graphics2D",
"g2",
",",
"double",
"fontSize",
")",
"{",
"int",
"numCategories",
"=",
"confusion",
".",
"getNumRows",
"(",
")",
";",
"int",
"longestLabel",
"=",
"0",
";",
"if",
"(",
"renderLabels",
")",
"{",
"for",
... | Renders the names on each category to the side of the confusion matrix | [
"Renders",
"the",
"names",
"on",
"each",
"category",
"to",
"the",
"side",
"of",
"the",
"confusion",
"matrix"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/learning/ConfusionMatrixPanel.java#L200-L236 |
square/dagger | compiler/src/main/java/dagger/internal/codegen/GraphAnalysisLoader.java | GraphAnalysisLoader.resolveType | @VisibleForTesting static TypeElement resolveType(Elements elements, String className) {
int index = nextDollar(className, className, 0);
if (index == -1) {
return getTypeElement(elements, className);
}
// have to test various possibilities of replacing '$' with '.' since '.' in a canonical name
// of a nested type is replaced with '$' in the binary name.
StringBuilder sb = new StringBuilder(className);
return resolveType(elements, className, sb, index);
} | java | @VisibleForTesting static TypeElement resolveType(Elements elements, String className) {
int index = nextDollar(className, className, 0);
if (index == -1) {
return getTypeElement(elements, className);
}
// have to test various possibilities of replacing '$' with '.' since '.' in a canonical name
// of a nested type is replaced with '$' in the binary name.
StringBuilder sb = new StringBuilder(className);
return resolveType(elements, className, sb, index);
} | [
"@",
"VisibleForTesting",
"static",
"TypeElement",
"resolveType",
"(",
"Elements",
"elements",
",",
"String",
"className",
")",
"{",
"int",
"index",
"=",
"nextDollar",
"(",
"className",
",",
"className",
",",
"0",
")",
";",
"if",
"(",
"index",
"==",
"-",
"... | Resolves the given class name into a {@link TypeElement}. The class name is a binary name, but
{@link Elements#getTypeElement(CharSequence)} wants a canonical name. So this method searches
the space of possible canonical names, starting with the most likely (since '$' is rarely used
in canonical class names). | [
"Resolves",
"the",
"given",
"class",
"name",
"into",
"a",
"{"
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/compiler/src/main/java/dagger/internal/codegen/GraphAnalysisLoader.java#L64-L73 |
structr/structr | structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java | DatePropertyParser.parseISO8601DateString | public static Date parseISO8601DateString(String source) {
final String[] supportedFormats = new String[] { "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", "yyyy-MM-dd'T'HH:mm:ssXXX", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZ" };
// SimpleDateFormat is not fully ISO8601 compatible, so we replace 'Z' by +0000
if (StringUtils.contains(source, "Z")) {
source = StringUtils.replace(source, "Z", "+0000");
}
Date parsedDate = null;
for (final String format : supportedFormats) {
try {
parsedDate = new SimpleDateFormat(format).parse(source);
} catch (ParseException pe) {
}
if (parsedDate != null) {
return parsedDate;
}
}
return null;
} | java | public static Date parseISO8601DateString(String source) {
final String[] supportedFormats = new String[] { "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", "yyyy-MM-dd'T'HH:mm:ssXXX", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZ" };
// SimpleDateFormat is not fully ISO8601 compatible, so we replace 'Z' by +0000
if (StringUtils.contains(source, "Z")) {
source = StringUtils.replace(source, "Z", "+0000");
}
Date parsedDate = null;
for (final String format : supportedFormats) {
try {
parsedDate = new SimpleDateFormat(format).parse(source);
} catch (ParseException pe) {
}
if (parsedDate != null) {
return parsedDate;
}
}
return null;
} | [
"public",
"static",
"Date",
"parseISO8601DateString",
"(",
"String",
"source",
")",
"{",
"final",
"String",
"[",
"]",
"supportedFormats",
"=",
"new",
"String",
"[",
"]",
"{",
"\"yyyy-MM-dd'T'HH:mm:ss.SSSXXX\"",
",",
"\"yyyy-MM-dd'T'HH:mm:ssXXX\"",
",",
"\"yyyy-MM-dd'T... | Try to parse source string as a ISO8601 date.
@param source
@return null if unable to parse | [
"Try",
"to",
"parse",
"source",
"string",
"as",
"a",
"ISO8601",
"date",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java#L123-L151 |
grails/grails-core | grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java | WebUtils.exposeRequestAttributeIfNotPresent | private static void exposeRequestAttributeIfNotPresent(ServletRequest request, String name, Object value) {
if (request.getAttribute(name) == null) {
request.setAttribute(name, value);
}
} | java | private static void exposeRequestAttributeIfNotPresent(ServletRequest request, String name, Object value) {
if (request.getAttribute(name) == null) {
request.setAttribute(name, value);
}
} | [
"private",
"static",
"void",
"exposeRequestAttributeIfNotPresent",
"(",
"ServletRequest",
"request",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"request",
".",
"getAttribute",
"(",
"name",
")",
"==",
"null",
")",
"{",
"request",
".",
... | Expose the specified request attribute if not already present.
@param request current servlet request
@param name the name of the attribute
@param value the suggested value of the attribute | [
"Expose",
"the",
"specified",
"request",
"attribute",
"if",
"not",
"already",
"present",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java#L277-L281 |
trustathsh/ironcommon | src/main/java/de/hshannover/f4/trust/ironcommon/yaml/YamlReader.java | YamlReader.loadAs | @SuppressWarnings("unchecked")
public static synchronized <T> T loadAs(String fileName, Class<T> clazz)
throws IOException {
ObjectChecks.checkForNullReference(fileName, "fileName is null");
ObjectChecks.checkForNullReference(clazz, "clazz is null");
FileReader fileReader = null;
File f = null;
try {
fileReader = new FileReader(fileName);
} catch (FileNotFoundException e) {
f = new File(fileName);
if (f.isDirectory()) {
throw new IOException(fileName + " is a directory");
} else if (f.isFile()) {
throw new IOException("Could not open " + fileName + ": "
+ e.getMessage());
} else {
mLogger.debug("File: "
+ fileName
+ " doesn't exist and it's not a directory, try to create it.");
// If it doens't exist and it's not a directory, try to create
// it.
try {
new FileWriter(fileName).close();
} catch (IOException ee) {
throw new IOException("Could not create " + fileName + ": "
+ ee.getMessage());
}
try {
fileReader = new FileReader(fileName);
} catch (IOException ee) {
throw new IOException("Could not open " + fileName + ": "
+ ee.getMessage());
}
}
}
Yaml yaml = new Yaml();
Object data = yaml.loadAs(fileReader, clazz);
fileReader.close();
return (T) data;
} | java | @SuppressWarnings("unchecked")
public static synchronized <T> T loadAs(String fileName, Class<T> clazz)
throws IOException {
ObjectChecks.checkForNullReference(fileName, "fileName is null");
ObjectChecks.checkForNullReference(clazz, "clazz is null");
FileReader fileReader = null;
File f = null;
try {
fileReader = new FileReader(fileName);
} catch (FileNotFoundException e) {
f = new File(fileName);
if (f.isDirectory()) {
throw new IOException(fileName + " is a directory");
} else if (f.isFile()) {
throw new IOException("Could not open " + fileName + ": "
+ e.getMessage());
} else {
mLogger.debug("File: "
+ fileName
+ " doesn't exist and it's not a directory, try to create it.");
// If it doens't exist and it's not a directory, try to create
// it.
try {
new FileWriter(fileName).close();
} catch (IOException ee) {
throw new IOException("Could not create " + fileName + ": "
+ ee.getMessage());
}
try {
fileReader = new FileReader(fileName);
} catch (IOException ee) {
throw new IOException("Could not open " + fileName + ": "
+ ee.getMessage());
}
}
}
Yaml yaml = new Yaml();
Object data = yaml.loadAs(fileReader, clazz);
fileReader.close();
return (T) data;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"loadAs",
"(",
"String",
"fileName",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"IOException",
"{",
"ObjectChecks",
".",
"checkForNullReferenc... | Tries to load the content of a yml-file as instances of a given
{@link Class}. If the file exists but is empty, the file is newly created
and null is returned.
@param fileName
The file name of the yml-file.
@param clazz
The data-type that the content of the yml-file shall be cast
into.
@param <T>
blubb
@return The content of the yml-file as instances of {@link Class} of type
T.
@throws IOException
If the file could not be opened, created (when it doesn't
exist) or the given filename is a directory. | [
"Tries",
"to",
"load",
"the",
"content",
"of",
"a",
"yml",
"-",
"file",
"as",
"instances",
"of",
"a",
"given",
"{",
"@link",
"Class",
"}",
".",
"If",
"the",
"file",
"exists",
"but",
"is",
"empty",
"the",
"file",
"is",
"newly",
"created",
"and",
"null... | train | https://github.com/trustathsh/ironcommon/blob/fee589a9300ab16744ca12fafae4357dd18c9fcb/src/main/java/de/hshannover/f4/trust/ironcommon/yaml/YamlReader.java#L87-L131 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.singleStepConference | public void singleStepConference(
String connId,
String destination,
String location,
KeyValueCollection userData,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidsinglestepconferenceData confData =
new VoicecallsidsinglestepconferenceData();
confData.setDestination(destination);
confData.setLocation(location);
confData.setUserData(Util.toKVList(userData));
confData.setReasons(Util.toKVList(reasons));
confData.setExtensions(Util.toKVList(extensions));
SingleStepConferenceData data = new SingleStepConferenceData();
data.data(confData);
ApiSuccessResponse response = this.voiceApi.singleStepConference(connId, data);
throwIfNotOk("singleStepConference", response);
} catch (ApiException e) {
throw new WorkspaceApiException("singleStepConference failed", e);
}
} | java | public void singleStepConference(
String connId,
String destination,
String location,
KeyValueCollection userData,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidsinglestepconferenceData confData =
new VoicecallsidsinglestepconferenceData();
confData.setDestination(destination);
confData.setLocation(location);
confData.setUserData(Util.toKVList(userData));
confData.setReasons(Util.toKVList(reasons));
confData.setExtensions(Util.toKVList(extensions));
SingleStepConferenceData data = new SingleStepConferenceData();
data.data(confData);
ApiSuccessResponse response = this.voiceApi.singleStepConference(connId, data);
throwIfNotOk("singleStepConference", response);
} catch (ApiException e) {
throw new WorkspaceApiException("singleStepConference failed", e);
}
} | [
"public",
"void",
"singleStepConference",
"(",
"String",
"connId",
",",
"String",
"destination",
",",
"String",
"location",
",",
"KeyValueCollection",
"userData",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApi... | Perform a single-step conference to the specified destination. This adds the destination to the
existing call, creating a conference if necessary.
@param connId The connection ID of the call to conference.
@param destination The number to add to the call.
@param location Name of the remote location in the form of <SwitchName> or <T-ServerApplicationName>@<SwitchName>. This value is used by Workspace to set the location attribute for the corresponding T-Server requests. (optional)
@param userData Key/value data to include with the call. (optional)
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Perform",
"a",
"single",
"-",
"step",
"conference",
"to",
"the",
"specified",
"destination",
".",
"This",
"adds",
"the",
"destination",
"to",
"the",
"existing",
"call",
"creating",
"a",
"conference",
"if",
"necessary",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1034-L1058 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractAttributeDefinitionBuilder.java | AbstractAttributeDefinitionBuilder.setDeprecated | public BUILDER setDeprecated(ModelVersion since, boolean notificationUseful) {
//noinspection deprecation
this.deprecated = new DeprecationData(since, notificationUseful);
return (BUILDER) this;
} | java | public BUILDER setDeprecated(ModelVersion since, boolean notificationUseful) {
//noinspection deprecation
this.deprecated = new DeprecationData(since, notificationUseful);
return (BUILDER) this;
} | [
"public",
"BUILDER",
"setDeprecated",
"(",
"ModelVersion",
"since",
",",
"boolean",
"notificationUseful",
")",
"{",
"//noinspection deprecation",
"this",
".",
"deprecated",
"=",
"new",
"DeprecationData",
"(",
"since",
",",
"notificationUseful",
")",
";",
"return",
"... | Marks the attribute as deprecated since the given API version, with the ability to configure that
notifications to the user (e.g. via a log message) about deprecation of the attribute should not be emitted.
Notifying the user should only be done if the user can take some action in response. Advising that
something will be removed in a later release is not useful if there is no alternative in the
current release. If the {@code notificationUseful} param is {@code true} the text
description of the attribute deprecation available from the {@code read-resource-description}
management operation should provide useful information about how the user can avoid using
the attribute.
@param since the API version, with the API being the one (core or a subsystem) in which the attribute is used
@param notificationUseful whether actively advising the user about the deprecation is useful
@return a builder that can be used to continue building the attribute definition | [
"Marks",
"the",
"attribute",
"as",
"deprecated",
"since",
"the",
"given",
"API",
"version",
"with",
"the",
"ability",
"to",
"configure",
"that",
"notifications",
"to",
"the",
"user",
"(",
"e",
".",
"g",
".",
"via",
"a",
"log",
"message",
")",
"about",
"d... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractAttributeDefinitionBuilder.java#L713-L717 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastToken | @Nullable
public static String getLastToken (@Nullable final String sStr, final char cSearch)
{
final int nIndex = getLastIndexOf (sStr, cSearch);
return nIndex == StringHelper.STRING_NOT_FOUND ? sStr : sStr.substring (nIndex + 1);
} | java | @Nullable
public static String getLastToken (@Nullable final String sStr, final char cSearch)
{
final int nIndex = getLastIndexOf (sStr, cSearch);
return nIndex == StringHelper.STRING_NOT_FOUND ? sStr : sStr.substring (nIndex + 1);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getLastToken",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"final",
"char",
"cSearch",
")",
"{",
"final",
"int",
"nIndex",
"=",
"getLastIndexOf",
"(",
"sStr",
",",
"cSearch",
")",
";",
"return",
"nI... | Get the last token from (and excluding) the separating character.
@param sStr
The string to search. May be <code>null</code>.
@param cSearch
The search character.
@return The passed string if no such separator token was found. | [
"Get",
"the",
"last",
"token",
"from",
"(",
"and",
"excluding",
")",
"the",
"separating",
"character",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5138-L5143 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/ImageHelper.java | ImageHelper.getSubImage | public static BufferedImage getSubImage(BufferedImage image, int x, int y, int width, int height) {
int type = (image.getTransparency() == Transparency.OPAQUE)
? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
BufferedImage tmp = new BufferedImage(width, height, type);
Graphics2D g2 = tmp.createGraphics();
g2.drawImage(image.getSubimage(x, y, width, height), 0, 0, null);
g2.dispose();
return tmp;
} | java | public static BufferedImage getSubImage(BufferedImage image, int x, int y, int width, int height) {
int type = (image.getTransparency() == Transparency.OPAQUE)
? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
BufferedImage tmp = new BufferedImage(width, height, type);
Graphics2D g2 = tmp.createGraphics();
g2.drawImage(image.getSubimage(x, y, width, height), 0, 0, null);
g2.dispose();
return tmp;
} | [
"public",
"static",
"BufferedImage",
"getSubImage",
"(",
"BufferedImage",
"image",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"int",
"type",
"=",
"(",
"image",
".",
"getTransparency",
"(",
")",
"==",
"Transpare... | A replacement for the standard <code>BufferedImage.getSubimage</code>
method.
@param image
@param x the X coordinate of the upper-left corner of the specified
rectangular region
@param y the Y coordinate of the upper-left corner of the specified
rectangular region
@param width the width of the specified rectangular region
@param height the height of the specified rectangular region
@return a BufferedImage that is the subimage of <code>image</code>. | [
"A",
"replacement",
"for",
"the",
"standard",
"<code",
">",
"BufferedImage",
".",
"getSubimage<",
"/",
"code",
">",
"method",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageHelper.java#L85-L93 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java | ExperimentsInner.createAsync | public Observable<ExperimentInner> createAsync(String resourceGroupName, String workspaceName, String experimentName) {
return createWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName).map(new Func1<ServiceResponse<ExperimentInner>, ExperimentInner>() {
@Override
public ExperimentInner call(ServiceResponse<ExperimentInner> response) {
return response.body();
}
});
} | java | public Observable<ExperimentInner> createAsync(String resourceGroupName, String workspaceName, String experimentName) {
return createWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName).map(new Func1<ServiceResponse<ExperimentInner>, ExperimentInner>() {
@Override
public ExperimentInner call(ServiceResponse<ExperimentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExperimentInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"String",
"experimentName",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workspaceName",
... | Creates an Experiment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"an",
"Experiment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java#L383-L390 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/slider2/Slider2Renderer.java | Slider2Renderer.decode | @Override
public void decode(FacesContext context, UIComponent component) {
Slider2 slider = (Slider2) component;
if (slider.isDisabled() || slider.isReadonly()) {
return;
}
decodeBehaviors(context, slider);
String clientId = slider.getClientId(context);
Number submittedValue = convert(component, Float.valueOf(getRequestParameter(context, clientId)));
if (submittedValue != null) {
slider.setSubmittedValue(submittedValue);
}
new AJAXRenderer().decode(context, component, clientId);
} | java | @Override
public void decode(FacesContext context, UIComponent component) {
Slider2 slider = (Slider2) component;
if (slider.isDisabled() || slider.isReadonly()) {
return;
}
decodeBehaviors(context, slider);
String clientId = slider.getClientId(context);
Number submittedValue = convert(component, Float.valueOf(getRequestParameter(context, clientId)));
if (submittedValue != null) {
slider.setSubmittedValue(submittedValue);
}
new AJAXRenderer().decode(context, component, clientId);
} | [
"@",
"Override",
"public",
"void",
"decode",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"{",
"Slider2",
"slider",
"=",
"(",
"Slider2",
")",
"component",
";",
"if",
"(",
"slider",
".",
"isDisabled",
"(",
")",
"||",
"slider",
".",
... | This methods receives and processes input made by the user. More specifically, it ckecks whether the
user has interacted with the current b:slider2. The default implementation simply stores
the input value in the list of submitted values. If the validation checks are passed,
the values in the <code>submittedValues</code> list are store in the backend bean.
@param context the FacesContext.
@param component the current b:slider2. | [
"This",
"methods",
"receives",
"and",
"processes",
"input",
"made",
"by",
"the",
"user",
".",
"More",
"specifically",
"it",
"ckecks",
"whether",
"the",
"user",
"has",
"interacted",
"with",
"the",
"current",
"b",
":",
"slider2",
".",
"The",
"default",
"implem... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/slider2/Slider2Renderer.java#L48-L65 |
alkacon/opencms-core | src/org/opencms/util/CmsFileUtil.java | CmsFileUtil.normalizePath | public static String normalizePath(URL url, char separatorChar) {
// get the path part from the URL
String path = new File(url.getPath()).getAbsolutePath();
// trick to get the OS default encoding, taken from the official Java i18n FAQ
String systemEncoding = (new OutputStreamWriter(new ByteArrayOutputStream())).getEncoding();
// decode url in order to remove spaces and escaped chars from path
return CmsFileUtil.normalizePath(CmsEncoder.decode(path, systemEncoding), separatorChar);
} | java | public static String normalizePath(URL url, char separatorChar) {
// get the path part from the URL
String path = new File(url.getPath()).getAbsolutePath();
// trick to get the OS default encoding, taken from the official Java i18n FAQ
String systemEncoding = (new OutputStreamWriter(new ByteArrayOutputStream())).getEncoding();
// decode url in order to remove spaces and escaped chars from path
return CmsFileUtil.normalizePath(CmsEncoder.decode(path, systemEncoding), separatorChar);
} | [
"public",
"static",
"String",
"normalizePath",
"(",
"URL",
"url",
",",
"char",
"separatorChar",
")",
"{",
"// get the path part from the URL",
"String",
"path",
"=",
"new",
"File",
"(",
"url",
".",
"getPath",
"(",
")",
")",
".",
"getAbsolutePath",
"(",
")",
... | Returns the normalized file path created from the given URL.<p>
The path part {@link URL#getPath()} is used, unescaped and
normalized using {@link #normalizePath(String, char)}.<p>
@param url the URL to extract the path information from
@param separatorChar the file separator char to use, for example {@link File#separatorChar}
@return the normalized file path created from the given URL | [
"Returns",
"the",
"normalized",
"file",
"path",
"created",
"from",
"the",
"given",
"URL",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L550-L558 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/schema/ElasticSearchSchemaService.java | ElasticSearchSchemaService.doExtractResponse | @VisibleForTesting
static String doExtractResponse(int statusCode, HttpEntity entity) {
String message = null;
if (entity != null) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
entity.writeTo(baos);
message = baos.toString("UTF-8");
}
catch (IOException ex) {
throw new SystemException(ex);
}
}
//if the response is in the 400 range, use IllegalArgumentException, which currently translates to a 400 error
if (statusCode>= HttpStatus.SC_BAD_REQUEST && statusCode < HttpStatus.SC_INTERNAL_SERVER_ERROR) {
throw new IllegalArgumentException("Status code: " + statusCode + " . Error occurred. " + message);
}
//everything else that's not in the 200 range, use SystemException, which translates to a 500 error.
if ((statusCode < HttpStatus.SC_OK) || (statusCode >= HttpStatus.SC_MULTIPLE_CHOICES)) {
throw new SystemException("Status code: " + statusCode + " . Error occurred. " + message);
} else {
return message;
}
} | java | @VisibleForTesting
static String doExtractResponse(int statusCode, HttpEntity entity) {
String message = null;
if (entity != null) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
entity.writeTo(baos);
message = baos.toString("UTF-8");
}
catch (IOException ex) {
throw new SystemException(ex);
}
}
//if the response is in the 400 range, use IllegalArgumentException, which currently translates to a 400 error
if (statusCode>= HttpStatus.SC_BAD_REQUEST && statusCode < HttpStatus.SC_INTERNAL_SERVER_ERROR) {
throw new IllegalArgumentException("Status code: " + statusCode + " . Error occurred. " + message);
}
//everything else that's not in the 200 range, use SystemException, which translates to a 500 error.
if ((statusCode < HttpStatus.SC_OK) || (statusCode >= HttpStatus.SC_MULTIPLE_CHOICES)) {
throw new SystemException("Status code: " + statusCode + " . Error occurred. " + message);
} else {
return message;
}
} | [
"@",
"VisibleForTesting",
"static",
"String",
"doExtractResponse",
"(",
"int",
"statusCode",
",",
"HttpEntity",
"entity",
")",
"{",
"String",
"message",
"=",
"null",
";",
"if",
"(",
"entity",
"!=",
"null",
")",
"{",
"try",
"(",
"ByteArrayOutputStream",
"baos",... | testable version of {@link ElasticSearchSchemaService#extractResponse(Response)}
@param statusCode
@param entity
@return | [
"testable",
"version",
"of",
"{"
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/schema/ElasticSearchSchemaService.java#L1410-L1434 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java | VMCommandLine.launchVMWithJar | @SuppressWarnings("checkstyle:magicnumber")
public static Process launchVMWithJar(File jarFile, String... additionalParams) throws IOException {
final String javaBin = getVMBinary();
if (javaBin == null) {
throw new FileNotFoundException("java"); //$NON-NLS-1$
}
final long totalMemory = Runtime.getRuntime().maxMemory() / 1024;
final String userDir = FileSystem.getUserHomeDirectoryName();
final int nParams = 4;
final String[] params = new String[additionalParams.length + nParams];
params[0] = javaBin;
params[1] = "-Xmx" + totalMemory + "k"; //$NON-NLS-1$ //$NON-NLS-2$
params[2] = "-jar"; //$NON-NLS-1$
params[3] = jarFile.getAbsolutePath();
System.arraycopy(additionalParams, 0, params, nParams, additionalParams.length);
return Runtime.getRuntime().exec(params, null, new File(userDir));
} | java | @SuppressWarnings("checkstyle:magicnumber")
public static Process launchVMWithJar(File jarFile, String... additionalParams) throws IOException {
final String javaBin = getVMBinary();
if (javaBin == null) {
throw new FileNotFoundException("java"); //$NON-NLS-1$
}
final long totalMemory = Runtime.getRuntime().maxMemory() / 1024;
final String userDir = FileSystem.getUserHomeDirectoryName();
final int nParams = 4;
final String[] params = new String[additionalParams.length + nParams];
params[0] = javaBin;
params[1] = "-Xmx" + totalMemory + "k"; //$NON-NLS-1$ //$NON-NLS-2$
params[2] = "-jar"; //$NON-NLS-1$
params[3] = jarFile.getAbsolutePath();
System.arraycopy(additionalParams, 0, params, nParams, additionalParams.length);
return Runtime.getRuntime().exec(params, null, new File(userDir));
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"public",
"static",
"Process",
"launchVMWithJar",
"(",
"File",
"jarFile",
",",
"String",
"...",
"additionalParams",
")",
"throws",
"IOException",
"{",
"final",
"String",
"javaBin",
"=",
"getVMBinary",
... | Run a jar file inside a new VM.
@param jarFile is the jar file to launch.
@param additionalParams is the list of additional parameters
@return the process that is running the new virtual machine, neither <code>null</code>
@throws IOException when a IO error occurs.
@since 6.2 | [
"Run",
"a",
"jar",
"file",
"inside",
"a",
"new",
"VM",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L255-L271 |
Waikato/moa | moa/src/main/java/moa/classifiers/lazy/neighboursearch/NormalizableDistance.java | NormalizableDistance.updateRangesFirst | public void updateRangesFirst(Instance instance, int numAtt, double[][] ranges) {
for (int j = 0; j < numAtt; j++) {
if (!instance.isMissing(j)) {
ranges[j][R_MIN] = instance.value(j);
ranges[j][R_MAX] = instance.value(j);
ranges[j][R_WIDTH] = 0.0;
}
else { // if value was missing
ranges[j][R_MIN] = Double.POSITIVE_INFINITY;
ranges[j][R_MAX] = -Double.POSITIVE_INFINITY;
ranges[j][R_WIDTH] = Double.POSITIVE_INFINITY;
}
}
} | java | public void updateRangesFirst(Instance instance, int numAtt, double[][] ranges) {
for (int j = 0; j < numAtt; j++) {
if (!instance.isMissing(j)) {
ranges[j][R_MIN] = instance.value(j);
ranges[j][R_MAX] = instance.value(j);
ranges[j][R_WIDTH] = 0.0;
}
else { // if value was missing
ranges[j][R_MIN] = Double.POSITIVE_INFINITY;
ranges[j][R_MAX] = -Double.POSITIVE_INFINITY;
ranges[j][R_WIDTH] = Double.POSITIVE_INFINITY;
}
}
} | [
"public",
"void",
"updateRangesFirst",
"(",
"Instance",
"instance",
",",
"int",
"numAtt",
",",
"double",
"[",
"]",
"[",
"]",
"ranges",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"numAtt",
";",
"j",
"++",
")",
"{",
"if",
"(",
"!",
... | Used to initialize the ranges. For this the values of the first
instance is used to save time.
Sets low and high to the values of the first instance and
width to zero.
@param instance the new instance
@param numAtt number of attributes in the model
@param ranges low, high and width values for all attributes | [
"Used",
"to",
"initialize",
"the",
"ranges",
".",
"For",
"this",
"the",
"values",
"of",
"the",
"first",
"instance",
"is",
"used",
"to",
"save",
"time",
".",
"Sets",
"low",
"and",
"high",
"to",
"the",
"values",
"of",
"the",
"first",
"instance",
"and",
"... | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/NormalizableDistance.java#L494-L507 |
graphql-java/graphql-java | src/main/java/graphql/schema/GraphQLCodeRegistry.java | GraphQLCodeRegistry.getDataFetcher | public DataFetcher getDataFetcher(GraphQLFieldsContainer parentType, GraphQLFieldDefinition fieldDefinition) {
return getDataFetcherImpl(parentType, fieldDefinition, dataFetcherMap, systemDataFetcherMap);
} | java | public DataFetcher getDataFetcher(GraphQLFieldsContainer parentType, GraphQLFieldDefinition fieldDefinition) {
return getDataFetcherImpl(parentType, fieldDefinition, dataFetcherMap, systemDataFetcherMap);
} | [
"public",
"DataFetcher",
"getDataFetcher",
"(",
"GraphQLFieldsContainer",
"parentType",
",",
"GraphQLFieldDefinition",
"fieldDefinition",
")",
"{",
"return",
"getDataFetcherImpl",
"(",
"parentType",
",",
"fieldDefinition",
",",
"dataFetcherMap",
",",
"systemDataFetcherMap",
... | Returns a data fetcher associated with a field within a container type
@param parentType the container type
@param fieldDefinition the field definition
@return the DataFetcher associated with this field. All fields have data fetchers | [
"Returns",
"a",
"data",
"fetcher",
"associated",
"with",
"a",
"field",
"within",
"a",
"container",
"type"
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/GraphQLCodeRegistry.java#L57-L59 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.elementMult | public static void elementMult( DMatrix2x2 a , DMatrix2x2 b) {
a.a11 *= b.a11; a.a12 *= b.a12;
a.a21 *= b.a21; a.a22 *= b.a22;
} | java | public static void elementMult( DMatrix2x2 a , DMatrix2x2 b) {
a.a11 *= b.a11; a.a12 *= b.a12;
a.a21 *= b.a21; a.a22 *= b.a22;
} | [
"public",
"static",
"void",
"elementMult",
"(",
"DMatrix2x2",
"a",
",",
"DMatrix2x2",
"b",
")",
"{",
"a",
".",
"a11",
"*=",
"b",
".",
"a11",
";",
"a",
".",
"a12",
"*=",
"b",
".",
"a12",
";",
"a",
".",
"a21",
"*=",
"b",
".",
"a21",
";",
"a",
"... | <p>Performs an element by element multiplication operation:<br>
<br>
a<sub>ij</sub> = a<sub>ij</sub> * b<sub>ij</sub> <br>
</p>
@param a The left matrix in the multiplication operation. Modified.
@param b The right matrix in the multiplication operation. Not modified. | [
"<p",
">",
"Performs",
"an",
"element",
"by",
"element",
"multiplication",
"operation",
":",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"*",
"b<sub",
">",
"ij<",
"/",
"sub",
">",
"<br",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L866-L869 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.updateComputeNodeUser | public void updateComputeNodeUser(String poolId, String nodeId, String userName, String password, DateTime expiryTime) throws BatchErrorException, IOException {
updateComputeNodeUser(poolId, nodeId, userName, password, expiryTime, null);
} | java | public void updateComputeNodeUser(String poolId, String nodeId, String userName, String password, DateTime expiryTime) throws BatchErrorException, IOException {
updateComputeNodeUser(poolId, nodeId, userName, password, expiryTime, null);
} | [
"public",
"void",
"updateComputeNodeUser",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"userName",
",",
"String",
"password",
",",
"DateTime",
"expiryTime",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"updateComputeNodeUser",
... | Updates the specified user account on the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node where the user account will be updated.
@param userName The name of the user account to update.
@param password The password of the account. If null, the password is removed.
@param expiryTime The time at which the account should expire. If null, the expiry time is replaced with its default value.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Updates",
"the",
"specified",
"user",
"account",
"on",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L146-L148 |
prestodb/presto | presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java | UnscaledDecimal128Arithmetic.addWithOverflow | public static long addWithOverflow(Slice left, Slice right, Slice result)
{
boolean leftNegative = isNegative(left);
boolean rightNegative = isNegative(right);
long overflow = 0;
if (leftNegative == rightNegative) {
// either both negative or both positive
overflow = addUnsignedReturnOverflow(left, right, result, leftNegative);
if (leftNegative) {
overflow = -overflow;
}
}
else {
int compare = compareAbsolute(left, right);
if (compare > 0) {
subtractUnsigned(left, right, result, leftNegative);
}
else if (compare < 0) {
subtractUnsigned(right, left, result, !leftNegative);
}
else {
setToZero(result);
}
}
return overflow;
} | java | public static long addWithOverflow(Slice left, Slice right, Slice result)
{
boolean leftNegative = isNegative(left);
boolean rightNegative = isNegative(right);
long overflow = 0;
if (leftNegative == rightNegative) {
// either both negative or both positive
overflow = addUnsignedReturnOverflow(left, right, result, leftNegative);
if (leftNegative) {
overflow = -overflow;
}
}
else {
int compare = compareAbsolute(left, right);
if (compare > 0) {
subtractUnsigned(left, right, result, leftNegative);
}
else if (compare < 0) {
subtractUnsigned(right, left, result, !leftNegative);
}
else {
setToZero(result);
}
}
return overflow;
} | [
"public",
"static",
"long",
"addWithOverflow",
"(",
"Slice",
"left",
",",
"Slice",
"right",
",",
"Slice",
"result",
")",
"{",
"boolean",
"leftNegative",
"=",
"isNegative",
"(",
"left",
")",
";",
"boolean",
"rightNegative",
"=",
"isNegative",
"(",
"right",
")... | Instead of throwing overflow exception, this function returns:
0 when there was no overflow
+1 when there was overflow
-1 when there was underflow | [
"Instead",
"of",
"throwing",
"overflow",
"exception",
"this",
"function",
"returns",
":",
"0",
"when",
"there",
"was",
"no",
"overflow",
"+",
"1",
"when",
"there",
"was",
"overflow",
"-",
"1",
"when",
"there",
"was",
"underflow"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java#L312-L337 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getOutfitInfo | public void getOutfitInfo(int[] ids, Callback<List<Outfit>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getOutfitInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getOutfitInfo(int[] ids, Callback<List<Outfit>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getOutfitInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getOutfitInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Outfit",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
... | For more info on Outfits API go <a href="https://wiki.guildwars2.com/wiki/API:2/outfits">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of outfit id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Outfit outfit info | [
"For",
"more",
"info",
"on",
"Outfits",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"outfits",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1934-L1937 |
OpenTSDB/opentsdb | src/stats/StatsCollector.java | StatsCollector.addExtraTag | public final void addExtraTag(final String name, final String value) {
if (name.length() <= 0) {
throw new IllegalArgumentException("empty tag name, value=" + value);
} else if (value.length() <= 0) {
throw new IllegalArgumentException("empty value, tag name=" + name);
} else if (name.indexOf('=') != -1) {
throw new IllegalArgumentException("tag name contains `=': " + name
+ " (value = " + value + ')');
} else if (value.indexOf('=') != -1) {
throw new IllegalArgumentException("tag value contains `=': " + value
+ " (name = " + name + ')');
}
if (extratags == null) {
extratags = new HashMap<String, String>();
}
extratags.put(name, value);
} | java | public final void addExtraTag(final String name, final String value) {
if (name.length() <= 0) {
throw new IllegalArgumentException("empty tag name, value=" + value);
} else if (value.length() <= 0) {
throw new IllegalArgumentException("empty value, tag name=" + name);
} else if (name.indexOf('=') != -1) {
throw new IllegalArgumentException("tag name contains `=': " + name
+ " (value = " + value + ')');
} else if (value.indexOf('=') != -1) {
throw new IllegalArgumentException("tag value contains `=': " + value
+ " (name = " + name + ')');
}
if (extratags == null) {
extratags = new HashMap<String, String>();
}
extratags.put(name, value);
} | [
"public",
"final",
"void",
"addExtraTag",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"empty tag name, value=\"... | Adds a tag to all the subsequent data points recorded.
<p>
All subsequent calls to one of the {@code record} methods will
associate the tag given to this method with the data point.
<p>
This method can be called multiple times to associate multiple tags
with all the subsequent data points.
@param name The name of the tag.
@param value The value of the tag.
@throws IllegalArgumentException if the name or the value are empty
or otherwise invalid.
@see #clearExtraTag | [
"Adds",
"a",
"tag",
"to",
"all",
"the",
"subsequent",
"data",
"points",
"recorded",
".",
"<p",
">",
"All",
"subsequent",
"calls",
"to",
"one",
"of",
"the",
"{"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/stats/StatsCollector.java#L182-L198 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java | CallableUtils.updateDirectionsByName | public static QueryParameters updateDirectionsByName(QueryParameters original, QueryParameters source) {
QueryParameters updatedParams = new QueryParameters(original);
if (source != null) {
for (String sourceKey : source.keySet()) {
if (updatedParams.containsKey(sourceKey) == true) {
updatedParams.updateDirection(sourceKey, source.getDirection(sourceKey));
}
}
}
return updatedParams;
} | java | public static QueryParameters updateDirectionsByName(QueryParameters original, QueryParameters source) {
QueryParameters updatedParams = new QueryParameters(original);
if (source != null) {
for (String sourceKey : source.keySet()) {
if (updatedParams.containsKey(sourceKey) == true) {
updatedParams.updateDirection(sourceKey, source.getDirection(sourceKey));
}
}
}
return updatedParams;
} | [
"public",
"static",
"QueryParameters",
"updateDirectionsByName",
"(",
"QueryParameters",
"original",
",",
"QueryParameters",
"source",
")",
"{",
"QueryParameters",
"updatedParams",
"=",
"new",
"QueryParameters",
"(",
"original",
")",
";",
"if",
"(",
"source",
"!=",
... | Same as @updateDirections but updates based not on position but on key
@param original QueryParameters which would be updated
@param source QueryParameters directions of which would be read
@return updated clone on @original with updated directions | [
"Same",
"as",
"@updateDirections",
"but",
"updates",
"based",
"not",
"on",
"position",
"but",
"on",
"key"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java#L168-L180 |
mguymon/naether | src/main/java/com/tobedevoured/naether/PathClassLoader.java | PathClassLoader.newInstance | public Object newInstance( String name, Object... params ) throws ClassLoaderException {
return newInstance( name, params, null );
} | java | public Object newInstance( String name, Object... params ) throws ClassLoaderException {
return newInstance( name, params, null );
} | [
"public",
"Object",
"newInstance",
"(",
"String",
"name",
",",
"Object",
"...",
"params",
")",
"throws",
"ClassLoaderException",
"{",
"return",
"newInstance",
"(",
"name",
",",
"params",
",",
"null",
")",
";",
"}"
] | Create new instance of Object with constructor parameters using the ClassLoader
@param name String
@param params Object parameters for constructor
@return Object
@throws ClassLoaderException exception | [
"Create",
"new",
"instance",
"of",
"Object",
"with",
"constructor",
"parameters",
"using",
"the",
"ClassLoader"
] | train | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/java/com/tobedevoured/naether/PathClassLoader.java#L107-L109 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java | WorkerHelper.closeWTX | public static void closeWTX(final boolean abortTransaction, final INodeWriteTrx wtx, final ISession ses)
throws TTException {
synchronized (ses) {
if (abortTransaction) {
wtx.abort();
}
ses.close();
}
} | java | public static void closeWTX(final boolean abortTransaction, final INodeWriteTrx wtx, final ISession ses)
throws TTException {
synchronized (ses) {
if (abortTransaction) {
wtx.abort();
}
ses.close();
}
} | [
"public",
"static",
"void",
"closeWTX",
"(",
"final",
"boolean",
"abortTransaction",
",",
"final",
"INodeWriteTrx",
"wtx",
",",
"final",
"ISession",
"ses",
")",
"throws",
"TTException",
"{",
"synchronized",
"(",
"ses",
")",
"{",
"if",
"(",
"abortTransaction",
... | This method closes all open treetank connections concerning a
NodeWriteTrx.
@param abortTransaction
<code>true</code> if the transaction has to be aborted, <code>false</code> otherwise.
@param wtx
INodeWriteTrx to be closed
@param ses
ISession to be closed
@throws TreetankException | [
"This",
"method",
"closes",
"all",
"open",
"treetank",
"connections",
"concerning",
"a",
"NodeWriteTrx",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java#L195-L203 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrFieldConfiguration.java | CmsSolrFieldConfiguration.appendSpellFields | private void appendSpellFields(I_CmsSearchDocument document) {
/*
* Add the content fields (multiple for contents with more than one locale)
*/
// add the content_<locale> fields to this configuration
String title = document.getFieldValueAsString(
CmsPropertyDefinition.PROPERTY_TITLE + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT);
document.addSearchField(
new CmsSolrField(CmsSearchField.FIELD_SPELL, null, null, null),
document.getFieldValueAsString(CmsSearchField.FIELD_CONTENT) + "\n" + title);
for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
document.addSearchField(
new CmsSolrField(locale + "_" + CmsSearchField.FIELD_SPELL, null, locale, null),
document.getFieldValueAsString(
CmsSearchFieldConfiguration.getLocaleExtendedName(CmsSearchField.FIELD_CONTENT, locale))
+ "\n"
+ title);
}
} | java | private void appendSpellFields(I_CmsSearchDocument document) {
/*
* Add the content fields (multiple for contents with more than one locale)
*/
// add the content_<locale> fields to this configuration
String title = document.getFieldValueAsString(
CmsPropertyDefinition.PROPERTY_TITLE + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT);
document.addSearchField(
new CmsSolrField(CmsSearchField.FIELD_SPELL, null, null, null),
document.getFieldValueAsString(CmsSearchField.FIELD_CONTENT) + "\n" + title);
for (Locale locale : OpenCms.getLocaleManager().getAvailableLocales()) {
document.addSearchField(
new CmsSolrField(locale + "_" + CmsSearchField.FIELD_SPELL, null, locale, null),
document.getFieldValueAsString(
CmsSearchFieldConfiguration.getLocaleExtendedName(CmsSearchField.FIELD_CONTENT, locale))
+ "\n"
+ title);
}
} | [
"private",
"void",
"appendSpellFields",
"(",
"I_CmsSearchDocument",
"document",
")",
"{",
"/*\n * Add the content fields (multiple for contents with more than one locale)\n */",
"// add the content_<locale> fields to this configuration",
"String",
"title",
"=",
"document",
... | Copy the content and the title property of the document to a spell field / a language specific spell field.
@param document the document that gets extended by the spell fields. | [
"Copy",
"the",
"content",
"and",
"the",
"title",
"property",
"of",
"the",
"document",
"to",
"a",
"spell",
"field",
"/",
"a",
"language",
"specific",
"spell",
"field",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrFieldConfiguration.java#L871-L890 |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java | MethodValidator.extractCategory | protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) {
Iterator<Node> path = violation.getPropertyPath().iterator();
Node method = path.next();
logger.debug("Constraint violation on method {}: {}", method, violation);
StringBuilder cat = new StringBuilder();
cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName());// parameter name
while (path.hasNext()) {
cat.append(".").append(path.next());
}
return cat.toString();
} | java | protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) {
Iterator<Node> path = violation.getPropertyPath().iterator();
Node method = path.next();
logger.debug("Constraint violation on method {}: {}", method, violation);
StringBuilder cat = new StringBuilder();
cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName());// parameter name
while (path.hasNext()) {
cat.append(".").append(path.next());
}
return cat.toString();
} | [
"protected",
"String",
"extractCategory",
"(",
"ValuedParameter",
"[",
"]",
"params",
",",
"ConstraintViolation",
"<",
"Object",
">",
"violation",
")",
"{",
"Iterator",
"<",
"Node",
">",
"path",
"=",
"violation",
".",
"getPropertyPath",
"(",
")",
".",
"iterato... | Returns the category for this constraint violation. By default, the category returned
is the full path for property. You can override this method if you prefer another strategy. | [
"Returns",
"the",
"category",
"for",
"this",
"constraint",
"violation",
".",
"By",
"default",
"the",
"category",
"returned",
"is",
"the",
"full",
"path",
"for",
"property",
".",
"You",
"can",
"override",
"this",
"method",
"if",
"you",
"prefer",
"another",
"s... | train | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/validator/beanvalidation/MethodValidator.java#L117-L130 |
h2oai/h2o-2 | src/main/java/water/ga/GoogleAnalytics.java | GoogleAnalytics.processCustomDimensionParameters | private void processCustomDimensionParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) {
Map<String, String> customDimParms = new HashMap<String, String>();
for (String defaultCustomDimKey : defaultRequest.customDimentions().keySet()) {
customDimParms.put(defaultCustomDimKey, defaultRequest.customDimentions().get(defaultCustomDimKey));
}
@SuppressWarnings("unchecked")
Map<String, String> requestCustomDims = request.customDimentions();
for (String requestCustomDimKey : requestCustomDims.keySet()) {
customDimParms.put(requestCustomDimKey, requestCustomDims.get(requestCustomDimKey));
}
for (String key : customDimParms.keySet()) {
postParms.add(new BasicNameValuePair(key, customDimParms.get(key)));
}
} | java | private void processCustomDimensionParameters(@SuppressWarnings("rawtypes") GoogleAnalyticsRequest request, List<NameValuePair> postParms) {
Map<String, String> customDimParms = new HashMap<String, String>();
for (String defaultCustomDimKey : defaultRequest.customDimentions().keySet()) {
customDimParms.put(defaultCustomDimKey, defaultRequest.customDimentions().get(defaultCustomDimKey));
}
@SuppressWarnings("unchecked")
Map<String, String> requestCustomDims = request.customDimentions();
for (String requestCustomDimKey : requestCustomDims.keySet()) {
customDimParms.put(requestCustomDimKey, requestCustomDims.get(requestCustomDimKey));
}
for (String key : customDimParms.keySet()) {
postParms.add(new BasicNameValuePair(key, customDimParms.get(key)));
}
} | [
"private",
"void",
"processCustomDimensionParameters",
"(",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"GoogleAnalyticsRequest",
"request",
",",
"List",
"<",
"NameValuePair",
">",
"postParms",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"customDimPar... | Processes the custom dimensions and adds the values to list of parameters, which would be posted to GA.
@param request
@param postParms | [
"Processes",
"the",
"custom",
"dimensions",
"and",
"adds",
"the",
"values",
"to",
"list",
"of",
"parameters",
"which",
"would",
"be",
"posted",
"to",
"GA",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/ga/GoogleAnalytics.java#L217-L232 |
OpenLiberty/open-liberty | dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractRun.java | SelfExtractRun.getExtractDirectory | private static String getExtractDirectory() {
createExtractor();
String containerPath = extractor.container.getName();
File containerFile = new File(containerPath);
if (containerFile.isDirectory()) {
extractor.allowNonEmptyInstallDirectory(true);
return containerFile.getAbsolutePath();
}
// check if user specified explicit directory
String extractDirVar = System.getenv("WLP_JAR_EXTRACT_DIR");
// if so, return it and done
if (extractDirVar != null && extractDirVar.length() > 0) {
String retVal = createIfNeeded(extractDirVar.trim());
return retVal;
} else {
String extractDirVarRoot = System.getenv("WLP_JAR_EXTRACT_ROOT");
if (extractDirVarRoot == null || extractDirVarRoot.length() == 0) {
extractDirVarRoot = getUserHome() + File.separator + "wlpExtract";
}
createIfNeeded(extractDirVarRoot);
try {
String basedir = (new File(extractDirVarRoot)).getAbsolutePath();
return createTempDirectory(basedir, jarFileName() + "_");
} catch (Exception e) {
throw new RuntimeException("Could not create temp directory under: " + extractDirVarRoot);
}
}
} | java | private static String getExtractDirectory() {
createExtractor();
String containerPath = extractor.container.getName();
File containerFile = new File(containerPath);
if (containerFile.isDirectory()) {
extractor.allowNonEmptyInstallDirectory(true);
return containerFile.getAbsolutePath();
}
// check if user specified explicit directory
String extractDirVar = System.getenv("WLP_JAR_EXTRACT_DIR");
// if so, return it and done
if (extractDirVar != null && extractDirVar.length() > 0) {
String retVal = createIfNeeded(extractDirVar.trim());
return retVal;
} else {
String extractDirVarRoot = System.getenv("WLP_JAR_EXTRACT_ROOT");
if (extractDirVarRoot == null || extractDirVarRoot.length() == 0) {
extractDirVarRoot = getUserHome() + File.separator + "wlpExtract";
}
createIfNeeded(extractDirVarRoot);
try {
String basedir = (new File(extractDirVarRoot)).getAbsolutePath();
return createTempDirectory(basedir, jarFileName() + "_");
} catch (Exception e) {
throw new RuntimeException("Could not create temp directory under: " + extractDirVarRoot);
}
}
} | [
"private",
"static",
"String",
"getExtractDirectory",
"(",
")",
"{",
"createExtractor",
"(",
")",
";",
"String",
"containerPath",
"=",
"extractor",
".",
"container",
".",
"getName",
"(",
")",
";",
"File",
"containerFile",
"=",
"new",
"File",
"(",
"containerPat... | Determine and return directory to extract into.
Three choices:
1) ${WLP_JAR_EXTRACT_DIR}
2) ${WLP_JAR_EXTRACT_ROOT}/<jar file name>_nnnnnnnnnnnnnnnnnnn
3) default - <home>/wlpExtract/<jar file name>_nnnnnnnnnnnnnnnnnnn
@return extraction directory | [
"Determine",
"and",
"return",
"directory",
"to",
"extract",
"into",
".",
"Three",
"choices",
":",
"1",
")",
"$",
"{",
"WLP_JAR_EXTRACT_DIR",
"}",
"2",
")",
"$",
"{",
"WLP_JAR_EXTRACT_ROOT",
"}",
"/",
"<jar",
"file",
"name",
">",
"_nnnnnnnnnnnnnnnnnnn",
"3",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/SelfExtractRun.java#L134-L164 |
tobato/FastDFS_Client | src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java | BytesUtil.buff2int | public static int buff2int(byte[] bs, int offset) {
return ((bs[offset] >= 0 ? bs[offset] : 256 + bs[offset]) << 24)
| ((bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1]) << 16)
| ((bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2]) << 8)
| (bs[offset + 3] >= 0 ? bs[offset + 3] : 256 + bs[offset + 3]);
} | java | public static int buff2int(byte[] bs, int offset) {
return ((bs[offset] >= 0 ? bs[offset] : 256 + bs[offset]) << 24)
| ((bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1]) << 16)
| ((bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2]) << 8)
| (bs[offset + 3] >= 0 ? bs[offset + 3] : 256 + bs[offset + 3]);
} | [
"public",
"static",
"int",
"buff2int",
"(",
"byte",
"[",
"]",
"bs",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"(",
"bs",
"[",
"offset",
"]",
">=",
"0",
"?",
"bs",
"[",
"offset",
"]",
":",
"256",
"+",
"bs",
"[",
"offset",
"]",
")",
"<<",
... | buff convert to int
@param bs the buffer (big-endian)
@param offset the start position based 0
@return int number | [
"buff",
"convert",
"to",
"int"
] | train | https://github.com/tobato/FastDFS_Client/blob/8e3bfe712f1739028beed7f3a6b2cc4579a231e4/src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java#L60-L65 |
RobertStewart/privateer | src/main/java/com/wombatnation/privateer/Privateer.java | Privateer.callMethod | public Object callMethod(Object o, String methodName, Object... args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Method method = null;
if (args == null || args.length == 0) {
method = o.getClass().getDeclaredMethod(methodName);
} else {
Class<?>[] types = new Class[args.length];
for (int i = 0; i < args.length; i++) {
types[i] = args[i].getClass();
}
try {
method = o.getClass().getDeclaredMethod(methodName, types);
} catch (NoSuchMethodException e) {
// Try more complex comparison for matching args to supertypes in the params
method = findSupertypeMethod(o, methodName, types);
}
}
if (method == null) {
throw new NoSuchMethodException("Found no method named" + methodName + " with matching params");
}
method.setAccessible(true);
return method.invoke(o, args);
} | java | public Object callMethod(Object o, String methodName, Object... args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Method method = null;
if (args == null || args.length == 0) {
method = o.getClass().getDeclaredMethod(methodName);
} else {
Class<?>[] types = new Class[args.length];
for (int i = 0; i < args.length; i++) {
types[i] = args[i].getClass();
}
try {
method = o.getClass().getDeclaredMethod(methodName, types);
} catch (NoSuchMethodException e) {
// Try more complex comparison for matching args to supertypes in the params
method = findSupertypeMethod(o, methodName, types);
}
}
if (method == null) {
throw new NoSuchMethodException("Found no method named" + methodName + " with matching params");
}
method.setAccessible(true);
return method.invoke(o, args);
} | [
"public",
"Object",
"callMethod",
"(",
"Object",
"o",
",",
"String",
"methodName",
",",
"Object",
"...",
"args",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"Method",
"method",
"=",
"null",
";",
"if... | Calls the specified method on the Object o with the specified arguments. Returns the
result as an Object. Only methods declared on the class for Object o can be called.
<p>
The length of the vararg list of arguments to be passed to the method must match
what the method expects. If no arguments are expected, null can be passed. If one
argument is expected, that argument can be passed as an object. If multiple
arguments are expected, they can be passed as an Object array or as a comma-separated
list.
@param o Object to access
@param methodName Name of method to call
@param args Vararg list of arguments to pass to method
@return Object that is the result of calling the named method
@throws NoSuchMethodException if the name or arguments don't match any declared method
@throws IllegalAccessException
@throws InvocationTargetException if some unexpected error occurs when invoking a method that was thought to match
@throws IllegalArgumentException if the argument count doesn't match any method that has the same name | [
"Calls",
"the",
"specified",
"method",
"on",
"the",
"Object",
"o",
"with",
"the",
"specified",
"arguments",
".",
"Returns",
"the",
"result",
"as",
"an",
"Object",
".",
"Only",
"methods",
"declared",
"on",
"the",
"class",
"for",
"Object",
"o",
"can",
"be",
... | train | https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L123-L150 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/spring/ThreadScopeContext.java | ThreadScopeContext.setBean | public void setBean(String name, Object object) {
Bean bean = beans.get(name);
if (null == bean) {
bean = new Bean();
beans.put(name, bean);
}
bean.object = object;
} | java | public void setBean(String name, Object object) {
Bean bean = beans.get(name);
if (null == bean) {
bean = new Bean();
beans.put(name, bean);
}
bean.object = object;
} | [
"public",
"void",
"setBean",
"(",
"String",
"name",
",",
"Object",
"object",
")",
"{",
"Bean",
"bean",
"=",
"beans",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"bean",
")",
"{",
"bean",
"=",
"new",
"Bean",
"(",
")",
";",
"beans",... | Set a bean in the context.
@param name bean name
@param object bean value | [
"Set",
"a",
"bean",
"in",
"the",
"context",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/spring/ThreadScopeContext.java#L47-L54 |
milaboratory/milib | src/main/java/com/milaboratory/core/io/util/IOUtil.java | IOUtil.writeRawVarint64 | public static void writeRawVarint64(OutputStream os, long value) throws IOException {
while (true) {
if ((value & ~0x7FL) == 0) {
os.write((int) value);
return;
} else {
os.write(((int) value & 0x7F) | 0x80);
value >>>= 7;
}
}
} | java | public static void writeRawVarint64(OutputStream os, long value) throws IOException {
while (true) {
if ((value & ~0x7FL) == 0) {
os.write((int) value);
return;
} else {
os.write(((int) value & 0x7F) | 0x80);
value >>>= 7;
}
}
} | [
"public",
"static",
"void",
"writeRawVarint64",
"(",
"OutputStream",
"os",
",",
"long",
"value",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"(",
"value",
"&",
"~",
"0x7F",
"L",
")",
"==",
"0",
")",
"{",
"os",
".",
... | Encode and write a varint.
<p>Copied from com.google.protobuf.CodedOutputStream from Google's protobuf library.</p> | [
"Encode",
"and",
"write",
"a",
"varint",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/io/util/IOUtil.java#L115-L125 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.