_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q160000 | AnimaQuery.between | train | public <R> AnimaQuery<T> between(TypeFunction<T, R> function, Object a, Object b) {
String columnName = AnimaUtils.getLambdaColumnName(function);
return this.between(columnName, a, b);
} | java | {
"resource": ""
} |
q160001 | AnimaQuery.gte | train | public <S extends Model, R> AnimaQuery<T> gte(TypeFunction<S, R> function, Object value) {
String columnName = AnimaUtils.getLambdaColumnName(function);
return this.gte(columnName, value);
} | java | {
"resource": ""
} |
q160002 | AnimaQuery.lt | train | public AnimaQuery<T> lt(String column, Object value) {
conditionSQL.append(" AND ").append(column).append(" < ?");
paramValues.add(value);
return this;
} | java | {
"resource": ""
} |
q160003 | AnimaQuery.in | train | public <S> AnimaQuery<T> in(List<S> list) {
return this.in(list.toArray());
} | java | {
"resource": ""
} |
q160004 | AnimaQuery.order | train | public <R> AnimaQuery<T> order(TypeFunction<T, R> function, OrderBy orderBy) {
String columnName = AnimaUtils.getLambdaColumnName(function);
return order(columnName, orderBy);
} | java | {
"resource": ""
} |
q160005 | AnimaQuery.byId | train | public T byId(Object id) {
this.beforeCheck();
this.where(primaryKeyColumn, id);
String sql = this.buildSelectSQL(false);
T model = this.queryOne(modelClass, sql, paramValues);
ifNotNullThen(model, () -> this.setJoin(Collections.singletonList(model)));
return model;
... | java | {
"resource": ""
} |
q160006 | AnimaQuery.one | train | public T one() {
this.beforeCheck();
String sql = this.buildSelectSQL(true);
T model = this.queryOne(modelClass, sql, paramValues);
ifThen(null != model && null != joinParams,
() -> this.setJoin(Collections.singletonList(model)));
return model;
} | java | {
"resource": ""
} |
q160007 | AnimaQuery.all | train | public List<T> all() {
this.beforeCheck();
String sql = this.buildSelectSQL(true);
List<T> models = this.queryList(modelClass, sql, paramValues);
this.setJoin(models);
return models;
} | java | {
"resource": ""
} |
q160008 | AnimaQuery.map | train | public <R> Stream<R> map(Function<T, R> function) {
return stream().map(function);
} | java | {
"resource": ""
} |
q160009 | AnimaQuery.limit | train | public List<T> limit(int limit) {
return ifReturn(Anima.of().isUseSQLLimit(),
() -> {
isSQLLimit = true;
paramValues.add(limit);
return all();
},
() -> {
List<T> all = all();
... | java | {
"resource": ""
} |
q160010 | AnimaQuery.page | train | public Page<T> page(PageRow pageRow) {
String sql = this.buildSelectSQL(false);
return this.page(sql, pageRow);
} | java | {
"resource": ""
} |
q160011 | AnimaQuery.set | train | public AnimaQuery<T> set(String column, Object value) {
updateColumns.put(column, value);
return this;
} | java | {
"resource": ""
} |
q160012 | AnimaQuery.set | train | public <S extends Model, R> AnimaQuery<T> set(TypeFunction<S, R> function, Object value) {
return this.set(AnimaUtils.getLambdaColumnName(function), value);
} | java | {
"resource": ""
} |
q160013 | AnimaQuery.join | train | public AnimaQuery<T> join(JoinParam joinParam) {
ifNullThrow(joinParam,
new AnimaException("Join param not null"));
ifNullThrow(joinParam.getJoinModel(),
new AnimaException("Join param [model] not null"));
ifNullThrow(AnimaUtils.isEmpty(joinParam.getFieldName())... | java | {
"resource": ""
} |
q160014 | AnimaQuery.save | train | public <S extends Model> ResultKey save(S model) {
List<Object> columnValues = AnimaUtils.toColumnValues(model, true);
String sql = this.buildInsertSQL(model, columnValues);
Connection conn = getConn();
try {
List<Object> params = columnValues.stream... | java | {
"resource": ""
} |
q160015 | AnimaQuery.updateById | train | public <S extends Model> int updateById(S model, Serializable id) {
this.where(primaryKeyColumn, id);
String sql = this.buildUpdateSQL(model, null);
List<Object> columnValueList = AnimaUtils.toColumnValues(model, false);
columnValueList.add(id);
return this.exec... | java | {
"resource": ""
} |
q160016 | AnimaQuery.updateByModel | train | public <S extends Model> int updateByModel(S model) {
this.beforeCheck();
Object primaryKey = AnimaUtils.getAndRemovePrimaryKey(model);
StringBuilder sql = new StringBuilder(this.buildUpdateSQL(model, null));
List<Object> columnValueList = AnimaUtils.toColumnValues(model, false);
... | java | {
"resource": ""
} |
q160017 | AnimaQuery.buildSelectSQL | train | private String buildSelectSQL(boolean addOrderBy) {
SQLParams sqlParams = SQLParams.builder()
.modelClass(this.modelClass)
.selectColumns(this.selectColumns)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.conditionSQL(th... | java | {
"resource": ""
} |
q160018 | AnimaQuery.buildCountSQL | train | private String buildCountSQL() {
SQLParams sqlParams = SQLParams.builder()
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.conditionSQL(this.conditionSQL)
.build();
return Anima.of().d... | java | {
"resource": ""
} |
q160019 | AnimaQuery.buildPageSQL | train | private String buildPageSQL(String sql, PageRow pageRow) {
SQLParams sqlParams = SQLParams.builder()
.modelClass(this.modelClass)
.selectColumns(this.selectColumns)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.conditio... | java | {
"resource": ""
} |
q160020 | AnimaQuery.buildInsertSQL | train | private <S extends Model> String buildInsertSQL(S model, List<Object> columnValues) {
SQLParams sqlParams = SQLParams.builder()
.model(model)
.columnValues(columnValues)
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkNam... | java | {
"resource": ""
} |
q160021 | AnimaQuery.buildUpdateSQL | train | private <S extends Model> String buildUpdateSQL(S model, Map<String, Object> updateColumns) {
SQLParams sqlParams = SQLParams.builder()
.model(model)
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
... | java | {
"resource": ""
} |
q160022 | AnimaQuery.buildDeleteSQL | train | private <S extends Model> String buildDeleteSQL(S model) {
SQLParams sqlParams = SQLParams.builder()
.model(model)
.modelClass(this.modelClass)
.tableName(this.tableName)
.pkName(this.primaryKeyColumn)
.conditionSQL(this.conditionSQ... | java | {
"resource": ""
} |
q160023 | AnimaQuery.getConn | train | private Connection getConn() {
Connection connection = localConnection.get();
return ifNotNullReturn(connection, connection, this.getSql2o().open());
} | java | {
"resource": ""
} |
q160024 | AnimaQuery.beginTransaction | train | public static void beginTransaction() {
ifNullThen(localConnection.get(),
() -> {
Connection connection = getSql2o().beginTransaction();
localConnection.set(connection);
});
} | java | {
"resource": ""
} |
q160025 | AnimaQuery.endTransaction | train | public static void endTransaction() {
ifNotNullThen(localConnection.get(),
() -> {
Connection connection = localConnection.get();
ifThen(connection.isRollbackOnClose(), connection::close);
localConnection.remove();
});
... | java | {
"resource": ""
} |
q160026 | AnimaQuery.setJoin | train | private void setJoin(List<T> models) {
if (null == models || models.isEmpty() ||
joinParams.size() == 0) {
return;
}
models.stream().filter(Objects::nonNull).forEach(this::setJoin);
} | java | {
"resource": ""
} |
q160027 | AnimaQuery.setJoin | train | private void setJoin(T model) {
for (JoinParam joinParam : joinParams) {
try {
Object leftValue = AnimaUtils.invokeMethod(
model,
getGetterName(joinParam.getOnLeft()),
AnimaUtils.EMPTY_ARG);
Stri... | java | {
"resource": ""
} |
q160028 | AnimaQuery.clean | train | private void clean(Connection conn) {
this.selectColumns = null;
this.isSQLLimit = false;
this.orderBySQL = new StringBuilder();
this.conditionSQL = new StringBuilder();
this.paramValues.clear();
this.excludedColumns.clear();
this.updateColumns.clear();
i... | java | {
"resource": ""
} |
q160029 | AnimaUtils.getAndRemovePrimaryKey | train | public static <S extends Model> Object getAndRemovePrimaryKey(S model) {
String fieldName = getPKField(model.getClass());
Object value = invokeMethod(model, getGetterName(fieldName), EMPTY_ARG);
if (null != value) {
invokeMethod(model, getSetterName(fieldName), NULL_ARG);
... | java | {
"resource": ""
} |
q160030 | AnimaUtils.toArray | train | public static <T> T[] toArray(List<T> list) {
T[] toR = (T[]) Array.newInstance(list.get(0).getClass(), list.size());
for (int i = 0; i < list.size(); i++) {
toR[i] = list.get(i);
}
return toR;
} | java | {
"resource": ""
} |
q160031 | Model.set | train | public AnimaQuery<? extends Model> set(String column, Object value) {
return query.set(column, value);
} | java | {
"resource": ""
} |
q160032 | Model.set | train | public <T extends Model, R> AnimaQuery<? extends Model> set(TypeFunction<T, R> function, Object value) {
return query.set(function, value);
} | java | {
"resource": ""
} |
q160033 | Anima.open | train | public static Anima open(Sql2o sql2o) {
Anima anima = new Anima();
anima.setSql2o(sql2o);
instance = anima;
return anima;
} | java | {
"resource": ""
} |
q160034 | Anima.open | train | public static Anima open(String url, Quirks quirks) {
return open(url, null, null, quirks);
} | java | {
"resource": ""
} |
q160035 | Anima.open | train | public static Anima open(DataSource dataSource, Quirks quirks) {
return open(new Sql2o(dataSource, quirks));
} | java | {
"resource": ""
} |
q160036 | Anima.atomic | train | public static Atomic atomic(Runnable runnable) {
try {
AnimaQuery.beginTransaction();
runnable.run();
AnimaQuery.commit();
return Atomic.ok();
} catch (Exception e) {
boolean isRollback = ifReturn(
of().rollbackException.is... | java | {
"resource": ""
} |
q160037 | Anima.addConverter | train | public Anima addConverter(Converter<?>... converters) {
ifThrow(null == converters || converters.length == 0,
new AnimaException("converters not be null."));
for (Converter<?> converter : converters) {
Class<?> type = AnimaUtils.getConverterType(converter);
sql2o... | java | {
"resource": ""
} |
q160038 | Anima.select | train | @SafeVarargs
public static <T extends Model, R> Select select(TypeFunction<T, R>... functions) {
return select(
Arrays.stream(functions)
.map(AnimaUtils::getLambdaColumnName)
.collect(joining(", ")));
} | java | {
"resource": ""
} |
q160039 | Anima.saveBatch | train | public static <T extends Model> void saveBatch(List<T> models) {
atomic(() -> models.forEach(Anima::save))
.catchException(e -> log.error("Batch save model error, message: {}", e));
} | java | {
"resource": ""
} |
q160040 | Anima.deleteBatch | train | @SafeVarargs
public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, S... ids) {
atomic(() -> Arrays.stream(ids)
.forEach(new AnimaQuery<>(model)::deleteById))
.catchException(e -> log.error("Batch save model error, message: {}", e));
} | java | {
"resource": ""
} |
q160041 | Anima.deleteBatch | train | public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, List<S> idList) {
deleteBatch(model, AnimaUtils.toArray(idList));
} | java | {
"resource": ""
} |
q160042 | Anima.deleteById | train | public static <T extends Model> int deleteById(Class<T> model, Serializable id) {
return new AnimaQuery<>(model).deleteById(id);
} | java | {
"resource": ""
} |
q160043 | Row.asMap | train | public Map<String, Object> asMap() {
Map<String, Object> map = new HashMap<>();
Set<String> keys = columnNameToIdxMap.keySet();
Iterator<String> iterator = keys.iterator();
while (iterator.hasNext()) {
String colum = iterator.next().toString();
int index = columnN... | java | {
"resource": ""
} |
q160044 | AnimaCache.getTableName | train | public static String getTableName(String className, String prefix) {
boolean hasPrefix = prefix != null && prefix.trim().length() > 0;
return hasPrefix ? English.plural(prefix + "_" + AnimaUtils.toUnderline(className), 2) : English.plural(AnimaUtils.toUnderline(className), 2);
} | java | {
"resource": ""
} |
q160045 | AbstractCertStoreInspector.selectCertificate | train | X509Certificate selectCertificate(final CertStore store,
final Collection<X509CertSelector> selectors) throws CertStoreException {
for (CertSelector selector : selectors) {
LOGGER.debug("Selecting certificate using {}", selector);
Collection<? extends Certificate> certs = store
.getCertificates(selector... | java | {
"resource": ""
} |
q160046 | Client.validateInput | train | private void validateInput() {
// Check for null values first.
if (url == null) {
throw new NullPointerException("URL should not be null");
}
if (!url.getProtocol().matches("^https?$")) {
throw new IllegalArgumentException(
"URL protocol should... | java | {
"resource": ""
} |
q160047 | Client.createTransport | train | private Transport createTransport(final String profile) {
if (getCaCapabilities(profile).isPostSupported()) {
return transportFactory.forMethod(Method.POST, url);
} else {
return transportFactory.forMethod(Method.GET, url);
}
} | java | {
"resource": ""
} |
q160048 | ConsoleCertificateVerifier.verify | train | @Override
public boolean verify(final X509Certificate cert) {
final List<String> algs = new ArrayList<String>(
getAlgorithms(MessageDigest.class.getSimpleName()));
Collections.sort(algs);
int max = 0;
for (final String alg : algs) {
if (alg.length() > max)... | java | {
"resource": ""
} |
q160049 | PkcsPkiEnvelopeEncoder.encode | train | public CMSEnvelopedData encode(final byte[] messageData)
throws MessageEncodingException {
LOGGER.debug("Encoding pkcsPkiEnvelope");
CMSEnvelopedDataGenerator edGenerator = new CMSEnvelopedDataGenerator();
CMSTypedData envelopable = new CMSProcessableByteArray(messageData);
R... | java | {
"resource": ""
} |
q160050 | Capabilities.getStrongestCipher | train | public String getStrongestCipher() {
final String cipher;
if (cipherExists("AES") && caps.contains(Capability.AES)) {
cipher = "AES";
} else if (cipherExists("DESede")
&& caps.contains(Capability.TRIPLE_DES)) {
cipher = "DESede";
} else {
... | java | {
"resource": ""
} |
q160051 | Capabilities.getStrongestMessageDigest | train | public MessageDigest getStrongestMessageDigest() {
if (digestExists("SHA-512") && caps.contains(Capability.SHA_512)) {
return getDigest("SHA-512");
} else if (digestExists("SHA-256") && caps.contains(Capability.SHA_256)) {
return getDigest("SHA-256");
} else if (digestExi... | java | {
"resource": ""
} |
q160052 | SignedDataUtils.isSignedBy | train | public static boolean isSignedBy(final CMSSignedData sd,
final X509Certificate signer) {
SignerInformationStore store = sd.getSignerInfos();
SignerInformation signerInfo = store.get(new JcaSignerId(signer));
if (signerInfo == null) {
return false;
}
CMSSig... | java | {
"resource": ""
} |
q160053 | X500Utils.toX500Name | train | public static X500Name toX500Name(final X500Principal principal) {
byte[] bytes = principal.getEncoded();
return X500Name.getInstance(bytes);
} | java | {
"resource": ""
} |
q160054 | PrettyTimeParser.provideRepresentation | train | private String provideRepresentation(int number)
{
String key;
if (number == 0)
key = "zero";
else if (number < 20)
key = numNames[number];
else if (number < 100)
{
int unit = number % 10;
key = tensNames[number / 10] + numNames[unit];
}
... | java | {
"resource": ""
} |
q160055 | SnappyFramedOutputStream.flushBuffer | train | private void flushBuffer()
throws IOException
{
if (buffer.position() > 0) {
buffer.flip();
writeCompressed(buffer);
buffer.clear();
}
} | java | {
"resource": ""
} |
q160056 | Snappy.arrayCopy | train | public static void arrayCopy(Object src, int offset, int byteLength, Object dest, int dest_offset)
throws IOException
{
impl.arrayCopy(src, offset, byteLength, dest, dest_offset);
} | java | {
"resource": ""
} |
q160057 | Snappy.compress | train | public static int compress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException
{
return rawCompress(input, inputOffset, inputLength, output, outputOffset);
} | java | {
"resource": ""
} |
q160058 | Snappy.getNativeLibraryVersion | train | public static String getNativeLibraryVersion()
{
URL versionFile = SnappyLoader.class.getResource("/org/xerial/snappy/VERSION");
String version = "unknown";
try {
if (versionFile != null) {
InputStream in = null;
try {
Properti... | java | {
"resource": ""
} |
q160059 | Snappy.rawCompress | train | public static long rawCompress(long inputAddr, long inputSize, long destAddr)
throws IOException
{
return impl.rawCompress(inputAddr, inputSize, destAddr);
} | java | {
"resource": ""
} |
q160060 | Snappy.rawUncompress | train | public static long rawUncompress(long inputAddr, long inputSize, long destAddr)
throws IOException
{
return impl.rawUncompress(inputAddr, inputSize, destAddr);
} | java | {
"resource": ""
} |
q160061 | Snappy.rawCompress | train | public static byte[] rawCompress(Object data, int byteSize)
throws IOException
{
byte[] buf = new byte[Snappy.maxCompressedLength(byteSize)];
int compressedByteSize = impl.rawCompress(data, 0, byteSize, buf, 0);
byte[] result = new byte[compressedByteSize];
System.arrayco... | java | {
"resource": ""
} |
q160062 | Snappy.rawCompress | train | public static int rawCompress(Object input, int inputOffset, int inputLength, byte[] output, int outputOffset)
throws IOException
{
if (input == null || output == null) {
throw new NullPointerException("input or output is null");
}
int compressedSize = impl
... | java | {
"resource": ""
} |
q160063 | Snappy.uncompress | train | public static byte[] uncompress(byte[] input)
throws IOException
{
byte[] result = new byte[Snappy.uncompressedLength(input)];
Snappy.uncompress(input, 0, input.length, result, 0);
return result;
} | java | {
"resource": ""
} |
q160064 | Snappy.uncompressDoubleArray | train | public static double[] uncompressDoubleArray(byte[] input)
throws IOException
{
int uncompressedLength = Snappy.uncompressedLength(input, 0, input.length);
double[] result = new double[uncompressedLength / 8];
impl.rawUncompress(input, 0, input.length, result, 0);
return ... | java | {
"resource": ""
} |
q160065 | Snappy.uncompressFloatArray | train | public static float[] uncompressFloatArray(byte[] input, int offset, int length)
throws IOException
{
int uncompressedLength = Snappy.uncompressedLength(input, offset, length);
float[] result = new float[uncompressedLength / 4];
impl.rawUncompress(input, offset, length, result, 0... | java | {
"resource": ""
} |
q160066 | Snappy.uncompressString | train | public static String uncompressString(byte[] input, int offset, int length)
throws IOException
{
try {
return uncompressString(input, offset, length, "UTF-8");
}
catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 decoder is not... | java | {
"resource": ""
} |
q160067 | Snappy.uncompressString | train | public static String uncompressString(byte[] input, int offset, int length, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = new byte[uncompressedLength(input, offset, length)];
uncompress(input, offset, length, uncompressed, 0);
... | java | {
"resource": ""
} |
q160068 | Snappy.uncompressString | train | public static String uncompressString(byte[] input, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = uncompress(input);
return new String(uncompressed, encoding);
} | java | {
"resource": ""
} |
q160069 | SnappyInputStream.rawRead | train | public int rawRead(Object array, int byteOffset, int byteLength)
throws IOException
{
int writtenBytes = 0;
for (; writtenBytes < byteLength; ) {
if (uncompressedCursor >= uncompressedLimit) {
if (hasNextChunk()) {
continue;
... | java | {
"resource": ""
} |
q160070 | SnappyInputStream.readNext | train | private int readNext(byte[] dest, int offset, int len)
throws IOException
{
int readBytes = 0;
while (readBytes < len) {
int ret = in.read(dest, readBytes + offset, len - readBytes);
if (ret == -1) {
finishedReading = true;
return r... | java | {
"resource": ""
} |
q160071 | BitShuffle.shuffle | train | public static byte[] shuffle(short[] input) throws IOException {
byte[] output = new byte[input.length * 2];
int numProcessed = impl.shuffle(input, 0, 2, input.length * 2, output, 0);
assert(numProcessed == input.length * 2);
return output;
} | java | {
"resource": ""
} |
q160072 | BitShuffle.unshuffle | train | public static int unshuffle(ByteBuffer shuffled, BitShuffleType type, ByteBuffer output) throws IOException {
if (!shuffled.isDirect()) {
throw new SnappyError(SnappyErrorCode.NOT_A_DIRECT_BUFFER, "input is not a direct buffer");
}
if (!output.isDirect()) {
throw new Snap... | java | {
"resource": ""
} |
q160073 | BitShuffle.unshuffleShortArray | train | public static short[] unshuffleShortArray(byte[] input) throws IOException {
short[] output = new short[input.length / 2];
int numProcessed = impl.unshuffle(input, 0, 2, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | {
"resource": ""
} |
q160074 | BitShuffle.unshuffleIntArray | train | public static int[] unshuffleIntArray(byte[] input) throws IOException {
int[] output = new int[input.length / 4];
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | {
"resource": ""
} |
q160075 | BitShuffle.unshuffleLongArray | train | public static long[] unshuffleLongArray(byte[] input) throws IOException {
long[] output = new long[input.length / 8];
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | {
"resource": ""
} |
q160076 | BitShuffle.unshuffleFloatArray | train | public static float[] unshuffleFloatArray(byte[] input) throws IOException {
float[] output = new float[input.length / 4];
int numProcessed = impl.unshuffle(input, 0, 4, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | {
"resource": ""
} |
q160077 | BitShuffle.unshuffleDoubleArray | train | public static double[] unshuffleDoubleArray(byte[] input) throws IOException {
double[] output = new double[input.length / 8];
int numProcessed = impl.unshuffle(input, 0, 8, input.length, output, 0);
assert(numProcessed == input.length);
return output;
} | java | {
"resource": ""
} |
q160078 | SnappyOutputStream.rawWrite | train | public void rawWrite(Object array, int byteOffset, int byteLength)
throws IOException
{
if (closed) {
throw new IOException("Stream is closed");
}
int cursor = 0;
while (cursor < byteLength) {
int readLen = Math.min(byteLength - cursor, blockSize -... | java | {
"resource": ""
} |
q160079 | SnappyLoader.loadNativeLibrary | train | private synchronized static void loadNativeLibrary()
{
if (!isLoaded) {
try {
nativeLibFile = findNativeLibrary();
if (nativeLibFile != null) {
// Load extracted or specified snappyjava native library.
System.load(nativeLibF... | java | {
"resource": ""
} |
q160080 | SnappyLoader.extractLibraryFile | train | private static File extractLibraryFile(String libFolderForCurrentOS, String libraryFileName, String targetFolder)
{
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
// Attach UUID to the native library file to ensure multiple class loaders can read the libsnappy-java mu... | java | {
"resource": ""
} |
q160081 | SnappyLoader.getVersion | train | public static String getVersion()
{
URL versionFile = SnappyLoader.class
.getResource("/META-INF/maven/org.xerial.snappy/snappy-java/pom.properties");
if (versionFile == null) {
versionFile = SnappyLoader.class.getResource("/org/xerial/snappy/VERSION");
}
... | java | {
"resource": ""
} |
q160082 | SpoonRunner.run | train | public boolean run() {
otherApks.forEach(otherApk -> {
checkArgument(otherApk.exists(), "Could not find other APK: " + otherApk);
});
checkArgument(testApk.exists(), "Could not find test APK: " + testApk);
AndroidDebugBridge adb = SpoonUtils.initAdb(androidSdk, adbTimeout);
try {
final... | java | {
"resource": ""
} |
q160083 | DeviceUtils.scrubModel | train | static String scrubModel(String manufacturer, String model) {
if (manufacturer == null || model == null) {
return model;
}
if (model.regionMatches(true, 0, manufacturer, 0, manufacturer.length())) {
model = model.substring(manufacturer.length());
}
if (model.length() > 0 && (model.charAt... | java | {
"resource": ""
} |
q160084 | DeviceUtils.scrubLanguage | train | static String scrubLanguage(String language) {
if ("ldpi".equals(language)
|| "mdpi".equals(language)
|| "hdpi".equals(language)
|| "xhdpi".equals(language)) {
return null; // HTC, you suck!
}
return language;
} | java | {
"resource": ""
} |
q160085 | StringBlock.find | train | public int find(String string) {
if (m_strings == null) {
return -1;
}
for (int i = 0; i < m_strings.length - 1; i++) {
if (m_strings[i].equals(string)) {
return i;
}
}
return -1;
} | java | {
"resource": ""
} |
q160086 | StringBlock.stringAt | train | private String stringAt(int index) {
// Determine the offset from the start of the string pool.
int offset = m_stringOffsets[index];
// For convenience, wrap the string pool in ByteBuffer
// so that it will handle advancing the buffer index.
ByteBuffer buffer =
B... | java | {
"resource": ""
} |
q160087 | SpoonInstrumentationInfo.parseFromFile | train | static SpoonInstrumentationInfo parseFromFile(File apkTestFile) {
try (ZipFile zip = new ZipFile(apkTestFile)) {
ZipEntry entry = zip.getEntry("AndroidManifest.xml");
InputStream is = zip.getInputStream(entry);
AXMLParser parser = new AXMLParser(is);
int eventType = parser.getType();
... | java | {
"resource": ""
} |
q160088 | HtmlUtils.getStatusCssClass | train | static String getStatusCssClass(DeviceTestResult testResult) {
String status;
switch (testResult.getStatus()) {
case PASS:
status = "pass";
break;
case IGNORED:
status = "ignored";
break;
case FAIL:
status = "fail";
break;
case ASSUMPTION_F... | java | {
"resource": ""
} |
q160089 | SpoonUtils.obtainRealDevice | train | static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
// Get an existing real device.
for (IDevice adbDevice : adb.getDevices()) {
if (adbDevice.getSerialNumber().equals(serial)) {
return adbDevice;
}
}
throw new IllegalArgumentException("Unknown device serial: " +... | java | {
"resource": ""
} |
q160090 | SpoonUtils.findAllDevices | train | public static Set<String> findAllDevices(AndroidDebugBridge adb, Integer minApiLevel) {
Set<String> devices = new LinkedHashSet<>();
for (IDevice realDevice : adb.getDevices()) {
if (minApiLevel == null) {
devices.add(realDevice.getSerialNumber());
} else {
DeviceDetails deviceDetail... | java | {
"resource": ""
} |
q160091 | AXMLParser.next | train | public final int next() throws IOException {
if (m_nextException!=null) {
throw m_nextException;
}
try {
return doNext();
}
catch (IOException e) {
m_nextException=e;
resetState();
throw e;
}
} | java | {
"resource": ""
} |
q160092 | AXMLParser.getAttributeResourceID | train | public final int getAttributeResourceID(int index) {
int resourceIndex=getAttribute(index).name;
if (m_resourceIDs==null ||
resourceIndex<0 || resourceIndex>=m_resourceIDs.length)
{
return 0;
}
return m_resourceIDs[resourceIndex];
} | java | {
"resource": ""
} |
q160093 | SpoonDeviceRunner.createConfiguredRunner | train | private RemoteAndroidTestRunner createConfiguredRunner(String testPackage, String testRunner,
IDevice device) throws Exception {
RemoteAndroidTestRunner runner = new SpoonAndroidTestRunner(
instrumentationInfo.getApplicationPackage(), testPackage, testRunner, device,
clearAppDataBefor... | java | {
"resource": ""
} |
q160094 | SpoonDeviceRunner.pullDeviceFiles | train | private void pullDeviceFiles(IDevice device) throws Exception {
for (String dir : DEVICE_DIRS) {
pullDirectory(device, dir);
}
} | java | {
"resource": ""
} |
q160095 | JUnitStepListener.cleanData | train | private void cleanData(List<GalenTestInfo> testInfos) {
for (GalenTestInfo testInfo : testInfos) {
if (testInfo.getReport() != null) {
try {
FileTempStorage storage = testInfo.getReport().getFileStorage();
if (storage != null) {
... | java | {
"resource": ""
} |
q160096 | GalenJsExecutor.evalStrictToString | train | @Override
public String evalStrictToString(String script) {
Object returnedObject = context.evaluateString(scope, script, "<cmd>", 1, null);
String unwrappedObject = unwrapProcessedObjectToString(returnedObject);
if (unwrappedObject != null) {
return unwrappedObject;
} e... | java | {
"resource": ""
} |
q160097 | SpecGenerator.restructurePageItems | train | private List<PageItemNode> restructurePageItems(List<PageItem> items) {
List<PageItemNode> pins = items.stream().map(PageItemNode::new).collect(toList());
for (PageItemNode pinA : pins) {
for (PageItemNode pinB: pins) {
if (pinA != pinB) {
if (isInside(pin... | java | {
"resource": ""
} |
q160098 | PageSpec.setObjects | train | public void setObjects(Map<String, Locator> objects) {
this.objects.clear();
if (objects != null) {
this.objects.putAll(objects);
}
} | java | {
"resource": ""
} |
q160099 | PageSpec.setObjectGroups | train | public void setObjectGroups(Map<String, List<String>> objectGroups) {
this.objectGroups.clear();
if (objectGroups != null) {
this.objectGroups.putAll(objectGroups);
}
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.