method2testcases stringlengths 118 6.63k |
|---|
### Question:
PoolManagement { public RedisPools createRedisPoolAndConnection(RedisPoolProperty property) throws Exception { return getRedisPool(createRedisPool(property)); } private PoolManagement(); synchronized static PoolManagement getInstance(); RedisPools getRedisPool(); RedisPools getRedisPool(String poolId); R... |
### Question:
RedisHash extends Commands { public Long saveWhenNotExist(String key, String member, String value) { return getJedis().hsetnx(key, member, value); } private RedisHash(); synchronized static RedisHash getInstance(); Long save(String key, String member, String value); String save(String key, Map<String, St... |
### Question:
RedisHash extends Commands { public String get(String key, String member) { return getJedis().hget(key, member); } private RedisHash(); synchronized static RedisHash getInstance(); Long save(String key, String member, String value); String save(String key, Map<String, String> map); Long saveWhenNotExist(... |
### Question:
RedisHash extends Commands { public Set<String> getMembers(String key) { return getJedis().hkeys(key); } private RedisHash(); synchronized static RedisHash getInstance(); Long save(String key, String member, String value); String save(String key, Map<String, String> map); Long saveWhenNotExist(String key... |
### Question:
RedisHash extends Commands { public List<String> getValues(String key) { return getJedis().hvals(key); } private RedisHash(); synchronized static RedisHash getInstance(); Long save(String key, String member, String value); String save(String key, Map<String, String> map); Long saveWhenNotExist(String key... |
### Question:
RedisHash extends Commands { public Long increase(String key, String member, long value) throws TypeErrorException { Long result; try { result = getJedis().hincrBy(key, member, value); } catch (Exception e) { throw new TypeErrorException(ExceptionInfo.TYPE_ERROR, e, RedisHash.class); } return result; } pr... |
### Question:
RedisHash extends Commands { public Double increaseByFloat(String key, String member, double value) throws TypeErrorException { Double result; try { result = getJedis().hincrByFloat(key, member, value); } catch (Exception e) { throw new TypeErrorException(ExceptionInfo.TYPE_ERROR, e, RedisHash.class); } r... |
### Question:
RedisHash extends Commands { public Long length(String key) { return getJedis().hlen(key); } private RedisHash(); synchronized static RedisHash getInstance(); Long save(String key, String member, String value); String save(String key, Map<String, String> map); Long saveWhenNotExist(String key, String mem... |
### Question:
RedisHash extends Commands { public Long remove(String key, String... members) { return getJedis().hdel(key, members); } private RedisHash(); synchronized static RedisHash getInstance(); Long save(String key, String member, String value); String save(String key, Map<String, String> map); Long saveWhenNot... |
### Question:
PoolManagement { public RedisPools getRedisPool() { if (currentPoolId == null) { logger.error(ExceptionInfo.NOT_EXIST_CURRENT_POOL); return null; } try { return getRedisPool(currentPoolId); } catch (Exception e) { logger.error(e.getMessage()); logger.debug(NoticeInfo.ERROR_INFO, e); return null; } } priva... |
### Question:
PoolManagement { public boolean checkConnection(RedisPoolProperty property) { if (!validate(property)) { return false; } RedisPools pools = new RedisPools(); pools.setProperty(property); boolean flag = pools.available(); pools.destroyPool(); return flag; } private PoolManagement(); synchronized static Po... |
### Question:
SplashUrlDecoder { public static LaunchData getLaunchType(String launchUri) { if (launchUri == null) { launchUri = ""; } LaunchData data; if (launchUri.contains(ADD_ISSUER_PATH)) { data = handleAddIssuerUri(launchUri); if (data != null) { return data; } } else if (launchUri.contains(ADD_CERT_PATH)) { data... |
### Question:
Metadata { public List<String> getDisplayOrder() { return mDisplayOrder; } Metadata(List<String> displayOrder, Map<String, JsonObject> groups, Map<String, GroupDef> groupDefinitions, List<Field> fields); List<String> getDisplayOrder(); Map<String, JsonObject> getGroups(); Map<String, GroupDef> getGroupDef... |
### Question:
Metadata { public List<Field> getFields() { return mFields; } Metadata(List<String> displayOrder, Map<String, JsonObject> groups, Map<String, GroupDef> groupDefinitions, List<Field> fields); List<String> getDisplayOrder(); Map<String, JsonObject> getGroups(); Map<String, GroupDef> getGroupDefinitions(); L... |
### Question:
BitcoinUtils { public static List<String> generateMnemonic(byte[] seedData) { if (MnemonicCode.INSTANCE == null) { return null; } try { return MnemonicCode.INSTANCE.toMnemonic(seedData); } catch (MnemonicException.MnemonicLengthException e) { Timber.e(e, "Unable to create mnemonic from word list"); } retu... |
### Question:
BitcoinUtils { public static boolean isValidPassphrase(String passphrase) { try { byte[] entropy = MnemonicCode.INSTANCE.toEntropy(Arrays.asList(passphrase.split(" "))); return entropy.length > 0; } catch (MnemonicException e) { Timber.e(e, "Invalid passphrase"); return false; } } static void init(Contex... |
### Question:
Cloud { public void createPacketsFile() { File packetsFile = new File(this.sharedDir, "Packets.txt"); if (packetsFile.exists()) { try { packetsFile.createNewFile(); } catch (IOException e) { log.error("Cannot create", e); } } try (PrintWriter writer = new PrintWriter(new FileOutputStream(packetsFile))) { ... |
### Question:
QuestionRepository implements QuestionDataSource { @Override public Flowable<List<Question>> loadQuestions(boolean forceRemote) { if (forceRemote) { return refreshData(); } else { if (caches.size() > 0) { return Flowable.just(caches); } else { return localDataSource.loadQuestions(false) .take(1) .flatMap(... |
### Question:
QuestionRemoteDataSource implements QuestionDataSource { @Override public void clearData() { throw new UnsupportedOperationException("Unsupported operation"); } @Inject QuestionRemoteDataSource(QuestionService questionService); @Override Flowable<List<Question>> loadQuestions(boolean forceRemote); @Overr... |
### Question:
QuestionRepository implements QuestionDataSource { public Flowable<Question> getQuestion(long questionId) { return Flowable.fromIterable(caches).filter(question -> question.getId() == questionId); } @Inject QuestionRepository(@Local QuestionDataSource localDataSource,
@Remote QuestionDataSource rem... |
### Question:
QuestionRepository implements QuestionDataSource { @Override public void clearData() { caches.clear(); localDataSource.clearData(); } @Inject QuestionRepository(@Local QuestionDataSource localDataSource,
@Remote QuestionDataSource remoteDataSource); @Override Flowable<List<Question>> loadQuestions(... |
### Question:
QuestionRepository implements QuestionDataSource { @Override public void addQuestion(Question question) { throw new UnsupportedOperationException("Unsupported operation"); } @Inject QuestionRepository(@Local QuestionDataSource localDataSource,
@Remote QuestionDataSource remoteDataSource); @Override... |
### Question:
QuestionLocalDataSource implements QuestionDataSource { @Override public Flowable<List<Question>> loadQuestions(boolean forceRemote) { return questionDao.getAllQuestions(); } @Inject QuestionLocalDataSource(QuestionDao questionDao); @Override Flowable<List<Question>> loadQuestions(boolean forceRemote); @... |
### Question:
QuestionLocalDataSource implements QuestionDataSource { @Override public void addQuestion(Question question) { questionDao.insert(question); } @Inject QuestionLocalDataSource(QuestionDao questionDao); @Override Flowable<List<Question>> loadQuestions(boolean forceRemote); @Override void addQuestion(Questi... |
### Question:
QuestionLocalDataSource implements QuestionDataSource { @Override public void clearData() { questionDao.deleteAll(); } @Inject QuestionLocalDataSource(QuestionDao questionDao); @Override Flowable<List<Question>> loadQuestions(boolean forceRemote); @Override void addQuestion(Question question); @Override ... |
### Question:
QuestionRemoteDataSource implements QuestionDataSource { @Override public Flowable<List<Question>> loadQuestions(boolean forceRemote) { return questionService.loadQuestionsByTag(Config.ANDROID_QUESTION_TAG).map(QuestionResponse::getQuestions); } @Inject QuestionRemoteDataSource(QuestionService questionSe... |
### Question:
QuestionRemoteDataSource implements QuestionDataSource { @Override public void addQuestion(Question question) { throw new UnsupportedOperationException("Unsupported operation"); } @Inject QuestionRemoteDataSource(QuestionService questionService); @Override Flowable<List<Question>> loadQuestions(boolean f... |
### Question:
BytecodeAdapterService implements
SourceAdapterService<String, CtMethod, CtField, Annotation> { @Override public IsClass toClass(String binaryName) { int arrayCount = 0; while (binaryName.matches(".*" + X_Util.arrayRegex)) { arrayCount += 1; binaryName = binaryName.replaceFirst(X_Util.arrayRegex, "");... |
### Question:
ToStringUserInterface extends AbstractUserInterface implements Appendable { @Override public String toString() { return b.toString(); } @Override int hashCode(); @Override String toString(); @Override boolean equals(Object obj); @Override Appendable append(CharSequence csq); @Override Appendable append(C... |
### Question:
JavaLexer { public static <R> int visitAnnotation (final AnnotationVisitor<R> visitor, final R receiver, final CharSequence chars, int pos) { pos = eatWhitespace(chars, pos); if (pos == chars.length()) { return pos; } int start = pos; try { while(chars.charAt(pos) == '@') { pos = eatJavaname(chars, pos + ... |
### Question:
LogInjector { public Log defaultLogger() { return (level, debug) -> (level == LogLevel.ERROR ? SYS_ERR : SYS_OUT) .print(level, debug); } Log defaultLogger(); }### Answer:
@Test public void testDefaultLogging() throws Throwable { final String msg = "Success! " + hashCode(); borrowSout( ()-> LogInjector.... |
### Question:
SlideRenderer { public void renderSlide(DomBuffer into, UiContainerExpr slide) { final DomBuffer out; if ("xapi-slide".equals(into.getTagName())) { out = into; } else { out = into.makeTag("xapi-slide"); } slide.getAttribute("id") .mapNullSafe(UiAttrExpr::getExpression) .mapNullSafe(ASTHelper::extractStrin... |
### Question:
CacheUtils { public byte[] getBytes(@NonNull String key) { return getBytes(key, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int maxCount); sta... |
### Question:
CacheUtils { public String getString(@NonNull String key) { return getString(key, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int maxCount); s... |
### Question:
CacheUtils { public JSONObject getJSONObject(@NonNull String key) { return getJSONObject(key, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int ... |
### Question:
CacheUtils { public JSONArray getJSONArray(@NonNull String key) { return getJSONArray(key, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int max... |
### Question:
CacheUtils { public Bitmap getBitmap(@NonNull String key) { return getBitmap(key, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int maxCount); s... |
### Question:
CacheUtils { public Drawable getDrawable(@NonNull String key) { return getDrawable(key, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int maxCou... |
### Question:
CacheUtils { public <T> T getParcelable(@NonNull String key, @NonNull Parcelable.Creator<T> creator) { return getParcelable(key, creator, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); stat... |
### Question:
CacheUtils { public Object getSerializable(@NonNull String key) { return getSerializable(key, null); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int ... |
### Question:
CacheUtils { public long getCacheSize() { return mCacheManager.getCacheSize(); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int maxCount); static Cach... |
### Question:
CacheUtils { public int getCacheCount() { return mCacheManager.getCacheCount(); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int maxCount); static Cac... |
### Question:
CacheUtils { public boolean remove(@NonNull String key) { return mCacheManager.removeByKey(key); } private CacheUtils(@NonNull File cacheDir, long maxSize, int maxCount); static CacheUtils getInstance(); static CacheUtils getInstance(String cacheName); static CacheUtils getInstance(long maxSize, int maxC... |
### Question:
SPUtils { public String getString(@NonNull String key) { return getString(key, ""); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@Non... |
### Question:
SPUtils { public int getInt(@NonNull String key) { return getInt(key, -1); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@NonNull Stri... |
### Question:
SPUtils { public long getLong(@NonNull String key) { return getLong(key, -1L); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@NonNull ... |
### Question:
SPUtils { public float getFloat(@NonNull String key) { return getFloat(key, -1f); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@NonNu... |
### Question:
SPUtils { public boolean getBoolean(@NonNull String key) { return getBoolean(key, false); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getStrin... |
### Question:
SPUtils { public Map<String, ?> getAll() { return sp.getAll(); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@NonNull String key, @Non... |
### Question:
SPUtils { public void remove(@NonNull String key) { sp.edit().remove(key).apply(); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@NonN... |
### Question:
SPUtils { public boolean contains(@NonNull String key) { return sp.contains(key); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@NonNu... |
### Question:
SPUtils { public void clear() { sp.edit().clear().apply(); } private SPUtils(String spName); static SPUtils getInstance(); static SPUtils getInstance(String spName); void put(@NonNull String key, @NonNull String value); String getString(@NonNull String key); String getString(@NonNull String key, @NonNull... |
### Question:
ProxyConfig { public String getProxyHost() { return proxyHost; } ProxyConfig(PropertyLoader propertyLoader); boolean isProxyRequired(); String getProxyType(); String getProxyHost(); int getProxyPort(); String getProxyAddress(); String getProxyUsername(); String getProxyPassword(); String getNonProxyHosts(... |
### Question:
ConcordionBrowserFixture extends ConcordionFixture implements BrowserBasedTest { @Override public Browser getBrowser() { return getBrowser(threadBrowserId.get()); } static void setScreenshotTakerClass(Class<? extends ScreenshotTaker> screenshotTaker); @Override Browser getBrowser(); Browser getBrowser(St... |
### Question:
PageHelper { public <P extends BasePageObject<P>> P newInstance(Class<P> expectedPage, Object... params) { try { if (params.length > 0) { Class<?>[] constructorArguments = new Class<?>[2]; constructorArguments[0] = BrowserBasedTest.class; constructorArguments[1] = Object[].class; return expectedPage.getDe... |
### Question:
CaselessProperties extends Properties { @Override public synchronized Object put(Object key, Object value) { lookup.put(((String) key), (String) key); return super.put(key, value); } @Override synchronized Object put(Object key, Object value); @Override String getProperty(String key); @Override String ge... |
### Question:
DefaultPropertyLoader implements PropertyLoader { @Override public String getProperty(String key) { String value = retrieveProperty(key); if (value.isEmpty()) { throw new IllegalArgumentException(String.format("Unable to find property %s", key)); } return value; } DefaultPropertyLoader(Properties properti... |
### Question:
DefaultPropertyLoader implements PropertyLoader { public String getEnvironment() { return environment; } DefaultPropertyLoader(Properties properties); String getEnvironment(); @Override String getProperty(String key); @Override String getProperty(String key, String defaultValue); @Override boolean getProp... |
### Question:
DefaultPropertyLoader implements PropertyLoader { @Override public Map<String, String> getPropertiesStartingWith(String keyPrefix) { return getPropertiesStartingWith(keyPrefix, false); } DefaultPropertyLoader(Properties properties); String getEnvironment(); @Override String getProperty(String key); @Overr... |
### Question:
DefaultPropertiesLoader implements PropertiesLoader { @Override public Properties getProperties() { return properties; } protected DefaultPropertiesLoader(String properties, String userProperties); private DefaultPropertiesLoader(); static DefaultPropertiesLoader getInstance(); @Override Properties getP... |
### Question:
ConcordionBase implements ResourceRegistry { @Override public boolean isRegistered(Closeable resource, ResourceScope scope) { return getResourcePairFromScope(resource, scope).isPresent(); } @Override void registerCloseableResource(Closeable resource, ResourceScope scope); @Override void registerCloseable... |
### Question:
PrometheusMetricsReporter extends AbstractMetricsReporter implements MetricsReporter { @Override public void reportSpan(SpanData spanData) { String[] labelValues = getLabelValues(spanData); if (labelValues != null) { this.histogram.labels(labelValues).observe(spanData.getDuration() / (double)1000000); } }... |
### Question:
MicrometerMetricsReporter extends AbstractMetricsReporter implements MetricsReporter { @Override public void reportSpan(SpanData spanData) { boolean skip = Arrays.stream(this.metricLabels).anyMatch(m -> m.value(spanData) == null); if (skip) { return; } List<Tag> tags = Arrays.stream(this.metricLabels) .ma... |
### Question:
PrometheusMetricsReporter extends AbstractMetricsReporter implements MetricsReporter { protected static String convertLabel(String label) { StringBuilder builder = new StringBuilder(label); for (int i=0; i < builder.length(); i++) { char ch = builder.charAt(i); if (!(ch == '_' || ch == ':' || Character.is... |
### Question:
TagMetricLabel implements MetricLabel { @Override public Object value(SpanData spanData) { Object ret = spanData.getTags().get(name()); return ret == null ? defaultValue : ret; } TagMetricLabel(String name, Object defaultValue); @Override String name(); @Override Object defaultValue(); @Override Object va... |
### Question:
BaggageMetricLabel implements MetricLabel { @Override public Object value(SpanData spanData) { Object ret = spanData.getBaggageItem(name()); return ret == null ? defaultValue : ret; } BaggageMetricLabel(String name, Object defaultValue); @Override String name(); @Override Object defaultValue(); @Override ... |
### Question:
AbstractMetricsReporter implements MetricsReporter { protected String[] getLabelValues(SpanData spanData) { String[] values = new String[metricLabels.length]; for (int i=0; i < values.length; i++) { Object value = metricLabels[i].value(spanData); if (value == null) { return null; } values[i] = value.toStr... |
### Question:
NumberPadTimePickerPresenter implements INumberPadTimePicker.Presenter,
DigitwiseTimeModel.OnInputChangeListener { @Override public void presentState(@NonNull INumberPadTimePicker.State state) { initialize(state); if (!mIs24HourMode) { mView.setAmPmDisplayIndex(mLocaleModel.isAmPmWrittenBeforeTime... |
### Question:
NumberPadTimePickerPresenter implements INumberPadTimePicker.Presenter,
DigitwiseTimeModel.OnInputChangeListener { @Override public void onAltKeyClick(CharSequence altKeyText) { final String altKeyString = altKeyText.toString(); final int[] altDigits = mTextModel.altDigits(altKeyString); if (count... |
### Question:
InsertOrReplaceProxy implements MethodInterceptor { @Override public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable { if (method.getName().equals("toString") && args.length == 0) { String sql = toString((String) proxy.invoke(realInsert, args)); return sql; }... |
### Question:
ShadowResources { public String getString(@StringRes int id) throws NotFoundException { return getText(id).toString(); } ShadowResources(); String getString(@StringRes int id); @NonNull String[] getStringArray(@ArrayRes int id); @NonNull int[] getIntArray(@ArrayRes int id); String getPackageName(); }### ... |
### Question:
ShadowResources { @NonNull public String[] getStringArray(@ArrayRes int id) throws NotFoundException { Map<Integer, String> idNameMap = getArrayIdTable(); Map<String, List<String>> stringArrayMap = getResourceStringArrayMap(); if (idNameMap.containsKey(id)) { String name = idNameMap.get(id); if (stringArr... |
### Question:
ShadowResources { @NonNull public int[] getIntArray(@ArrayRes int id) throws NotFoundException { Map<Integer, String> idNameMap = getArrayIdTable(); Map<String, List<Integer>> intArrayMap = getResourceIntArrayMap(); if (idNameMap.containsKey(id)) { String name = idNameMap.get(id); if (intArrayMap.contains... |
### Question:
ShadowResources { public String getPackageName() { if (!TextUtils.isEmpty(mPackageName)) { return mPackageName; } String manifestPath = "build/intermediates/bundles/debug/AndroidManifest.xml"; if (!new File(manifestPath).exists()) { manifestPath = "build/intermediates/bundles/release/AndroidManifest.xml";... |
### Question:
KbSqlParserManager { public Statement parse(String sql) throws JSQLParserException { sql = sql.trim(); boolean isInsertOrReplace = false; if (sql.toUpperCase().startsWith("INSERT OR REPLACE")) { isInsertOrReplace = true; String[] sqlParts = new String[2]; sqlParts[0] = sql.substring(0, "INSERT OR REPLACE"... |
### Question:
ShadowCursor implements Cursor { @Override public String getString(int columnIndex) { Object obj = getObject(columnIndex); return obj == null ? null : obj.toString(); } ShadowCursor(List<String> columns, List<List<Object>> datas); @Override int getCount(); @Override int getPosition(); @Override boolean mo... |
### Question:
KbSqlParser { public static String bindArgs(String sql, @Nullable Object[] bindArgs) { if (bindArgs == null || bindArgs.length == 0 || sql.startsWith("PRAGMA")) { return sql; } bindArgs = replaceBoolean(bindArgs); try { KbSqlParserManager pm = new KbSqlParserManager(); Statement statement = pm.parse(sql);... |
### Question:
KbSqlParser { protected static int getBindArgsCount(String sql) { Set<Expression> expressionSet = findBindArgsExpressions(sql); int count = 0; for (Expression expression : expressionSet) { count += getBindArgsCount(expression); } return count; } static String bindArgs(String sql, @Nullable Object[] bindA... |
### Question:
KbSqlParser { protected static Set<Expression> findBindArgsExpressions(String sql) { if (sql == null || sql.startsWith("PRAGMA") || !sql.contains("?")) { return new LinkedHashSet<>(); } KbSqlParserManager pm = new KbSqlParserManager(); try { Statement statement = pm.parse(sql); Set<Expression> expressionS... |
### Question:
ShadowContext implements Shadow { public static void deleteAllTempDir() { FileUtils.deletePath(DB_PATH); FileUtils.deletePath(DATA_DIR); FileUtils.deletePath(EXT_DIR); } ShadowContext(Resources resources); @NonNull final String getString(@StringRes int resId); Resources getResources(); SharedPreferences g... |
### Question:
NoOpWorkflowImpl implements NoOpWorkflow { @Override public void run() { System.out.println("Run called"); run(0); } @Override void run(); }### Answer:
@Test public void testRun() { context.checking( new Expectations() { { exactly(3).of(control).createDatabaseName("test"); will(returnValue("bbb")); } })... |
### Question:
JobWorkflowImpl implements JobWorkflow { @Override public void executeCommand(final RunJobRequest request) { this.request = request; this.workflowId = contextProvider .getDecisionContext() .getWorkflowContext() .getWorkflowExecution() .getWorkflowId(); final String masterRoleName = "dm-master-role-" + wor... |
### Question:
UriBuilderImpl extends UriBuilder { @Override public UriBuilder replaceQueryParam(String name, Object... values) { checkSsp(); if (queryParams == null) { queryParams = UriComponent.decodeQuery(query.toString(), false); query.setLength(0); } name = encode(name, UriComponent.Type.QUERY_PARAM); queryParams.r... |
### Question:
DemoAO { public void hello(String name) throws FileNotFoundException { System.out.println(demoService.sayHello(name)); } void hello(String name); }### Answer:
@Test public void testHello() throws FileNotFoundException { demoAO.hello("抠逼阵儿"); } |
### Question:
StackTraceHelper { public static StackFrame[] convertJsStackTrace(@Nullable ReadableArray stack) { int size = stack != null ? stack.size() : 0; StackFrame[] result = new StackFrame[size]; for (int i = 0; i < size; i++) { ReadableMap frame = stack.getMap(i); String methodName = frame.getString("methodName"... |
### Question:
ClipboardModule extends ContextBaseJavaModule { @SuppressLint("DeprecatedMethod") @ReactMethod public void setString(String text) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { ClipData clipdata = ClipData.newPlainText(null, text); ClipboardManager clipboard = getClipboardService(); clipb... |
### Question:
UIManagerModule extends ReactContextBaseJavaModule implements
OnBatchCompleteListener, LifecycleEventListener, PerformanceCounter { @ReactMethod public void replaceExistingNonRootView(int oldTag, int newTag) { mUIImplementation.replaceExistingNonRootView(oldTag, newTag); } UIManagerModule(
React... |
### Question:
CompositeReactPackage extends ReactInstancePackage { @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { final Map<String, NativeModule> moduleMap = new HashMap<>(); for (ReactPackage reactPackage: mChildReactPackages) { for (NativeModule nativeModule: reactPack... |
### Question:
CompositeReactPackage extends ReactInstancePackage { @Override public List<Class<? extends JavaScriptModule>> createJSModules() { final Set<Class<? extends JavaScriptModule>> moduleSet = new HashSet<>(); for (ReactPackage reactPackage: mChildReactPackages) { for (Class<? extends JavaScriptModule> jsModule... |
### Question:
CompositeReactPackage extends ReactInstancePackage { @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { final Map<String, ViewManager> viewManagerMap = new HashMap<>(); for (ReactPackage reactPackage: mChildReactPackages) { for (ViewManager viewManager: reactPack... |
### Question:
PdfParser { static List<String> extractTextLinesFromPdf(InputStream pdfStream) { PdfReader pdfReader = null; try { pdfReader = new PdfReader(pdfStream); List<String> textLines = new ArrayList<>(); for (int page = 1; page <= pdfReader.getNumberOfPages(); page++) { String textFromPage = PdfTextExtractor.get... |
### Question:
PdfParser { static List<List<String>> findVariableSections(List<String> codebookTextLines) { int firstVariableLine = findFirstVariableLine(codebookTextLines); int lastVariableLine = findLastVariableLine(codebookTextLines); List<List<String>> variableSectionLineGroups = new ArrayList<>(); List<String> sect... |
### Question:
PdfParser { static String parseLabel(List<String> variableSection) { List<String> fieldText = extractFieldContent(variableSection, FIELD_NAME_LABEL, FIELD_NAME_LABEL_ALT1); List<String> fieldParagraphs = extractParagraphs(fieldText); if (fieldParagraphs.size() != 1) throw new IllegalStateException( String... |
### Question:
DatabaseSchemaManager { public static void createOrUpdateSchema(DataSource dataSource) { LOGGER.info("Schema create/upgrade: running..."); Flyway flyway = new Flyway(); flyway.setCleanDisabled(true); flyway.setDataSource(dataSource); flyway.setPlaceholders(createScriptPlaceholdersMap(dataSource)); flyway.... |
### Question:
CommandContext { public boolean hasFlag(char ch) { return booleanFlags.contains(ch) || valueFlags.containsKey(ch); } CommandContext(String args); CommandContext(String[] args); CommandContext(String args, Set<Character> valueFlags); CommandContext(String args, Set<Character> valueFlags, boolean allowHa... |
### Question:
Location { public Location setY(double y) { return new Location(extent, position.withY(y), yaw, pitch); } Location(Extent extent); Location(Extent extent, double x, double y, double z); Location(Extent extent, Vector3 position); Location(Extent extent, double x, double y, double z, Vector3 direction); ... |
### Question:
Location { public double getZ() { return position.getZ(); } Location(Extent extent); Location(Extent extent, double x, double y, double z); Location(Extent extent, Vector3 position); Location(Extent extent, double x, double y, double z, Vector3 direction); Location(Extent extent, double x, double y, d... |
### Question:
Location { public int getBlockZ() { return (int) Math.floor(position.getZ()); } Location(Extent extent); Location(Extent extent, double x, double y, double z); Location(Extent extent, Vector3 position); Location(Extent extent, double x, double y, double z, Vector3 direction); Location(Extent extent, d... |
### Question:
Location { public Location setZ(double z) { return new Location(extent, position.withZ(z), yaw, pitch); } Location(Extent extent); Location(Extent extent, double x, double y, double z); Location(Extent extent, Vector3 position); Location(Extent extent, double x, double y, double z, Vector3 direction); ... |
### Question:
MorePaths { public static Stream<Path> iterPaths(Path path) { Deque<Path> parents = new ArrayDeque<>(path.getNameCount()); Path next = path; while (next != null) { parents.addFirst(next); next = next.getParent(); } return ImmutableList.copyOf(parents).stream(); } private MorePaths(); static Comparator<Pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.