method2testcases stringlengths 118 3.08k |
|---|
### Question:
Not extends BaseExpression { @Override public void addChildren(Deque<Expression> expressions) { addChildren(expressions, 1); } Not(); @Override Result apply(PathData item); @Override boolean isOperator(); @Override int getPrecedence(); @Override void addChildren(Deque<Expression> expressions); static void... |
### Question:
Depth extends BaseExpression { @Override public Result apply(PathData item) { return Result.PASS; } Depth(); @Override Result apply(PathData item); @Override void initialise(FindOptions options); static void registerExpression(ExpressionFactory factory); }### Answer:
@Test public void apply() throws IOEx... |
### Question:
Or extends BaseExpression { @Override public void addChildren(Deque<Expression> expressions) { addChildren(expressions, 2); } Or(); @Override Result apply(PathData item); @Override boolean isOperator(); @Override int getPrecedence(); @Override void addChildren(Deque<Expression> expressions); static void r... |
### Question:
Atime extends NumberExpression { @Override public Result apply(PathData item) throws IOException { return applyNumber(getOptions().getStartTime() - getFileStatus(item).getAccessTime()); } Atime(); Atime(long units); @Override Result apply(PathData item); static void registerExpression(ExpressionFactory f... |
### Question:
Exec extends BaseExpression { @Override public void addArguments(Deque<String> args) { while(!args.isEmpty()) { String arg = args.pop(); if("+".equals(arg) && !getArguments().isEmpty() && "{}".equals(getArguments().get(getArguments().size() - 1))) { setBatch(true); break; } else if(";".equals(arg)) { brea... |
### Question:
Print extends BaseExpression { public Print(boolean appendNull) { super(); setUsage(USAGE); setHelp(HELP); setAppendNull(appendNull); } Print(boolean appendNull); Print(); @Override Result apply(PathData item); @Override boolean isAction(); static void registerExpression(ExpressionFactory factory); }###... |
### Question:
Prune extends BaseExpression { @Override public Result apply(PathData item) throws IOException { if(getOptions().isDepth()) { return Result.PASS; } return Result.STOP; } Prune(); @Override Result apply(PathData item); static void registerExpression(ExpressionFactory factory); }### Answer:
@Test public vo... |
### Question:
Nogroup extends BaseExpression { @Override public Result apply(PathData item) throws IOException { String group = getFileStatus(item).getGroup(); if((group == null) || (group.equals(""))) { return Result.PASS; } return Result.FAIL; } Nogroup(); @Override Result apply(PathData item); static void registerEx... |
### Question:
Nouser extends BaseExpression { @Override public Result apply(PathData item) throws IOException { String user = getFileStatus(item).getOwner(); if((user == null) || (user.equals(""))) { return Result.PASS; } return Result.FAIL; } Nouser(); @Override Result apply(PathData item); static void registerExpress... |
### Question:
Blocksize extends NumberExpression { @Override public Result apply(PathData item) throws IOException { return applyNumber(getFileStatus(item).getBlockSize()); } Blocksize(); @Override Result apply(PathData item); static void registerExpression(ExpressionFactory factory); }### Answer:
@Test public void ap... |
### Question:
Result { public Result combine(Result other) { return new Result(this.isPass() && other.isPass(), this.isDescend() && other.isDescend()); } private Result(boolean success, boolean recurse); boolean isDescend(); boolean isPass(); Result combine(Result other); Result negate(); String toString(); @Override ... |
### Question:
Result { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Result other = (Result) obj; if (descend != other.descend) return false; if (success != other.success) return false; return true; } private R... |
### Question:
Newer extends BaseExpression { @Override public Result apply(PathData item) throws IOException { if(getFileStatus(item).getModificationTime() > filetime) { return Result.PASS; } return Result.FAIL; } Newer(); @Override void initialise(FindOptions options); @Override Result apply(PathData item); @Override ... |
### Question:
Group extends BaseExpression { @Override public Result apply(PathData item) throws IOException { String group = getFileStatus(item).getGroup(); if(requiredGroup.equals(group)) { return Result.PASS; } return Result.FAIL; } Group(); @Override void addArguments(Deque<String> args); @Override void initialise(... |
### Question:
Mtime extends NumberExpression { @Override public Result apply(PathData item) throws IOException { return applyNumber(getOptions().getStartTime() - getFileStatus(item).getModificationTime()); } Mtime(); Mtime(long units); @Override Result apply(PathData item); static void registerExpression(ExpressionFac... |
### Question:
Type extends BaseExpression { @Override public void initialise(FindOptions option) throws IOException { String arg = getArgument(1); if(FILE_TYPES.containsKey(arg)) { this.fileType = FILE_TYPES.get(arg); } else { throw new IOException("Invalid file type: " + arg); } } Type(); @Override void addArguments(D... |
### Question:
Name extends BaseExpression { @Override public Result apply(PathData item) { String name = getPath(item).getName(); if(!caseSensitive) { name = name.toLowerCase(); } if(globPattern.matches(name)) { return Result.PASS; } else { return Result.FAIL; } } Name(); Name(boolean caseSensitive); @Override void ad... |
### Question:
Replicas extends NumberExpression { @Override public Result apply(PathData item) throws IOException { return applyNumber(getFileStatus(item).getReplication()); } Replicas(); @Override Result apply(PathData item); static void registerExpression(ExpressionFactory factory); }### Answer:
@Test public void ap... |
### Question:
ClassExpression extends FilterExpression { @Override public boolean isOperator() { if(expression == null) { return false; } return expression.isOperator(); } ClassExpression(); static void registerExpression(ExpressionFactory factory); @Override void addArguments(Deque<String> args); @Override String[] ge... |
### Question:
JGitAPIExceptions { public static RuntimeException exceptionWithFriendlyMessageFor(Exception e) { Throwable cause = getRootCause(e); String message = cause.getMessage(); if (message == null) { message = cause.getClass().getSimpleName(); } if (cause instanceof JSchException) { message = "SSH: " + message; ... |
### Question:
FilePathMatcher implements Predicate<FilePath> { public int[] match(CharSequence filePath) { Matcher matcher = pattern.matcher(filePath); if (matcher.find()) { for (int i = 0; i < matchingLetters.length; ++i) { matchingLetters[i] = matcher.start(i + 1); } return matchingLetters; } else { return null; } } ... |
### Question:
RDTTag extends RepoDomainType<TagSummary> { public List<TagSummary> getAll() { final RevWalk revWalk = new RevWalk(repository); List<TagSummary> tagSummaries = newArrayList(transform(repository.getTags().values(), new TagSummaryFactory(revWalk))); sort(tagSummaries, SORT_BY_TIME_AND_NAME); return tagSumma... |
### Question:
GitHubWebLaunchActivity extends WebLaunchActivity { Intent cloneLauncherForWebBrowseIntent(Uri uri) { Matcher matcher = projectPathPattern.matcher(uri.getPath()); matcher.find(); return cloneLauncherIntentFor("git: } }### Answer:
@Test public void shouldSupplyCloneSourceForRegularGithubProjectPage() { ... |
### Question:
EmailCommandHandler { public void create(EmailCreateCommand command) throws Exception { EmailAggregate emailAggregate = getByUUID(command.getUuid()); emailAggregate = emailAggregate.create(command); List<AppEvent> pendingEvents = emailAggregate.getUncommittedChanges(); eventSourcingService.save(emailAggre... |
### Question:
EmailCommandHandler { public void send(EmailSendCommand command) throws Exception { EmailAggregate emailAggregate = getByUUID(command.getUuid()); emailAggregate = emailAggregate.send(command); List<AppEvent> pendingEvents = emailAggregate.getUncommittedChanges(); pendingEvents.forEach(eventPublisher::stre... |
### Question:
EmailCommandHandler { public EmailAggregate getByUUID(String uuid) { return EmailAggregate.from(uuid, eventSourcingService.getRelatedEvents(uuid)); } EmailCommandHandler(
EventSourcingService eventSourcingService,
EventPublisher eventPublisher
); void create(EmailCreateCommand ... |
### Question:
EmailAggregate extends AbstractAggregate implements Aggregate { public EmailAggregate create(EmailCreateCommand command) throws Exception { if (state.getState() != null) { throw new Exception("Is not possible to edit a deleted email"); } return applyChange(new EmailCreatedEvent(uuid, command.getEmail()));... |
### Question:
EmailAggregate extends AbstractAggregate implements Aggregate { public EmailAggregate send(EmailSendCommand command) throws Exception { if (state.getState() == EmailState.DELETED) { throw new Exception("Is not possible to edit a deleted email"); } return applyChange(new EmailSentEvent( command.getUuid(), ... |
### Question:
EmailAggregate extends AbstractAggregate implements Aggregate { @Override public EmailAggregate markChangesAsCommitted() { return new EmailAggregate(uuid, new CopyOnWriteArrayList(), state); } EmailAggregate(String uuid, List<AppEvent> changes); EmailAggregate(String uuid, List<AppEvent> changes, Email s... |
### Question:
EmailAggregate extends AbstractAggregate implements Aggregate { public EmailAggregate delete(EmailDeleteCommand command) throws Exception { if (state.getState() == EmailState.DELETED) { throw new Exception("Is not possible to delete a deleted email"); } return applyChange(new EmailDeletedEvent(uuid, getSt... |
### Question:
Tables { public static String getSQL(Object[] sqlData, Version currentVersion) { try { for (int c = 0; c < sqlData.length; c += 2) { Version curSqlVersion = (Version) sqlData[c]; String curSql = (String) sqlData[c + 1]; if (currentVersion.isMinimum(curSqlVersion)) return curSql; } } catch (Exception e) { ... |
### Question:
PGTypeTable implements Table<PGTypeTable.Row> { @Override public String getSQL(Version currentVersion) { return Tables.getSQL(SQL, currentVersion); } private PGTypeTable(); @Override String getSQL(Version currentVersion); @Override Row createRow(Context context, ResultBatch resultBatch, int rowIdx); stat... |
### Question:
PGTypeTable implements Table<PGTypeTable.Row> { @Override public Row createRow(Context context, ResultBatch resultBatch, int rowIdx) throws IOException { Row row = new Row(); row.load(context, resultBatch, rowIdx); return row; } private PGTypeTable(); @Override String getSQL(Version currentVersion); @Ove... |
### Question:
SearchHistoryEntity implements SearchHistory { @Override @NonNull public String getPlaceId() { return placeId; } SearchHistoryEntity(@NonNull String placeId, CarmenFeature carmenFeature); @Override @NonNull String getPlaceId(); @Override CarmenFeature getCarmenFeature(); }### Answer:
@Test public void ge... |
### Question:
LocalizationPlugin { public void setMapLanguage(@Languages String language) { setMapLanguage(new MapLocale(language)); } LocalizationPlugin(@NonNull MapView mapView, @NonNull final MapboxMap mapboxMap, @NonNull Style style); void matchMapLanguageWithDeviceDefault(); void matchMapLanguageWithDeviceDefault(... |
### Question:
MapLocale { @Nullable public static MapLocale getMapLocale(@NonNull Locale locale) { return getMapLocale(locale, false); } MapLocale(@NonNull String mapLanguage); MapLocale(@NonNull LatLngBounds countryBounds); MapLocale(@NonNull @Languages String mapLanguage, @Nullable LatLngBounds countryBounds); @Non... |
### Question:
SearchHistoryEntity implements SearchHistory { @Override public CarmenFeature getCarmenFeature() { return carmenFeature; } SearchHistoryEntity(@NonNull String placeId, CarmenFeature carmenFeature); @Override @NonNull String getPlaceId(); @Override CarmenFeature getCarmenFeature(); }### Answer:
@Test publ... |
### Question:
DraggableAnnotationController { boolean startDragging(@NonNull Annotation annotation, @NonNull AnnotationManager annotationManager) { if (annotation.isDraggable()) { for (OnAnnotationDragListener d : (List<OnAnnotationDragListener>) annotationManager.getDragListeners()) { d.onAnnotationDragStarted(annotat... |
### Question:
DraggableAnnotationController { void stopDragging(@Nullable Annotation annotation, @Nullable AnnotationManager annotationManager) { if (annotation != null && annotationManager != null) { for (OnAnnotationDragListener d : (List<OnAnnotationDragListener>) annotationManager.getDragListeners()) { d.onAnnotati... |
### Question:
CarmenFeatureConverter { @TypeConverter public static String fromCarmenFeature(@NonNull CarmenFeature carmenFeature) { return carmenFeature.toJson(); } private CarmenFeatureConverter(); @TypeConverter static CarmenFeature toCarmenFeature(String serializedCarmenFeature); @TypeConverter static String fromC... |
### Question:
PlacePickerOptions implements BasePlaceOptions, Parcelable { public static Builder builder() { return new AutoValue_PlacePickerOptions.Builder() .includeReverseGeocode(true) .includeDeviceLocationButton(false); } @Override @Nullable abstract String language(); @Override @Nullable abstract String geocodin... |
### Question:
PlacePicker { @Nullable public static CarmenFeature getPlace(Intent data) { String json = data.getStringExtra(PlaceConstants.RETURNING_CARMEN_FEATURE); if (json == null) { return null; } return CarmenFeature.fromJson(json); } private PlacePicker(); @Nullable static CarmenFeature getPlace(Intent data); st... |
### Question:
PlacePicker { public static CameraPosition getLastCameraPosition(Intent data) { return data.getParcelableExtra(PlaceConstants.MAP_CAMERA_POSITION); } private PlacePicker(); @Nullable static CarmenFeature getPlace(Intent data); static CameraPosition getLastCameraPosition(Intent data); }### Answer:
@Test ... |
### Question:
TightCouplingProcessor { List<List<String>> subsets(List<String> set) { List<List<String>> subsets = new ArrayList<>(); int n = set.size(); for (int i = 0; i < (1 << n); i++) { List<String> combination = new ArrayList<>(); for (int j = 0; j < n; j++) if ((i & (1 << j)) > 0) combination.add(set.get(j)); if... |
### Question:
InvocationStatistics { public void addInvocation(Invocation invocation) { numberOfInvocations++; if (this.methodName != null) { this.methodName = invocation.getMethodName(); } this.recentDuration = invocation.getRecentDuration(); this.lastInvocationTimestamp = invocation.getCreationTime(); String currentE... |
### Question:
InvocationMonitoring { public void reset() { this.statistics.clear(); } @PostConstruct void init(); void onNewCall(@Observes Invocation invocation); List<InvocationStatistics> getExceptional(); List<InvocationStatistics> getUnstable(); List<InvocationStatistics> getSlowest(); List<InvocationStatistics> g... |
### Question:
BluetoothController implements Closeable { public boolean isBluetoothEnabled() { return bluetooth.isEnabled(); } BluetoothController(Activity context,BluetoothAdapter adapter, BluetoothDiscoveryDeviceListener listener); boolean isBluetoothEnabled(); void startDiscovery(); void turnOnBluetooth(); boolean p... |
### Question:
BluetoothController implements Closeable { public void turnOnBluetooth() { Log.d(TAG, "Enabling Bluetooth."); broadcastReceiverDelegator.onBluetoothTurningOn(); bluetooth.enable(); } BluetoothController(Activity context,BluetoothAdapter adapter, BluetoothDiscoveryDeviceListener listener); boolean isBlueto... |
### Question:
BluetoothController implements Closeable { public boolean isDiscovering() { return bluetooth.isDiscovering(); } BluetoothController(Activity context,BluetoothAdapter adapter, BluetoothDiscoveryDeviceListener listener); boolean isBluetoothEnabled(); void startDiscovery(); void turnOnBluetooth(); boolean pa... |
### Question:
BluetoothController implements Closeable { public int getPairingDeviceStatus() { if (this.boundingDevice == null) { throw new IllegalStateException("No device currently bounding"); } int bondState = this.boundingDevice.getBondState(); if (bondState != BluetoothDevice.BOND_BONDING) { this.boundingDevice = ... |
### Question:
BluetoothController implements Closeable { public static String getDeviceName(BluetoothDevice device) { String deviceName = device.getName(); if (deviceName == null) { deviceName = device.getAddress(); } return deviceName; } BluetoothController(Activity context,BluetoothAdapter adapter, BluetoothDiscovery... |
### Question:
BluetoothController implements Closeable { public boolean isAlreadyPaired(BluetoothDevice device) { return bluetooth.getBondedDevices().contains(device); } BluetoothController(Activity context,BluetoothAdapter adapter, BluetoothDiscoveryDeviceListener listener); boolean isBluetoothEnabled(); void startDis... |
### Question:
BluetoothController implements Closeable { public static String deviceToString(BluetoothDevice device) { return "[Address: " + device.getAddress() + ", Name: " + device.getName() + "]"; } BluetoothController(Activity context,BluetoothAdapter adapter, BluetoothDiscoveryDeviceListener listener); boolean isB... |
### Question:
BluetoothController implements Closeable { public void turnOnBluetoothAndScheduleDiscovery() { this.bluetoothDiscoveryScheduled = true; turnOnBluetooth(); } BluetoothController(Activity context,BluetoothAdapter adapter, BluetoothDiscoveryDeviceListener listener); boolean isBluetoothEnabled(); void startDi... |
### Question:
Regex extends KoryphePredicate<String> { @Override public boolean test(final String input) { return !(null == input || input.getClass() != String.class) && controlValue.matcher(input).matches(); } Regex(); Regex(final String controlValue); Regex(final Pattern controlValue); @JsonTypeInfo(use = JsonTypeI... |
### Question:
Regex extends KoryphePredicate<String> { @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonProperty("value") public Pattern getControlValue() { return controlValue; } Regex(); Regex(final String controlValue); Regex(final Pattern controlValue); @JsonTypeInfo(use =... |
### Question:
AreIn extends KoryphePredicate<Collection<?>> { @JsonIgnore public Collection<?> getValues() { return allowedValues; } AreIn(); AreIn(final Collection<?> allowedValues); AreIn(final Object... allowedValues); @JsonIgnore Collection<?> getValues(); void setValues(final Collection<?> allowedValues); @JsonT... |
### Question:
IsMoreThan extends KoryphePredicate<Comparable> implements InputValidator { @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonProperty("value") public Comparable getControlValue() { return controlValue; } IsMoreThan(); IsMoreThan(final Comparable<?> controlValue); ... |
### Question:
IsMoreThan extends KoryphePredicate<Comparable> implements InputValidator { @Override public ValidationResult isInputValid(final Class<?>... arguments) { final ValidationResult result = new ValidationResult(); if (null == controlValue) { result.addError("Control value has not been set"); return result; } ... |
### Question:
IsXMoreThanY extends KoryphePredicate2<Comparable, Comparable> implements InputValidator { @Override public boolean test(final Comparable input1, final Comparable input2) { return null != input1 && null != input2 && input1.getClass() == input2.getClass() && (input1.compareTo(input2) > 0); } @Override boo... |
### Question:
IsXMoreThanY extends KoryphePredicate2<Comparable, Comparable> implements InputValidator { @Override public ValidationResult isInputValid(final Class<?>... arguments) { final ValidationResult result = new ValidationResult(); if (null == arguments || 2 != arguments.length || null == arguments[0] || null ==... |
### Question:
AreEqual extends KoryphePredicate2<Object, Object> { @Override public boolean test(final Object input1, final Object input2) { if (null == input1) { return null == input2; } return input1.equals(input2); } @Override boolean test(final Object input1, final Object input2); }### Answer:
@Test public void s... |
### Question:
IsFalse extends KoryphePredicate<Boolean> { @Override public boolean test(final Boolean input) { return Boolean.FALSE.equals(input); } @Override boolean test(final Boolean input); }### Answer:
@Test public void shouldAcceptTheValueWhenFalse() { final IsFalse filter = new IsFalse(); boolean accepted = fi... |
### Question:
IsA extends KoryphePredicate<Object> { @Override public boolean test(final Object input) { return null == input || null == type || type.isAssignableFrom(input.getClass()); } IsA(); IsA(final Class<?> type); IsA(final String type); void setType(final String type); String getType(); @Override boolean test... |
### Question:
IsA extends KoryphePredicate<Object> { public String getType() { return null != type ? type.getName() : null; } IsA(); IsA(final Class<?> type); IsA(final String type); void setType(final String type); String getType(); @Override boolean test(final Object input); @Override boolean equals(final Object ob... |
### Question:
AbstractInTimeRange extends KoryphePredicate<T> { @Override public String toString() { return new ToStringBuilder(this) .appendSuper(predicate.toString()) .toString(); } protected AbstractInTimeRange(final AbstractInTimeRangeDual<T> predicate); @Override boolean test(final T value); String getStart(); Lo... |
### Question:
AbstractInTimeRangeDual extends KoryphePredicate2<Comparable<T>, Comparable<T>> { @JsonGetter("timeZone") public String getTimeZoneId() { return null != timeZone ? timeZone.getID() : null; } protected AbstractInTimeRangeDual(); protected AbstractInTimeRangeDual(final Function<Long, T> toT); void initial... |
### Question:
Not extends KoryphePredicate<I> implements InputValidator { @Override public boolean test(final I input) { return null != predicate && !predicate.test(input); } Not(); Not(final Predicate<I> predicate); void setPredicate(final Predicate<I> predicate); Predicate<I> getPredicate(); @Override boolean test(f... |
### Question:
Not extends KoryphePredicate<I> implements InputValidator { public Predicate<I> getPredicate() { return predicate; } Not(); Not(final Predicate<I> predicate); void setPredicate(final Predicate<I> predicate); Predicate<I> getPredicate(); @Override boolean test(final I input); @Override boolean equals(fina... |
### Question:
IsTrue extends KoryphePredicate<Boolean> { @Override public boolean test(final Boolean input) { return Boolean.TRUE.equals(input); } @Override boolean test(final Boolean input); }### Answer:
@Test public void shouldAcceptTheValueWhenTrue() { final IsTrue filter = new IsTrue(); boolean accepted = filter.... |
### Question:
IsEqual extends KoryphePredicate<Object> { @Override public boolean test(final Object input) { if (null == controlValue) { return null == input; } return controlValue.equals(input); } IsEqual(); IsEqual(final Object controlValue); @JsonProperty("value") @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include ... |
### Question:
IsEqual extends KoryphePredicate<Object> { @JsonProperty("value") @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.WRAPPER_OBJECT) public Object getControlValue() { return controlValue; } IsEqual(); IsEqual(final Object controlValue); @JsonProperty("value") @JsonTypeInfo(use = JsonTyp... |
### Question:
CollectionContains extends KoryphePredicate<Collection<?>> { @Override public boolean test(final Collection<?> input) { return input.contains(value); } CollectionContains(); CollectionContains(final Object value); @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "... |
### Question:
CollectionContains extends KoryphePredicate<Collection<?>> { @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "class") public Object getValue() { return value; } CollectionContains(); CollectionContains(final Object value); @JsonTypeInfo(use = JsonTypeInfo.Id.CLAS... |
### Question:
MapContainsPredicate extends KoryphePredicate<Map> { @Override public boolean test(final Map input) { if (null != input && null != keyPredicate) { for (final Object key : input.keySet()) { if (keyPredicate.test(key)) { return true; } } } return false; } MapContainsPredicate(); MapContainsPredicate(final ... |
### Question:
MapContainsPredicate extends KoryphePredicate<Map> { @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "class") public Predicate getKeyPredicate() { return keyPredicate; } MapContainsPredicate(); MapContainsPredicate(final Predicate keyPredicate); @JsonTypeInfo(use... |
### Question:
AgeOffFromDays extends KoryphePredicate2<Long, Integer> { @Override public boolean test(final Long timestamp, final Integer days) { return null != timestamp && null != days && (System.currentTimeMillis() - (days * DAYS_TO_MILLISECONDS) < timestamp); } @Override boolean test(final Long timestamp, final In... |
### Question:
IsLessThan extends KoryphePredicate<Comparable> implements InputValidator { @Override public ValidationResult isInputValid(final Class<?>... arguments) { final ValidationResult result = new ValidationResult(); if (null == controlValue) { result.addError("Control value has not been set"); return result; } ... |
### Question:
IsLongerThan extends KoryphePredicate<Object> implements InputValidator { public int getMinLength() { return minLength; } IsLongerThan(); IsLongerThan(final int minLength); IsLongerThan(final int minLength, final boolean orEqualTo); int getMinLength(); void setMinLength(final int minLength); boolean isO... |
### Question:
MapContains extends KoryphePredicate<Map> { @Override public boolean test(final Map input) { return input.containsKey(key); } MapContains(); MapContains(final String key); String getKey(); void setKey(final String key); @Override boolean test(final Map input); @Override boolean equals(final Object obj); ... |
### Question:
MapContains extends KoryphePredicate<Map> { public String getKey() { return key; } MapContains(); MapContains(final String key); String getKey(); void setKey(final String key); @Override boolean test(final Map input); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String ... |
### Question:
IsXLessThanY extends KoryphePredicate2<Comparable, Comparable> implements InputValidator { @Override public boolean test(final Comparable input1, final Comparable input2) { return null != input1 && null != input2 && input1.getClass() == input2.getClass() && (input1.compareTo(input2) < 0); } @Override boo... |
### Question:
IsXLessThanY extends KoryphePredicate2<Comparable, Comparable> implements InputValidator { @Override public ValidationResult isInputValid(final Class<?>... arguments) { final ValidationResult result = new ValidationResult(); if (null == arguments || 2 != arguments.length || null == arguments[0] || null ==... |
### Question:
AgeOff extends KoryphePredicate<Long> { public long getAgeOffTime() { return ageOffTime; } AgeOff(); AgeOff(final long ageOffTime); @Override boolean test(final Long input); long getAgeOffTime(); void setAgeOffTime(final long ageOffTime); void setAgeOffDays(final int ageOfDays); void setAgeOffHours(final... |
### Question:
AgeOff extends KoryphePredicate<Long> { @Override public boolean test(final Long input) { return null != input && (System.currentTimeMillis() - input) < ageOffTime; } AgeOff(); AgeOff(final long ageOffTime); @Override boolean test(final Long input); long getAgeOffTime(); void setAgeOffTime(final long age... |
### Question:
IsIn extends KoryphePredicate<Object> { @Override public boolean test(final Object input) { return null != allowedValues && allowedValues.contains(input); } IsIn(); IsIn(final Collection<Object> controlData); IsIn(final Object... controlData); @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTyp... |
### Question:
IsIn extends KoryphePredicate<Object> { @JsonIgnore public Set<Object> getAllowedValues() { return allowedValues; } IsIn(); IsIn(final Collection<Object> controlData); IsIn(final Object... controlData); @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonProperty("v... |
### Question:
Exists extends KoryphePredicate<Object> { @Override public boolean test(final Object input) { return null != input; } @Override boolean test(final Object input); }### Answer:
@Test public void shouldAcceptTheValueWhenNotNull() { final Exists filter = new Exists(); boolean accepted = filter.test("Not nul... |
### Question:
MultiRegex extends KoryphePredicate<String> { @Override public boolean test(final String input) { if (null == input || input.getClass() != String.class) { return false; } for (final Pattern pattern : patterns) { if (pattern.matcher(input).matches()) { return true; } } return false; } MultiRegex(); MultiR... |
### Question:
MultiRegex extends KoryphePredicate<String> { @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.WRAPPER_OBJECT) @JsonProperty("value") public Pattern[] getPatterns() { return Arrays.copyOf(patterns, patterns.length); } MultiRegex(); MultiRegex(final Pattern... patterns); @JsonTypeInfo(... |
### Question:
IsShorterThan extends KoryphePredicate<Object> implements InputValidator { public int getMaxLength() { return maxLength; } IsShorterThan(); IsShorterThan(final int maxLength); IsShorterThan(final int maxLength, final boolean orEqualTo); int getMaxLength(); void setMaxLength(final int maxLength); boolean... |
### Question:
StringConcat extends KorypheBinaryOperator<String> { public void setSeparator(final String separator) { this.separator = separator; } StringConcat(); StringConcat(final String separator); @Override String _apply(final String a, final String b); String getSeparator(); void setSeparator(final String separa... |
### Question:
StringDeduplicateConcat extends KorypheBinaryOperator<String> { @Override protected String _apply(final String a, final String b) { final Set<String> set = new LinkedHashSet<>(); Collections.addAll(set, p.split(StringUtils.removeStart(a, separator))); Collections.addAll(set, p.split(StringUtils.removeStar... |
### Question:
ExtractKeys extends KorypheFunction<Map<K, V>, Iterable<K>> { @Override public Iterable<K> apply(final Map<K, V> map) { return null == map ? null : map.keySet(); } @Override Iterable<K> apply(final Map<K, V> map); }### Answer:
@Test public void shouldExtractKeysFromGivenMap() { final ExtractKeys<String,... |
### Question:
DivideBy extends KorypheFunction<Integer, Tuple2<Integer, Integer>> { @Override public Tuple2<Integer, Integer> apply(final Integer input) { if (input == null) { return null; } else { return new Tuple2<>(input / by, input % by); } } DivideBy(); DivideBy(final int by); int getBy(); void setBy(final int by... |
### Question:
DivideBy extends KorypheFunction<Integer, Tuple2<Integer, Integer>> { public int getBy() { return by; } DivideBy(); DivideBy(final int by); int getBy(); void setBy(final int by); @Override Tuple2<Integer, Integer> apply(final Integer input); @Override boolean equals(final Object o); @Override int hashCod... |
### Question:
StringRegexSplit extends KorypheFunction<String, List<String>> { @Override public List<String> apply(final String input) { if (null == input) { return null; } final Pattern pattern = Pattern.compile(regex); return Arrays.asList(pattern.split(input)); } StringRegexSplit(); StringRegexSplit(final String re... |
### Question:
FirstValid extends KorypheFunction<Iterable<I_ITEM>, I_ITEM> { @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "class") public Predicate getPredicate() { return predicate; } FirstValid(); FirstValid(final Predicate predicate); @Override I_ITEM apply(final Iterabl... |
### Question:
ToLong extends KorypheFunction<Object, Long> { @Override public Long apply(final Object value) { if (null == value) { return null; } if (value instanceof Number) { return ((Number) value).longValue(); } if (value instanceof String) { return Long.valueOf(((String) value)); } throw new IllegalArgumentExcept... |
### Question:
NthItem extends KorypheFunction<Iterable<T>, T> { public int getSelection() { return selection; } NthItem(); NthItem(final int selection); @Override @SuppressFBWarnings(value = "DE_MIGHT_IGNORE", justification = "Any exceptions are to be ignored") T apply(final Iterable<T> input); void setSelection(final... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.