repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/HardwareDescriptionFactory.java | HardwareDescriptionFactory.extractFromSystem | public static HardwareDescription extractFromSystem() {
int numberOfCPUCores = Runtime.getRuntime().availableProcessors();
long sizeOfPhysicalMemory = getSizeOfPhysicalMemory();
if (sizeOfPhysicalMemory < 0) {
sizeOfPhysicalMemory = 1;
}
long sizeOfFreeMemory = getSizeOfFreeMemory();
return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfFreeMemory);
} | java | public static HardwareDescription extractFromSystem() {
int numberOfCPUCores = Runtime.getRuntime().availableProcessors();
long sizeOfPhysicalMemory = getSizeOfPhysicalMemory();
if (sizeOfPhysicalMemory < 0) {
sizeOfPhysicalMemory = 1;
}
long sizeOfFreeMemory = getSizeOfFreeMemory();
return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfFreeMemory);
} | [
"public",
"static",
"HardwareDescription",
"extractFromSystem",
"(",
")",
"{",
"int",
"numberOfCPUCores",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"availableProcessors",
"(",
")",
";",
"long",
"sizeOfPhysicalMemory",
"=",
"getSizeOfPhysicalMemory",
"(",
")"... | Extracts a hardware description object from the system.
@return the hardware description object or <code>null</code> if at least
one value for the hardware description cannot be determined | [
"Extracts",
"a",
"hardware",
"description",
"object",
"from",
"the",
"system",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/HardwareDescriptionFactory.java#L67-L78 |
raydac/netbeans-mmd-plugin | mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java | MindMapPanel.putSessionObject | public void putSessionObject(@Nonnull final String key, @Nullable final Object obj) {
this.lock();
try {
if (obj == null) {
this.sessionObjects.remove(key);
} else {
this.sessionObjects.put(key, obj);
}
} finally {
this.unlock();
}
} | java | public void putSessionObject(@Nonnull final String key, @Nullable final Object obj) {
this.lock();
try {
if (obj == null) {
this.sessionObjects.remove(key);
} else {
this.sessionObjects.put(key, obj);
}
} finally {
this.unlock();
}
} | [
"public",
"void",
"putSessionObject",
"(",
"@",
"Nonnull",
"final",
"String",
"key",
",",
"@",
"Nullable",
"final",
"Object",
"obj",
")",
"{",
"this",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"this",
".",
"s... | Put session object for key.
@param key key of he object, must not be null
@param obj object to be placed, if null then object will be removed
@since 1.4.2 | [
"Put",
"session",
"object",
"for",
"key",
"."
] | train | https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/MindMapPanel.java#L1282-L1293 |
classgraph/classgraph | src/main/java/io/github/classgraph/ClassGraph.java | ClassGraph.scanAsync | public Future<ScanResult> scanAsync(final ExecutorService executorService, final int numParallelTasks) {
try {
return executorService.submit(new Scanner(scanSpec, executorService, numParallelTasks,
/* scanResultProcessor = */ null, /* failureHandler = */ null, topLevelLog));
} catch (final InterruptedException e) {
// Interrupted during the Scanner constructor's execution (specifically, by getModuleOrder(),
// which is unlikely to ever actually be interrupted -- but this exception needs to be caught).
return executorService.submit(new Callable<ScanResult>() {
@Override
public ScanResult call() throws Exception {
throw e;
}
});
}
} | java | public Future<ScanResult> scanAsync(final ExecutorService executorService, final int numParallelTasks) {
try {
return executorService.submit(new Scanner(scanSpec, executorService, numParallelTasks,
/* scanResultProcessor = */ null, /* failureHandler = */ null, topLevelLog));
} catch (final InterruptedException e) {
// Interrupted during the Scanner constructor's execution (specifically, by getModuleOrder(),
// which is unlikely to ever actually be interrupted -- but this exception needs to be caught).
return executorService.submit(new Callable<ScanResult>() {
@Override
public ScanResult call() throws Exception {
throw e;
}
});
}
} | [
"public",
"Future",
"<",
"ScanResult",
">",
"scanAsync",
"(",
"final",
"ExecutorService",
"executorService",
",",
"final",
"int",
"numParallelTasks",
")",
"{",
"try",
"{",
"return",
"executorService",
".",
"submit",
"(",
"new",
"Scanner",
"(",
"scanSpec",
",",
... | Asynchronously scans the classpath for matching files, returning a {@code Future<ScanResult>}. You should
assign the wrapped {@link ScanResult} in a try-with-resources statement, or manually close it when you are
finished with it.
@param executorService
A custom {@link ExecutorService} to use for scheduling worker tasks.
@param numParallelTasks
The number of parallel tasks to break the work into during the most CPU-intensive stage of
classpath scanning. Ideally the ExecutorService will have at least this many threads available.
@return a {@code Future<ScanResult>}, that when resolved using get() yields a new {@link ScanResult} object
representing the result of the scan. | [
"Asynchronously",
"scans",
"the",
"classpath",
"for",
"matching",
"files",
"returning",
"a",
"{",
"@code",
"Future<ScanResult",
">",
"}",
".",
"You",
"should",
"assign",
"the",
"wrapped",
"{",
"@link",
"ScanResult",
"}",
"in",
"a",
"try",
"-",
"with",
"-",
... | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassGraph.java#L1121-L1135 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/SerializerIntrinsics.java | SerializerIntrinsics.mov_ptr | public final void mov_ptr(Register dst, long src)
{
assert dst.index() == 0;
emitX86(INST_MOV_PTR, dst, Immediate.imm(src));
} | java | public final void mov_ptr(Register dst, long src)
{
assert dst.index() == 0;
emitX86(INST_MOV_PTR, dst, Immediate.imm(src));
} | [
"public",
"final",
"void",
"mov_ptr",
"(",
"Register",
"dst",
",",
"long",
"src",
")",
"{",
"assert",
"dst",
".",
"index",
"(",
")",
"==",
"0",
";",
"emitX86",
"(",
"INST_MOV_PTR",
",",
"dst",
",",
"Immediate",
".",
"imm",
"(",
"src",
")",
")",
";"... | Move byte, word, dword or qword from absolute address @a src to
AL, AX, EAX or RAX register. | [
"Move",
"byte",
"word",
"dword",
"or",
"qword",
"from",
"absolute",
"address"
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/SerializerIntrinsics.java#L971-L975 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java | VariablesInner.createOrUpdateAsync | public Observable<VariableInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String variableName, VariableCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName, parameters).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() {
@Override
public VariableInner call(ServiceResponse<VariableInner> response) {
return response.body();
}
});
} | java | public Observable<VariableInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String variableName, VariableCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName, parameters).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() {
@Override
public VariableInner call(ServiceResponse<VariableInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VariableInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"variableName",
",",
"VariableCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWit... | Create a variable.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param variableName The variable name.
@param parameters The parameters supplied to the create or update variable operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VariableInner object | [
"Create",
"a",
"variable",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java#L134-L141 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/os390/OS390CCompiler.java | OS390CCompiler.buildDefineArguments | @Override
protected void buildDefineArguments(final CompilerDef[] defs, final Vector<String> args) {
//
// assume that we aren't inheriting defines from containing <cc>
//
UndefineArgument[] merged = defs[0].getActiveDefines();
for (int i = 1; i < defs.length; i++) {
//
// if we are inheriting, merge the specific defines with the
// containing defines
merged = UndefineArgument.merge(defs[i].getActiveDefines(), merged);
}
final StringBuffer buf = new StringBuffer(30);
for (final UndefineArgument current : merged) {
buf.setLength(0);
if (current.isDefine()) {
args.addElement("-D");
buf.append(current.getName());
if (current.getValue() != null && current.getValue().length() > 0) {
buf.append('=');
buf.append(current.getValue());
}
args.addElement(buf.toString());
} else {
args.addElement("-U");
args.addElement(current.getName());
}
}
} | java | @Override
protected void buildDefineArguments(final CompilerDef[] defs, final Vector<String> args) {
//
// assume that we aren't inheriting defines from containing <cc>
//
UndefineArgument[] merged = defs[0].getActiveDefines();
for (int i = 1; i < defs.length; i++) {
//
// if we are inheriting, merge the specific defines with the
// containing defines
merged = UndefineArgument.merge(defs[i].getActiveDefines(), merged);
}
final StringBuffer buf = new StringBuffer(30);
for (final UndefineArgument current : merged) {
buf.setLength(0);
if (current.isDefine()) {
args.addElement("-D");
buf.append(current.getName());
if (current.getValue() != null && current.getValue().length() > 0) {
buf.append('=');
buf.append(current.getValue());
}
args.addElement(buf.toString());
} else {
args.addElement("-U");
args.addElement(current.getName());
}
}
} | [
"@",
"Override",
"protected",
"void",
"buildDefineArguments",
"(",
"final",
"CompilerDef",
"[",
"]",
"defs",
",",
"final",
"Vector",
"<",
"String",
">",
"args",
")",
"{",
"//",
"// assume that we aren't inheriting defines from containing <cc>",
"//",
"UndefineArgument",... | The buildDefineArguments implementation CommandLineCCompiler is not good
for us because os390 defines are give by -D definex instead of
/Ddefinex, 2 args not 1! since we implement this ourslefs, we do not
have to implement the getDefineSwitch() and the getUndefineSwitch(). | [
"The",
"buildDefineArguments",
"implementation",
"CommandLineCCompiler",
"is",
"not",
"good",
"for",
"us",
"because",
"os390",
"defines",
"are",
"give",
"by",
"-",
"D",
"definex",
"instead",
"of",
"/",
"Ddefinex",
"2",
"args",
"not",
"1!",
"since",
"we",
"impl... | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/os390/OS390CCompiler.java#L99-L127 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.cancelJob | public static void cancelJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
JobRecord jobRecord = backEnd.queryJob(key, InflationType.NONE);
CancelJobTask cancelJobTask = new CancelJobTask(key, jobRecord.getQueueSettings());
try {
backEnd.enqueue(cancelJobTask);
} catch (TaskAlreadyExistsException e) {
// OK. Some other thread has already enqueued this task.
}
} | java | public static void cancelJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
JobRecord jobRecord = backEnd.queryJob(key, InflationType.NONE);
CancelJobTask cancelJobTask = new CancelJobTask(key, jobRecord.getQueueSettings());
try {
backEnd.enqueue(cancelJobTask);
} catch (TaskAlreadyExistsException e) {
// OK. Some other thread has already enqueued this task.
}
} | [
"public",
"static",
"void",
"cancelJob",
"(",
"String",
"jobHandle",
")",
"throws",
"NoSuchObjectException",
"{",
"checkNonEmpty",
"(",
"jobHandle",
",",
"\"jobHandle\"",
")",
";",
"Key",
"key",
"=",
"KeyFactory",
".",
"createKey",
"(",
"JobRecord",
".",
"DATA_S... | Sends cancellation request to the root job.
@param jobHandle The handle of a job
@throws NoSuchObjectException If a JobRecord with the given handle cannot
be found in the data store. | [
"Sends",
"cancellation",
"request",
"to",
"the",
"root",
"job",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L382-L392 |
OpenLiberty/open-liberty | dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ThreadPoolController.java | ThreadPoolController.adjustPoolSize | int adjustPoolSize(int poolSize, int poolAdjustment) {
if (threadPool == null)
return poolSize; // arguably should return 0, but "least change" is safer... This happens during shutdown.
int newPoolSize = poolSize + poolAdjustment;
lastAction = LastAction.NONE;
if (poolAdjustment != 0) {
// don't shrink below coreThreads
if (poolAdjustment < 0 && newPoolSize >= coreThreads) {
lastAction = LastAction.SHRINK;
setPoolSize(newPoolSize);
} else if (poolAdjustment > 0 && newPoolSize <= maxThreads) {
lastAction = LastAction.GROW;
setPoolSize(newPoolSize);
} else {
newPoolSize = poolSize;
}
}
return newPoolSize;
} | java | int adjustPoolSize(int poolSize, int poolAdjustment) {
if (threadPool == null)
return poolSize; // arguably should return 0, but "least change" is safer... This happens during shutdown.
int newPoolSize = poolSize + poolAdjustment;
lastAction = LastAction.NONE;
if (poolAdjustment != 0) {
// don't shrink below coreThreads
if (poolAdjustment < 0 && newPoolSize >= coreThreads) {
lastAction = LastAction.SHRINK;
setPoolSize(newPoolSize);
} else if (poolAdjustment > 0 && newPoolSize <= maxThreads) {
lastAction = LastAction.GROW;
setPoolSize(newPoolSize);
} else {
newPoolSize = poolSize;
}
}
return newPoolSize;
} | [
"int",
"adjustPoolSize",
"(",
"int",
"poolSize",
",",
"int",
"poolAdjustment",
")",
"{",
"if",
"(",
"threadPool",
"==",
"null",
")",
"return",
"poolSize",
";",
"// arguably should return 0, but \"least change\" is safer... This happens during shutdown.",
"int",
"newPoolSize... | Adjust the size of the thread pool.
@param poolSize the current pool size
@param poolAdjustment the change to make to the pool
@return the new pool size | [
"Adjust",
"the",
"size",
"of",
"the",
"thread",
"pool",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.threading/src/com/ibm/ws/threading/internal/ThreadPoolController.java#L1209-L1230 |
HubSpot/jinjava | src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java | ExpressionResolver.resolveProperty | public Object resolveProperty(Object object, List<String> propertyNames) {
// Always wrap base object.
Object value = resolver.wrap(object);
for (String propertyName : propertyNames) {
if (value == null) {
return null;
}
value = resolver.getValue(elContext, value, propertyName);
}
return value;
} | java | public Object resolveProperty(Object object, List<String> propertyNames) {
// Always wrap base object.
Object value = resolver.wrap(object);
for (String propertyName : propertyNames) {
if (value == null) {
return null;
}
value = resolver.getValue(elContext, value, propertyName);
}
return value;
} | [
"public",
"Object",
"resolveProperty",
"(",
"Object",
"object",
",",
"List",
"<",
"String",
">",
"propertyNames",
")",
"{",
"// Always wrap base object.",
"Object",
"value",
"=",
"resolver",
".",
"wrap",
"(",
"object",
")",
";",
"for",
"(",
"String",
"property... | Resolve property of bean.
@param object
Bean.
@param propertyNames
Names of properties to resolve recursively.
@return Value of property. | [
"Resolve",
"property",
"of",
"bean",
"."
] | train | https://github.com/HubSpot/jinjava/blob/ce570935630f49c666170d2330b0b9ba4eddb955/src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java#L142-L155 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java | PhoneNumberUtil.formatCommonNational | public final String formatCommonNational(final String pphoneNumber, final String pcountryCode) {
return this.formatCommonNational(this.parsePhoneNumber(pphoneNumber, pcountryCode));
} | java | public final String formatCommonNational(final String pphoneNumber, final String pcountryCode) {
return this.formatCommonNational(this.parsePhoneNumber(pphoneNumber, pcountryCode));
} | [
"public",
"final",
"String",
"formatCommonNational",
"(",
"final",
"String",
"pphoneNumber",
",",
"final",
"String",
"pcountryCode",
")",
"{",
"return",
"this",
".",
"formatCommonNational",
"(",
"this",
".",
"parsePhoneNumber",
"(",
"pphoneNumber",
",",
"pcountryCod... | format phone number in common national format.
@param pphoneNumber phone number to format
@param pcountryCode iso code of country
@return formated phone number as String | [
"format",
"phone",
"number",
"in",
"common",
"national",
"format",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java#L1641-L1643 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/JDBCUtils.java | JDBCUtils.release | public static void release(ResultSet result, Statement statement, Connection connection) {
if (result != null) {
try {
result.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (statement != null) {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (connection != null) {
JDBCUtils.release(connection);
}
} | java | public static void release(ResultSet result, Statement statement, Connection connection) {
if (result != null) {
try {
result.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (statement != null) {
try {
statement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (connection != null) {
JDBCUtils.release(connection);
}
} | [
"public",
"static",
"void",
"release",
"(",
"ResultSet",
"result",
",",
"Statement",
"statement",
",",
"Connection",
"connection",
")",
"{",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"try",
"{",
"result",
".",
"close",
"(",
")",
";",
"}",
"catch",
"... | 关闭与数据库的连接资源,包括‘ResultSet’‘Statement’‘Connection’ 的实例对象所占用的资源,注意顺序不能颠倒
@param result 结果集
@param statement 执行SQL语句的Statement对象
@param connection 连接数据库的连接对象 | [
"关闭与数据库的连接资源,包括‘ResultSet’‘Statement’‘Connection’",
"的实例对象所占用的资源,注意顺序不能颠倒"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/JDBCUtils.java#L206-L226 |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/JSONReader.java | JSONReader.readListOf | @SuppressWarnings("unchecked")
public <T> List<T> readListOf(Class<T> type) throws IOException
{
if (_parser.isExpectedStartArrayToken()) {
return (List<T>) new CollectionReader(List.class, _readerLocator.findReader(type)).read(this, _parser);
}
if (_parser.hasToken(JsonToken.VALUE_NULL)) {
return null;
}
throw JSONObjectException.from(_parser,
"Can not read a List: expect to see START_ARRAY ('['), instead got: "+ValueReader._tokenDesc(_parser));
} | java | @SuppressWarnings("unchecked")
public <T> List<T> readListOf(Class<T> type) throws IOException
{
if (_parser.isExpectedStartArrayToken()) {
return (List<T>) new CollectionReader(List.class, _readerLocator.findReader(type)).read(this, _parser);
}
if (_parser.hasToken(JsonToken.VALUE_NULL)) {
return null;
}
throw JSONObjectException.from(_parser,
"Can not read a List: expect to see START_ARRAY ('['), instead got: "+ValueReader._tokenDesc(_parser));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"readListOf",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_parser",
".",
"isExpectedStartArrayToken",
"(",
")",
")... | Method for reading a JSON Array from input and building a {@link java.util.List}
out of it. Note that if input does NOT contain a
JSON Array, {@link JSONObjectException} will be thrown. | [
"Method",
"for",
"reading",
"a",
"JSON",
"Array",
"from",
"input",
"and",
"building",
"a",
"{"
] | train | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/JSONReader.java#L254-L265 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/model/BaseDrawerItem.java | BaseDrawerItem.getTextColorStateList | protected ColorStateList getTextColorStateList(@ColorInt int color, @ColorInt int selectedTextColor) {
if (colorStateList == null || color + selectedTextColor != colorStateList.first) {
colorStateList = new Pair<>(color + selectedTextColor, DrawerUIUtils.getTextColorStateList(color, selectedTextColor));
}
return colorStateList.second;
} | java | protected ColorStateList getTextColorStateList(@ColorInt int color, @ColorInt int selectedTextColor) {
if (colorStateList == null || color + selectedTextColor != colorStateList.first) {
colorStateList = new Pair<>(color + selectedTextColor, DrawerUIUtils.getTextColorStateList(color, selectedTextColor));
}
return colorStateList.second;
} | [
"protected",
"ColorStateList",
"getTextColorStateList",
"(",
"@",
"ColorInt",
"int",
"color",
",",
"@",
"ColorInt",
"int",
"selectedTextColor",
")",
"{",
"if",
"(",
"colorStateList",
"==",
"null",
"||",
"color",
"+",
"selectedTextColor",
"!=",
"colorStateList",
".... | helper to get the ColorStateList for the text and remembering it so we do not have to recreate it all the time
@param color
@param selectedTextColor
@return | [
"helper",
"to",
"get",
"the",
"ColorStateList",
"for",
"the",
"text",
"and",
"remembering",
"it",
"so",
"we",
"do",
"not",
"have",
"to",
"recreate",
"it",
"all",
"the",
"time"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/model/BaseDrawerItem.java#L342-L348 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VariantNormalizer.java | VariantNormalizer.reverseIndexOfDifference | public static int reverseIndexOfDifference(final CharSequence cs1, final CharSequence cs2) {
if (cs1 == cs2) {
return StringUtils.INDEX_NOT_FOUND;
}
if (cs1 == null || cs2 == null) {
return 0;
}
int i;
int cs1Length = cs1.length();
int cs2Length = cs2.length();
for (i = 0; i < cs1Length && i < cs2Length; ++i) {
if (cs1.charAt(cs1Length - i - 1) != cs2.charAt(cs2Length - i - 1)) {
break;
}
}
if (i < cs2Length || i < cs1Length) {
return i;
}
return StringUtils.INDEX_NOT_FOUND;
} | java | public static int reverseIndexOfDifference(final CharSequence cs1, final CharSequence cs2) {
if (cs1 == cs2) {
return StringUtils.INDEX_NOT_FOUND;
}
if (cs1 == null || cs2 == null) {
return 0;
}
int i;
int cs1Length = cs1.length();
int cs2Length = cs2.length();
for (i = 0; i < cs1Length && i < cs2Length; ++i) {
if (cs1.charAt(cs1Length - i - 1) != cs2.charAt(cs2Length - i - 1)) {
break;
}
}
if (i < cs2Length || i < cs1Length) {
return i;
}
return StringUtils.INDEX_NOT_FOUND;
} | [
"public",
"static",
"int",
"reverseIndexOfDifference",
"(",
"final",
"CharSequence",
"cs1",
",",
"final",
"CharSequence",
"cs2",
")",
"{",
"if",
"(",
"cs1",
"==",
"cs2",
")",
"{",
"return",
"StringUtils",
".",
"INDEX_NOT_FOUND",
";",
"}",
"if",
"(",
"cs1",
... | <p>Compares two CharSequences, and returns the index beginning from the behind,
at which the CharSequences begin to differ.</p>
Based on {@link StringUtils#indexOfDifference}
<p>For example,
{@code reverseIndexOfDifference("you are a machine", "i have one machine") -> 8}</p>
<pre>
reverseIndexOfDifference(null, null) = -1
reverseIndexOfDifference("", "") = -1
reverseIndexOfDifference("", "abc") = 0
reverseIndexOfDifference("abc", "") = 0
reverseIndexOfDifference("abc", "abc") = -1
reverseIndexOfDifference("ab", "xyzab") = 2
reverseIndexOfDifference("abcde", "xyzab") = 2
reverseIndexOfDifference("abcde", "xyz") = 0
</pre>
@param cs1 the first CharSequence, may be null
@param cs2 the second CharSequence, may be null
@return the index from behind where cs1 and cs2 begin to differ; -1 if they are equal | [
"<p",
">",
"Compares",
"two",
"CharSequences",
"and",
"returns",
"the",
"index",
"beginning",
"from",
"the",
"behind",
"at",
"which",
"the",
"CharSequences",
"begin",
"to",
"differ",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/VariantNormalizer.java#L1088-L1108 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getString | @PublicEvolving
public String getString(ConfigOption<String> configOption, String overrideDefault) {
Object o = getRawValueFromOption(configOption);
return o == null ? overrideDefault : o.toString();
} | java | @PublicEvolving
public String getString(ConfigOption<String> configOption, String overrideDefault) {
Object o = getRawValueFromOption(configOption);
return o == null ? overrideDefault : o.toString();
} | [
"@",
"PublicEvolving",
"public",
"String",
"getString",
"(",
"ConfigOption",
"<",
"String",
">",
"configOption",
",",
"String",
"overrideDefault",
")",
"{",
"Object",
"o",
"=",
"getRawValueFromOption",
"(",
"configOption",
")",
";",
"return",
"o",
"==",
"null",
... | Returns the value associated with the given config option as a string.
If no value is mapped under any key of the option, it returns the specified
default instead of the option's default value.
@param configOption The configuration option
@return the (default) value associated with the given config option | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"string",
".",
"If",
"no",
"value",
"is",
"mapped",
"under",
"any",
"key",
"of",
"the",
"option",
"it",
"returns",
"the",
"specified",
"default",
"instead",
"of... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L163-L167 |
pdef/pdef-java | pdef/src/main/java/io/pdef/json/JsonJacksonFormat.java | JsonJacksonFormat.read | public <T> T read(final InputStream stream, final DataTypeDescriptor<T> descriptor)
throws Exception {
if (stream == null) throw new NullPointerException("input");
if (descriptor == null) throw new NullPointerException("descriptor");
JsonParser parser = factory.createParser(stream);
return read(parser, descriptor);
} | java | public <T> T read(final InputStream stream, final DataTypeDescriptor<T> descriptor)
throws Exception {
if (stream == null) throw new NullPointerException("input");
if (descriptor == null) throw new NullPointerException("descriptor");
JsonParser parser = factory.createParser(stream);
return read(parser, descriptor);
} | [
"public",
"<",
"T",
">",
"T",
"read",
"(",
"final",
"InputStream",
"stream",
",",
"final",
"DataTypeDescriptor",
"<",
"T",
">",
"descriptor",
")",
"throws",
"Exception",
"{",
"if",
"(",
"stream",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"... | Parses an object from an input stream, does not close the input stream. | [
"Parses",
"an",
"object",
"from",
"an",
"input",
"stream",
"does",
"not",
"close",
"the",
"input",
"stream",
"."
] | train | https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/json/JsonJacksonFormat.java#L212-L219 |
itfsw/QueryBuilder | src/main/java/com/itfsw/query/builder/support/utils/spring/Assert.java | Assert.notEmpty | public static void notEmpty(Object[] array, String message) {
if (ObjectUtils.isEmpty(array)) {
throw new IllegalArgumentException(message);
}
} | java | public static void notEmpty(Object[] array, String message) {
if (ObjectUtils.isEmpty(array)) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"Object",
"[",
"]",
"array",
",",
"String",
"message",
")",
"{",
"if",
"(",
"ObjectUtils",
".",
"isEmpty",
"(",
"array",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}"... | Assert that an array contains elements; that is, it must not be
{@code null} and must contain at least one element.
<pre class="code">Assert.notEmpty(array, "The array must contain elements");</pre>
@param array the array to check
@param message the exception message to use if the assertion fails
@throws IllegalArgumentException if the object array is {@code null} or contains no elements | [
"Assert",
"that",
"an",
"array",
"contains",
"elements",
";",
"that",
"is",
"it",
"must",
"not",
"be",
"{"
] | train | https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/support/utils/spring/Assert.java#L226-L230 |
hawkular/hawkular-commons | hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/WsSessions.java | WsSessions.createSessionEntry | private SessionEntry createSessionEntry(String sessionKey, Session session) {
List<WsSessionListener> sessionListeners = new ArrayList<>();
for (BiFunction<String, Session, WsSessionListener> producer : wsSessionListenerProducers) {
WsSessionListener sessionListener = producer.apply(sessionKey, session);
if (sessionListener != null) {
sessionListeners.add(sessionListener);
}
}
return new SessionEntry(session, sessionListeners);
} | java | private SessionEntry createSessionEntry(String sessionKey, Session session) {
List<WsSessionListener> sessionListeners = new ArrayList<>();
for (BiFunction<String, Session, WsSessionListener> producer : wsSessionListenerProducers) {
WsSessionListener sessionListener = producer.apply(sessionKey, session);
if (sessionListener != null) {
sessionListeners.add(sessionListener);
}
}
return new SessionEntry(session, sessionListeners);
} | [
"private",
"SessionEntry",
"createSessionEntry",
"(",
"String",
"sessionKey",
",",
"Session",
"session",
")",
"{",
"List",
"<",
"WsSessionListener",
">",
"sessionListeners",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"BiFunction",
"<",
"String",
... | Creates a new {@link SessionEntry} for the given {@code sessionKey} and {@code session}. Iterates over
{@link #wsSessionListenerProducers} to get {@link WsSessionListener}s that will be attached to the given
{@code session}.
<p>
Note that this only produces/assigns websocket session listeners to the sessions, but the listeners are not
told to do anything yet.
@param sessionKey the sessionId or feedId
@param session the {@link Session} for which we are creating the {@link SessionEntry}
@return a new {@link SessionEntry} | [
"Creates",
"a",
"new",
"{",
"@link",
"SessionEntry",
"}",
"for",
"the",
"given",
"{",
"@code",
"sessionKey",
"}",
"and",
"{",
"@code",
"session",
"}",
".",
"Iterates",
"over",
"{",
"@link",
"#wsSessionListenerProducers",
"}",
"to",
"get",
"{",
"@link",
"Ws... | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/WsSessions.java#L174-L183 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.extractFromVariableStatement | public List<JQLPlaceHolder> extractFromVariableStatement(JQLContext jqlContext, String jql) {
return extractPlaceHoldersFromVariableStatement(jqlContext, jql, new ArrayList<JQLPlaceHolder>());
} | java | public List<JQLPlaceHolder> extractFromVariableStatement(JQLContext jqlContext, String jql) {
return extractPlaceHoldersFromVariableStatement(jqlContext, jql, new ArrayList<JQLPlaceHolder>());
} | [
"public",
"List",
"<",
"JQLPlaceHolder",
">",
"extractFromVariableStatement",
"(",
"JQLContext",
"jqlContext",
",",
"String",
"jql",
")",
"{",
"return",
"extractPlaceHoldersFromVariableStatement",
"(",
"jqlContext",
",",
"jql",
",",
"new",
"ArrayList",
"<",
"JQLPlaceH... | Extract all bind parameters and dynamic part used in query.
@param jqlContext
the jql context
@param jql
the jql
@return the list | [
"Extract",
"all",
"bind",
"parameters",
"and",
"dynamic",
"part",
"used",
"in",
"query",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L859-L861 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java | MetaClassRegistryImpl.fireConstantMetaClassUpdate | protected void fireConstantMetaClassUpdate(Object obj, Class c, final MetaClass oldMC, MetaClass newMc) {
MetaClassRegistryChangeEventListener[] listener = getMetaClassRegistryChangeEventListeners();
MetaClassRegistryChangeEvent cmcu = new MetaClassRegistryChangeEvent(this, obj, c, oldMC, newMc);
for (int i = 0; i<listener.length; i++) {
listener[i].updateConstantMetaClass(cmcu);
}
} | java | protected void fireConstantMetaClassUpdate(Object obj, Class c, final MetaClass oldMC, MetaClass newMc) {
MetaClassRegistryChangeEventListener[] listener = getMetaClassRegistryChangeEventListeners();
MetaClassRegistryChangeEvent cmcu = new MetaClassRegistryChangeEvent(this, obj, c, oldMC, newMc);
for (int i = 0; i<listener.length; i++) {
listener[i].updateConstantMetaClass(cmcu);
}
} | [
"protected",
"void",
"fireConstantMetaClassUpdate",
"(",
"Object",
"obj",
",",
"Class",
"c",
",",
"final",
"MetaClass",
"oldMC",
",",
"MetaClass",
"newMc",
")",
"{",
"MetaClassRegistryChangeEventListener",
"[",
"]",
"listener",
"=",
"getMetaClassRegistryChangeEventListe... | Causes the execution of all registered listeners. This method is used mostly
internal to kick of the listener notification. It can also be used by subclasses
to achieve the same.
@param obj object instance if the MetaClass change is on a per-instance metaclass (or null if global)
@param c the class
@param oldMC the old MetaClass
@param newMc the new MetaClass | [
"Causes",
"the",
"execution",
"of",
"all",
"registered",
"listeners",
".",
"This",
"method",
"is",
"used",
"mostly",
"internal",
"to",
"kick",
"of",
"the",
"listener",
"notification",
".",
"It",
"can",
"also",
"be",
"used",
"by",
"subclasses",
"to",
"achieve... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java#L402-L408 |
JOML-CI/JOML | src/org/joml/Vector3i.java | Vector3i.set | public Vector3i set(int index, IntBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector3i set(int index, IntBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector3i",
"set",
"(",
"int",
"index",
",",
"IntBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link IntBuffer} starting at the
specified absolute buffer position/index.
<p>
This method will not increment the position of the given IntBuffer.
@param index
the absolute position into the IntBuffer
@param buffer
values will be read in <code>x, y, z</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"IntBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3i.java#L363-L366 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/cache/cache_stats.java | cache_stats.get_nitro_response | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
cache_stats[] resources = new cache_stats[1];
cache_response result = (cache_response) service.get_payload_formatter().string_to_resource(cache_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.cache;
return resources;
} | java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
cache_stats[] resources = new cache_stats[1];
cache_response result = (cache_response) service.get_payload_formatter().string_to_resource(cache_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.cache;
return resources;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"cache_stats",
"[",
"]",
"resources",
"=",
"new",
"cache_stats",
"[",
"1",
"]",
";",
"cache_response",
"res... | <pre>
converts nitro response into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"converts",
"nitro",
"response",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cache/cache_stats.java#L887-L906 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/cellconverter/OptionalProcessCase.java | OptionalProcessCase.get | public T get(final ProcessCase processCase) {
if(!isPresent(processCase)) {
throw new NoSuchElementException(String.format("No value present in processCase '%s'.", processCase.name()));
}
return value.get();
} | java | public T get(final ProcessCase processCase) {
if(!isPresent(processCase)) {
throw new NoSuchElementException(String.format("No value present in processCase '%s'.", processCase.name()));
}
return value.get();
} | [
"public",
"T",
"get",
"(",
"final",
"ProcessCase",
"processCase",
")",
"{",
"if",
"(",
"!",
"isPresent",
"(",
"processCase",
")",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
"String",
".",
"format",
"(",
"\"No value present in processCase '%s'.\"",
... | この{@link OptionalProcessCase}に値が存在する場合は値を返し、それ以外の場合は{@link NoSuchElementException}を返します。
@param processCase 処理ケース
@return この{@link NoSuchElementException}が保持する非null値
@throws NoSuchElementException 存在する値がない場合 | [
"この",
"{"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/cellconverter/OptionalProcessCase.java#L85-L92 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java | Message.addSubject | public Subject addSubject(String language, String subject) {
language = determineLanguage(language);
Subject messageSubject = new Subject(language, subject);
subjects.add(messageSubject);
return messageSubject;
} | java | public Subject addSubject(String language, String subject) {
language = determineLanguage(language);
Subject messageSubject = new Subject(language, subject);
subjects.add(messageSubject);
return messageSubject;
} | [
"public",
"Subject",
"addSubject",
"(",
"String",
"language",
",",
"String",
"subject",
")",
"{",
"language",
"=",
"determineLanguage",
"(",
"language",
")",
";",
"Subject",
"messageSubject",
"=",
"new",
"Subject",
"(",
"language",
",",
"subject",
")",
";",
... | Adds a subject with a corresponding language.
@param language the language of the subject being added.
@param subject the subject being added to the message.
@return the new {@link org.jivesoftware.smack.packet.Message.Subject}
@throws NullPointerException if the subject is null, a null pointer exception is thrown | [
"Adds",
"a",
"subject",
"with",
"a",
"corresponding",
"language",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java#L237-L242 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalManager.java | BookKeeperJournalManager.prepareBookKeeperEnv | @VisibleForTesting
public static void prepareBookKeeperEnv(final String availablePath,
ZooKeeper zooKeeper) throws IOException {
final CountDownLatch availablePathLatch = new CountDownLatch(1);
StringCallback cb = new StringCallback() {
@Override
public void processResult(int rc, String path, Object ctx, String name) {
if (Code.OK.intValue() == rc || Code.NODEEXISTS.intValue() == rc) {
availablePathLatch.countDown();
LOG.info("Successfully created bookie available path:" +
availablePath);
} else {
Code code = Code.get(rc);
LOG.error("Failed to create available bookie path (" +
availablePath + ")", KeeperException.create(code, path));
}
}
};
ZkUtils.createFullPathOptimistic(zooKeeper, availablePath, new byte[0],
Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, cb, null);
try {
int timeoutMs = zooKeeper.getSessionTimeout();
if (!availablePathLatch.await(timeoutMs, TimeUnit.MILLISECONDS)) {
throw new IOException("Couldn't create the bookie available path : " +
availablePath + ", timed out after " + timeoutMs + " ms.");
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IOException("Interrupted when creating the bookie available " +
"path: " + availablePath, e);
}
} | java | @VisibleForTesting
public static void prepareBookKeeperEnv(final String availablePath,
ZooKeeper zooKeeper) throws IOException {
final CountDownLatch availablePathLatch = new CountDownLatch(1);
StringCallback cb = new StringCallback() {
@Override
public void processResult(int rc, String path, Object ctx, String name) {
if (Code.OK.intValue() == rc || Code.NODEEXISTS.intValue() == rc) {
availablePathLatch.countDown();
LOG.info("Successfully created bookie available path:" +
availablePath);
} else {
Code code = Code.get(rc);
LOG.error("Failed to create available bookie path (" +
availablePath + ")", KeeperException.create(code, path));
}
}
};
ZkUtils.createFullPathOptimistic(zooKeeper, availablePath, new byte[0],
Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, cb, null);
try {
int timeoutMs = zooKeeper.getSessionTimeout();
if (!availablePathLatch.await(timeoutMs, TimeUnit.MILLISECONDS)) {
throw new IOException("Couldn't create the bookie available path : " +
availablePath + ", timed out after " + timeoutMs + " ms.");
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IOException("Interrupted when creating the bookie available " +
"path: " + availablePath, e);
}
} | [
"@",
"VisibleForTesting",
"public",
"static",
"void",
"prepareBookKeeperEnv",
"(",
"final",
"String",
"availablePath",
",",
"ZooKeeper",
"zooKeeper",
")",
"throws",
"IOException",
"{",
"final",
"CountDownLatch",
"availablePathLatch",
"=",
"new",
"CountDownLatch",
"(",
... | Create parent ZNode under which available BookKeeper bookie servers will
register themselves. Will create parent ZNodes for that path as well.
@see ZkUtils#createFullPathOptimistic(ZooKeeper, String, byte[], List, CreateMode, StringCallback, Object)
@param availablePath Full ZooKeeper path for bookies to register
themselves.
@param zooKeeper Fully instantiated ZooKeeper instance.
@throws IOException If we are unable to successfully create the path
during the time specified as the ZooKeeper session
timeout. | [
"Create",
"parent",
"ZNode",
"under",
"which",
"available",
"BookKeeper",
"bookie",
"servers",
"will",
"register",
"themselves",
".",
"Will",
"create",
"parent",
"ZNodes",
"for",
"that",
"path",
"as",
"well",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/bookkeeper/BookKeeperJournalManager.java#L212-L243 |
jmchilton/galaxy-bootstrap | src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java | DownloadProperties.gitGithub | public static DownloadProperties gitGithub(final String branch, final File destination) {
return new DownloadProperties(new GitGithubDownloader(GALAXY_GITHUB_REPOSITORY_URL, branch, LATEST_COMMIT), destination);
} | java | public static DownloadProperties gitGithub(final String branch, final File destination) {
return new DownloadProperties(new GitGithubDownloader(GALAXY_GITHUB_REPOSITORY_URL, branch, LATEST_COMMIT), destination);
} | [
"public",
"static",
"DownloadProperties",
"gitGithub",
"(",
"final",
"String",
"branch",
",",
"final",
"File",
"destination",
")",
"{",
"return",
"new",
"DownloadProperties",
"(",
"new",
"GitGithubDownloader",
"(",
"GALAXY_GITHUB_REPOSITORY_URL",
",",
"branch",
",",
... | Builds a new DownloadProperties for downloading Galaxy from github using wget.
@param branch The branch to download (e.g. master, dev, release_15.03).
@param destination The destination directory to store Galaxy, null if a directory
should be chosen by default.
@return A DownloadProperties for downloading Galaxy from github using wget. | [
"Builds",
"a",
"new",
"DownloadProperties",
"for",
"downloading",
"Galaxy",
"from",
"github",
"using",
"wget",
"."
] | train | https://github.com/jmchilton/galaxy-bootstrap/blob/4a899f5e6ec0c9f6f4b9b21d5a0320e5925ec649/src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java#L304-L306 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/dispatcher/internal/HttpDispatcher.java | HttpDispatcher.modified | @Modified
protected void modified(Map<String, Object> config) {
if (null == config || config.isEmpty()) {
return;
}
// config dictionaries are case-insensitive but case preserving per spec.
// The default value type is String, unless a different type is indicated in metatype.
setContextRootNotFoundMessage((String) config.get(PROP_VHOST_NOT_FOUND));
enableWelcomePage(MetatypeUtils.parseBoolean(CONFIG_ALIAS,
PROP_ENABLE_WELCOME_PAGE,
config.get(PROP_ENABLE_WELCOME_PAGE),
true));
setPadContextRootNotFoundMessage(MetatypeUtils.parseBoolean(CONFIG_ALIAS,
PROP_PAD_VHOST_NOT_FOUND,
config.get(PROP_PAD_VHOST_NOT_FOUND),
false));
origHeaderOrigin = MetatypeUtils.parseStringArray(CONFIG_ALIAS,
PROP_TRUSTED_PRIVATE_HEADER_ORIGIN,
config.get(PROP_TRUSTED_PRIVATE_HEADER_ORIGIN),
new String[] { "*" });
origSensitiveHeaderOrigin = MetatypeUtils.parseStringArray(CONFIG_ALIAS,
PROP_TRUSTED_SENSITIVE_HEADER_ORIGIN,
config.get(PROP_TRUSTED_SENSITIVE_HEADER_ORIGIN),
new String[] { "none" });
parseTrustedPrivateHeaderOrigin(origHeaderOrigin, origSensitiveHeaderOrigin);
} | java | @Modified
protected void modified(Map<String, Object> config) {
if (null == config || config.isEmpty()) {
return;
}
// config dictionaries are case-insensitive but case preserving per spec.
// The default value type is String, unless a different type is indicated in metatype.
setContextRootNotFoundMessage((String) config.get(PROP_VHOST_NOT_FOUND));
enableWelcomePage(MetatypeUtils.parseBoolean(CONFIG_ALIAS,
PROP_ENABLE_WELCOME_PAGE,
config.get(PROP_ENABLE_WELCOME_PAGE),
true));
setPadContextRootNotFoundMessage(MetatypeUtils.parseBoolean(CONFIG_ALIAS,
PROP_PAD_VHOST_NOT_FOUND,
config.get(PROP_PAD_VHOST_NOT_FOUND),
false));
origHeaderOrigin = MetatypeUtils.parseStringArray(CONFIG_ALIAS,
PROP_TRUSTED_PRIVATE_HEADER_ORIGIN,
config.get(PROP_TRUSTED_PRIVATE_HEADER_ORIGIN),
new String[] { "*" });
origSensitiveHeaderOrigin = MetatypeUtils.parseStringArray(CONFIG_ALIAS,
PROP_TRUSTED_SENSITIVE_HEADER_ORIGIN,
config.get(PROP_TRUSTED_SENSITIVE_HEADER_ORIGIN),
new String[] { "none" });
parseTrustedPrivateHeaderOrigin(origHeaderOrigin, origSensitiveHeaderOrigin);
} | [
"@",
"Modified",
"protected",
"void",
"modified",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"config",
")",
"{",
"if",
"(",
"null",
"==",
"config",
"||",
"config",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"// config dictionaries are ca... | DS method for runtime updates to configuration without stopping and
restarting the component.
@param config | [
"DS",
"method",
"for",
"runtime",
"updates",
"to",
"configuration",
"without",
"stopping",
"and",
"restarting",
"the",
"component",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/dispatcher/internal/HttpDispatcher.java#L200-L232 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/StdScheduler.java | StdScheduler.triggerJob | public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException
{
m_aSched.triggerJob (jobKey, data);
} | java | public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException
{
m_aSched.triggerJob (jobKey, data);
} | [
"public",
"void",
"triggerJob",
"(",
"final",
"JobKey",
"jobKey",
",",
"final",
"JobDataMap",
"data",
")",
"throws",
"SchedulerException",
"{",
"m_aSched",
".",
"triggerJob",
"(",
"jobKey",
",",
"data",
")",
";",
"}"
] | <p>
Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>.
</p> | [
"<p",
">",
"Calls",
"the",
"equivalent",
"method",
"on",
"the",
"proxied",
"<code",
">",
"QuartzScheduler<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/StdScheduler.java#L349-L352 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/common/Similarity.java | Similarity.jaccardIndex | public static double jaccardIndex(Vector a, Vector b) {
return jaccardIndex(Vectors.asDouble(a), Vectors.asDouble(b));
} | java | public static double jaccardIndex(Vector a, Vector b) {
return jaccardIndex(Vectors.asDouble(a), Vectors.asDouble(b));
} | [
"public",
"static",
"double",
"jaccardIndex",
"(",
"Vector",
"a",
",",
"Vector",
"b",
")",
"{",
"return",
"jaccardIndex",
"(",
"Vectors",
".",
"asDouble",
"(",
"a",
")",
",",
"Vectors",
".",
"asDouble",
"(",
"b",
")",
")",
";",
"}"
] | Computes the <a href="http://en.wikipedia.org/wiki/Jaccard_index">Jaccard
index</a> comparing the similarity both {@code Vector}s when viewed as
sets of samples. | [
"Computes",
"the",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Jaccard_index",
">",
"Jaccard",
"index<",
"/",
"a",
">",
"comparing",
"the",
"similarity",
"both",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L1005-L1007 |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java | UserGroupManager.assignRoleToUserGroup | @Nonnull
public EChange assignRoleToUserGroup (@Nullable final String sUserGroupID, @Nonnull @Nonempty final String sRoleID)
{
// Resolve user group
final UserGroup aUserGroup = getOfID (sUserGroupID);
if (aUserGroup == null)
{
AuditHelper.onAuditModifyFailure (UserGroup.OT, sUserGroupID, "no-such-usergroup-id", "assign-role");
return EChange.UNCHANGED;
}
m_aRWLock.writeLock ().lock ();
try
{
if (aUserGroup.assignRole (sRoleID).isUnchanged ())
return EChange.UNCHANGED;
BusinessObjectHelper.setLastModificationNow (aUserGroup);
internalUpdateItem (aUserGroup);
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
AuditHelper.onAuditModifySuccess (UserGroup.OT, "assign-role", sUserGroupID, sRoleID);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupRoleAssignment (aUserGroup, sRoleID, true));
return EChange.CHANGED;
} | java | @Nonnull
public EChange assignRoleToUserGroup (@Nullable final String sUserGroupID, @Nonnull @Nonempty final String sRoleID)
{
// Resolve user group
final UserGroup aUserGroup = getOfID (sUserGroupID);
if (aUserGroup == null)
{
AuditHelper.onAuditModifyFailure (UserGroup.OT, sUserGroupID, "no-such-usergroup-id", "assign-role");
return EChange.UNCHANGED;
}
m_aRWLock.writeLock ().lock ();
try
{
if (aUserGroup.assignRole (sRoleID).isUnchanged ())
return EChange.UNCHANGED;
BusinessObjectHelper.setLastModificationNow (aUserGroup);
internalUpdateItem (aUserGroup);
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
AuditHelper.onAuditModifySuccess (UserGroup.OT, "assign-role", sUserGroupID, sRoleID);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupRoleAssignment (aUserGroup, sRoleID, true));
return EChange.CHANGED;
} | [
"@",
"Nonnull",
"public",
"EChange",
"assignRoleToUserGroup",
"(",
"@",
"Nullable",
"final",
"String",
"sUserGroupID",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sRoleID",
")",
"{",
"// Resolve user group",
"final",
"UserGroup",
"aUserGroup",
"=",
"... | Assign the passed role ID to the user group with the passed ID.<br>
Note: the role ID must not be checked for consistency
@param sUserGroupID
The ID of the user group to assign the role to.
@param sRoleID
The ID of the role to be assigned
@return {@link EChange#CHANGED} if the passed user group ID was resolved,
and the role ID was not already previously contained | [
"Assign",
"the",
"passed",
"role",
"ID",
"to",
"the",
"user",
"group",
"with",
"the",
"passed",
"ID",
".",
"<br",
">",
"Note",
":",
"the",
"role",
"ID",
"must",
"not",
"be",
"checked",
"for",
"consistency"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java#L626-L656 |
victims/victims-lib-java | src/main/java/com/redhat/victims/fingerprint/JarFile.java | JarFile.submitJob | protected void submitJob(ExecutorService executor, Content file) {
// lifted from http://stackoverflow.com/a/5853198/1874604
class OneShotTask implements Runnable {
Content file;
OneShotTask(Content file) {
this.file = file;
}
public void run() {
processContent(file);
}
}
// we do not care about Future
executor.submit(new OneShotTask(file));
} | java | protected void submitJob(ExecutorService executor, Content file) {
// lifted from http://stackoverflow.com/a/5853198/1874604
class OneShotTask implements Runnable {
Content file;
OneShotTask(Content file) {
this.file = file;
}
public void run() {
processContent(file);
}
}
// we do not care about Future
executor.submit(new OneShotTask(file));
} | [
"protected",
"void",
"submitJob",
"(",
"ExecutorService",
"executor",
",",
"Content",
"file",
")",
"{",
"// lifted from http://stackoverflow.com/a/5853198/1874604",
"class",
"OneShotTask",
"implements",
"Runnable",
"{",
"Content",
"file",
";",
"OneShotTask",
"(",
"Content... | Helper method to sumit a new threaded tast to a given executor.
@param executor
@param file | [
"Helper",
"method",
"to",
"sumit",
"a",
"new",
"threaded",
"tast",
"to",
"a",
"given",
"executor",
"."
] | train | https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/fingerprint/JarFile.java#L114-L129 |
undera/jmeter-plugins | plugins/jmxmon/src/main/java/kg/apc/jmeter/jmxmon/JMXMonConnectionPool.java | JMXMonConnectionPool.getConnection | public MBeanServerConnection getConnection(String jmxUrl, Hashtable attributes)
{
return getConnection(jmxUrl, attributes, false);
} | java | public MBeanServerConnection getConnection(String jmxUrl, Hashtable attributes)
{
return getConnection(jmxUrl, attributes, false);
} | [
"public",
"MBeanServerConnection",
"getConnection",
"(",
"String",
"jmxUrl",
",",
"Hashtable",
"attributes",
")",
"{",
"return",
"getConnection",
"(",
"jmxUrl",
",",
"attributes",
",",
"false",
")",
";",
"}"
] | Try to get a connection to the specified jmx url
@param jmxUrl the jmx url
@param attributes jmx connection attributes
@return a jmx connection | [
"Try",
"to",
"get",
"a",
"connection",
"to",
"the",
"specified",
"jmx",
"url"
] | train | https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/jmxmon/src/main/java/kg/apc/jmeter/jmxmon/JMXMonConnectionPool.java#L49-L52 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java | GrailsDomainBinder.bindClass | public void bindClass(PersistentEntity entity, InFlightMetadataCollector mappings, String sessionFactoryBeanName)
throws MappingException {
//if (domainClass.getClazz().getSuperclass() == Object.class) {
if (entity.isRoot()) {
bindRoot((HibernatePersistentEntity) entity, mappings, sessionFactoryBeanName);
}
} | java | public void bindClass(PersistentEntity entity, InFlightMetadataCollector mappings, String sessionFactoryBeanName)
throws MappingException {
//if (domainClass.getClazz().getSuperclass() == Object.class) {
if (entity.isRoot()) {
bindRoot((HibernatePersistentEntity) entity, mappings, sessionFactoryBeanName);
}
} | [
"public",
"void",
"bindClass",
"(",
"PersistentEntity",
"entity",
",",
"InFlightMetadataCollector",
"mappings",
",",
"String",
"sessionFactoryBeanName",
")",
"throws",
"MappingException",
"{",
"//if (domainClass.getClazz().getSuperclass() == Object.class) {",
"if",
"(",
"entity... | Binds a Grails domain class to the Hibernate runtime meta model
@param entity The domain class to bind
@param mappings The existing mappings
@param sessionFactoryBeanName the session factory bean name
@throws MappingException Thrown if the domain class uses inheritance which is not supported | [
"Binds",
"a",
"Grails",
"domain",
"class",
"to",
"the",
"Hibernate",
"runtime",
"meta",
"model"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L1235-L1241 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/TaylorSeries.java | TaylorSeries.Sinh | public static double Sinh(double x, int nTerms) {
if (nTerms < 2) return x;
if (nTerms == 2) {
return x + (x * x * x) / 6D;
} else {
double mult = x * x * x;
double fact = 6;
int factS = 5;
double result = x + mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x * x;
fact *= factS * (factS - 1);
factS += 2;
result += mult / fact;
}
return result;
}
} | java | public static double Sinh(double x, int nTerms) {
if (nTerms < 2) return x;
if (nTerms == 2) {
return x + (x * x * x) / 6D;
} else {
double mult = x * x * x;
double fact = 6;
int factS = 5;
double result = x + mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x * x;
fact *= factS * (factS - 1);
factS += 2;
result += mult / fact;
}
return result;
}
} | [
"public",
"static",
"double",
"Sinh",
"(",
"double",
"x",
",",
"int",
"nTerms",
")",
"{",
"if",
"(",
"nTerms",
"<",
"2",
")",
"return",
"x",
";",
"if",
"(",
"nTerms",
"==",
"2",
")",
"{",
"return",
"x",
"+",
"(",
"x",
"*",
"x",
"*",
"x",
")",... | compute Sinh using Taylor Series.
@param x An angle, in radians.
@param nTerms Number of terms.
@return Result. | [
"compute",
"Sinh",
"using",
"Taylor",
"Series",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/TaylorSeries.java#L107-L126 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmsessionpolicy_binding.java | tmsessionpolicy_binding.get | public static tmsessionpolicy_binding get(nitro_service service, String name) throws Exception{
tmsessionpolicy_binding obj = new tmsessionpolicy_binding();
obj.set_name(name);
tmsessionpolicy_binding response = (tmsessionpolicy_binding) obj.get_resource(service);
return response;
} | java | public static tmsessionpolicy_binding get(nitro_service service, String name) throws Exception{
tmsessionpolicy_binding obj = new tmsessionpolicy_binding();
obj.set_name(name);
tmsessionpolicy_binding response = (tmsessionpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"tmsessionpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"tmsessionpolicy_binding",
"obj",
"=",
"new",
"tmsessionpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"nam... | Use this API to fetch tmsessionpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"tmsessionpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmsessionpolicy_binding.java#L136-L141 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java | ConsoleMenu.selectOne | public static String selectOne(final String title, final String[] optionNames, final String[] optionValues, final int defaultOption) {
if (optionNames.length != optionValues.length) {
throw new IllegalArgumentException("option names and values must have same length");
}
ConsoleMenu.println("Please chose " + title + DEFAULT_TITLE + defaultOption + ")");
for (int i = 0; i < optionNames.length; i++) {
ConsoleMenu.println(i + 1 + ") " + optionNames[i]);
}
int choice;
do {
choice = ConsoleMenu.getInt("Your Choice 1-" + optionNames.length + ": ", defaultOption);
} while (choice <= 0 || choice > optionNames.length);
return optionValues[choice - 1];
} | java | public static String selectOne(final String title, final String[] optionNames, final String[] optionValues, final int defaultOption) {
if (optionNames.length != optionValues.length) {
throw new IllegalArgumentException("option names and values must have same length");
}
ConsoleMenu.println("Please chose " + title + DEFAULT_TITLE + defaultOption + ")");
for (int i = 0; i < optionNames.length; i++) {
ConsoleMenu.println(i + 1 + ") " + optionNames[i]);
}
int choice;
do {
choice = ConsoleMenu.getInt("Your Choice 1-" + optionNames.length + ": ", defaultOption);
} while (choice <= 0 || choice > optionNames.length);
return optionValues[choice - 1];
} | [
"public",
"static",
"String",
"selectOne",
"(",
"final",
"String",
"title",
",",
"final",
"String",
"[",
"]",
"optionNames",
",",
"final",
"String",
"[",
"]",
"optionValues",
",",
"final",
"int",
"defaultOption",
")",
"{",
"if",
"(",
"optionNames",
".",
"l... | Generates a menu with a list of options and return the value selected.
@param title
for the command line
@param optionNames
name for each option
@param optionValues
value for each option
@return String as selected by the user of the console app | [
"Generates",
"a",
"menu",
"with",
"a",
"list",
"of",
"options",
"and",
"return",
"the",
"value",
"selected",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L351-L369 |
JodaOrg/joda-time | src/main/java/org/joda/time/Minutes.java | Minutes.minutesBetween | public static Minutes minutesBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalTime && end instanceof LocalTime) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int minutes = chrono.minutes().getDifference(
((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis());
return Minutes.minutes(minutes);
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Minutes.minutes(amount);
} | java | public static Minutes minutesBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalTime && end instanceof LocalTime) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int minutes = chrono.minutes().getDifference(
((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis());
return Minutes.minutes(minutes);
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Minutes.minutes(amount);
} | [
"public",
"static",
"Minutes",
"minutesBetween",
"(",
"ReadablePartial",
"start",
",",
"ReadablePartial",
"end",
")",
"{",
"if",
"(",
"start",
"instanceof",
"LocalTime",
"&&",
"end",
"instanceof",
"LocalTime",
")",
"{",
"Chronology",
"chrono",
"=",
"DateTimeUtils"... | Creates a <code>Minutes</code> representing the number of whole minutes
between the two specified partial datetimes.
<p>
The two partials must contain the same fields, for example you can specify
two <code>LocalTime</code> objects.
@param start the start partial date, must not be null
@param end the end partial date, must not be null
@return the period in minutes
@throws IllegalArgumentException if the partials are null or invalid | [
"Creates",
"a",
"<code",
">",
"Minutes<",
"/",
"code",
">",
"representing",
"the",
"number",
"of",
"whole",
"minutes",
"between",
"the",
"two",
"specified",
"partial",
"datetimes",
".",
"<p",
">",
"The",
"two",
"partials",
"must",
"contain",
"the",
"same",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Minutes.java#L117-L126 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java | ComponentTagDeclarationLibrary.addComponent | public final void addComponent(String namespace, String name, String componentType, String rendererType)
{
Map<String, TagHandlerFactory> map = _factories.get(namespace);
if (map == null)
{
map = new HashMap<String, TagHandlerFactory>();
_factories.put(namespace, map);
}
map.put(name, new ComponentHandlerFactory(componentType, rendererType));
} | java | public final void addComponent(String namespace, String name, String componentType, String rendererType)
{
Map<String, TagHandlerFactory> map = _factories.get(namespace);
if (map == null)
{
map = new HashMap<String, TagHandlerFactory>();
_factories.put(namespace, map);
}
map.put(name, new ComponentHandlerFactory(componentType, rendererType));
} | [
"public",
"final",
"void",
"addComponent",
"(",
"String",
"namespace",
",",
"String",
"name",
",",
"String",
"componentType",
",",
"String",
"rendererType",
")",
"{",
"Map",
"<",
"String",
",",
"TagHandlerFactory",
">",
"map",
"=",
"_factories",
".",
"get",
... | Add a ComponentHandler with the specified componentType and rendererType, aliased by the tag name.
@see ComponentHandler
@see javax.faces.application.Application#createComponent(java.lang.String)
@param name
name to use, "foo" would be <my:foo />
@param componentType
componentType to use
@param rendererType
rendererType to use | [
"Add",
"a",
"ComponentHandler",
"with",
"the",
"specified",
"componentType",
"and",
"rendererType",
"aliased",
"by",
"the",
"tag",
"name",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/ComponentTagDeclarationLibrary.java#L144-L153 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findResult | public static <S, T> T findResult(S[] self, @ClosureParams(FirstParam.Component.class) Closure<T> condition) {
return findResult(new ArrayIterator<S>(self), condition);
} | java | public static <S, T> T findResult(S[] self, @ClosureParams(FirstParam.Component.class) Closure<T> condition) {
return findResult(new ArrayIterator<S>(self), condition);
} | [
"public",
"static",
"<",
"S",
",",
"T",
">",
"T",
"findResult",
"(",
"S",
"[",
"]",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"Component",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"findResult",
"(... | Iterates through the Array calling the given closure condition for each item but stopping once the first non-null
result is found and returning that result. If all results are null, null is returned.
@param self an Array
@param condition a closure that returns a non-null value to indicate that processing should stop and the value should be returned
@return the first non-null result from calling the closure, or null
@since 2.5.0 | [
"Iterates",
"through",
"the",
"Array",
"calling",
"the",
"given",
"closure",
"condition",
"for",
"each",
"item",
"but",
"stopping",
"once",
"the",
"first",
"non",
"-",
"null",
"result",
"is",
"found",
"and",
"returning",
"that",
"result",
".",
"If",
"all",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4574-L4576 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smsd/algorithm/mcgregor/McGregorChecks.java | McGregorChecks.removeRedundantArcs | protected static void removeRedundantArcs(int row, int column, List<Integer> marcs, McgregorHelper mcGregorHelper) {
int neighborBondNumA = mcGregorHelper.getNeighborBondNumA();
int neighborBondNumB = mcGregorHelper.getNeighborBondNumB();
List<Integer> iBondNeighborAtomsA = mcGregorHelper.getiBondNeighborAtomsA();
List<Integer> iBondNeighborAtomsB = mcGregorHelper.getiBondNeighborAtomsB();
int g1Atom = iBondNeighborAtomsA.get(row * 3 + 0);
int g2Atom = iBondNeighborAtomsA.get(row * 3 + 1);
int g3Atom = iBondNeighborAtomsB.get(column * 3 + 0);
int g4Atom = iBondNeighborAtomsB.get(column * 3 + 1);
for (int x = 0; x < neighborBondNumA; x++) {
int rowAtom1 = iBondNeighborAtomsA.get(x * 3 + 0);
int rowAtom2 = iBondNeighborAtomsA.get(x * 3 + 1);
for (int y = 0; y < neighborBondNumB; y++) {
int columnAtom3 = iBondNeighborAtomsB.get(y * 3 + 0);
int columnAtom4 = iBondNeighborAtomsB.get(y * 3 + 1);
if (McGregorChecks.cases(g1Atom, g2Atom, g3Atom, g4Atom, rowAtom1, rowAtom2, columnAtom3,
columnAtom4)) {
marcs.set(x * neighborBondNumB + y, 0);
}
}
}
for (int v = 0; v < neighborBondNumA; v++) {
marcs.set(v * neighborBondNumB + column, 0);
}
for (int w = 0; w < neighborBondNumB; w++) {
marcs.set(row * neighborBondNumB + w, 0);
}
marcs.set(row * neighborBondNumB + column, 1);
} | java | protected static void removeRedundantArcs(int row, int column, List<Integer> marcs, McgregorHelper mcGregorHelper) {
int neighborBondNumA = mcGregorHelper.getNeighborBondNumA();
int neighborBondNumB = mcGregorHelper.getNeighborBondNumB();
List<Integer> iBondNeighborAtomsA = mcGregorHelper.getiBondNeighborAtomsA();
List<Integer> iBondNeighborAtomsB = mcGregorHelper.getiBondNeighborAtomsB();
int g1Atom = iBondNeighborAtomsA.get(row * 3 + 0);
int g2Atom = iBondNeighborAtomsA.get(row * 3 + 1);
int g3Atom = iBondNeighborAtomsB.get(column * 3 + 0);
int g4Atom = iBondNeighborAtomsB.get(column * 3 + 1);
for (int x = 0; x < neighborBondNumA; x++) {
int rowAtom1 = iBondNeighborAtomsA.get(x * 3 + 0);
int rowAtom2 = iBondNeighborAtomsA.get(x * 3 + 1);
for (int y = 0; y < neighborBondNumB; y++) {
int columnAtom3 = iBondNeighborAtomsB.get(y * 3 + 0);
int columnAtom4 = iBondNeighborAtomsB.get(y * 3 + 1);
if (McGregorChecks.cases(g1Atom, g2Atom, g3Atom, g4Atom, rowAtom1, rowAtom2, columnAtom3,
columnAtom4)) {
marcs.set(x * neighborBondNumB + y, 0);
}
}
}
for (int v = 0; v < neighborBondNumA; v++) {
marcs.set(v * neighborBondNumB + column, 0);
}
for (int w = 0; w < neighborBondNumB; w++) {
marcs.set(row * neighborBondNumB + w, 0);
}
marcs.set(row * neighborBondNumB + column, 1);
} | [
"protected",
"static",
"void",
"removeRedundantArcs",
"(",
"int",
"row",
",",
"int",
"column",
",",
"List",
"<",
"Integer",
">",
"marcs",
",",
"McgregorHelper",
"mcGregorHelper",
")",
"{",
"int",
"neighborBondNumA",
"=",
"mcGregorHelper",
".",
"getNeighborBondNumA... | The function is called in function partsearch. The function is given a temporary matrix and a position (row/column)
within this matrix. First the function sets all entries to zero, which can be exlcuded in respect to the current
atom by atom matching. After this the function replaces all entries in the same row and column of the current
position by zeros. Only the entry of the current position is set to one.
Return value "count_arcsleft" counts the number of arcs, which are still in the matrix.
@param row
@param column
@param marcs
@param mcGregorHelper | [
"The",
"function",
"is",
"called",
"in",
"function",
"partsearch",
".",
"The",
"function",
"is",
"given",
"a",
"temporary",
"matrix",
"and",
"a",
"position",
"(",
"row",
"/",
"column",
")",
"within",
"this",
"matrix",
".",
"First",
"the",
"function",
"sets... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/mcgregor/McGregorChecks.java#L249-L284 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java | Requests.createPublishDelete | public static PublishDelete createPublishDelete(Identifier i1, Identifier i2) {
return createPublishDelete(i1, i2, null);
} | java | public static PublishDelete createPublishDelete(Identifier i1, Identifier i2) {
return createPublishDelete(i1, i2, null);
} | [
"public",
"static",
"PublishDelete",
"createPublishDelete",
"(",
"Identifier",
"i1",
",",
"Identifier",
"i2",
")",
"{",
"return",
"createPublishDelete",
"(",
"i1",
",",
"i2",
",",
"null",
")",
";",
"}"
] | Create a new {@link PublishDelete} instance for a link between two
{@link Identifier} instances in order to delete all metadata of the link.
@param i1 the first {@link Identifier} of the link
@param i2 the second {@link Identifier} of the link
@return the new {@link PublishDelete} instance | [
"Create",
"a",
"new",
"{",
"@link",
"PublishDelete",
"}",
"instance",
"for",
"a",
"link",
"between",
"two",
"{",
"@link",
"Identifier",
"}",
"instances",
"in",
"order",
"to",
"delete",
"all",
"metadata",
"of",
"the",
"link",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java#L578-L580 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/utilities/SpaceCharacters.java | SpaceCharacters.indent | public static void indent(int num, StringBuilder out) {
if (num <= SIXTY_FOUR) {
out.append(SIXTY_FOUR_SPACES, 0, num);
return;
} else if (num <= 128){
// avoid initializing loop counters if only one iteration
out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
out.append(SIXTY_FOUR_SPACES, 0, num - SIXTY_FOUR);
} else {
int times = num / SIXTY_FOUR;
int rem = num % SIXTY_FOUR;
for (int i = 0; i< times; i++) {
out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
}
out.append(SIXTY_FOUR_SPACES, 0, rem);
return;
}
} | java | public static void indent(int num, StringBuilder out) {
if (num <= SIXTY_FOUR) {
out.append(SIXTY_FOUR_SPACES, 0, num);
return;
} else if (num <= 128){
// avoid initializing loop counters if only one iteration
out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
out.append(SIXTY_FOUR_SPACES, 0, num - SIXTY_FOUR);
} else {
int times = num / SIXTY_FOUR;
int rem = num % SIXTY_FOUR;
for (int i = 0; i< times; i++) {
out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
}
out.append(SIXTY_FOUR_SPACES, 0, rem);
return;
}
} | [
"public",
"static",
"void",
"indent",
"(",
"int",
"num",
",",
"StringBuilder",
"out",
")",
"{",
"if",
"(",
"num",
"<=",
"SIXTY_FOUR",
")",
"{",
"out",
".",
"append",
"(",
"SIXTY_FOUR_SPACES",
",",
"0",
",",
"num",
")",
";",
"return",
";",
"}",
"else"... | Write a number of whitespaces to a StringBuffer
@param num
@param out | [
"Write",
"a",
"number",
"of",
"whitespaces",
"to",
"a",
"StringBuffer"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/SpaceCharacters.java#L51-L68 |
apache/groovy | subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java | XmlUtil.newSAXParser | public static SAXParser newSAXParser(String schemaLanguage, boolean namespaceAware, boolean validating, Source... schemas) throws SAXException, ParserConfigurationException {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(validating);
factory.setNamespaceAware(namespaceAware);
if (schemas.length != 0) {
SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
factory.setSchema(schemaFactory.newSchema(schemas));
}
SAXParser saxParser = factory.newSAXParser();
if (schemas.length == 0) {
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", schemaLanguage);
}
return saxParser;
} | java | public static SAXParser newSAXParser(String schemaLanguage, boolean namespaceAware, boolean validating, Source... schemas) throws SAXException, ParserConfigurationException {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(validating);
factory.setNamespaceAware(namespaceAware);
if (schemas.length != 0) {
SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
factory.setSchema(schemaFactory.newSchema(schemas));
}
SAXParser saxParser = factory.newSAXParser();
if (schemas.length == 0) {
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", schemaLanguage);
}
return saxParser;
} | [
"public",
"static",
"SAXParser",
"newSAXParser",
"(",
"String",
"schemaLanguage",
",",
"boolean",
"namespaceAware",
",",
"boolean",
"validating",
",",
"Source",
"...",
"schemas",
")",
"throws",
"SAXException",
",",
"ParserConfigurationException",
"{",
"SAXParserFactory"... | Factory method to create a SAXParser configured to validate according to a particular schema language and
optionally providing the schema sources to validate with.
@param schemaLanguage the schema language used, e.g. XML Schema or RelaxNG (as per the String representation in javax.xml.XMLConstants)
@param namespaceAware will the parser be namespace aware
@param validating will the parser also validate against DTDs
@param schemas the schemas to validate against
@return the created SAXParser
@throws SAXException
@throws ParserConfigurationException
@since 1.8.7 | [
"Factory",
"method",
"to",
"create",
"a",
"SAXParser",
"configured",
"to",
"validate",
"according",
"to",
"a",
"particular",
"schema",
"language",
"and",
"optionally",
"providing",
"the",
"schema",
"sources",
"to",
"validate",
"with",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/XmlUtil.java#L246-L259 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java | DateTimeParseContext.charEqualsIgnoreCase | static boolean charEqualsIgnoreCase(char c1, char c2) {
return c1 == c2 ||
Character.toUpperCase(c1) == Character.toUpperCase(c2) ||
Character.toLowerCase(c1) == Character.toLowerCase(c2);
} | java | static boolean charEqualsIgnoreCase(char c1, char c2) {
return c1 == c2 ||
Character.toUpperCase(c1) == Character.toUpperCase(c2) ||
Character.toLowerCase(c1) == Character.toLowerCase(c2);
} | [
"static",
"boolean",
"charEqualsIgnoreCase",
"(",
"char",
"c1",
",",
"char",
"c2",
")",
"{",
"return",
"c1",
"==",
"c2",
"||",
"Character",
".",
"toUpperCase",
"(",
"c1",
")",
"==",
"Character",
".",
"toUpperCase",
"(",
"c2",
")",
"||",
"Character",
".",... | Compares two characters ignoring case.
@param c1 the first
@param c2 the second
@return true if equal | [
"Compares",
"two",
"characters",
"ignoring",
"case",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java#L255-L259 |
apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.freePage | public void freePage(MemoryBlock page, MemoryConsumer consumer) {
assert (page.pageNumber != MemoryBlock.NO_PAGE_NUMBER) :
"Called freePage() on memory that wasn't allocated with allocatePage()";
assert (page.pageNumber != MemoryBlock.FREED_IN_ALLOCATOR_PAGE_NUMBER) :
"Called freePage() on a memory block that has already been freed";
assert (page.pageNumber != MemoryBlock.FREED_IN_TMM_PAGE_NUMBER) :
"Called freePage() on a memory block that has already been freed";
assert(allocatedPages.get(page.pageNumber));
pageTable[page.pageNumber] = null;
synchronized (this) {
allocatedPages.clear(page.pageNumber);
}
if (logger.isTraceEnabled()) {
logger.trace("Freed page number {} ({} bytes)", page.pageNumber, page.size());
}
long pageSize = page.size();
// Clear the page number before passing the block to the MemoryAllocator's free().
// Doing this allows the MemoryAllocator to detect when a TaskMemoryManager-managed
// page has been inappropriately directly freed without calling TMM.freePage().
page.pageNumber = MemoryBlock.FREED_IN_TMM_PAGE_NUMBER;
memoryManager.tungstenMemoryAllocator().free(page);
releaseExecutionMemory(pageSize, consumer);
} | java | public void freePage(MemoryBlock page, MemoryConsumer consumer) {
assert (page.pageNumber != MemoryBlock.NO_PAGE_NUMBER) :
"Called freePage() on memory that wasn't allocated with allocatePage()";
assert (page.pageNumber != MemoryBlock.FREED_IN_ALLOCATOR_PAGE_NUMBER) :
"Called freePage() on a memory block that has already been freed";
assert (page.pageNumber != MemoryBlock.FREED_IN_TMM_PAGE_NUMBER) :
"Called freePage() on a memory block that has already been freed";
assert(allocatedPages.get(page.pageNumber));
pageTable[page.pageNumber] = null;
synchronized (this) {
allocatedPages.clear(page.pageNumber);
}
if (logger.isTraceEnabled()) {
logger.trace("Freed page number {} ({} bytes)", page.pageNumber, page.size());
}
long pageSize = page.size();
// Clear the page number before passing the block to the MemoryAllocator's free().
// Doing this allows the MemoryAllocator to detect when a TaskMemoryManager-managed
// page has been inappropriately directly freed without calling TMM.freePage().
page.pageNumber = MemoryBlock.FREED_IN_TMM_PAGE_NUMBER;
memoryManager.tungstenMemoryAllocator().free(page);
releaseExecutionMemory(pageSize, consumer);
} | [
"public",
"void",
"freePage",
"(",
"MemoryBlock",
"page",
",",
"MemoryConsumer",
"consumer",
")",
"{",
"assert",
"(",
"page",
".",
"pageNumber",
"!=",
"MemoryBlock",
".",
"NO_PAGE_NUMBER",
")",
":",
"\"Called freePage() on memory that wasn't allocated with allocatePage()\... | Free a block of memory allocated via {@link TaskMemoryManager#allocatePage}. | [
"Free",
"a",
"block",
"of",
"memory",
"allocated",
"via",
"{"
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L329-L351 |
pmlopes/yoke | framework/src/main/java/com/jetdrone/vertx/yoke/engine/AbstractEngine.java | AbstractEngine.isFresh | public void isFresh(final String filename, final Handler<Boolean> next) {
final FileSystem fileSystem = vertx.fileSystem();
fileSystem.props(filename, new AsyncResultHandler<FileProps>() {
@Override
public void handle(AsyncResult<FileProps> asyncResult) {
if (asyncResult.failed()) {
next.handle(false);
} else {
LRUCache.CacheEntry<String, T> cacheEntry = cache.get(filename);
final long lastModified = asyncResult.result().lastModifiedTime();
if (cacheEntry == null) {
next.handle(false);
} else {
if (cacheEntry.isFresh(lastModified)) {
next.handle(true);
} else {
// not fresh anymore, purge it
cache.remove(filename);
next.handle(false);
}
}
}
}
});
} | java | public void isFresh(final String filename, final Handler<Boolean> next) {
final FileSystem fileSystem = vertx.fileSystem();
fileSystem.props(filename, new AsyncResultHandler<FileProps>() {
@Override
public void handle(AsyncResult<FileProps> asyncResult) {
if (asyncResult.failed()) {
next.handle(false);
} else {
LRUCache.CacheEntry<String, T> cacheEntry = cache.get(filename);
final long lastModified = asyncResult.result().lastModifiedTime();
if (cacheEntry == null) {
next.handle(false);
} else {
if (cacheEntry.isFresh(lastModified)) {
next.handle(true);
} else {
// not fresh anymore, purge it
cache.remove(filename);
next.handle(false);
}
}
}
}
});
} | [
"public",
"void",
"isFresh",
"(",
"final",
"String",
"filename",
",",
"final",
"Handler",
"<",
"Boolean",
">",
"next",
")",
"{",
"final",
"FileSystem",
"fileSystem",
"=",
"vertx",
".",
"fileSystem",
"(",
")",
";",
"fileSystem",
".",
"props",
"(",
"filename... | Verifies if a file in the filesystem is still fresh against the cache. Errors are treated as not fresh.
@param filename File to look for
@param next next asynchronous handler | [
"Verifies",
"if",
"a",
"file",
"in",
"the",
"filesystem",
"is",
"still",
"fresh",
"against",
"the",
"cache",
".",
"Errors",
"are",
"treated",
"as",
"not",
"fresh",
"."
] | train | https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/engine/AbstractEngine.java#L51-L77 |
bechte/junit-hierarchicalcontextrunner | src/main/java/de/bechte/junit/runners/context/HierarchicalContextRunner.java | HierarchicalContextRunner.runChildren | protected Statement runChildren(final Description description, final RunNotifier notifier) {
return new RunAll(
new RunChildren<FrameworkMethod>(testClass, methodRunner, methodResolver, notifier),
new RunChildren<Class<?>>(testClass, contextRunner, contextResolver, notifier)
);
} | java | protected Statement runChildren(final Description description, final RunNotifier notifier) {
return new RunAll(
new RunChildren<FrameworkMethod>(testClass, methodRunner, methodResolver, notifier),
new RunChildren<Class<?>>(testClass, contextRunner, contextResolver, notifier)
);
} | [
"protected",
"Statement",
"runChildren",
"(",
"final",
"Description",
"description",
",",
"final",
"RunNotifier",
"notifier",
")",
"{",
"return",
"new",
"RunAll",
"(",
"new",
"RunChildren",
"<",
"FrameworkMethod",
">",
"(",
"testClass",
",",
"methodRunner",
",",
... | This method returns a {@link Statement} that is responsible for running all children of the given test class. In
order to run more than one {@link Statement}, please use the {@link RunAll} statement for grouping.
Note: Clients may override this method. The statement returned should only be responsible for running the
children. Extra work may be registered with the {@code statementBuilders} list which is initialized during the
call of {@link #initialize()}. Please register additional payload, e.g. the run of {@code @BeforeClass},
{@code @AfterClass} or {@code @ClassRule}, there. {@link de.bechte.junit.runners.context.statements.builder.ClassStatementBuilder}s will be called in the order they are
registered.
@param description the {@link Description} of the class
@param notifier the {@link RunNotifier} used for this iteration
@return a {@link Statement} that runs all children | [
"This",
"method",
"returns",
"a",
"{",
"@link",
"Statement",
"}",
"that",
"is",
"responsible",
"for",
"running",
"all",
"children",
"of",
"the",
"given",
"test",
"class",
".",
"In",
"order",
"to",
"run",
"more",
"than",
"one",
"{",
"@link",
"Statement",
... | train | https://github.com/bechte/junit-hierarchicalcontextrunner/blob/c11bb846613a3db730ec2dd812e16cd2aaefc924/src/main/java/de/bechte/junit/runners/context/HierarchicalContextRunner.java#L151-L156 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.beginGetNetworkConfigurationDiagnosticAsync | public Observable<NetworkConfigurationDiagnosticResponseInner> beginGetNetworkConfigurationDiagnosticAsync(String resourceGroupName, String networkWatcherName, NetworkConfigurationDiagnosticParameters parameters) {
return beginGetNetworkConfigurationDiagnosticWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NetworkConfigurationDiagnosticResponseInner>, NetworkConfigurationDiagnosticResponseInner>() {
@Override
public NetworkConfigurationDiagnosticResponseInner call(ServiceResponse<NetworkConfigurationDiagnosticResponseInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkConfigurationDiagnosticResponseInner> beginGetNetworkConfigurationDiagnosticAsync(String resourceGroupName, String networkWatcherName, NetworkConfigurationDiagnosticParameters parameters) {
return beginGetNetworkConfigurationDiagnosticWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NetworkConfigurationDiagnosticResponseInner>, NetworkConfigurationDiagnosticResponseInner>() {
@Override
public NetworkConfigurationDiagnosticResponseInner call(ServiceResponse<NetworkConfigurationDiagnosticResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkConfigurationDiagnosticResponseInner",
">",
"beginGetNetworkConfigurationDiagnosticAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"NetworkConfigurationDiagnosticParameters",
"parameters",
")",
"{",
"return"... | Get network configuration diagnostic.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters to get network configuration diagnostic.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkConfigurationDiagnosticResponseInner object | [
"Get",
"network",
"configuration",
"diagnostic",
"."
] | 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/NetworkWatchersInner.java#L2759-L2766 |
nutzam/nutzboot | nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java | TioWebsocketMsgHandler.onClose | @Override
public Object onClose(WsRequest wsRequest, byte[] bytes, ChannelContext channelContext) throws Exception {
TioWebsocketMethodMapper onClose = methods.getOnClose();
if (onClose != null) {
onClose.getMethod().invoke(onClose.getInstance(), channelContext);
}
log.debug("onClose");
Tio.remove(channelContext, "onClose");
return null;
} | java | @Override
public Object onClose(WsRequest wsRequest, byte[] bytes, ChannelContext channelContext) throws Exception {
TioWebsocketMethodMapper onClose = methods.getOnClose();
if (onClose != null) {
onClose.getMethod().invoke(onClose.getInstance(), channelContext);
}
log.debug("onClose");
Tio.remove(channelContext, "onClose");
return null;
} | [
"@",
"Override",
"public",
"Object",
"onClose",
"(",
"WsRequest",
"wsRequest",
",",
"byte",
"[",
"]",
"bytes",
",",
"ChannelContext",
"channelContext",
")",
"throws",
"Exception",
"{",
"TioWebsocketMethodMapper",
"onClose",
"=",
"methods",
".",
"getOnClose",
"(",
... | close connection
@param wsRequest wsRequest
@param bytes bytes
@param channelContext channelContext
@return AnyObject
@throws Exception e | [
"close",
"connection"
] | train | https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java#L73-L82 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static Func0<Observable<Void>> toAsync(Action0 action) {
return toAsync(action, Schedulers.computation());
} | java | public static Func0<Observable<Void>> toAsync(Action0 action) {
return toAsync(action, Schedulers.computation());
} | [
"public",
"static",
"Func0",
"<",
"Observable",
"<",
"Void",
">",
">",
"toAsync",
"(",
"Action0",
"action",
")",
"{",
"return",
"toAsync",
"(",
"action",
",",
"Schedulers",
".",
"computation",
"(",
")",
")",
";",
"}"
] | Convert a synchronous action call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt="">
<p>
@param action the action to convert
@return a function that returns an Observable that executes the {@code action} and emits {@code null}
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229868.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"action",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L146-L148 |
groupon/odo | proxyserver/src/main/java/com/groupon/odo/Proxy.java | Proxy.processClientId | private void processClientId(HttpServletRequest httpServletRequest, History history) {
// get the client id from the request header if applicable.. otherwise set to default
// also set the client uuid in the history object
if (httpServletRequest.getHeader(Constants.PROFILE_CLIENT_HEADER_NAME) != null &&
!httpServletRequest.getHeader(Constants.PROFILE_CLIENT_HEADER_NAME).equals("")) {
history.setClientUUID(httpServletRequest.getHeader(Constants.PROFILE_CLIENT_HEADER_NAME));
} else {
history.setClientUUID(Constants.PROFILE_CLIENT_DEFAULT_ID);
}
logger.info("Client UUID is: {}", history.getClientUUID());
} | java | private void processClientId(HttpServletRequest httpServletRequest, History history) {
// get the client id from the request header if applicable.. otherwise set to default
// also set the client uuid in the history object
if (httpServletRequest.getHeader(Constants.PROFILE_CLIENT_HEADER_NAME) != null &&
!httpServletRequest.getHeader(Constants.PROFILE_CLIENT_HEADER_NAME).equals("")) {
history.setClientUUID(httpServletRequest.getHeader(Constants.PROFILE_CLIENT_HEADER_NAME));
} else {
history.setClientUUID(Constants.PROFILE_CLIENT_DEFAULT_ID);
}
logger.info("Client UUID is: {}", history.getClientUUID());
} | [
"private",
"void",
"processClientId",
"(",
"HttpServletRequest",
"httpServletRequest",
",",
"History",
"history",
")",
"{",
"// get the client id from the request header if applicable.. otherwise set to default",
"// also set the client uuid in the history object",
"if",
"(",
"httpServ... | Apply the matching client UUID for the request
@param httpServletRequest
@param history | [
"Apply",
"the",
"matching",
"client",
"UUID",
"for",
"the",
"request"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyserver/src/main/java/com/groupon/odo/Proxy.java#L531-L541 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.elementMult | public static void elementMult( DMatrix2 a , DMatrix2 b) {
a.a1 *= b.a1;
a.a2 *= b.a2;
} | java | public static void elementMult( DMatrix2 a , DMatrix2 b) {
a.a1 *= b.a1;
a.a2 *= b.a2;
} | [
"public",
"static",
"void",
"elementMult",
"(",
"DMatrix2",
"a",
",",
"DMatrix2",
"b",
")",
"{",
"a",
".",
"a1",
"*=",
"b",
".",
"a1",
";",
"a",
".",
"a2",
"*=",
"b",
".",
"a2",
";",
"}"
] | <p>Performs an element by element multiplication operation:<br>
<br>
a<sub>i</sub> = a<sub>i</sub> * b<sub>i</sub> <br>
</p>
@param a The left vector in the multiplication operation. Modified.
@param b The right vector in the multiplication operation. Not modified. | [
"<p",
">",
"Performs",
"an",
"element",
"by",
"element",
"multiplication",
"operation",
":",
"<br",
">",
"<br",
">",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"*",
"b<sub",
">",
"i<",
"/",
"sub",
">",
"<br",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L879-L882 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobsInner.java | DscCompilationJobsInner.createAsync | public Observable<DscCompilationJobInner> createAsync(String resourceGroupName, String automationAccountName, UUID compilationJobId, DscCompilationJobCreateParameters parameters) {
return createWithServiceResponseAsync(resourceGroupName, automationAccountName, compilationJobId, parameters).map(new Func1<ServiceResponse<DscCompilationJobInner>, DscCompilationJobInner>() {
@Override
public DscCompilationJobInner call(ServiceResponse<DscCompilationJobInner> response) {
return response.body();
}
});
} | java | public Observable<DscCompilationJobInner> createAsync(String resourceGroupName, String automationAccountName, UUID compilationJobId, DscCompilationJobCreateParameters parameters) {
return createWithServiceResponseAsync(resourceGroupName, automationAccountName, compilationJobId, parameters).map(new Func1<ServiceResponse<DscCompilationJobInner>, DscCompilationJobInner>() {
@Override
public DscCompilationJobInner call(ServiceResponse<DscCompilationJobInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DscCompilationJobInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"UUID",
"compilationJobId",
",",
"DscCompilationJobCreateParameters",
"parameters",
")",
"{",
"return",
"createWithSer... | Creates the Dsc compilation job of the configuration.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param compilationJobId The the DSC configuration Id.
@param parameters The parameters supplied to the create compilation job operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DscCompilationJobInner object | [
"Creates",
"the",
"Dsc",
"compilation",
"job",
"of",
"the",
"configuration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscCompilationJobsInner.java#L128-L135 |
lucee/Lucee | core/src/main/java/lucee/commons/io/IOUtil.java | IOUtil.getMimeType | public static String getMimeType(InputStream is, String defaultValue) {
try {
return getMimeType(IOUtil.toBytesMax(is, 1000), defaultValue);
}
catch (IOException e) {
return defaultValue;
}
} | java | public static String getMimeType(InputStream is, String defaultValue) {
try {
return getMimeType(IOUtil.toBytesMax(is, 1000), defaultValue);
}
catch (IOException e) {
return defaultValue;
}
} | [
"public",
"static",
"String",
"getMimeType",
"(",
"InputStream",
"is",
",",
"String",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"getMimeType",
"(",
"IOUtil",
".",
"toBytesMax",
"(",
"is",
",",
"1000",
")",
",",
"defaultValue",
")",
";",
"}",
"catch",... | return the mime type of a file, dont check extension
@param barr
@param defaultValue
@return mime type of the file | [
"return",
"the",
"mime",
"type",
"of",
"a",
"file",
"dont",
"check",
"extension"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/IOUtil.java#L1040-L1047 |
groupon/odo | client/src/main/java/com/groupon/odo/client/Client.java | Client.setCustomRequestForDefaultClient | public static boolean setCustomRequestForDefaultClient(String profileName, String pathName, String customData) {
try {
return setCustomForDefaultClient(profileName, pathName, false, customData);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | java | public static boolean setCustomRequestForDefaultClient(String profileName, String pathName, String customData) {
try {
return setCustomForDefaultClient(profileName, pathName, false, customData);
} catch (Exception e) {
e.printStackTrace();
}
return false;
} | [
"public",
"static",
"boolean",
"setCustomRequestForDefaultClient",
"(",
"String",
"profileName",
",",
"String",
"pathName",
",",
"String",
"customData",
")",
"{",
"try",
"{",
"return",
"setCustomForDefaultClient",
"(",
"profileName",
",",
"pathName",
",",
"false",
"... | set custom request for profile's default client
@param profileName profileName to modify
@param pathName friendly name of path
@param customData custom request data
@return true if success, false otherwise | [
"set",
"custom",
"request",
"for",
"profile",
"s",
"default",
"client"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L818-L825 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/ColumnMetadata.java | ColumnMetadata.named | public static ColumnMetadata named(String name) {
return new ColumnMetadata(null, name, null, true, UNDEFINED, UNDEFINED);
} | java | public static ColumnMetadata named(String name) {
return new ColumnMetadata(null, name, null, true, UNDEFINED, UNDEFINED);
} | [
"public",
"static",
"ColumnMetadata",
"named",
"(",
"String",
"name",
")",
"{",
"return",
"new",
"ColumnMetadata",
"(",
"null",
",",
"name",
",",
"null",
",",
"true",
",",
"UNDEFINED",
",",
"UNDEFINED",
")",
";",
"}"
] | Creates default column meta data with the given column name, but without
any type or constraint information. Use the fluent builder methods to
further configure it.
@throws NullPointerException
if the name is null | [
"Creates",
"default",
"column",
"meta",
"data",
"with",
"the",
"given",
"column",
"name",
"but",
"without",
"any",
"type",
"or",
"constraint",
"information",
".",
"Use",
"the",
"fluent",
"builder",
"methods",
"to",
"further",
"configure",
"it",
"."
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/ColumnMetadata.java#L69-L71 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java | DescribePointSift.setImageGradient | public void setImageGradient(Deriv derivX , Deriv derivY ) {
this.imageDerivX.wrap(derivX);
this.imageDerivY.wrap(derivY);
} | java | public void setImageGradient(Deriv derivX , Deriv derivY ) {
this.imageDerivX.wrap(derivX);
this.imageDerivY.wrap(derivY);
} | [
"public",
"void",
"setImageGradient",
"(",
"Deriv",
"derivX",
",",
"Deriv",
"derivY",
")",
"{",
"this",
".",
"imageDerivX",
".",
"wrap",
"(",
"derivX",
")",
";",
"this",
".",
"imageDerivY",
".",
"wrap",
"(",
"derivY",
")",
";",
"}"
] | Sets the image spacial derivatives. These should be computed from an image at the appropriate scale
in scale-space.
@param derivX x-derivative of input image
@param derivY y-derivative of input image | [
"Sets",
"the",
"image",
"spacial",
"derivatives",
".",
"These",
"should",
"be",
"computed",
"from",
"an",
"image",
"at",
"the",
"appropriate",
"scale",
"in",
"scale",
"-",
"space",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java#L91-L94 |
alibaba/transmittable-thread-local | src/main/java/com/alibaba/ttl/TtlRunnable.java | TtlRunnable.get | @Nullable
public static TtlRunnable get(@Nullable Runnable runnable, boolean releaseTtlValueReferenceAfterRun, boolean idempotent) {
if (null == runnable) return null;
if (runnable instanceof TtlEnhanced) {
// avoid redundant decoration, and ensure idempotency
if (idempotent) return (TtlRunnable) runnable;
else throw new IllegalStateException("Already TtlRunnable!");
}
return new TtlRunnable(runnable, releaseTtlValueReferenceAfterRun);
} | java | @Nullable
public static TtlRunnable get(@Nullable Runnable runnable, boolean releaseTtlValueReferenceAfterRun, boolean idempotent) {
if (null == runnable) return null;
if (runnable instanceof TtlEnhanced) {
// avoid redundant decoration, and ensure idempotency
if (idempotent) return (TtlRunnable) runnable;
else throw new IllegalStateException("Already TtlRunnable!");
}
return new TtlRunnable(runnable, releaseTtlValueReferenceAfterRun);
} | [
"@",
"Nullable",
"public",
"static",
"TtlRunnable",
"get",
"(",
"@",
"Nullable",
"Runnable",
"runnable",
",",
"boolean",
"releaseTtlValueReferenceAfterRun",
",",
"boolean",
"idempotent",
")",
"{",
"if",
"(",
"null",
"==",
"runnable",
")",
"return",
"null",
";",
... | Factory method, wrap input {@link Runnable} to {@link TtlRunnable}.
@param runnable input {@link Runnable}. if input is {@code null}, return {@code null}.
@param releaseTtlValueReferenceAfterRun release TTL value reference after run, avoid memory leak even if {@link TtlRunnable} is referred.
@param idempotent is idempotent mode or not. if {@code true}, just return input {@link Runnable} when it's {@link TtlRunnable},
otherwise throw {@link IllegalStateException}.
<B><I>Caution</I></B>: {@code true} will cover up bugs! <b>DO NOT</b> set, only when you know why.
@return Wrapped {@link Runnable}
@throws IllegalStateException when input is {@link TtlRunnable} already and not idempotent. | [
"Factory",
"method",
"wrap",
"input",
"{",
"@link",
"Runnable",
"}",
"to",
"{",
"@link",
"TtlRunnable",
"}",
"."
] | train | https://github.com/alibaba/transmittable-thread-local/blob/30b4d99cdb7064b4c1797d2e40bfa07adce8e7f9/src/main/java/com/alibaba/ttl/TtlRunnable.java#L121-L131 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP9Reader.java | MPP9Reader.processFieldNameAliases | private void processFieldNameAliases(Map<Integer, FieldType> map, byte[] data)
{
if (data != null)
{
int offset = 0;
int index = 0;
CustomFieldContainer fields = m_file.getCustomFields();
while (offset < data.length)
{
String alias = MPPUtility.getUnicodeString(data, offset);
if (!alias.isEmpty())
{
FieldType field = map.get(Integer.valueOf(index));
if (field != null)
{
fields.getCustomField(field).setAlias(alias);
}
}
offset += (alias.length() + 1) * 2;
index++;
}
}
} | java | private void processFieldNameAliases(Map<Integer, FieldType> map, byte[] data)
{
if (data != null)
{
int offset = 0;
int index = 0;
CustomFieldContainer fields = m_file.getCustomFields();
while (offset < data.length)
{
String alias = MPPUtility.getUnicodeString(data, offset);
if (!alias.isEmpty())
{
FieldType field = map.get(Integer.valueOf(index));
if (field != null)
{
fields.getCustomField(field).setAlias(alias);
}
}
offset += (alias.length() + 1) * 2;
index++;
}
}
} | [
"private",
"void",
"processFieldNameAliases",
"(",
"Map",
"<",
"Integer",
",",
"FieldType",
">",
"map",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";... | Retrieve any resource field aliases defined in the MPP file.
@param map index to field map
@param data resource field name alias data | [
"Retrieve",
"any",
"resource",
"field",
"aliases",
"defined",
"in",
"the",
"MPP",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9Reader.java#L864-L886 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java | Normalization.zeromeanUnitVariance | public static DataRowsFacade zeromeanUnitVariance(DataRowsFacade frame, List<String> skipColumns) {
List<String> columnsList = DataFrames.toList(frame.get().columns());
columnsList.removeAll(skipColumns);
String[] columnNames = DataFrames.toArray(columnsList);
//first row is std second row is mean, each column in a row is for a particular column
List<Row> stdDevMean = stdDevMeanColumns(frame, columnNames);
for (int i = 0; i < columnNames.length; i++) {
String columnName = columnNames[i];
double std = ((Number) stdDevMean.get(0).get(i)).doubleValue();
double mean = ((Number) stdDevMean.get(1).get(i)).doubleValue();
if (std == 0.0)
std = 1; //All same value -> (x-x)/1 = 0
frame = dataRows(frame.get().withColumn(columnName, frame.get().col(columnName).minus(mean).divide(std)));
}
return frame;
} | java | public static DataRowsFacade zeromeanUnitVariance(DataRowsFacade frame, List<String> skipColumns) {
List<String> columnsList = DataFrames.toList(frame.get().columns());
columnsList.removeAll(skipColumns);
String[] columnNames = DataFrames.toArray(columnsList);
//first row is std second row is mean, each column in a row is for a particular column
List<Row> stdDevMean = stdDevMeanColumns(frame, columnNames);
for (int i = 0; i < columnNames.length; i++) {
String columnName = columnNames[i];
double std = ((Number) stdDevMean.get(0).get(i)).doubleValue();
double mean = ((Number) stdDevMean.get(1).get(i)).doubleValue();
if (std == 0.0)
std = 1; //All same value -> (x-x)/1 = 0
frame = dataRows(frame.get().withColumn(columnName, frame.get().col(columnName).minus(mean).divide(std)));
}
return frame;
} | [
"public",
"static",
"DataRowsFacade",
"zeromeanUnitVariance",
"(",
"DataRowsFacade",
"frame",
",",
"List",
"<",
"String",
">",
"skipColumns",
")",
"{",
"List",
"<",
"String",
">",
"columnsList",
"=",
"DataFrames",
".",
"toList",
"(",
"frame",
".",
"get",
"(",
... | Normalize by zero mean unit variance
@param frame the data to normalize
@return a zero mean unit variance centered
rdd | [
"Normalize",
"by",
"zero",
"mean",
"unit",
"variance"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L123-L142 |
the-fascinator/plugin-indexer-solr | src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java | SolrIndexer.cachePythonObject | private void cachePythonObject(String oid, PyObject pyObject) {
if (useCache && pyObject != null) {
scriptCache.put(oid, pyObject);
}
} | java | private void cachePythonObject(String oid, PyObject pyObject) {
if (useCache && pyObject != null) {
scriptCache.put(oid, pyObject);
}
} | [
"private",
"void",
"cachePythonObject",
"(",
"String",
"oid",
",",
"PyObject",
"pyObject",
")",
"{",
"if",
"(",
"useCache",
"&&",
"pyObject",
"!=",
"null",
")",
"{",
"scriptCache",
".",
"put",
"(",
"oid",
",",
"pyObject",
")",
";",
"}",
"}"
] | Add a python object to the cache if caching if configured
@param oid
: The rules OID to use as an index
@param pyObject
: The compiled PyObject to cache | [
"Add",
"a",
"python",
"object",
"to",
"the",
"cache",
"if",
"caching",
"if",
"configured"
] | train | https://github.com/the-fascinator/plugin-indexer-solr/blob/001159b18b78a87daa5d8b2a17ced28694bae156/src/main/java/com/googlecode/fascinator/indexer/SolrIndexer.java#L1135-L1139 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java | BytecodeUtils.doEqualsString | private static Expression doEqualsString(SoyExpression stringExpr, SoyExpression other) {
// This is compatible with SharedRuntime.compareString, which interestingly makes == break
// transitivity. See b/21461181
SoyRuntimeType otherRuntimeType = other.soyRuntimeType();
if (otherRuntimeType.isKnownStringOrSanitizedContent()) {
if (stringExpr.isNonNullable()) {
return stringExpr.invoke(MethodRef.EQUALS, other.unboxAsString());
} else {
return MethodRef.OBJECTS_EQUALS.invoke(stringExpr, other.unboxAsString());
}
}
if (otherRuntimeType.isKnownNumber() && other.isNonNullable()) {
// in this case, we actually try to convert stringExpr to a number
return MethodRef.RUNTIME_STRING_EQUALS_AS_NUMBER.invoke(stringExpr, other.coerceToDouble());
}
// We don't know what other is, assume the worst and call out to our boxed implementation for
// string comparisons.
return MethodRef.RUNTIME_COMPARE_NULLABLE_STRING.invoke(stringExpr, other.box());
} | java | private static Expression doEqualsString(SoyExpression stringExpr, SoyExpression other) {
// This is compatible with SharedRuntime.compareString, which interestingly makes == break
// transitivity. See b/21461181
SoyRuntimeType otherRuntimeType = other.soyRuntimeType();
if (otherRuntimeType.isKnownStringOrSanitizedContent()) {
if (stringExpr.isNonNullable()) {
return stringExpr.invoke(MethodRef.EQUALS, other.unboxAsString());
} else {
return MethodRef.OBJECTS_EQUALS.invoke(stringExpr, other.unboxAsString());
}
}
if (otherRuntimeType.isKnownNumber() && other.isNonNullable()) {
// in this case, we actually try to convert stringExpr to a number
return MethodRef.RUNTIME_STRING_EQUALS_AS_NUMBER.invoke(stringExpr, other.coerceToDouble());
}
// We don't know what other is, assume the worst and call out to our boxed implementation for
// string comparisons.
return MethodRef.RUNTIME_COMPARE_NULLABLE_STRING.invoke(stringExpr, other.box());
} | [
"private",
"static",
"Expression",
"doEqualsString",
"(",
"SoyExpression",
"stringExpr",
",",
"SoyExpression",
"other",
")",
"{",
"// This is compatible with SharedRuntime.compareString, which interestingly makes == break",
"// transitivity. See b/21461181",
"SoyRuntimeType",
"otherRu... | Compare a string valued expression to another expression using soy == semantics.
@param stringExpr An expression that is known to be an unboxed string
@param other An expression to compare it to. | [
"Compare",
"a",
"string",
"valued",
"expression",
"to",
"another",
"expression",
"using",
"soy",
"==",
"semantics",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L611-L629 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsPropertyTypeInteger | public FessMessages addErrorsPropertyTypeInteger(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_property_type_integer, arg0));
return this;
} | java | public FessMessages addErrorsPropertyTypeInteger(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_property_type_integer, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsPropertyTypeInteger",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_property_type_integer",
",",
"ar... | Add the created action message for the key 'errors.property_type_integer' with parameters.
<pre>
message: {0} should be numeric.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"property_type_integer",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"{",
"0",
"}",
"should",
"be",
"numeric",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2200-L2204 |
neo4j-contrib/neo4j-apoc-procedures | src/main/java/apoc/couchbase/CouchbaseManager.java | CouchbaseManager.getConnectionObjectsFromConfigurationKey | protected static Pair<PasswordAuthenticator, List<String>> getConnectionObjectsFromConfigurationKey(String configurationKey) {
Map<String, Object> couchbaseConfig = getKeyMap(configurationKey);
Object username, password;
if ((username = couchbaseConfig.get(USERNAME_CONFIG_KEY)) == null || (password = couchbaseConfig.get(PASSWORD_CONFIG_KEY)) == null) {
throw new RuntimeException("Please check you 'apoc.couchbase." + configurationKey + "' configuration, username and password are missing");
}
Object url;
if ((url = couchbaseConfig.get(URI_CONFIG_KEY)) == null) {
throw new RuntimeException("Please check you 'apoc.couchbase." + configurationKey + "' configuration, url is missing");
}
return Pair.of(
new PasswordAuthenticator(username.toString(), password.toString()),
Arrays.asList(url.toString().split(","))
);
} | java | protected static Pair<PasswordAuthenticator, List<String>> getConnectionObjectsFromConfigurationKey(String configurationKey) {
Map<String, Object> couchbaseConfig = getKeyMap(configurationKey);
Object username, password;
if ((username = couchbaseConfig.get(USERNAME_CONFIG_KEY)) == null || (password = couchbaseConfig.get(PASSWORD_CONFIG_KEY)) == null) {
throw new RuntimeException("Please check you 'apoc.couchbase." + configurationKey + "' configuration, username and password are missing");
}
Object url;
if ((url = couchbaseConfig.get(URI_CONFIG_KEY)) == null) {
throw new RuntimeException("Please check you 'apoc.couchbase." + configurationKey + "' configuration, url is missing");
}
return Pair.of(
new PasswordAuthenticator(username.toString(), password.toString()),
Arrays.asList(url.toString().split(","))
);
} | [
"protected",
"static",
"Pair",
"<",
"PasswordAuthenticator",
",",
"List",
"<",
"String",
">",
">",
"getConnectionObjectsFromConfigurationKey",
"(",
"String",
"configurationKey",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"couchbaseConfig",
"=",
"getKeyMap",... | Creates a {@link Pair} containing a {@link PasswordAuthenticator} and a {@link List} of (cluster) nodes from configuration properties
@param configurationKey the configuration key in neo4j.conf that should be defined as apoc.couchbase.[configurationKey]
@return a tuple2, the connections objects that we need to establish a connection to a Couchbase Server | [
"Creates",
"a",
"{",
"@link",
"Pair",
"}",
"containing",
"a",
"{",
"@link",
"PasswordAuthenticator",
"}",
"and",
"a",
"{",
"@link",
"List",
"}",
"of",
"(",
"cluster",
")",
"nodes",
"from",
"configuration",
"properties"
] | train | https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/couchbase/CouchbaseManager.java#L74-L91 |
groupon/monsoon | remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java | Client.getEnd | @Override
public DateTime getEnd() {
try {
final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP);
try {
return decodeTimestamp(BlockingWrapper.execute(() -> client.getEnd_1()));
} finally {
client.close();
}
} catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) {
LOG.log(Level.SEVERE, "getEnd RPC call failed", ex);
throw new RuntimeException("RPC call failed", ex);
}
} | java | @Override
public DateTime getEnd() {
try {
final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP);
try {
return decodeTimestamp(BlockingWrapper.execute(() -> client.getEnd_1()));
} finally {
client.close();
}
} catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) {
LOG.log(Level.SEVERE, "getEnd RPC call failed", ex);
throw new RuntimeException("RPC call failed", ex);
}
} | [
"@",
"Override",
"public",
"DateTime",
"getEnd",
"(",
")",
"{",
"try",
"{",
"final",
"rh_protoClient",
"client",
"=",
"getRpcClient",
"(",
"OncRpcProtocols",
".",
"ONCRPC_UDP",
")",
";",
"try",
"{",
"return",
"decodeTimestamp",
"(",
"BlockingWrapper",
".",
"ex... | Return the highest timestamp in the stored metrics.
@return The highest timestamp in the stored metrics. | [
"Return",
"the",
"highest",
"timestamp",
"in",
"the",
"stored",
"metrics",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java#L172-L185 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java | JCusolverDn.cusolverDnSsyevd_bufferSize | public static int cusolverDnSsyevd_bufferSize(
cusolverDnHandle handle,
int jobz,
int uplo,
int n,
Pointer A,
int lda,
Pointer W,
int[] lwork)
{
return checkResult(cusolverDnSsyevd_bufferSizeNative(handle, jobz, uplo, n, A, lda, W, lwork));
} | java | public static int cusolverDnSsyevd_bufferSize(
cusolverDnHandle handle,
int jobz,
int uplo,
int n,
Pointer A,
int lda,
Pointer W,
int[] lwork)
{
return checkResult(cusolverDnSsyevd_bufferSizeNative(handle, jobz, uplo, n, A, lda, W, lwork));
} | [
"public",
"static",
"int",
"cusolverDnSsyevd_bufferSize",
"(",
"cusolverDnHandle",
"handle",
",",
"int",
"jobz",
",",
"int",
"uplo",
",",
"int",
"n",
",",
"Pointer",
"A",
",",
"int",
"lda",
",",
"Pointer",
"W",
",",
"int",
"[",
"]",
"lwork",
")",
"{",
... | standard symmetric eigenvalue solver, A*x = lambda*x, by divide-and-conquer | [
"standard",
"symmetric",
"eigenvalue",
"solver",
"A",
"*",
"x",
"=",
"lambda",
"*",
"x",
"by",
"divide",
"-",
"and",
"-",
"conquer"
] | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L3036-L3047 |
paypal/SeLion | client/src/main/java/com/paypal/selion/configuration/ConfigManager.java | ConfigManager.addConfig | public static synchronized void addConfig(String name, LocalConfig config) {
SeLionLogger.getLogger().entering(new Object[] { name, config });
checkArgument(StringUtils.isNotBlank(name),
"A testname for which configuration is being added cannot be null (or) empty.");
checkArgument(config != null, "A configuration object cannot be null.");
if (configsMap.containsKey(name)) {
String message = "Overwriting an already existing configuration";
SeLionLogger.getLogger().warning(message);
}
configsMap.put(name, config);
SeLionLogger.getLogger().exiting();
} | java | public static synchronized void addConfig(String name, LocalConfig config) {
SeLionLogger.getLogger().entering(new Object[] { name, config });
checkArgument(StringUtils.isNotBlank(name),
"A testname for which configuration is being added cannot be null (or) empty.");
checkArgument(config != null, "A configuration object cannot be null.");
if (configsMap.containsKey(name)) {
String message = "Overwriting an already existing configuration";
SeLionLogger.getLogger().warning(message);
}
configsMap.put(name, config);
SeLionLogger.getLogger().exiting();
} | [
"public",
"static",
"synchronized",
"void",
"addConfig",
"(",
"String",
"name",
",",
"LocalConfig",
"config",
")",
"{",
"SeLionLogger",
".",
"getLogger",
"(",
")",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"name",
",",
"config",
"}",
")",
";"... | Adds the local configuration {@link LocalConfig} associated with name. Over-rides any config with the same name.
@param config
The LocalConfig.
@param name
The name to associate with local config. | [
"Adds",
"the",
"local",
"configuration",
"{",
"@link",
"LocalConfig",
"}",
"associated",
"with",
"name",
".",
"Over",
"-",
"rides",
"any",
"config",
"with",
"the",
"same",
"name",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/configuration/ConfigManager.java#L71-L82 |
bThink-BGU/BPjs | src/main/java/il/ac/bgu/cs/bp/bpjs/execution/jsproxy/BProgramJsProxy.java | BProgramJsProxy.synchronizationPoint | @Override
void synchronizationPoint( NativeObject jsRWB, Boolean hot, Object data ) {
Map<String, Object> jRWB = (Map)Context.jsToJava(jsRWB, Map.class);
SyncStatement stmt = SyncStatement.make();
if ( hot != null ) {
stmt = stmt.hot(hot);
}
Object req = jRWB.get("request");
if ( req != null ) {
if ( req instanceof BEvent ) {
stmt = stmt.request((BEvent)req);
} else if ( req instanceof NativeArray ) {
NativeArray arr = (NativeArray) req;
stmt = stmt.request(
Arrays.asList( arr.getIndexIds() ).stream()
.map( i -> (BEvent)arr.get(i) )
.collect( toList() ));
}
}
EventSet waitForSet = convertToEventSet(jRWB.get("waitFor"));
EventSet blockSet = convertToEventSet(jRWB.get("block"));
EventSet interruptSet = convertToEventSet(jRWB.get("interrupt"));
stmt = stmt.waitFor( waitForSet )
.block( blockSet )
.interrupt( interruptSet )
.data( data );
boolean hasCollision = stmt.getRequest().stream().anyMatch(blockSet::contains);
if (hasCollision) {
System.err.println("Warning: B-thread is blocking an event it is also requesting, this may lead to a deadlock.");
}
captureBThreadState(stmt);
} | java | @Override
void synchronizationPoint( NativeObject jsRWB, Boolean hot, Object data ) {
Map<String, Object> jRWB = (Map)Context.jsToJava(jsRWB, Map.class);
SyncStatement stmt = SyncStatement.make();
if ( hot != null ) {
stmt = stmt.hot(hot);
}
Object req = jRWB.get("request");
if ( req != null ) {
if ( req instanceof BEvent ) {
stmt = stmt.request((BEvent)req);
} else if ( req instanceof NativeArray ) {
NativeArray arr = (NativeArray) req;
stmt = stmt.request(
Arrays.asList( arr.getIndexIds() ).stream()
.map( i -> (BEvent)arr.get(i) )
.collect( toList() ));
}
}
EventSet waitForSet = convertToEventSet(jRWB.get("waitFor"));
EventSet blockSet = convertToEventSet(jRWB.get("block"));
EventSet interruptSet = convertToEventSet(jRWB.get("interrupt"));
stmt = stmt.waitFor( waitForSet )
.block( blockSet )
.interrupt( interruptSet )
.data( data );
boolean hasCollision = stmt.getRequest().stream().anyMatch(blockSet::contains);
if (hasCollision) {
System.err.println("Warning: B-thread is blocking an event it is also requesting, this may lead to a deadlock.");
}
captureBThreadState(stmt);
} | [
"@",
"Override",
"void",
"synchronizationPoint",
"(",
"NativeObject",
"jsRWB",
",",
"Boolean",
"hot",
",",
"Object",
"data",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"jRWB",
"=",
"(",
"Map",
")",
"Context",
".",
"jsToJava",
"(",
"jsRWB",
",",
... | Where the actual Behavioral Programming synchronization point is done.
@param jsRWB The JavaScript object {@code {request:... waitFor:...}}
@param hot {@code True} if this should be a "hot" synchronization point.
@param data Optional extra data the synchronizing b-thread may want to add. | [
"Where",
"the",
"actual",
"Behavioral",
"Programming",
"synchronization",
"point",
"is",
"done",
"."
] | train | https://github.com/bThink-BGU/BPjs/blob/2d388365a27ad79ded108eaf98a35a7ef292ae1f/src/main/java/il/ac/bgu/cs/bp/bpjs/execution/jsproxy/BProgramJsProxy.java#L191-L225 |
lucee/Lucee | core/src/main/java/lucee/commons/io/ini/IniFile.java | IniFile.getKeyValue | public String getKeyValue(String strSection, String key) throws IOException {
Object o = getSection(strSection).get(key.toLowerCase());
if (o == null) throw new IOException("key " + key + " doesn't exist in section " + strSection);
return (String) o;
} | java | public String getKeyValue(String strSection, String key) throws IOException {
Object o = getSection(strSection).get(key.toLowerCase());
if (o == null) throw new IOException("key " + key + " doesn't exist in section " + strSection);
return (String) o;
} | [
"public",
"String",
"getKeyValue",
"(",
"String",
"strSection",
",",
"String",
"key",
")",
"throws",
"IOException",
"{",
"Object",
"o",
"=",
"getSection",
"(",
"strSection",
")",
".",
"get",
"(",
"key",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
... | Gets the KeyValue attribute of the IniFile object
@param strSection section to get
@param key key to get
@return matching alue
@throws IOException | [
"Gets",
"the",
"KeyValue",
"attribute",
"of",
"the",
"IniFile",
"object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/ini/IniFile.java#L143-L148 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.getManagementPoliciesAsync | public Observable<StorageAccountManagementPoliciesInner> getManagementPoliciesAsync(String resourceGroupName, String accountName) {
return getManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<StorageAccountManagementPoliciesInner>, StorageAccountManagementPoliciesInner>() {
@Override
public StorageAccountManagementPoliciesInner call(ServiceResponse<StorageAccountManagementPoliciesInner> response) {
return response.body();
}
});
} | java | public Observable<StorageAccountManagementPoliciesInner> getManagementPoliciesAsync(String resourceGroupName, String accountName) {
return getManagementPoliciesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<StorageAccountManagementPoliciesInner>, StorageAccountManagementPoliciesInner>() {
@Override
public StorageAccountManagementPoliciesInner call(ServiceResponse<StorageAccountManagementPoliciesInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StorageAccountManagementPoliciesInner",
">",
"getManagementPoliciesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"getManagementPoliciesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accoun... | Gets the data policy rules associated with the specified storage account.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StorageAccountManagementPoliciesInner object | [
"Gets",
"the",
"data",
"policy",
"rules",
"associated",
"with",
"the",
"specified",
"storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1227-L1234 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.leaveGroup | protected void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
leave(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | java | protected void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
leave(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | [
"protected",
"void",
"leaveGroup",
"(",
"SocketAddress",
"mcastaddr",
",",
"NetworkInterface",
"netIf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mcastaddr",
"==",
"null",
"||",
"!",
"(",
"mcastaddr",
"instanceof",
"InetSocketAddress",
")",
")",
"throw",
"n... | Leave the multicast group.
@param mcastaddr multicast address to leave.
@param netIf specified the local interface to leave the group at
@throws IllegalArgumentException if mcastaddr is null or is a
SocketAddress subclass not supported by this socket
@since 1.4 | [
"Leave",
"the",
"multicast",
"group",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L217-L222 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/FormLayoutFormBuilder.java | FormLayoutFormBuilder.setLayout | public void setLayout(FormLayout layout, JPanel panel)
{
this.panel = panel;
this.layout = layout;
panel.setLayout(layout);
cc = new CellConstraints();
row = -1;
} | java | public void setLayout(FormLayout layout, JPanel panel)
{
this.panel = panel;
this.layout = layout;
panel.setLayout(layout);
cc = new CellConstraints();
row = -1;
} | [
"public",
"void",
"setLayout",
"(",
"FormLayout",
"layout",
",",
"JPanel",
"panel",
")",
"{",
"this",
".",
"panel",
"=",
"panel",
";",
"this",
".",
"layout",
"=",
"layout",
";",
"panel",
".",
"setLayout",
"(",
"layout",
")",
";",
"cc",
"=",
"new",
"C... | Set a panel with the provided layout layout.
@param layout JGoodies FormLayout
@param panel JPanel on which the builder will place the components. | [
"Set",
"a",
"panel",
"with",
"the",
"provided",
"layout",
"layout",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/FormLayoutFormBuilder.java#L208-L215 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/Table.java | Table.insertFromScript | public void insertFromScript(PersistentStore store, Object[] data) {
systemUpdateIdentityValue(data);
insertData(store, data);
} | java | public void insertFromScript(PersistentStore store, Object[] data) {
systemUpdateIdentityValue(data);
insertData(store, data);
} | [
"public",
"void",
"insertFromScript",
"(",
"PersistentStore",
"store",
",",
"Object",
"[",
"]",
"data",
")",
"{",
"systemUpdateIdentityValue",
"(",
"data",
")",
";",
"insertData",
"(",
"store",
",",
"data",
")",
";",
"}"
] | Not for general use.
Used by ScriptReader to unconditionally insert a row into
the table when the .script file is read. | [
"Not",
"for",
"general",
"use",
".",
"Used",
"by",
"ScriptReader",
"to",
"unconditionally",
"insert",
"a",
"row",
"into",
"the",
"table",
"when",
"the",
".",
"script",
"file",
"is",
"read",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Table.java#L2347-L2350 |
apache/fluo | modules/cluster/src/main/java/org/apache/fluo/cluster/runner/YarnAppRunner.java | YarnAppRunner.getResourceReport | private ResourceReport getResourceReport(TwillController controller, int maxWaitMs) {
ResourceReport report = controller.getResourceReport();
int elapsed = 0;
while (report == null) {
report = controller.getResourceReport();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
elapsed += 500;
if ((maxWaitMs != -1) && (elapsed > maxWaitMs)) {
String msg = String.format("Exceeded max wait time to retrieve ResourceReport from Twill."
+ " Elapsed time = %s ms", elapsed);
log.error(msg);
throw new IllegalStateException(msg);
}
if ((elapsed % 10000) == 0) {
log.info("Waiting for ResourceReport from Twill. Elapsed time = {} ms", elapsed);
}
}
return report;
} | java | private ResourceReport getResourceReport(TwillController controller, int maxWaitMs) {
ResourceReport report = controller.getResourceReport();
int elapsed = 0;
while (report == null) {
report = controller.getResourceReport();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
elapsed += 500;
if ((maxWaitMs != -1) && (elapsed > maxWaitMs)) {
String msg = String.format("Exceeded max wait time to retrieve ResourceReport from Twill."
+ " Elapsed time = %s ms", elapsed);
log.error(msg);
throw new IllegalStateException(msg);
}
if ((elapsed % 10000) == 0) {
log.info("Waiting for ResourceReport from Twill. Elapsed time = {} ms", elapsed);
}
}
return report;
} | [
"private",
"ResourceReport",
"getResourceReport",
"(",
"TwillController",
"controller",
",",
"int",
"maxWaitMs",
")",
"{",
"ResourceReport",
"report",
"=",
"controller",
".",
"getResourceReport",
"(",
")",
";",
"int",
"elapsed",
"=",
"0",
";",
"while",
"(",
"rep... | Attempts to retrieves ResourceReport until maxWaitMs time is reached. Set maxWaitMs to -1 to
retry forever. | [
"Attempts",
"to",
"retrieves",
"ResourceReport",
"until",
"maxWaitMs",
"time",
"is",
"reached",
".",
"Set",
"maxWaitMs",
"to",
"-",
"1",
"to",
"retry",
"forever",
"."
] | train | https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/cluster/src/main/java/org/apache/fluo/cluster/runner/YarnAppRunner.java#L290-L312 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java | Locale.getStringWithDefault | @Pure
public static String getStringWithDefault(String key, String defaultValue, Object... params) {
return getStringWithDefault(ClassLoaderFinder.findClassLoader(), detectResourceClass(null), key, defaultValue, params);
} | java | @Pure
public static String getStringWithDefault(String key, String defaultValue, Object... params) {
return getStringWithDefault(ClassLoaderFinder.findClassLoader(), detectResourceClass(null), key, defaultValue, params);
} | [
"@",
"Pure",
"public",
"static",
"String",
"getStringWithDefault",
"(",
"String",
"key",
",",
"String",
"defaultValue",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"getStringWithDefault",
"(",
"ClassLoaderFinder",
".",
"findClassLoader",
"(",
")",
",",
"... | Replies the text that corresponds to the specified resource.
@param key is the name of the resource into the specified file
@param defaultValue is the default value to replies if the resource does not contain the specified key.
@param params is the the list of parameters which will
replaces the <code>#1</code>, <code>#2</code>... into the string.
@return the text that corresponds to the specified resource | [
"Replies",
"the",
"text",
"that",
"corresponds",
"to",
"the",
"specified",
"resource",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java#L390-L393 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.findActionConfig | public static ActionConfig findActionConfig( String actionConfigPath, String modulePath, ServletContext context )
{
ModuleConfig moduleConfig = getModuleConfig( modulePath, context );
assert moduleConfig != null;
return moduleConfig.findActionConfig( actionConfigPath );
} | java | public static ActionConfig findActionConfig( String actionConfigPath, String modulePath, ServletContext context )
{
ModuleConfig moduleConfig = getModuleConfig( modulePath, context );
assert moduleConfig != null;
return moduleConfig.findActionConfig( actionConfigPath );
} | [
"public",
"static",
"ActionConfig",
"findActionConfig",
"(",
"String",
"actionConfigPath",
",",
"String",
"modulePath",
",",
"ServletContext",
"context",
")",
"{",
"ModuleConfig",
"moduleConfig",
"=",
"getModuleConfig",
"(",
"modulePath",
",",
"context",
")",
";",
"... | Get the Struts ActionConfig for the given action config path and module path. | [
"Get",
"the",
"Struts",
"ActionConfig",
"for",
"the",
"given",
"action",
"config",
"path",
"and",
"module",
"path",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L984-L989 |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java | JsonLdProcessor.toRDF | public static Object toRDF(Object input, JsonLdOptions options) throws JsonLdError {
return toRDF(input, null, options);
} | java | public static Object toRDF(Object input, JsonLdOptions options) throws JsonLdError {
return toRDF(input, null, options);
} | [
"public",
"static",
"Object",
"toRDF",
"(",
"Object",
"input",
",",
"JsonLdOptions",
"options",
")",
"throws",
"JsonLdError",
"{",
"return",
"toRDF",
"(",
"input",
",",
"null",
",",
"options",
")",
";",
"}"
] | Outputs the RDF dataset found in the given JSON-LD object.
@param input
the JSON-LD input.
@param options
the options to use: [base] the base IRI to use. [format] the
format to use to output a string: 'application/nquads' for
N-Quads (default). [loadContext(url, callback(err, url,
result))] the context loader.
@return A JSON-LD object.
@throws JsonLdError
If there is an error converting the dataset to JSON-LD. | [
"Outputs",
"the",
"RDF",
"dataset",
"found",
"in",
"the",
"given",
"JSON",
"-",
"LD",
"object",
"."
] | train | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java#L554-L556 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/date.java | date.parseDate | public static java.util.Date parseDate(String dateString, String dateFormat) {
java.util.Date newDate = null;
try {
newDate = new SimpleDateFormat(dateFormat, Locale.ENGLISH)
.parse(dateString);
} catch (ParseException e) {
QuickUtils.log.d("parse error", e);
}
return newDate;
} | java | public static java.util.Date parseDate(String dateString, String dateFormat) {
java.util.Date newDate = null;
try {
newDate = new SimpleDateFormat(dateFormat, Locale.ENGLISH)
.parse(dateString);
} catch (ParseException e) {
QuickUtils.log.d("parse error", e);
}
return newDate;
} | [
"public",
"static",
"java",
".",
"util",
".",
"Date",
"parseDate",
"(",
"String",
"dateString",
",",
"String",
"dateFormat",
")",
"{",
"java",
".",
"util",
".",
"Date",
"newDate",
"=",
"null",
";",
"try",
"{",
"newDate",
"=",
"new",
"SimpleDateFormat",
"... | Parse a data string into a real Date
<p/>
Note: (e.g. "yyyy-MM-dd HH:mm:ss")
@param dateString date in String format
@param dateFormat desired format (e.g. "yyyy-MM-dd HH:mm:ss")
@return | [
"Parse",
"a",
"data",
"string",
"into",
"a",
"real",
"Date",
"<p",
"/",
">",
"Note",
":",
"(",
"e",
".",
"g",
".",
"yyyy",
"-",
"MM",
"-",
"dd",
"HH",
":",
"mm",
":",
"ss",
")"
] | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/date.java#L149-L159 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.chompLast | public static String chompLast(String str, String sep) {
if (str.length() == 0) {
return str;
}
String sub = str.substring(str.length() - sep.length());
if (sep.equals(sub)) {
return str.substring(0, str.length() - sep.length());
}
return str;
} | java | public static String chompLast(String str, String sep) {
if (str.length() == 0) {
return str;
}
String sub = str.substring(str.length() - sep.length());
if (sep.equals(sub)) {
return str.substring(0, str.length() - sep.length());
}
return str;
} | [
"public",
"static",
"String",
"chompLast",
"(",
"String",
"str",
",",
"String",
"sep",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"str",
";",
"}",
"String",
"sub",
"=",
"str",
".",
"substring",
"(",
"str",
... | <p>Remove a value if and only if the String ends with that value.</p>
@param str the String to chomp from, must not be null
@param sep the String to chomp, must not be null
@return String without chomped ending
@throws NullPointerException if str or sep is <code>null</code>
@deprecated Use {@link #chomp(String,String)} instead.
Method will be removed in Commons Lang 3.0. | [
"<p",
">",
"Remove",
"a",
"value",
"if",
"and",
"only",
"if",
"the",
"String",
"ends",
"with",
"that",
"value",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L4025-L4034 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/backend/AppEngineBackEnd.java | AppEngineBackEnd.queryBarrier | private Barrier queryBarrier(Key barrierKey, boolean inflate) throws NoSuchObjectException {
Entity entity = getEntity("queryBarrier", barrierKey);
Barrier barrier = new Barrier(entity);
if (inflate) {
Collection<Barrier> barriers = new ArrayList<>(1);
barriers.add(barrier);
inflateBarriers(barriers);
}
logger.finest("Querying returned: " + barrier);
return barrier;
} | java | private Barrier queryBarrier(Key barrierKey, boolean inflate) throws NoSuchObjectException {
Entity entity = getEntity("queryBarrier", barrierKey);
Barrier barrier = new Barrier(entity);
if (inflate) {
Collection<Barrier> barriers = new ArrayList<>(1);
barriers.add(barrier);
inflateBarriers(barriers);
}
logger.finest("Querying returned: " + barrier);
return barrier;
} | [
"private",
"Barrier",
"queryBarrier",
"(",
"Key",
"barrierKey",
",",
"boolean",
"inflate",
")",
"throws",
"NoSuchObjectException",
"{",
"Entity",
"entity",
"=",
"getEntity",
"(",
"\"queryBarrier\"",
",",
"barrierKey",
")",
";",
"Barrier",
"barrier",
"=",
"new",
... | {@code inflate = true} means that {@link Barrier#getWaitingOnInflated()}
will not return {@code null}. | [
"{"
] | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/backend/AppEngineBackEnd.java#L296-L306 |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(String sql, Closure metaClosure, Closure rowClosure) throws SQLException {
eachRow(sql, metaClosure, 0, 0, rowClosure);
} | java | public void eachRow(String sql, Closure metaClosure, Closure rowClosure) throws SQLException {
eachRow(sql, metaClosure, 0, 0, rowClosure);
} | [
"public",
"void",
"eachRow",
"(",
"String",
"sql",
",",
"Closure",
"metaClosure",
",",
"Closure",
"rowClosure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"sql",
",",
"metaClosure",
",",
"0",
",",
"0",
",",
"rowClosure",
")",
";",
"}"
] | Performs the given SQL query calling the given <code>rowClosure</code> with each row of the
result set.
The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code>
that supports accessing the fields using property style notation and ordinal index values.
In addition, the <code>metaClosure</code> will be called once passing in the
<code>ResultSetMetaData</code> as argument.
<p>
Example usage:
<pre>
def printColNames = { meta ->
(1..meta.columnCount).each {
print meta.getColumnLabel(it).padRight(20)
}
println()
}
def printRow = { row ->
row.toRowResult().values().each{ print it.toString().padRight(20) }
println()
}
sql.eachRow("select * from PERSON", printColNames, printRow)
</pre>
<p>
Resource handling is performed automatically where appropriate.
@param sql the sql statement
@param metaClosure called for meta data (only once after sql execution)
@param rowClosure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs | [
"Performs",
"the",
"given",
"SQL",
"query",
"calling",
"the",
"given",
"<code",
">",
"rowClosure<",
"/",
"code",
">",
"with",
"each",
"row",
"of",
"the",
"result",
"set",
".",
"The",
"row",
"will",
"be",
"a",
"<code",
">",
"GroovyResultSet<",
"/",
"code"... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1150-L1152 |
phax/ph-web | ph-web/src/main/java/com/helger/web/fileupload/parse/AbstractFileUploadBase.java | AbstractFileUploadBase._parseHeaderLine | private static void _parseHeaderLine (@Nonnull final FileItemHeaders aHeaders, @Nonnull final String sHeader)
{
final int nColonOffset = sHeader.indexOf (':');
if (nColonOffset == -1)
{
// This header line is malformed, skip it.
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Found malformed HTTP header line '" + sHeader + "'");
return;
}
final String sHeaderName = sHeader.substring (0, nColonOffset).trim ();
final String sHeaderValue = sHeader.substring (sHeader.indexOf (':') + 1).trim ();
aHeaders.addHeader (sHeaderName, sHeaderValue);
} | java | private static void _parseHeaderLine (@Nonnull final FileItemHeaders aHeaders, @Nonnull final String sHeader)
{
final int nColonOffset = sHeader.indexOf (':');
if (nColonOffset == -1)
{
// This header line is malformed, skip it.
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Found malformed HTTP header line '" + sHeader + "'");
return;
}
final String sHeaderName = sHeader.substring (0, nColonOffset).trim ();
final String sHeaderValue = sHeader.substring (sHeader.indexOf (':') + 1).trim ();
aHeaders.addHeader (sHeaderName, sHeaderValue);
} | [
"private",
"static",
"void",
"_parseHeaderLine",
"(",
"@",
"Nonnull",
"final",
"FileItemHeaders",
"aHeaders",
",",
"@",
"Nonnull",
"final",
"String",
"sHeader",
")",
"{",
"final",
"int",
"nColonOffset",
"=",
"sHeader",
".",
"indexOf",
"(",
"'",
"'",
")",
";"... | Reads the next header line.
@param aHeaders
String with all headers.
@param sHeader
Map where to store the current header. | [
"Reads",
"the",
"next",
"header",
"line",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/fileupload/parse/AbstractFileUploadBase.java#L548-L561 |
google/closure-templates | java/src/com/google/template/soy/pysrc/internal/LocalVariableStack.java | LocalVariableStack.addVariable | LocalVariableStack addVariable(String name, PyExpr varExpression) {
Preconditions.checkState(!localVarExprs.isEmpty());
localVarExprs.peek().put(name, varExpression);
return this;
} | java | LocalVariableStack addVariable(String name, PyExpr varExpression) {
Preconditions.checkState(!localVarExprs.isEmpty());
localVarExprs.peek().put(name, varExpression);
return this;
} | [
"LocalVariableStack",
"addVariable",
"(",
"String",
"name",
",",
"PyExpr",
"varExpression",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"localVarExprs",
".",
"isEmpty",
"(",
")",
")",
";",
"localVarExprs",
".",
"peek",
"(",
")",
".",
"put",
"(",
... | Adds a variable to the current reference frame.
@param name The name of the variable as used by calling expressions.
@param varExpression The underlying expression used to access the variable.
@return A reference to this object. | [
"Adds",
"a",
"variable",
"to",
"the",
"current",
"reference",
"frame",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/LocalVariableStack.java#L56-L60 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/phaxio/PhaxioFaxClientSpi.java | PhaxioFaxClientSpi.updateFaxJob2HTTPRequestConverterConfiguration | @Override
protected void updateFaxJob2HTTPRequestConverterConfiguration(Map<String,String> configuration)
{
//get API key/secret
String apiKey=this.getConfigurationValue(FaxClientSpiConfigurationConstants.API_KEY_PROPERTY_KEY);
String apiSecret=this.getConfigurationValue(FaxClientSpiConfigurationConstants.API_SECRET_PROPERTY_KEY);
//validate data
if((apiKey==null)||(apiSecret==null))
{
throw new FaxException("Missing phaxio API key/secret values.");
}
//get property part
String propertyPart=this.getPropertyPart();
//modify configuration
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_FILE_CONTENT_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"filename");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_TARGET_ADDRESS_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"to");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_SENDER_FAX_NUMBER_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"caller_id");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.CANCEL_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"id");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.GET_FAX_JOB_STATUS_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"id");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.ADDITIONAL_PARAMETER_PROPERTY_KEY_PREFIX.toString()+"api_key",propertyPart),apiKey);
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.ADDITIONAL_PARAMETER_PROPERTY_KEY_PREFIX.toString()+"api_secret",propertyPart),apiSecret);
} | java | @Override
protected void updateFaxJob2HTTPRequestConverterConfiguration(Map<String,String> configuration)
{
//get API key/secret
String apiKey=this.getConfigurationValue(FaxClientSpiConfigurationConstants.API_KEY_PROPERTY_KEY);
String apiSecret=this.getConfigurationValue(FaxClientSpiConfigurationConstants.API_SECRET_PROPERTY_KEY);
//validate data
if((apiKey==null)||(apiSecret==null))
{
throw new FaxException("Missing phaxio API key/secret values.");
}
//get property part
String propertyPart=this.getPropertyPart();
//modify configuration
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_FILE_CONTENT_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"filename");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_TARGET_ADDRESS_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"to");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_SENDER_FAX_NUMBER_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"caller_id");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.CANCEL_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"id");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.GET_FAX_JOB_STATUS_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY.toString(),propertyPart),"id");
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.ADDITIONAL_PARAMETER_PROPERTY_KEY_PREFIX.toString()+"api_key",propertyPart),apiKey);
configuration.put(MessageFormat.format(FaxJob2HTTPRequestConverterConfigurationConstants.ADDITIONAL_PARAMETER_PROPERTY_KEY_PREFIX.toString()+"api_secret",propertyPart),apiSecret);
} | [
"@",
"Override",
"protected",
"void",
"updateFaxJob2HTTPRequestConverterConfiguration",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"configuration",
")",
"{",
"//get API key/secret",
"String",
"apiKey",
"=",
"this",
".",
"getConfigurationValue",
"(",
"FaxClientSpiCon... | Hook for extending classes.
@param configuration
The converter configuration | [
"Hook",
"for",
"extending",
"classes",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/phaxio/PhaxioFaxClientSpi.java#L172-L196 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.valueOf | public static BigDecimal valueOf(long unscaledVal, int scale) {
if (scale == 0)
return valueOf(unscaledVal);
else if (unscaledVal == 0) {
return zeroValueOf(scale);
}
return new BigDecimal(unscaledVal == INFLATED ?
INFLATED_BIGINT : null,
unscaledVal, scale, 0);
} | java | public static BigDecimal valueOf(long unscaledVal, int scale) {
if (scale == 0)
return valueOf(unscaledVal);
else if (unscaledVal == 0) {
return zeroValueOf(scale);
}
return new BigDecimal(unscaledVal == INFLATED ?
INFLATED_BIGINT : null,
unscaledVal, scale, 0);
} | [
"public",
"static",
"BigDecimal",
"valueOf",
"(",
"long",
"unscaledVal",
",",
"int",
"scale",
")",
"{",
"if",
"(",
"scale",
"==",
"0",
")",
"return",
"valueOf",
"(",
"unscaledVal",
")",
";",
"else",
"if",
"(",
"unscaledVal",
"==",
"0",
")",
"{",
"retur... | Translates a {@code long} unscaled value and an
{@code int} scale into a {@code BigDecimal}. This
{@literal "static factory method"} is provided in preference to
a ({@code long}, {@code int}) constructor because it
allows for reuse of frequently used {@code BigDecimal} values..
@param unscaledVal unscaled value of the {@code BigDecimal}.
@param scale scale of the {@code BigDecimal}.
@return a {@code BigDecimal} whose value is
<tt>(unscaledVal × 10<sup>-scale</sup>)</tt>. | [
"Translates",
"a",
"{",
"@code",
"long",
"}",
"unscaled",
"value",
"and",
"an",
"{",
"@code",
"int",
"}",
"scale",
"into",
"a",
"{",
"@code",
"BigDecimal",
"}",
".",
"This",
"{",
"@literal",
"static",
"factory",
"method",
"}",
"is",
"provided",
"in",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L1198-L1207 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/Sets.java | Sets.intersects | public static <E> boolean intersects(Set<E> s1, Set<E> s2) {
// loop over whichever set is smaller
if (s1.size() < s2.size()) {
for (E element1 : s1) {
if (s2.contains(element1)) {
return true;
}
}
} else {
for (E element2 : s2) {
if (s1.contains(element2)) {
return true;
}
}
}
return false;
} | java | public static <E> boolean intersects(Set<E> s1, Set<E> s2) {
// loop over whichever set is smaller
if (s1.size() < s2.size()) {
for (E element1 : s1) {
if (s2.contains(element1)) {
return true;
}
}
} else {
for (E element2 : s2) {
if (s1.contains(element2)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"<",
"E",
">",
"boolean",
"intersects",
"(",
"Set",
"<",
"E",
">",
"s1",
",",
"Set",
"<",
"E",
">",
"s2",
")",
"{",
"// loop over whichever set is smaller\r",
"if",
"(",
"s1",
".",
"size",
"(",
")",
"<",
"s2",
".",
"size",
"(",
... | Returns true if there is at least element that is in both s1 and s2. Faster
than calling intersection(Set,Set) if you don't need the contents of the
intersection. | [
"Returns",
"true",
"if",
"there",
"is",
"at",
"least",
"element",
"that",
"is",
"in",
"both",
"s1",
"and",
"s2",
".",
"Faster",
"than",
"calling",
"intersection",
"(",
"Set",
"Set",
")",
"if",
"you",
"don",
"t",
"need",
"the",
"contents",
"of",
"the",
... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Sets.java#L88-L105 |
osglworks/java-tool | src/main/java/org/osgl/util/E.java | E.unsupportedIf | public static void unsupportedIf(boolean tester, String msg, Object ... args) {
if (tester) {
throw unsupport(msg, args);
}
} | java | public static void unsupportedIf(boolean tester, String msg, Object ... args) {
if (tester) {
throw unsupport(msg, args);
}
} | [
"public",
"static",
"void",
"unsupportedIf",
"(",
"boolean",
"tester",
",",
"String",
"msg",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"tester",
")",
"{",
"throw",
"unsupport",
"(",
"msg",
",",
"args",
")",
";",
"}",
"}"
] | Throws out an {@link UnsupportedException} with error message specified
if `tester` is `true`.
@param tester
when `true` then throw out the exception.
@param msg
the error message format pattern.
@param args
the error message format arguments. | [
"Throws",
"out",
"an",
"{",
"@link",
"UnsupportedException",
"}",
"with",
"error",
"message",
"specified",
"if",
"tester",
"is",
"true",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L611-L615 |
vikingbrain/thedavidbox-client4j | src/main/java/com/vikingbrain/nmt/controller/impl/RemoteHttpServiceImpl.java | RemoteHttpServiceImpl.buildEncodedParameters | private StringBuffer buildEncodedParameters(LinkedHashMap<String, String> params) {
StringBuffer parametersUrlGet = new StringBuffer("");
if (null != params) {
for (String key : params.keySet()) {
String value = params.get(key);
String encodedParameter = encodeHttpParameter(value);
// It builds something like
// "¶m1=file%20name%26blues for entry "param1","file name&blues"
parametersUrlGet.append("&").append(key).append("=").append(encodedParameter);
}
}
return parametersUrlGet;
} | java | private StringBuffer buildEncodedParameters(LinkedHashMap<String, String> params) {
StringBuffer parametersUrlGet = new StringBuffer("");
if (null != params) {
for (String key : params.keySet()) {
String value = params.get(key);
String encodedParameter = encodeHttpParameter(value);
// It builds something like
// "¶m1=file%20name%26blues for entry "param1","file name&blues"
parametersUrlGet.append("&").append(key).append("=").append(encodedParameter);
}
}
return parametersUrlGet;
} | [
"private",
"StringBuffer",
"buildEncodedParameters",
"(",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"StringBuffer",
"parametersUrlGet",
"=",
"new",
"StringBuffer",
"(",
"\"\"",
")",
";",
"if",
"(",
"null",
"!=",
"params",
")",
"{"... | It uses the parameters to build the http arguments with name and value.
@param params all the parameters with name and value
@return the stringbuffer with the http arguments ready to be added to a http request | [
"It",
"uses",
"the",
"parameters",
"to",
"build",
"the",
"http",
"arguments",
"with",
"name",
"and",
"value",
"."
] | train | https://github.com/vikingbrain/thedavidbox-client4j/blob/b2375a59b30fc3bd5dae34316bda68e01d006535/src/main/java/com/vikingbrain/nmt/controller/impl/RemoteHttpServiceImpl.java#L87-L102 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/accesscontrol/robotstxt/Robotstxt.java | Robotstxt.getDirectivesFor | public RobotsDirectives getDirectivesFor(String ua, boolean useFallbacks) {
// find matching ua
for(String uaListed : namedUserAgents) {
if(ua.indexOf(uaListed)>-1) {
return agentsToDirectives.get(uaListed);
}
}
if(useFallbacks==false) {
return null;
}
if (wildcardDirectives!=null) {
return wildcardDirectives;
}
// no applicable user-agents, so empty directives
return NO_DIRECTIVES;
} | java | public RobotsDirectives getDirectivesFor(String ua, boolean useFallbacks) {
// find matching ua
for(String uaListed : namedUserAgents) {
if(ua.indexOf(uaListed)>-1) {
return agentsToDirectives.get(uaListed);
}
}
if(useFallbacks==false) {
return null;
}
if (wildcardDirectives!=null) {
return wildcardDirectives;
}
// no applicable user-agents, so empty directives
return NO_DIRECTIVES;
} | [
"public",
"RobotsDirectives",
"getDirectivesFor",
"(",
"String",
"ua",
",",
"boolean",
"useFallbacks",
")",
"{",
"// find matching ua",
"for",
"(",
"String",
"uaListed",
":",
"namedUserAgents",
")",
"{",
"if",
"(",
"ua",
".",
"indexOf",
"(",
"uaListed",
")",
"... | Return the RobotsDirectives, if any, appropriate for the given User-Agent
string. If useFallbacks is true, a wildcard ('*') directives or the default
of NO_DIRECTIVES will be returned, as appropriate, if there is no better
match. If useFallbacks is false, a null will be returned if no declared
directives targeted the given User-Agent.
@param ua String User-Agent to lookup
@param useFallbacks if true, fall-back to wildcard directives or
default allow as needed
@return directives to use, or null if useFallbacks is false and no
non-wildcard directives match the supplied User-Agent | [
"Return",
"the",
"RobotsDirectives",
"if",
"any",
"appropriate",
"for",
"the",
"given",
"User",
"-",
"Agent",
"string",
".",
"If",
"useFallbacks",
"is",
"true",
"a",
"wildcard",
"(",
"*",
")",
"directives",
"or",
"the",
"default",
"of",
"NO_DIRECTIVES",
"wil... | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/accesscontrol/robotstxt/Robotstxt.java#L207-L222 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/AttributeQuery.java | AttributeQuery.executeOneCompleteStmt | protected boolean executeOneCompleteStmt(final String _complStmt)
throws EFapsException
{
final boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
if (AbstractObjectQuery.LOG.isDebugEnabled()) {
AbstractObjectQuery.LOG.debug(_complStmt.toString());
}
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
new ArrayList<Instance>();
while (rs.next()) {
getValues().add(rs.getObject(1));
}
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(AttributeQuery.class, "executeOneCompleteStmt", e);
}
return ret;
} | java | protected boolean executeOneCompleteStmt(final String _complStmt)
throws EFapsException
{
final boolean ret = false;
ConnectionResource con = null;
try {
con = Context.getThreadContext().getConnectionResource();
if (AbstractObjectQuery.LOG.isDebugEnabled()) {
AbstractObjectQuery.LOG.debug(_complStmt.toString());
}
final Statement stmt = con.createStatement();
final ResultSet rs = stmt.executeQuery(_complStmt.toString());
new ArrayList<Instance>();
while (rs.next()) {
getValues().add(rs.getObject(1));
}
rs.close();
stmt.close();
} catch (final SQLException e) {
throw new EFapsException(AttributeQuery.class, "executeOneCompleteStmt", e);
}
return ret;
} | [
"protected",
"boolean",
"executeOneCompleteStmt",
"(",
"final",
"String",
"_complStmt",
")",
"throws",
"EFapsException",
"{",
"final",
"boolean",
"ret",
"=",
"false",
";",
"ConnectionResource",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=",
"Context",
".",
"... | Execute the actual statement against the database.
@param _complStmt Statment to be executed
@return true if executed with success
@throws EFapsException on error | [
"Execute",
"the",
"actual",
"statement",
"against",
"the",
"database",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/AttributeQuery.java#L202-L226 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/calltrace/TracingUtil.java | TracingUtil.buildCall | @Deprecated
public static String buildCall(final Method method, final Object[] parameters) {
if (method == null) {
throw new IllegalArgumentException("Parameter method can't be null");
}
return buildCall(method.getDeclaringClass().getSimpleName(), method.getName(), parameters, null).toString();
} | java | @Deprecated
public static String buildCall(final Method method, final Object[] parameters) {
if (method == null) {
throw new IllegalArgumentException("Parameter method can't be null");
}
return buildCall(method.getDeclaringClass().getSimpleName(), method.getName(), parameters, null).toString();
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"buildCall",
"(",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"parameters",
")",
"{",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Paramet... | Builds call.
@param method source {@link Method}, can't be null
@param parameters method parameters
@return call | [
"Builds",
"call",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/calltrace/TracingUtil.java#L29-L36 |
Erudika/para | para-server/src/main/java/com/erudika/para/i18n/LanguageUtils.java | LanguageUtils.approveTranslation | public boolean approveTranslation(String appid, String langCode, String key, String value) {
if (StringUtils.isBlank(langCode) || key == null || value == null || getDefaultLanguageCode().equals(langCode)) {
return false;
}
Sysprop s = dao.read(appid, keyPrefix.concat(langCode));
boolean create = false;
if (s == null) {
create = true;
s = new Sysprop(keyPrefix.concat(langCode));
s.setAppid(appid);
}
s.addProperty(key, value);
if (create) {
dao.create(appid, s);
} else {
dao.update(appid, s);
}
if (LANG_CACHE.containsKey(langCode)) {
LANG_CACHE.get(langCode).put(key, value);
}
updateTranslationProgressMap(appid, langCode, PLUS);
return true;
} | java | public boolean approveTranslation(String appid, String langCode, String key, String value) {
if (StringUtils.isBlank(langCode) || key == null || value == null || getDefaultLanguageCode().equals(langCode)) {
return false;
}
Sysprop s = dao.read(appid, keyPrefix.concat(langCode));
boolean create = false;
if (s == null) {
create = true;
s = new Sysprop(keyPrefix.concat(langCode));
s.setAppid(appid);
}
s.addProperty(key, value);
if (create) {
dao.create(appid, s);
} else {
dao.update(appid, s);
}
if (LANG_CACHE.containsKey(langCode)) {
LANG_CACHE.get(langCode).put(key, value);
}
updateTranslationProgressMap(appid, langCode, PLUS);
return true;
} | [
"public",
"boolean",
"approveTranslation",
"(",
"String",
"appid",
",",
"String",
"langCode",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"langCode",
")",
"||",
"key",
"==",
"null",
"||",
"value",
... | Approves a translation for a given language.
@param appid appid name of the {@link com.erudika.para.core.App}
@param langCode the 2-letter language code
@param key the translation key
@param value the translated string
@return true if the operation was successful | [
"Approves",
"a",
"translation",
"for",
"a",
"given",
"language",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/i18n/LanguageUtils.java#L320-L342 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.chmod | public static int chmod(String filename, String perm, boolean recursive)
throws IOException, InterruptedException {
StringBuffer cmdBuf = new StringBuffer();
cmdBuf.append("chmod ");
if (recursive) {
cmdBuf.append("-R ");
}
cmdBuf.append(perm).append(" ");
cmdBuf.append(filename);
String[] shellCmd = {"bash", "-c" ,cmdBuf.toString()};
ShellCommandExecutor shExec = new ShellCommandExecutor(shellCmd);
try {
shExec.execute();
}catch(IOException e) {
if(LOG.isDebugEnabled()) {
LOG.debug("Error while changing permission : " + filename
+" Exception: " + StringUtils.stringifyException(e));
}
}
return shExec.getExitCode();
} | java | public static int chmod(String filename, String perm, boolean recursive)
throws IOException, InterruptedException {
StringBuffer cmdBuf = new StringBuffer();
cmdBuf.append("chmod ");
if (recursive) {
cmdBuf.append("-R ");
}
cmdBuf.append(perm).append(" ");
cmdBuf.append(filename);
String[] shellCmd = {"bash", "-c" ,cmdBuf.toString()};
ShellCommandExecutor shExec = new ShellCommandExecutor(shellCmd);
try {
shExec.execute();
}catch(IOException e) {
if(LOG.isDebugEnabled()) {
LOG.debug("Error while changing permission : " + filename
+" Exception: " + StringUtils.stringifyException(e));
}
}
return shExec.getExitCode();
} | [
"public",
"static",
"int",
"chmod",
"(",
"String",
"filename",
",",
"String",
"perm",
",",
"boolean",
"recursive",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"StringBuffer",
"cmdBuf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"cmdBuf",
".... | Change the permissions on a file / directory, recursively, if
needed.
@param filename name of the file whose permissions are to change
@param perm permission string
@param recursive true, if permissions should be changed recursively
@return the exit code from the command.
@throws IOException
@throws InterruptedException | [
"Change",
"the",
"permissions",
"on",
"a",
"file",
"/",
"directory",
"recursively",
"if",
"needed",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L756-L776 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/CFFFontSubset.java | CFFFontSubset.BuildNewIndex | protected byte[] BuildNewIndex(int[] Offsets,HashMap Used,byte OperatorForUnusedEntries) throws IOException
{
int unusedCount = 0;
int Offset=0;
int[] NewOffsets = new int[Offsets.length];
// Build the Offsets Array for the Subset
for (int i=0;i<Offsets.length;++i)
{
NewOffsets[i] = Offset;
// If the object in the offset is also present in the used
// HashMap then increment the offset var by its size
if (Used.containsKey(Integer.valueOf(i))) {
Offset += Offsets[i+1] - Offsets[i];
} else {
// Else the same offset is kept in i+1.
unusedCount++;
}
}
// Offset var determines the size of the object array
byte[] NewObjects = new byte[Offset+unusedCount];
// Build the new Object array
int unusedOffset = 0;
for (int i=0;i<Offsets.length-1;++i)
{
int start = NewOffsets[i];
int end = NewOffsets[i+1];
NewOffsets[i] = start+unusedOffset;
// If start != End then the Object is used
// So, we will copy the object data from the font file
if (start != end)
{
// All offsets are Global Offsets relative to the beginning of the font file.
// Jump the file pointer to the start address to read from.
buf.seek(Offsets[i]);
// Read from the buffer and write into the array at start.
buf.readFully(NewObjects, start+unusedOffset, end-start);
} else {
NewObjects[start+unusedOffset] = OperatorForUnusedEntries;
unusedOffset++;
}
}
NewOffsets[Offsets.length-1] += unusedOffset;
// Use AssembleIndex to build the index from the offset & object arrays
return AssembleIndex(NewOffsets,NewObjects);
} | java | protected byte[] BuildNewIndex(int[] Offsets,HashMap Used,byte OperatorForUnusedEntries) throws IOException
{
int unusedCount = 0;
int Offset=0;
int[] NewOffsets = new int[Offsets.length];
// Build the Offsets Array for the Subset
for (int i=0;i<Offsets.length;++i)
{
NewOffsets[i] = Offset;
// If the object in the offset is also present in the used
// HashMap then increment the offset var by its size
if (Used.containsKey(Integer.valueOf(i))) {
Offset += Offsets[i+1] - Offsets[i];
} else {
// Else the same offset is kept in i+1.
unusedCount++;
}
}
// Offset var determines the size of the object array
byte[] NewObjects = new byte[Offset+unusedCount];
// Build the new Object array
int unusedOffset = 0;
for (int i=0;i<Offsets.length-1;++i)
{
int start = NewOffsets[i];
int end = NewOffsets[i+1];
NewOffsets[i] = start+unusedOffset;
// If start != End then the Object is used
// So, we will copy the object data from the font file
if (start != end)
{
// All offsets are Global Offsets relative to the beginning of the font file.
// Jump the file pointer to the start address to read from.
buf.seek(Offsets[i]);
// Read from the buffer and write into the array at start.
buf.readFully(NewObjects, start+unusedOffset, end-start);
} else {
NewObjects[start+unusedOffset] = OperatorForUnusedEntries;
unusedOffset++;
}
}
NewOffsets[Offsets.length-1] += unusedOffset;
// Use AssembleIndex to build the index from the offset & object arrays
return AssembleIndex(NewOffsets,NewObjects);
} | [
"protected",
"byte",
"[",
"]",
"BuildNewIndex",
"(",
"int",
"[",
"]",
"Offsets",
",",
"HashMap",
"Used",
",",
"byte",
"OperatorForUnusedEntries",
")",
"throws",
"IOException",
"{",
"int",
"unusedCount",
"=",
"0",
";",
"int",
"Offset",
"=",
"0",
";",
"int",... | Function builds the new offset array, object array and assembles the index.
used for creating the glyph and subrs subsetted index
@param Offsets the offset array of the original index
@param Used the hashmap of the used objects
@param OperatorForUnusedEntries the operator inserted into the data stream for unused entries
@return the new index subset version
@throws IOException | [
"Function",
"builds",
"the",
"new",
"offset",
"array",
"object",
"array",
"and",
"assembles",
"the",
"index",
".",
"used",
"for",
"creating",
"the",
"glyph",
"and",
"subrs",
"subsetted",
"index"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L937-L981 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | app/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/app/MainActivity.java | MainActivity.sendAutoRetryRequest | private void sendAutoRetryRequest(ResponseListener responseListener) {
Log.i("BMSCore", String.format("\n\nSending request to 504 endpoint"));
Request request504 = new Request("http://httpstat.us/504", Request.POST, 1000, 5);
request504.send(getApplicationContext(), "Sample upload text", responseListener);
} | java | private void sendAutoRetryRequest(ResponseListener responseListener) {
Log.i("BMSCore", String.format("\n\nSending request to 504 endpoint"));
Request request504 = new Request("http://httpstat.us/504", Request.POST, 1000, 5);
request504.send(getApplicationContext(), "Sample upload text", responseListener);
} | [
"private",
"void",
"sendAutoRetryRequest",
"(",
"ResponseListener",
"responseListener",
")",
"{",
"Log",
".",
"i",
"(",
"\"BMSCore\"",
",",
"String",
".",
"format",
"(",
"\"\\n\\nSending request to 504 endpoint\"",
")",
")",
";",
"Request",
"request504",
"=",
"new",... | Exercise auto-retries by trying to resend a request up to 5 times with a 504 (gateway timeout) response | [
"Exercise",
"auto",
"-",
"retries",
"by",
"trying",
"to",
"resend",
"a",
"request",
"up",
"to",
"5",
"times",
"with",
"a",
"504",
"(",
"gateway",
"timeout",
")",
"response"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/app/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/app/MainActivity.java#L141-L146 |
google/closure-compiler | src/com/google/javascript/jscomp/gwt/client/JsfileParser.java | JsfileParser.gjd | @JsMethod(namespace = "jscomp")
public static JsObject<Object> gjd(String code, String filename, @Nullable Reporter reporter) {
return parse(code, filename, reporter).full();
} | java | @JsMethod(namespace = "jscomp")
public static JsObject<Object> gjd(String code, String filename, @Nullable Reporter reporter) {
return parse(code, filename, reporter).full();
} | [
"@",
"JsMethod",
"(",
"namespace",
"=",
"\"jscomp\"",
")",
"public",
"static",
"JsObject",
"<",
"Object",
">",
"gjd",
"(",
"String",
"code",
",",
"String",
"filename",
",",
"@",
"Nullable",
"Reporter",
"reporter",
")",
"{",
"return",
"parse",
"(",
"code",
... | Method exported to JS to parse a file for dependencies and annotations. | [
"Method",
"exported",
"to",
"JS",
"to",
"parse",
"a",
"file",
"for",
"dependencies",
"and",
"annotations",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/gwt/client/JsfileParser.java#L219-L222 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getAvailableULocales | public static final ULocale[] getAvailableULocales(String baseName, ClassLoader loader) {
return getAvailEntry(baseName, loader).getULocaleList();
} | java | public static final ULocale[] getAvailableULocales(String baseName, ClassLoader loader) {
return getAvailEntry(baseName, loader).getULocaleList();
} | [
"public",
"static",
"final",
"ULocale",
"[",
"]",
"getAvailableULocales",
"(",
"String",
"baseName",
",",
"ClassLoader",
"loader",
")",
"{",
"return",
"getAvailEntry",
"(",
"baseName",
",",
"loader",
")",
".",
"getULocaleList",
"(",
")",
";",
"}"
] | Get the set of Locales installed in the specified bundles.
@return the list of available locales | [
"Get",
"the",
"set",
"of",
"Locales",
"installed",
"in",
"the",
"specified",
"bundles",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L475-L477 |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java | Utils.calculateLegendInformation | public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {
float textMargin = Utils.dpToPx(10.f);
float lastX = _StartX;
// calculate the legend label positions and check if there is enough space to display the label,
// if not the label will not be shown
for (BaseModel model : _Models) {
if (!model.isIgnore()) {
Rect textBounds = new Rect();
RectF legendBounds = model.getLegendBounds();
_Paint.getTextBounds(model.getLegendLabel(), 0, model.getLegendLabel().length(), textBounds);
model.setTextBounds(textBounds);
float centerX = legendBounds.centerX();
float centeredTextPos = centerX - (textBounds.width() / 2);
float textStartPos = centeredTextPos - textMargin;
// check if the text is too big to fit on the screen
if (centeredTextPos + textBounds.width() > _EndX - textMargin) {
model.setShowLabel(false);
} else {
// check if the current legend label overrides the label before
// if the label overrides the label before, the current label will not be shown.
// If not the label will be shown and the label position is calculated
if (textStartPos < lastX) {
if (lastX + textMargin < legendBounds.left) {
model.setLegendLabelPosition((int) (lastX + textMargin));
model.setShowLabel(true);
lastX = lastX + textMargin + textBounds.width();
} else {
model.setShowLabel(false);
}
} else {
model.setShowLabel(true);
model.setLegendLabelPosition((int) centeredTextPos);
lastX = centerX + (textBounds.width() / 2);
}
}
}
}
} | java | public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {
float textMargin = Utils.dpToPx(10.f);
float lastX = _StartX;
// calculate the legend label positions and check if there is enough space to display the label,
// if not the label will not be shown
for (BaseModel model : _Models) {
if (!model.isIgnore()) {
Rect textBounds = new Rect();
RectF legendBounds = model.getLegendBounds();
_Paint.getTextBounds(model.getLegendLabel(), 0, model.getLegendLabel().length(), textBounds);
model.setTextBounds(textBounds);
float centerX = legendBounds.centerX();
float centeredTextPos = centerX - (textBounds.width() / 2);
float textStartPos = centeredTextPos - textMargin;
// check if the text is too big to fit on the screen
if (centeredTextPos + textBounds.width() > _EndX - textMargin) {
model.setShowLabel(false);
} else {
// check if the current legend label overrides the label before
// if the label overrides the label before, the current label will not be shown.
// If not the label will be shown and the label position is calculated
if (textStartPos < lastX) {
if (lastX + textMargin < legendBounds.left) {
model.setLegendLabelPosition((int) (lastX + textMargin));
model.setShowLabel(true);
lastX = lastX + textMargin + textBounds.width();
} else {
model.setShowLabel(false);
}
} else {
model.setShowLabel(true);
model.setLegendLabelPosition((int) centeredTextPos);
lastX = centerX + (textBounds.width() / 2);
}
}
}
}
} | [
"public",
"static",
"void",
"calculateLegendInformation",
"(",
"List",
"<",
"?",
"extends",
"BaseModel",
">",
"_Models",
",",
"float",
"_StartX",
",",
"float",
"_EndX",
",",
"Paint",
"_Paint",
")",
"{",
"float",
"textMargin",
"=",
"Utils",
".",
"dpToPx",
"("... | Calculates the legend positions and which legend title should be displayed or not.
Important: the LegendBounds in the _Models should be set and correctly calculated before this
function is called!
@param _Models The graph data which should have the BaseModel class as parent class.
@param _StartX Left starting point on the screen. Should be the absolute pixel value!
@param _Paint The correctly set Paint which will be used for the text painting in the later process | [
"Calculates",
"the",
"legend",
"positions",
"and",
"which",
"legend",
"title",
"should",
"be",
"displayed",
"or",
"not",
"."
] | train | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L98-L140 |
upwork/java-upwork | src/com/Upwork/api/UpworkRestClient.java | UpworkRestClient.getJSONObject | public static JSONObject getJSONObject(HttpGet request, Integer method, HashMap<String, String> params) throws JSONException {
switch (method) {
case METHOD_GET:
return doGetRequest(request);
default:
throw new RuntimeException("Wrong http method requested");
}
} | java | public static JSONObject getJSONObject(HttpGet request, Integer method, HashMap<String, String> params) throws JSONException {
switch (method) {
case METHOD_GET:
return doGetRequest(request);
default:
throw new RuntimeException("Wrong http method requested");
}
} | [
"public",
"static",
"JSONObject",
"getJSONObject",
"(",
"HttpGet",
"request",
",",
"Integer",
"method",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"switch",
"(",
"method",
")",
"{",
"case",
"METHOD_GET",
... | Get JSON response for GET
@param request Request object for GET
@param method HTTP method
@param params POST parameters
@throws JSONException
@return {@link JSONObject} | [
"Get",
"JSON",
"response",
"for",
"GET"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/UpworkRestClient.java#L87-L94 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java | JsonModelCoder.encodeNullToNull | public void encodeNullToNull(Writer writer, T obj) throws IOException {
if (obj == null) {
writer.write("null");
return;
}
JsonUtil.startHash(writer);
encodeValue(writer, obj);
JsonUtil.endHash(writer);
writer.flush();
} | java | public void encodeNullToNull(Writer writer, T obj) throws IOException {
if (obj == null) {
writer.write("null");
return;
}
JsonUtil.startHash(writer);
encodeValue(writer, obj);
JsonUtil.endHash(writer);
writer.flush();
} | [
"public",
"void",
"encodeNullToNull",
"(",
"Writer",
"writer",
",",
"T",
"obj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"null\"",
")",
";",
"return",
";",
"}",
"JsonUtil",
".",
"startH... | Encodes the given value into the JSON format, and writes it using the given writer.<br>
Writes "null" if null is given.
@param writer {@link Writer} to be used for writing value
@param obj Value to encoded
@throws IOException | [
"Encodes",
"the",
"given",
"value",
"into",
"the",
"JSON",
"format",
"and",
"writes",
"it",
"using",
"the",
"given",
"writer",
".",
"<br",
">",
"Writes",
"null",
"if",
"null",
"is",
"given",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L429-L442 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.