method2testcases stringlengths 118 6.63k |
|---|
### Question:
PairwiseRankingLearningAlgorithm extends AObjectRankingWithBaseLearner<PairwiseRankingConfiguration> { @Override public PairwiseRankingLearningModel train(IDataset<?, ?, ?> dataset) throws TrainModelsFailedException { return (PairwiseRankingLearningModel) super.train(dataset); } PairwiseRankingLearningAlg... |
### Question:
ExpectedRankRegression extends AObjectRankingWithBaseLearner<ExpectedRankRegressionConfiguration> { @Override public ExpectedRankRegressionLearningModel train(IDataset<?, ?, ?> dataset) throws TrainModelsFailedException { return (ExpectedRankRegressionLearningModel) super.train(dataset); } ExpectedRankReg... |
### Question:
AAlgorithm implements IAlgorithm { @Override public void setParameters(JsonObject jsonObject) throws ParameterValidationFailedException { getAlgorithmConfiguration().overrideConfiguration(jsonObject); } AAlgorithm(); AAlgorithm(String algorithmIdentifier); @Override AAlgorithmConfiguration getDefaultAlgo... |
### Question:
PlackettLuceModelFittingAlgorithm extends ARankingDistributionFittingAlgorithm<PlackettLuceModelFittingAlgorithmConfiguration> { @Override public PlackettLuceModel fit(IDistributionSampleSet<Ranking> sampleSet) throws FittingDistributionFailedException { assertCorrectSampleSetType(sampleSet); initializeAl... |
### Question:
Snippet { @GetMapping(path = "/{id}") public SnippetEntity getSnippet(@PathVariable("id") String id) { return snippetService.getSnippet(id); } @GetMapping() Page<SnippetEntity> getSnippets(@RequestParam(value = "from", defaultValue = "0") final int from,
@Reques... |
### Question:
CategoryTreeNavigator { public void selectCategory(long selectedCategoryId) { Map<Long, Category> map = categories.asMap(); Category selectedCategory = map.get(selectedCategoryId); if (selectedCategory != null) { Stack<Long> path = new Stack<>(); Category parent = selectedCategory.parent; while (parent !=... |
### Question:
TransactionsTotalCalculator { public Total[] getTransactionsBalance() { WhereFilter filter = this.filter; if (filter.getAccountId() == -1) { filter = excludeAccountsNotIncludedInTotalsAndSplits(filter); } try (Cursor c = db.db().query(V_BLOTTER_FOR_ACCOUNT_WITH_SPLITS, BALANCE_PROJECTION, filter.getSelect... |
### Question:
SmsTransactionProcessor { public Transaction createTransactionBySms(String addr, String fullSmsBody, TransactionStatus status, boolean updateNote) { List<SmsTemplate> addrTemplates = db.getSmsTemplatesByNumber(addr); for (final SmsTemplate t : addrTemplates) { String[] match = findTemplateMatches(t.templa... |
### Question:
CategoryTreeNavigator { public boolean navigateTo(long categoryId) { Category selectedCategory = findCategory(categoryId); if (selectedCategory != null) { selectedCategoryId = selectedCategory.id; if (selectedCategory.hasChildren()) { categoriesStack.push(categories); categories = selectedCategory.childre... |
### Question:
SmsTransactionProcessor { static int[] findPlaceholderIndexes(String template) { Map<Integer, Placeholder> sorted = new TreeMap<>(); boolean foundPrice = false; for (Placeholder p : Placeholder.values()) { int i = template.indexOf(p.code); if (i >= 0) { if (p == PRICE) { foundPrice = true; } if (p != ANY)... |
### Question:
IntegrityCheckRunningBalance implements IntegrityCheck { @Override public Result check() { if (isRunningBalanceBroken()) { return new Result(Level.ERROR, context.getString(R.string.integrity_error)); } else { return Result.OK; } } IntegrityCheckRunningBalance(Context context, DatabaseAdapter db); @Overrid... |
### Question:
IntegrityCheckAutobackup implements IntegrityCheck { @Override public Result check() { if (MyPreferences.isAutoBackupEnabled(context)) { if (MyPreferences.isAutoBackupWarningEnabled(context)) { MyPreferences.AutobackupStatus status = MyPreferences.getAutobackupStatus(context); if (status.notify) { MyPrefe... |
### Question:
CurrencySelector { public void addSelectedCurrency(int selectedCurrency) { if (selectedCurrency > 0 && selectedCurrency <= currencies.size()) { List<String> c = currencies.get(selectedCurrency-1); addSelectedCurrency(c); } else { listener.onCreated(0); } } CurrencySelector(Context context, MyEntityManager... |
### Question:
CategoryCache { public static String extractCategoryName(String name) { int i = name.indexOf('/'); if (i != -1) { name = name.substring(0, i); } return name; } static String extractCategoryName(String name); void loadExistingCategories(DatabaseAdapter db); void insertCategories(DatabaseAdapter dbAdapter,... |
### Question:
Beverage { public abstract double cost(); protected Beverage(boolean milk, boolean mocha); boolean isMilk(); boolean isMocha(); String getDescription(); abstract double cost(); }### Answer:
@Test public void should_pay_1_when_buy_espresso() { Espresso espresso = new Espresso(false, false); assertTrue(es... |
### Question:
RemoteControl { public void off(int slot) { if (slot == 1) light.off(); if (slot == 2) ceiling.off(); if (slot == 3) stereo.off(); } RemoteControl(Light light, Ceiling ceiling, Stereo stereo); void on(int slot); void off(int slot); }### Answer:
@Test public void should_turn_off_stereo_when_press_third_of... |
### Question:
GumballMachine { public MachineStatus getState() { return State; } GumballMachine(int gumballNum, MachineStatus machineStatus); int getGumballNum(); void setGumballNum(int gumballNum); MachineStatus getState(); void setState(MachineStatus state); String insertQuarter(); String turnCrank(); String dispense... |
### Question:
WeatherData { public void measurementsChanged(int temp, int humidity, int windPower) { if (temp > 5) { seedingMachine.start(); if (humidity > 65) reapingMachine.start(); } if (temp > 10 && humidity < 55 && windPower < 4) wateringMachine.start(); } WeatherData(SeedingMachine seedingMachine, ReapingMachine ... |
### Question:
MenuItem { public List<Integer> getHealthRating() { return ingredients.stream() .map(Ingredient::getHealthRating) .collect(Collectors.toList()); } MenuItem(List<Ingredient> ingredients); void AddToPot(); void AddWater(); void AddOil(); void Smell(); void Taste(); void Cook(); List<Integer> getHealthRating... |
### Question:
MenuItem { public List<String> getProtein() { return ingredients.stream() .map(Ingredient::getProtein) .collect(Collectors.toList()); } MenuItem(List<Ingredient> ingredients); void AddToPot(); void AddWater(); void AddOil(); void Smell(); void Taste(); void Cook(); List<Integer> getHealthRating(); List<St... |
### Question:
MenuItem { public List<String> getCalory() { List<String> calories = ingredients.stream() .map(Ingredient::getCalory) .collect(Collectors.toList()); calories.add("Cooking will double calories!!!"); return calories; } MenuItem(List<Ingredient> ingredients); void AddToPot(); void AddWater(); void AddOil(); ... |
### Question:
UsingReturn { public String checkSecurity(List<String> people) { String found = ""; for (String name : people) { if (found == "") { if (name.equals("Don")) { sendAlert(); found = "Don"; } if (name.equals("John")) { sendAlert(); found = "John"; } } } return someLaterCode(found); } String checkSecurity(Lis... |
### Question:
OrsExample { public double disabilityAmount() { if (seniority < 2) return 0; if (monthsDisabled > 12) return 0; if (isPartTime) return 0; return disabilityAmount; } OrsExample(double seniority, double monthsDisabled, boolean isPartTime); double disabilityAmount(); }### Answer:
@Test public void should_ge... |
### Question:
AndsExample { public double getCharge() { if (onVacation()) if (lengthOfService() > 10) return 1; return 0.5; } AndsExample(double lengthOfService, boolean onVacation); double getCharge(); }### Answer:
@Test public void should_get_1_given_is_on_vacation_and_length_of_service_greater_than_10() { AndsExamp... |
### Question:
ConsolidateDuplicateConditionalFragments { public double disabilityAmount() { if (isSpecialDeal()) { total = price * 0.95; send(); } else { total = price * 0.98; send(); } return total; } ConsolidateDuplicateConditionalFragments(boolean isSpecialDeal, double price); double disabilityAmount(); }### Answer... |
### Question:
ChargeCalculator { public double getCharge(Date date, double quantity) { double charge; if (date.before(SUMMER_START) || date.after(SUMMER_END)) charge = quantity * winterRate + winterServiceCharge; else charge = quantity * summerRate; return charge; } double getCharge(Date date, double quantity); }### ... |
### Question:
Client { public String getStatement() { String plan = customer() == null ? "Basic Plan" : customer().getPlan(); String customerName = customer() == null ? "occupant" : customer().getName(); int weeksDelinquent = customer() == null ? 0 : customer().getWeeksDelinquentInLastYear(); return plan + " " + custom... |
### Question:
Employee { public int payAmount() throws Exception { switch (employeeType.getEmployeeCode()) { case EmployeeType.ENGINEER: return MonthlySalary; case EmployeeType.SALESMAN: return MonthlySalary + Commission; case EmployeeType.MANAGER: return MonthlySalary + Bonus; default: throw new Exception(); } } Emplo... |
### Question:
ReplaceNestedConditionalWithGuardClauses { public double getPayAmount() { double result; if (isDead) result = deadAmount(); else { if (isSeparated) result = separatedAmount(); else { if (isRetired) result = retiredAmount(); else result = normalPayAmount(); } } return result; } ReplaceNestedConditionalWith... |
### Question:
ReversingTheConditions { public double getAdjustedCapital() { double result = 0.0; if (capital > 0.0) { if (intRate > 0.0 && duration > 0.0) { result = (income / duration) * AdjFactor; } } return result; } ReversingTheConditions(double capital, double intRate, double duration, double income); double getAd... |
### Question:
InlineTemp { public boolean isAmountOver1000() { double amount = order.getAmount(); return amount > 1000; } InlineTemp(int amount); boolean isAmountOver1000(); }### Answer:
@Test public void should_get_true_given_amount_over_1000() { InlineTemp inlineTemp = new InlineTemp(2000); assertTrue(inlineTemp.isA... |
### Question:
Beverage { public String getDescription() { return ""; } protected Beverage(boolean milk, boolean mocha); boolean isMilk(); boolean isMocha(); String getDescription(); abstract double cost(); }### Answer:
@Test public void should_return_espresso_when_get_espresso_description() { Espresso espresso = new ... |
### Question:
InlineMethod { public int getRating() { return (moreThanFiveLateDeliveries()) ? 2 : 1; } InlineMethod(double numberOfLateDeliveries); int getRating(); }### Answer:
@Test public void should_get_rating_2_given_more_than_five_late_deliveries() { final int numberOfLateDeliveries = 6; InlineMethod inlineMetho... |
### Question:
ExtractMethod { public String printOwning(String name, int previousAmount) { String customerOwns = ""; double outstanding = 10 + previousAmount; customerOwns += "****/n"; customerOwns += "**Customer Owns**/n"; customerOwns += "****/n"; for (Order order : orders) { outstanding += order.getAmount(); } custo... |
### Question:
RemoveAssignmentsToParameters { public int discount(int inputVal, int quantity, int yearToDate) { if (inputVal > 50) inputVal -= 2; if (quantity > 100) inputVal -= 1; if (yearToDate > 10000) inputVal -= 4; return inputVal; } int discount(int inputVal, int quantity, int yearToDate); }### Answer:
@Test pu... |
### Question:
ReplaceTempWithQuery { public double getPrice() { double basePrice = quantity * itemPrice; double discountFactor; if (basePrice > 1000) discountFactor = 0.95; else discountFactor = 0.98; return basePrice * discountFactor; } ReplaceTempWithQuery(double quantity, double itemPrice); double getPrice(); }### ... |
### Question:
ReplaceMethodWithMethodObject { public int gamma(int inputVal, int quantity, int yearToDate) { int importantValue1 = inputVal * quantity; int importantValue2 = inputVal * yearToDate + 100; if ((yearToDate - importantValue1) > 100) importantValue2 -= 20; int importantValue3 = importantValue2 * 7; return im... |
### Question:
SeparateQueryFromModifier { public String checkSecurity(String[] people) { String found = foundMiscreant(people); return someLaterCode(found); } String checkSecurity(String[] people); }### Answer:
@Test public void should_get_alert_message_if_people_names_include_don() { String[] peopleNames = new Strin... |
### Question:
RemoteControl { public void on(int slot) { if (slot == 1) light.on(); if (slot == 2) ceiling.high(); if (slot == 3) { stereo.on(); stereo.setCdStatus(true); stereo.setVolume(11); } } RemoteControl(Light light, Ceiling ceiling, Stereo stereo); void on(int slot); void off(int slot); }### Answer:
@Test publ... |
### Question:
HideMethod { public String getLastReadingName() { List<String> readings = Arrays.asList("Refactoring", "Clean Code"); return getLast(readings); } String getLastReadingName(); String getLast(List<String > readings); }### Answer:
@Test public void should_get_last_reading_name() { HideMethod hideMethod = n... |
### Question:
DateCalculator { public Date getDate() { return new Date(previousDate.getYear(), previousDate.getMonth(), previousDate.getDate() + 1); } DateCalculator(Date previousDate); Date getDate(); }### Answer:
@Test public void should_get_correct_next_day() { Date previousDate = new Date(2011, 10, 11); DateCalcul... |
### Question:
DateManager { public Date getDate() { return new Date(previousDate.getYear(), previousDate.getMonth(), previousDate.getDate() + 1); } DateManager(Date previousDate); Date getDate(); }### Answer:
@Test public void should_get_correct_next_day() { Date previousDate = new Date(2011, 11, 11); DateManager calc... |
### Question:
PersonForExtractClass { public String getTelephoneNumber() { return ("(" + officeAreaCode + ") ") + officeNumber; } PersonForExtractClass(String officeAreaCode, String officeNumber); String getTelephoneNumber(); String getName(); void setName(String name); }### Answer:
@Test public void should_get_correc... |
### Question:
IntRange { public boolean includes(int arg) { return arg >= low && arg <= high; } IntRange(int low, int high); boolean includes(int arg); void grow(int factor); }### Answer:
@Test public void should_not_include_when_number_is_less_than_low_and_greater_than_high() { IntRange intRange = new IntRange(50, 10... |
### Question:
Customer { public String getCustomerName() { return customerName; } Customer(String customerName); String getCustomerName(); }### Answer:
@Test public void should_get_number_of_orders_for_customer() { Order kentOrder1 = new Order("Kent"); Order kentOrder2 = new Order("Kent"); assertEquals("Kent", kentOrd... |
### Question:
Currency { public String getCode() { return code; } Currency(String code); String getCode(); }### Answer:
@Test public void should_two_currencies_with_the_same_unit_are_equal() { Currency usdCurrency1 = new Currency("USD"); Currency usdCurrency2 = new Currency("USD"); assertEquals(usdCurrency1.getCode(),... |
### Question:
EnergyCalculator { public double potentialEnergy(double mass, double height) { return mass * height * 9.81; } double potentialEnergy(double mass, double height); }### Answer:
@Test public void should_get_potential_energy() { EnergyCalculator energyCalculator = new EnergyCalculator(); double potentialEne... |
### Question:
LifelineSite { public Dollars charge() { int usage = readings[0].getAmount() - readings[1].getAmount(); return charge(usage); } void addReading(Reading newReading); Dollars charge(); }### Answer:
@Test(expected = NullPointerException.class) public void should_throw_exception_given_no_reading() { Lifelin... |
### Question:
BusinessSite { public Dollars charge() { int usage = readings[lastReading].getAmount() - readings[lastReading - 1].getAmount(); return charge(usage); } void addReading(Reading newReading); Dollars charge(); }### Answer:
@Test(expected = NullPointerException.class) public void should_throw_exception_give... |
### Question:
ResidentialSite { public Dollars charge() { int i = 0; while (readings[i] != null) i++; int usage = readings[i - 1].getAmount() - readings[i - 2].getAmount(); Date end = readings[i - 1].getDate(); Date start = readings[i - 2].getDate(); start.setDate(start.getDate() + 1); return charge(usage, start, end);... |
### Question:
DisabilitySite { public Dollars charge() { int i; for (i = 0; readings[i] != null; i++) ; int usage = readings[i - 1].getAmount() - readings[i - 2].getAmount(); Date end = readings[i - 1].getDate(); Date start = readings[i - 2].getDate(); start.setDate(start.getDate() + 1); return charge(usage, start, end... |
### Question:
Pixelate { public static Bitmap fromAsset(@NonNull AssetManager assetManager, @NonNull String path, @NonNull PixelateLayer... layers) throws IOException { return fromInputStream(assetManager.open(path), layers); } static Bitmap fromAsset(@NonNull AssetManager assetManager, @NonNull String path, @NonNull ... |
### Question:
Pixelate { public static Bitmap fromInputStream(@NonNull InputStream inputStream, @NonNull PixelateLayer... layers) throws IOException { Bitmap in = BitmapFactory.decodeStream(inputStream); inputStream.close(); Bitmap out = fromBitmap(in, layers); in.recycle(); return out; } static Bitmap fromAsset(@NonN... |
### Question:
Pixelate { public static Bitmap fromBitmap(@NonNull Bitmap in, @NonNull PixelateLayer... layers) { Bitmap out = Bitmap.createBitmap(in.getWidth(), in.getHeight(), Bitmap.Config.ARGB_8888); render(in, out, layers); return out; } static Bitmap fromAsset(@NonNull AssetManager assetManager, @NonNull String p... |
### Question:
Pixelate { public static void render(@NonNull Bitmap in, @NonNull Bitmap out, @NonNull PixelateLayer... layers) { render(in, null, out, layers); } static Bitmap fromAsset(@NonNull AssetManager assetManager, @NonNull String path, @NonNull PixelateLayer... layers); static Bitmap fromInputStream(@NonNull In... |
### Question:
ActionMacroPath { public static Parser newParser() { return new Parser(); } ActionMacroPath(String key, Map<String, String> params); static Parser newParser(); final String key; final Map<String, String> params; }### Answer:
@Test public void test() { ActionMacroPath.Parser parser = ActionMacroPath.newPar... |
### Question:
Scheduler { public void addTask(String cron, Task task) throws InvalidCronException { initialize(); this.addTask(CronParser.parse(cron), this.executorFactory.createTaskExecutor(task)); } Scheduler(); void setDaemon(boolean daemon); void setTimeZone(int timeZone); void setTimeOffset(int timeOffset); int ge... |
### Question:
ClusteringController { public String getRepositoryName() throws RepositoryException{ Session repositorySession = newSession(); try { return repositorySession.getRepository().getDescriptor(org.modeshape.jcr.api.Repository.REPOSITORY_NAME); } finally { repositorySession.logout(); } } void setNewNodeName( S... |
### Question:
FederationController { public String getRepositoryName() throws RepositoryException{ Session repositorySession = newSession(); try { return repositorySession.getRepository().getDescriptor(org.modeshape.jcr.api.Repository.REPOSITORY_NAME); } finally { repositorySession.logout(); } } Map<String, String> ge... |
### Question:
SessionProducer { @RequestScoped @Produces public Session getSession() throws RepositoryException { LOGGER.info("Creating new session..."); return sampleRepository.login(); } @RequestScoped @Produces Session getSession(); void logoutSession( @Disposes final Session session ); }### Answer:
@Test public v... |
### Question:
CDIController { public String getRepositoryName() { return repositorySession.getRepository().getDescriptor(org.modeshape.jcr.api.Repository.REPOSITORY_NAME); } void setNewNodeName( String newNodeName ); String getNewNodeName(); String getParentPath(); void setParentPath( String parentPath ); Set<String> ... |
### Question:
Helper { public static ITabularFormula createRandomFormula(Random random, int varCount, int clausesCount) { int mMax = getMaxNumberOfUniqueTriplets(varCount); if (clausesCount > mMax) { throw new IllegalArgumentException(MessageFormat .format("3-SAT formula of {0} variables may have at most {1} valuable c... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void swapAB() { super.swapAB(); if (size == 0) { return; } int keys_oo51oooo = keys_73516240 & 0x30; int keys_oooo62oo = keys_73516240 & 0x0C; keys_73516240 = (byte) ((keys_73516240 & 0xC3) | ((keys_oo51oooo >> 2) & 0x3F) | (keys_oooo62... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void swapAC() { super.swapAC(); if (size == 0) { return; } int keys_o3o1oooo = keys_73516240 & 0x50; int keys_oooo6o4o = keys_73516240 & 0x0A; keys_73516240 = (byte) ((keys_73516240 & 0xA5) | ((keys_o3o1oooo >> 3) & 0x1F) | (keys_oooo6o... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void swapBC() { super.swapBC(); if (size == 0) { return; } int keys_o3ooo2oo = keys_73516240 & 0x44; int keys_oo5ooo4o = keys_73516240 & 0x22; keys_73516240 = (byte) ((keys_73516240 & 0x99) | ((keys_o3ooo2oo >> 1) & 0x7F) | (keys_oo5ooo... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void adjoinRight(ITier tier) { int tier_keys_73516240 = ((SimpleTier) tier).keys_73516240; int this_keys_o6o2o4o0 = (((tier_keys_73516240 >> 1) & 0x7F) | tier_keys_73516240) & 0x55; int this_keys_7o3o5o1o = ((this_keys_o6o2o4o0 << 1)); ... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void adjoinLeft(ITier tier) { int tier_keys_76325410 = ((SimpleTier) tier).get_keys_76325410(); int this_keys_o3o1o2o0 = (((tier_keys_76325410 >> 1) & 0x7F) | tier_keys_76325410) & 0x55; int this_keys_7o5o6o4o = ((this_keys_o3o1o2o0 << ... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void inverse() { keys_73516240 = (byte)(~keys_73516240); size = 8 - size; } SimpleTier(int a, int b, int c); private SimpleTier(SimpleTier tier); static SimpleTier createCompleteTier(int a, int b, int c); ITier clone(); void add(ITripl... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void concretize(int varName, Value value) { if (Helper.EnableAssertions) { if (value != Value.AllPlain && value != Value.AllNegative) { throw new IllegalArgumentException( "Value should be one of (" + Value.AllPlain + ", " + Value.AllNe... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public Value valueOfA() { return size == 0 ? Value.Mixed : (byte)(keys_73516240 & 0x0F) == keys_73516240 ? Value.AllPlain : (byte)(keys_73516240 & 0xF0) == keys_73516240 ? Value.AllNegative : Value.Mixed; } SimpleTier(int a, int b, int c); pri... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public Value valueOfB() { return size == 0 ? Value.Mixed : (byte)(keys_73516240 & 0x33) == keys_73516240 ? Value.AllPlain : (byte)(keys_73516240 & 0xCC) == keys_73516240 ? Value.AllNegative : Value.Mixed; } SimpleTier(int a, int b, int c); pri... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public Value valueOfC() { return size == 0 ? Value.Mixed : (byte)(keys_73516240 & 0x55) == keys_73516240 ? Value.AllPlain : (byte)(keys_73516240 & 0xAA) == keys_73516240 ? Value.AllNegative : Value.Mixed; } SimpleTier(int a, int b, int c); pri... |
### Question:
Helper { public static int getCanonicalVarName3(int varName1, int varName2, int[] canonicalName) { int varName3; if (varName1 == canonicalName[1]) { if (varName2 == canonicalName[2]) { varName3 = canonicalName[0]; } else { varName3 = canonicalName[2]; } } else { if (varName2 == canonicalName[1]) { if (var... |
### Question:
Helper { public static ObjectArrayList createCTF(ITabularFormula formula) { ObjectArrayList ctf = new ObjectArrayList(); ObjectArrayList tiers = formula.getTiers(); ITabularFormula f = new SimpleFormula(); f.unionOrAdd(formula.getTier(0).clone()); ctf.add(f); for (int i = 1; i < tiers.size(); i++) { ITier... |
### Question:
SimplePermutation implements IPermutation { public int indexOf(int varName) { return permutationHash.containsKey(varName) ? permutationHash.get(varName) : -1; } SimplePermutation(); boolean contains(int varName); int indexOf(int varName); void put(int[] varNames); void add(int varName); void add(int index... |
### Question:
SimplePermutation implements IPermutation { public void shiftToStart(int from, int to) { if (to <= from) { throw new IllegalArgumentException("to <= from"); } int[] buffer = new int[from]; int[] elements = permutation.elements(); System.arraycopy(elements, 0, buffer, 0, from); System.arraycopy(elements, f... |
### Question:
SimplePermutation implements IPermutation { public void shiftToEnd(int from, int to) { if (to <= from) { throw new IllegalArgumentException("to <= from"); } int[] buffer = new int[permutation.size() - to - 1]; int[] elements = permutation.elements(); System.arraycopy(elements, to + 1, buffer, 0, permutati... |
### Question:
SimpleFormula implements ICompactTripletsStructure, ICompactTripletsStructureHolder { public boolean evaluate(Properties properties) { boolean result = true; for (int j = 0; j < getTiers().size(); j++) { for (ITripletValue tiplet : getTier(j)) { ITripletPermutation permutation = getTier(j); boolean aValue... |
### Question:
SimpleTier extends SimpleTripletPermutation implements ITier { public void add(ITripletValue triplet) { if (!contains(triplet)) { keys_73516240 = (byte)(keys_73516240 | triplet.getTierKey()); size++; } } SimpleTier(int a, int b, int c); private SimpleTier(SimpleTier tier); static SimpleTier createComplet... |
### Question:
DefaultPreconditions implements Preconditions { @Override public boolean isConnecting(TGDevice device) { return device != null && device.getState() == TGDevice.STATE_CONNECTING; } @Override boolean isConnecting(TGDevice device); @Override boolean isConnected(TGDevice device); @Override boolean canConnect... |
### Question:
DefaultPreconditions implements Preconditions { @Override public boolean isBluetoothAdapterInitialized() { return isBluetoothAdapterInitialized(BluetoothAdapter.getDefaultAdapter()); } @Override boolean isConnecting(TGDevice device); @Override boolean isConnected(TGDevice device); @Override boolean canCo... |
### Question:
DefaultPreconditions implements Preconditions { @Override public boolean isBluetoothEnabled() { return isBluetoothEnabled(BluetoothAdapter.getDefaultAdapter()); } @Override boolean isConnecting(TGDevice device); @Override boolean isConnected(TGDevice device); @Override boolean canConnect(TGDevice device)... |
### Question:
NeuroSky { public void connect() throws BluetoothNotEnabledException { if (!preconditions.isBluetoothEnabled()) { throw new BluetoothNotEnabledException(); } if (canConnect()) { openConnection(); } } NeuroSky(final DeviceMessageListener listener); protected NeuroSky(final DeviceMessageListener listener, ... |
### Question:
DeviceMessageHandler extends Handler { @Override public void handleMessage(Message message) { super.handleMessage(message); if (listener != null) { listener.onMessageReceived(message); } } DeviceMessageHandler(final DeviceMessageListener deviceMessageListener); @Override void handleMessage(Message message... |
### Question:
EventBus { public static EventBus create() { return new EventBus(); } private EventBus(); static EventBus create(); void send(final BrainEvent object); @SuppressWarnings("unchecked") Flowable<BrainEvent> receive(BackpressureStrategy backpressureStrategy); }### Answer:
@Test public void shouldCreateBus()... |
### Question:
RxNeuroSky { public Completable connect() { return Completable.create(emitter -> { if (!preconditions.isBluetoothEnabled()) { emitter.onError(new BluetoothNotEnabledException()); } if (preconditions.canConnect(device)) { openConnection(); emitter.onComplete(); } else { emitter.onError(new BluetoothConnect... |
### Question:
DefaultPreconditions implements Preconditions { @Override public boolean isConnected(TGDevice device) { return device != null && device.getState() == TGDevice.STATE_CONNECTED; } @Override boolean isConnecting(TGDevice device); @Override boolean isConnected(TGDevice device); @Override boolean canConnect(T... |
### Question:
DefaultPreconditions implements Preconditions { @Override public boolean canConnect(TGDevice device) { return !isConnecting(device) && !isConnected(device); } @Override boolean isConnecting(TGDevice device); @Override boolean isConnected(TGDevice device); @Override boolean canConnect(TGDevice device); @O... |
### Question:
MDSHiveParserOutputFormat extends FileOutputFormat<NullWritable,ParserWritable> implements HiveOutputFormat<NullWritable,ParserWritable> { @Override public RecordWriter<NullWritable, ParserWritable> getRecordWriter( final FileSystem ignored, final JobConf job, final String name, final Progressable progres... |
### Question:
UnsupportedBlockIndex implements IBlockIndex { @Override public List<Integer> getBlockSpreadIndex( final IFilter filter ){ return null; } @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBlockIndex blockIndex ); @Override int getBinarySize(); @Override byte[] toBinary(); @Ove... |
### Question:
FindBlockIndex { public static IBlockIndex get( final String target ) throws IOException{ IBlockIndex cacheResult = CACHE.get( target ); if( cacheResult != null ){ return cacheResult.getNewInstance(); } if( target == null || target.isEmpty() ){ throw new IOException( "IBlockIndex class name is null or emp... |
### Question:
LongRangeBlockIndex implements IBlockIndex { @Override public BlockIndexType getBlockIndexType(){ return BlockIndexType.RANGE_LONG; } LongRangeBlockIndex(); LongRangeBlockIndex( final long min , final long max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBlockIndex blo... |
### Question:
LongRangeBlockIndex implements IBlockIndex { @Override public int getBinarySize(){ return Long.BYTES * 2; } LongRangeBlockIndex(); LongRangeBlockIndex( final long min , final long max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBlockIndex blockIndex ); @Override int g... |
### Question:
DoubleRangeBlockIndex implements IBlockIndex { @Override public BlockIndexType getBlockIndexType(){ return BlockIndexType.RANGE_DOUBLE; } DoubleRangeBlockIndex(); DoubleRangeBlockIndex( final Double min , final Double max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBl... |
### Question:
DoubleRangeBlockIndex implements IBlockIndex { @Override public int getBinarySize(){ return Double.BYTES * 2; } DoubleRangeBlockIndex(); DoubleRangeBlockIndex( final Double min , final Double max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBlockIndex blockIndex ); @Ov... |
### Question:
ShortRangeBlockIndex implements IBlockIndex { @Override public BlockIndexType getBlockIndexType(){ return BlockIndexType.RANGE_SHORT; } ShortRangeBlockIndex(); ShortRangeBlockIndex( final short min , final short max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBlockInd... |
### Question:
ParserWritable implements Writable { @Override public void readFields( final DataInput dataInput ) throws IOException { throw new UnsupportedOperationException("readFields unsupported"); } void set( final IParser parser ); @Override void write( final DataOutput dataOutput ); @Override void readFields( fi... |
### Question:
ShortRangeBlockIndex implements IBlockIndex { @Override public int getBinarySize(){ return Short.BYTES * 2; } ShortRangeBlockIndex(); ShortRangeBlockIndex( final short min , final short max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBlockIndex blockIndex ); @Override... |
### Question:
IntegerRangeBlockIndex implements IBlockIndex { @Override public BlockIndexType getBlockIndexType(){ return BlockIndexType.RANGE_INTEGER; } IntegerRangeBlockIndex(); IntegerRangeBlockIndex( final int min , final int max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBloc... |
### Question:
IntegerRangeBlockIndex implements IBlockIndex { @Override public int getBinarySize(){ return Integer.BYTES * 2; } IntegerRangeBlockIndex(); IntegerRangeBlockIndex( final int min , final int max ); @Override BlockIndexType getBlockIndexType(); @Override boolean merge( final IBlockIndex blockIndex ); @Over... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.