method2testcases stringlengths 118 6.63k |
|---|
### Question:
ABICallElection { public void clear() { this.votes = new HashMap<>(); } ABICallElection(AddressBasedAuthorizer authorizer, Map<ABICallSpec, List<RskAddress>> votes); ABICallElection(AddressBasedAuthorizer authorizer); Map<ABICallSpec, List<RskAddress>> getVotes(); void clear(); boolean vote(ABICallSpec c... |
### Question:
ABICallSpec { public String getFunction() { return function; } ABICallSpec(String function, byte[][] arguments); String getFunction(); byte[][] getArguments(); byte[] getEncoded(); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode(); static final Comparator<ABICal... |
### Question:
ABICallSpec { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } ABICallSpec otherSpec = ((ABICallSpec) other); return otherSpec.getFunction().equals(getFunction()) && areEqual(arguments, otherSpec... |
### Question:
PendingFederation { public List<FederationMember> getMembers() { return members; } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); boolean isComplete(); PendingFederation addMember(FederationMember member); Federation buildFederati... |
### Question:
PendingFederation { public boolean isComplete() { return this.members.size() >= MIN_MEMBERS_REQUIRED; } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); boolean isComplete(); PendingFederation addMember(FederationMember member); Fed... |
### Question:
PendingFederation { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || this.getClass() != other.getClass()) { return false; } return this.members.equals(((PendingFederation) other).members); } PendingFederation(List<FederationMember> members); List<Fed... |
### Question:
PendingFederation { @Override public String toString() { return String.format("%d signatures pending federation (%s)", members.size(), isComplete() ? "complete" : "incomplete"); } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKeys(); boo... |
### Question:
PendingFederation { public Federation buildFederation(Instant creationTime, long blockNumber, NetworkParameters btcParams) { if (!this.isComplete()) { throw new IllegalStateException("PendingFederation is incomplete"); } return new Federation( members, creationTime, blockNumber, btcParams ); } PendingFede... |
### Question:
ECKey { @Nullable public byte[] getPrivKeyBytes() { return bigIntegerToBytes(priv, 32); } ECKey(); ECKey(SecureRandom secureRandom); ECKey(@Nullable BigInteger priv, ECPoint pub); static ECPoint compressPoint(ECPoint uncompressed); static ECPoint decompressPoint(ECPoint compressed); static ECKey fromPri... |
### Question:
PendingFederation { public Keccak256 getHash() { byte[] encoded = BridgeSerializationUtils.serializePendingFederationOnlyBtcKeys(this); return new Keccak256(HashUtil.keccak256(encoded)); } PendingFederation(List<FederationMember> members); List<FederationMember> getMembers(); List<BtcECKey> getBtcPublicKe... |
### Question:
BIUtil { public static boolean isIn20PercentRange(BigInteger first, BigInteger second) { BigInteger five = BigInteger.valueOf(5); BigInteger limit = first.add(first.divide(five)); return !isMoreThan(second, limit); } static boolean isZero(BigInteger value); static boolean isEqual(BigInteger valueA, BigIn... |
### Question:
Value { public String toString() { StringBuilder stringBuilder = new StringBuilder(); if (isList()) { Object[] list = (Object[]) value; if (list.length == 2) { stringBuilder.append("[ "); Value key = new Value(list[0]); byte[] keyNibbles = CompactEncoder.binToNibblesNoTerminator(key.asBytes()); String key... |
### Question:
AddressBasedAuthorizer { public boolean isAuthorized(RskAddress sender) { return authorizedAddresses.stream() .anyMatch(address -> Arrays.equals(address, sender.getBytes())); } AddressBasedAuthorizer(List<ECKey> authorizedKeys, MinimumRequiredCalculation requiredCalculation); boolean isAuthorized(RskAddre... |
### Question:
BridgeSerializationUtils { public static PendingFederation deserializePendingFederation(byte[] data) { RLPList rlpList = (RLPList)RLP.decode2(data).get(0); List<FederationMember> members = new ArrayList<>(); for (int k = 0; k < rlpList.size(); k++) { RLPElement element = rlpList.get(k); FederationMember m... |
### Question:
TransportAsync implements Transport { public synchronized void handleConnected() { if (!this.state) { this.state = true; fireEvent(true, this.listener); } } TransportAsync(final Executor executor); synchronized void handleConnected(); synchronized void handleDisconnected(); @Override void state(final Cons... |
### Question:
Topic { public Stream<String> stream() { return segments.stream(); } private Topic(final List<String> segments); List<String> getSegments(); Stream<String> stream(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static Topic split(String path); static Topic ... |
### Question:
Payload { public static Payload of(final String key, final Object value) { Objects.requireNonNull(key); return new Payload(now(), singletonMap(key, value), false); } private Payload(final Instant timestamp, final Map<String, ?> values, final boolean cloneValues); Instant getTimestamp(); Map<String, ?> ge... |
### Question:
Errors { public static ErrorHandler<RuntimeException> ignore() { return IGNORE; } private Errors(); static ErrorHandler<RuntimeException> ignore(); static ErrorHandler<RuntimeException> handle(final BiConsumer<Throwable, Optional<Payload>> handler); static void ignore(final Throwable e, final Optional<Pa... |
### Question:
Errors { public static ErrorHandler<RuntimeException> handle(final BiConsumer<Throwable, Optional<Payload>> handler) { return new ErrorHandler<RuntimeException>() { @Override public void handleError(final Throwable e, final Optional<Payload> payload) throws RuntimeException { handler.accept(e, payload); }... |
### Question:
JksServerConfigurator implements HttpServerConfigurator { private int getPort(ServerConfiguration configuration) { return configuration.getInteger(ConfigKies.HTTPS_PORT, ConfigKies.DEFAULT_HTTPS_PORT); } @Override void configureHttpServer(VertxContext context, HttpServerOptions options); }### Answer:
@T... |
### Question:
HttpServiceDiscovery { public void getWebClient(Function<Record, Boolean> filter, Handler<AsyncResult<WebClient>> handler) { HttpEndpoint.getWebClient(serviceDiscovery, filter, handler); } HttpServiceDiscovery(ServiceDiscovery serviceDiscovery); void publish(HttpEndpointConfiguration configuration, Handle... |
### Question:
MessageSourceServiceDiscovery { public <T> void getConsumer(Function<Record, Boolean> filter, Handler<AsyncResult<MessageConsumer<T>>> handler) { MessageSource.getConsumer(serviceDiscovery, filter, handler); } MessageSourceServiceDiscovery(ServiceDiscovery serviceDiscovery); void publish(MessageSourceConf... |
### Question:
RedisServiceDiscovery { public void getClient(Function<Record, Boolean> filter, Handler<AsyncResult<RedisClient>> handler) { RedisDataSource.getRedisClient(serviceDiscovery, filter, handler); } RedisServiceDiscovery(ServiceDiscovery serviceDiscovery); void publish(DataSourceServiceConfiguration configurat... |
### Question:
EventBusServiceDiscovery { public <T> void getProxy(Class<T> serviceClass, Handler<AsyncResult<T>> handler) { EventBusService.getProxy(serviceDiscovery, serviceClass, handler); } EventBusServiceDiscovery(ServiceDiscovery serviceDiscovery); void publish(EventBusServiceConfiguration configuration, Handler<A... |
### Question:
EventBusServiceDiscovery { public <T> void getServiceProxy(Function<Record, Boolean> filter, Class<T> serviceClass, Handler<AsyncResult<T>> handler) { EventBusService.getServiceProxy(serviceDiscovery, filter, serviceClass, handler); } EventBusServiceDiscovery(ServiceDiscovery serviceDiscovery); void publi... |
### Question:
JDBCServiceDiscovery { public void getClient(Function<Record, Boolean> filter, Handler<AsyncResult<JDBCClient>> handler) { JDBCDataSource.getJDBCClient(serviceDiscovery, filter, handler); } JDBCServiceDiscovery(ServiceDiscovery serviceDiscovery); void publish(DataSourceServiceConfiguration configuration, ... |
### Question:
MongoServiceDiscovery { public void getClient(Function<Record, Boolean> filter, Handler<AsyncResult<MongoClient>> handler) { MongoDataSource.getMongoClient(serviceDiscovery, filter, handler); } MongoServiceDiscovery(ServiceDiscovery serviceDiscovery); void publish(DataSourceServiceConfiguration configurat... |
### Question:
VertxServiceDiscovery { public void publishRecord(Record record, Handler<AsyncResult<Record>> handler) { serviceDiscovery.publish(record, handler); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscovery eventBus(); MessageSourceServ... |
### Question:
VertxServiceDiscovery { public void lookup(Function<Record, Boolean> filter, Handler<AsyncResult<Record>> handler) { lookup(filter, false, handler); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscovery eventBus(); MessageSourceSer... |
### Question:
JksServerConfigurator implements HttpServerConfigurator { private String getPath(ServerConfiguration configuration) { return configuration.getString(ConfigKies.SSL_JKS_PATH); } @Override void configureHttpServer(VertxContext context, HttpServerOptions options); }### Answer:
@Test public void givenSslEna... |
### Question:
VertxServiceDiscovery { public void lookupIncludeOutOfService(Function<Record, Boolean> filter, Handler<AsyncResult<Record>> handler) { lookup(filter, true, handler); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscovery eventBus()... |
### Question:
VertxServiceDiscovery { public void lookupByJson(JsonObject jsonFilter, Handler<AsyncResult<Record>> handler) { serviceDiscovery.getRecord(jsonFilter, handler); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscovery eventBus(); Mess... |
### Question:
VertxServiceDiscovery { public void lookupAll(Function<Record, Boolean> filter, Handler<AsyncResult<List<Record>>> handler) { lookupAll(filter, false, handler); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscovery eventBus(); Mess... |
### Question:
VertxServiceDiscovery { public void lookupAllIncludeOutOfService(Function<Record, Boolean> filter, Handler<AsyncResult<List<Record>>> handler) { lookupAll(filter, true, handler); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscover... |
### Question:
HttpServiceDiscovery { public void getHttpClient(Function<Record, Boolean> filter, Handler<AsyncResult<HttpClient>> handler) { HttpEndpoint.getClient(serviceDiscovery, filter, handler); } HttpServiceDiscovery(ServiceDiscovery serviceDiscovery); void publish(HttpEndpointConfiguration configuration, Handler... |
### Question:
VertxServiceDiscovery { public void lookupAllByJson(JsonObject jsonFilter, Handler<AsyncResult<List<Record>>> handler) { serviceDiscovery.getRecords(jsonFilter, handler); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscovery eventB... |
### Question:
VertxServiceDiscovery { public ServiceReference lookupForAReference(Record record) { return serviceDiscovery.getReference(record); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http(); EventBusServiceDiscovery eventBus(); MessageSourceServiceDiscovery mess... |
### Question:
VertxServiceDiscovery { public ServiceReference lookupForAReferenceWithConfiguration(Record record, JsonObject configuration) { return serviceDiscovery.getReferenceWithConfiguration(record, configuration); } VertxServiceDiscovery(Vertx vertx); ServiceDiscovery serviceDiscovery(); HttpServiceDiscovery http... |
### Question:
ListItemsUniqueModel extends AbstractValueModel { public void setValue(Object newValue) { throw new UnsupportedOperationException("ListItemsUniqueModel is read-only"); } ListItemsUniqueModel(ObservableList<E> list, Class<E> beanClass, String propertyName); Object getValue(); boolean calculate(); void setV... |
### Question:
CollectionUtil { public static <E> E getElementAtIndex(Collection<E> set, int idx) { if (idx >= set.size() || idx < 0) { throw new IndexOutOfBoundsException(); } Iterator<E> it = set.iterator(); for (int i = 0; i < idx; ++i) { it.next(); } return it.next(); } static E getElementAtIndex(Collection<E> set,... |
### Question:
CollectionUtil { public static <E> int getIndexOfElement(Collection<E> set, Object child) { int i = 0; for (E e : set) { if (e.equals(child)) { return i; } ++i; } return -1; } static E getElementAtIndex(Collection<E> set, int idx); static int getIndexOfElement(Collection<E> set, Object child); static boo... |
### Question:
CollectionUtil { public static boolean nextLexicographicElement(int x[], int c[]) { assert(x.length == c.length); final int l = x.length; if (l < 1) { return false; } for (int i = l - 1; i >= 0; --i) { ++x[i]; if (x[i] == c[i]) { x[i] = 0; } else { return true; } } return false; } static E getElementAtIn... |
### Question:
GuardedObservableList extends AbstractObservableList<E> { @Override public void add(int index, E element) { check(element); d_nested.add(index, element); } GuardedObservableList(ObservableList<E> nested, Predicate<? super E> predicate); @Override E get(int index); @Override int size(); @Override void add(... |
### Question:
GuardedObservableList extends AbstractObservableList<E> { @Override public E set(int index, E element) { check(element); return d_nested.set(index, element); } GuardedObservableList(ObservableList<E> nested, Predicate<? super E> predicate); @Override E get(int index); @Override int size(); @Override void ... |
### Question:
FilteredObservableList extends AbstractObservableList<E> { @Override public void add(final int index, final E element) { if(!d_filter.evaluate(element)) throw new IllegalArgumentException("Cannot add " + element + ", it does not pass the filter of " + this); if(index < d_indices.size()) { d_inner.add(d_in... |
### Question:
FilteredObservableList extends AbstractObservableList<E> { private void intervalAdded(final int lower, final int upper) { final int delta = upper - lower + 1; final int first = firstAtLeast(lower); updateIndices(first, delta); final int oldSize = d_indices.size(); for(int i = upper; i >= lower; --i) { if ... |
### Question:
ListMinimumSizeModel extends AbstractValueModel { public Boolean getValue() { return d_val; } ListMinimumSizeModel(ListModel list, int minSize); Boolean getValue(); void setValue(Object value); }### Answer:
@Test public void testInitialValues() { assertFalse(new ListMinimumSizeModel(new ArrayListModel<St... |
### Question:
FilteredObservableList extends AbstractObservableList<E> { @Override public E remove(final int index) { return d_inner.remove((int) d_indices.get(index)); } FilteredObservableList(final ObservableList<E> inner, final Predicate<E> filter); void setFilter(final Predicate<E> filter); @Override E get(final in... |
### Question:
FilteredObservableList extends AbstractObservableList<E> { private void intervalRemoved(final int lower, final int upper) { final int first = firstAtLeast(lower); if (first >= d_indices.size()) { return; } final int last = firstOver(upper); d_indices.removeAll(new ArrayList<Integer>(d_indices.subList(firs... |
### Question:
FilteredObservableList extends AbstractObservableList<E> { @Override public E set(final int index, final E element) { if(!d_filter.evaluate(element)) throw new IllegalArgumentException("Cannot add " + element + ", it does not pass the filter."); return d_inner.set(d_indices.get(index), element); } Filtere... |
### Question:
FilteredObservableList extends AbstractObservableList<E> { public void setFilter(final Predicate<E> filter) { d_filter = filter; final int oldSize = size(); if(!isEmpty()) { d_indices.clear(); fireIntervalRemoved(0, oldSize - 1); } initializeIndices(); if(!isEmpty()) { fireIntervalAdded(0, size() - 1); } ... |
### Question:
ListMinimumSizeModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } ListMinimumSizeModel(ListModel list, int minSize); Boolean getValue(); void setValue(Object value); }### Answer:
@Test(expected=UnsupportedOperationException.class) public v... |
### Question:
SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public E remove(int index) { if (index >= 0 && index < size()) { E e = get(index); d_set.remove(e); d_listenerManager.fireIntervalRemoved(index, index); return e; } throw new IndexOutOfBoundsException(); } SortedSetModel(); S... |
### Question:
SortedSetModel extends AbstractList<E> implements ObservableList<E> { @Override public void add(int index, E element) { if (!d_set.contains(element)) { d_set.add(element); int idx = indexOf(element); d_listenerManager.fireIntervalAdded(idx, idx); } } SortedSetModel(); SortedSetModel(Comparator<? super E>... |
### Question:
SortedSetModel extends AbstractList<E> implements ObservableList<E> { public SortedSet<E> getSet() { return new TreeSet<E>(d_set); } SortedSetModel(); SortedSetModel(Comparator<? super E> comparator); SortedSetModel(Collection<? extends E> c); @Override int size(); @Override E get(int index); @Override ... |
### Question:
ValueEqualsModel extends AbstractConverter { public void setValue(final Object newValue) { throw new UnsupportedOperationException(getClass().getSimpleName() + " is read-only"); } ValueEqualsModel(final ValueModel model, final Object expectedValue); void setValue(final Object newValue); Object convertFrom... |
### Question:
ValueEqualsModel extends AbstractConverter { public void setExpected(Object expectedValue) { Object oldVal = getValue(); d_expectedValue = expectedValue; firePropertyChange("value", oldVal, getValue()); } ValueEqualsModel(final ValueModel model, final Object expectedValue); void setValue(final Object newV... |
### Question:
DateUtil { public static Date getCurrentDateWithoutTime() { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.AM_PM, Calendar.AM); Date date = cal.getTime(); return date; } static ... |
### Question:
Statistics { public static EstimateWithPrecision meanDifference( double m0, double s0, double n0, double m1, double s1, double n1) { double md = m1 - m0; double se = Math.sqrt((s0 * s0) / n0 + (s1 * s1) / n1); return new EstimateWithPrecision(md, se); } private Statistics(); static double logit(double p)... |
### Question:
SimpleSuspendableTask implements SimpleTask { public boolean wakeUp() { return d_suspendable.wakeUp(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspenda... |
### Question:
SimpleSuspendableTask implements SimpleTask { public boolean abort() { return d_suspendable.abort(); } SimpleSuspendableTask(Suspendable suspendable, String str); SimpleSuspendableTask(Runnable runnable, String str); SimpleSuspendableTask(Runnable runnable); SimpleSuspendableTask(Suspendable suspendabl... |
### Question:
DecisionTransition implements Transition { public List<Task> transition() { if (!isReady()) { throw new RuntimeException("Not ready for transition."); } if (d_condition.evaluate()) { return Collections.singletonList(d_ifTask); } else { return Collections.singletonList(d_elTask); } } DecisionTransition(Tas... |
### Question:
StringNotEmptyModel extends AbstractValueModel { public Boolean getValue() { return d_val; } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); }### Answer:
@Test public void testInitialValues() { assertFalse(new StringNotEmptyModel(new ValueHolder(null)).getValue())... |
### Question:
ActivityModel { public Set<Task> getNextStates() { if (isFinished()) { return Collections.emptySet(); } return findAccessibleStates(d_start); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task get... |
### Question:
ActivityModel { public boolean isFinished() { return d_end.isFinished(); } ActivityModel(Task start, Task end, Collection<? extends Transition> transitions); Set<Task> getNextStates(); boolean isFinished(); Task getStartState(); Task getEndState(); Set<Task> getStates(); Task getStateByName(String name); ... |
### Question:
IterativeTask extends SimpleSuspendableTask { public void setReportingInterval(int interval) { ((IterativeSuspendable)d_suspendable).setReportingInterval(interval); } IterativeTask(IterativeComputation computation, String str); IterativeTask(IterativeComputation computation); void setReportingInterval(in... |
### Question:
StringNotEmptyModel extends AbstractValueModel { public void setValue(Object value) { throw new UnsupportedOperationException(); } StringNotEmptyModel(ValueModel nested); Boolean getValue(); void setValue(Object value); }### Answer:
@Test(expected=UnsupportedOperationException.class) public void testSetV... |
### Question:
StudentTTable { public static double getT(int v) { if (v < 1) { throw new IllegalArgumentException("student T distribution defined only for positive degrees of freedom"); } TDistribution dist = new TDistribution(v); return dist.inverseCumulativeProbability(0.975); } static double getT(int v); }### Answe... |
### Question:
Interval { public double getLength() { return d_upperBound.doubleValue() - d_lowerBound.doubleValue(); } Interval(N lowerBound, N upperBound); N getLowerBound(); N getUpperBound(); double getLength(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }### Answer:
... |
### Question:
Interval { @Override public boolean equals(Object o) { if (o instanceof Interval<?>) { Interval<?> other = (Interval<?>) o; if (other.canEqual(this)) { if (other.getLowerBound().getClass().equals(getLowerBound().getClass())) { return ((getLowerBound().equals(other.getLowerBound())) && (getUpperBound().equ... |
### Question:
Interval { @Override public String toString() { return getLowerBound().toString() + "-" + getUpperBound().toString(); } Interval(N lowerBound, N upperBound); N getLowerBound(); N getUpperBound(); double getLength(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();... |
### Question:
LogstashLayout implements Layout<String> { @PluginBuilderFactory @SuppressWarnings("WeakerAccess") public static Builder newBuilder() { return new Builder(); } private LogstashLayout(Builder builder); @Override String toSerializable(LogEvent event); @Override byte[] toByteArray(LogEvent event); @Override... |
### Question:
MainActivity extends AppCompatActivity { @VisibleForTesting void initViews() { EditText weightText = (EditText)findViewById(R.id.text_weight); EditText heightText = (EditText)findViewById(R.id.text_height); TextView resultText = (TextView)findViewById(R.id.text_result); mCalcButton = (Button)findViewById(... |
### Question:
SaveBmiService extends IntentService { public static void start(Context context, BmiValue bmiValue) { Intent intent = new Intent(context, SaveBmiService.class); intent.putExtra(PARAM_KEY_BMI_VALUE, bmiValue); context.startService(intent); } SaveBmiService(); @Override void onCreate(); static void start(Co... |
### Question:
SaveBmiService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent == null) { return; } Serializable extra = intent.getSerializableExtra(PARAM_KEY_BMI_VALUE); if (extra == null || !(extra instanceof BmiValue)) { return; } BmiValue bmiValue = (BmiValue)extra; boolean... |
### Question:
BmiCalculator { public BmiValue calculate(float heightInMeter, float weightInKg) { if (heightInMeter < 0 || weightInKg < 0) { throw new RuntimeException("ํค์ ๋ชธ๋ฌด๊ฒ๋ ์์๋ก ์ง์ ํด์ฃผ์ธ์"); } float bmiValue = weightInKg / (heightInMeter * heightInMeter); return createValueObj(bmiValue); } BmiValue calculate(float heig... |
### Question:
BmiValue implements Serializable { public float toFloat() { int rounded = Math.round(mValue * 100); return rounded / 100f; } BmiValue(float value); float toFloat(); String getMessage(); }### Answer:
@Test public void ์์ฑ์์์ ๋ฌํFloat๊ฐ์์์์ 2์๋ฆฌ๊น์ง๋ฐ์ฌ๋ฆผํด๋ฐํํ๋ค() { BmiValue bmiValue = new BmiValue(20.00511f); Assert.a... |
### Question:
DriverSettings extends AbstractPropSettings { public String getGeckcoDriverPath() { return getProperty("GeckoDriverPath", geckoDriverPath); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDri... |
### Question:
FParser { public static Object eval(String s) { String func = FN(s); s = s.replaceFirst(func, ""); String[] params = {}; if (s.length() >= 2) { String param = s.substring(1, s.lastIndexOf(")")); params = param.split(RX, -1); } return String.valueOf(EXE(func, params)); } static List<String> getFuncList();... |
### Question:
FParser { public static String evaljs(String script) { try { return JS.eval("JSON.stringify(" + script + ")").toString(); } catch (ScriptException ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); } return "undefined"; } static List<String> getFuncList(); static Object eval(String s); static String evalj... |
### Question:
KeyMap { public static String resolveContextVars(String in, Map<?,?> vMap) { return replaceKeys(in, CONTEXT_VARS, true, 1, vMap); } static Map<Object, Object> getSystemVars(); static String resolveContextVars(String in, Map<?,?> vMap); static String resolveEnvVars(String in); static String replaceKeys(St... |
### Question:
KeyMap { public static String resolveEnvVars(String in) { return replaceKeys(in, ENV_VARS); } static Map<Object, Object> getSystemVars(); static String resolveContextVars(String in, Map<?,?> vMap); static String resolveEnvVars(String in); static String replaceKeys(String in, Pattern pattern, boolean pres... |
### Question:
KeyMap { public static String replaceKeys(String in, Pattern pattern, boolean preserveKeys, int passes, Map<?,?>... maps) { String out = in; for (int pass = 1; pass <= passes; pass++) { Matcher m = pattern.matcher(in); String match, key; while (m.find()) { match = m.group(); key = m.group(1); Boolean reso... |
### Question:
ChromeEmulators { public static String getPrefLocation() { if (SystemUtils.IS_OS_WINDOWS) { return SystemUtils.getUserHome().getAbsolutePath() + "/AppData/Local/Google/Chrome/User Data/Default"; } if (SystemUtils.IS_OS_MAC_OSX) { return SystemUtils.getUserHome().getAbsolutePath()+"/Library/Application Sup... |
### Question:
ChromeEmulators { public static void sync() { try { LOG.info("Trying to load emulators from Chrome Installation"); File file = new File(getPrefLocation(), "Preferences"); if (file.exists()) { Map map = MAPPER.readValue(file, Map.class); Map devtools = (Map) map.get("devtools"); Map prefs = (Map) devtools.... |
### Question:
ChromeEmulators { public static List<String> getEmulatorsList() { load(); return EMULATORS; } static void sync(); static String getPrefLocation(); static List<String> getEmulatorsList(); }### Answer:
@Test(enabled = false) public void testGetEmulatorsList() { System.out.println("getEmulatorsList"); List... |
### Question:
BasicHttpClient extends AbstractHttpClient { public JSONObject Get(URL targetUrl) throws Exception { return Get(targetUrl.toURI()); } BasicHttpClient(URL url, String userName, String password); BasicHttpClient(URL url, String userName, String password, Map<String, String> config); void auth(HttpRequest r... |
### Question:
DriverSettings extends AbstractPropSettings { public String getChromeDriverPath() { return getProperty("ChromeDriverPath", chromeDriverPath); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIED... |
### Question:
JIRAClient { public boolean isConnected() { try { DLogger.Log(client.Get(new URL(client.url + PROJECT)).toString()); return true; } catch (Exception ex) { LOG.log(Level.SEVERE, ex.getMessage(), ex); return false; } } JIRAClient(String urlStr, String userName, String password, Map options); int updateResul... |
### Question:
JIRAClient { @SuppressWarnings("unchecked") public JSONObject createIssue(JSONObject issue, List<File> attachments) { JSONObject res = null; try { res = client.post(new URL(client.url + ISSUE), issue.toString()); String restAttach = ISSUE_ATTACHMENTS.replace("issuekey", (String) res.get("id")); if (attach... |
### Question:
DriverSettings extends AbstractPropSettings { public String getIEDriverPath() { return getProperty("IEDriverPath", "./lib/Drivers/IEDriverServer.exe"); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); v... |
### Question:
DriverSettings extends AbstractPropSettings { public String getEdgeDriverPath() { return getProperty("EdgeDriverPath", "./lib/Drivers/MicrosoftWebDriver.exe"); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String ... |
### Question:
DriverSettings extends AbstractPropSettings { public void setGeckcoDriverPath(String path) { setProperty("GeckoDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(S... |
### Question:
DriverSettings extends AbstractPropSettings { public void setChromeDriverPath(String path) { setProperty("ChromeDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(... |
### Question:
DriverSettings extends AbstractPropSettings { public void setIEDriverPath(String path) { setProperty("IEDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(String p... |
### Question:
DriverSettings extends AbstractPropSettings { public void setEdgeDriverPath(String path) { setProperty("EdgeDriverPath", path); } DriverSettings(String location); void setFirefoxBinaryPath(String path); void setGeckcoDriverPath(String path); void setChromeDriverPath(String path); void setIEDriverPath(Stri... |
### Question:
FParser { public static List<String> getFuncList() { return FUNCTIONS; } static List<String> getFuncList(); static Object eval(String s); static String evaljs(String script); static List<String> FUNCTIONS; }### Answer:
@Test public void testGetFuncList() { System.out.println("getFuncList"); String[] vals... |
### Question:
RedisAppender implements Appender { public RedisThrottlerJmxBean getJmxBean() { return throttler.getJmxBean(); } private RedisAppender(Builder builder); Configuration getConfig(); @Override String getName(); @Override Layout<? extends Serializable> getLayout(); @Override boolean ignoreExceptions(); @Over... |
### Question:
KeyLockManager { public static KeyLock getKeyLock(String type) { return keyLockMap.get(type); } static void init(String[] types, int keyLockExpireTime, int keyLockCycleSleepTime, ILog log); static KeyLock getKeyLock(String type); static Object lockMethod(String lockKey, String keyType, KeylockFunction fu... |
### Question:
MsgManager { public static boolean addMsgListener(IMsgListener msgListener) throws Exception { Map<String, String> msgs = msgListener.getMsgs(); if (msgs != null) { Object[] msgKeyArray = msgs.keySet().toArray(); for (int i = 0; i < msgKeyArray.length; i++) { String msg = String.valueOf(msgKeyArray[i]); M... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.