method2testcases stringlengths 118 6.63k |
|---|
### Question:
AnnotationValues { public static String getString(AnnotationValue value) { return valueOfType(value, String.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annota... |
### Question:
AnnotationValues { public static ImmutableList<String> getStrings(AnnotationValue value) { return STRINGS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationM... |
### Question:
AnnotationValues { public static VariableElement getEnum(AnnotationValue value) { return EnumVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirro... |
### Question:
AnnotationValues { public static ImmutableList<VariableElement> getEnums(AnnotationValue value) { return ENUMS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnota... |
### Question:
AnnotationValues { public static ImmutableList<AnnotationValue> getAnnotationValues(AnnotationValue value) { return ANNOTATION_VALUES_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static Ann... |
### Question:
AnnotationValues { public static int getInt(AnnotationValue value) { return valueOfType(value, Integer.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(AnnotationV... |
### Question:
AnnotationValues { public static ImmutableList<Integer> getInts(AnnotationValue value) { return INTS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror... |
### Question:
OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(t... |
### Question:
AnnotationValues { public static long getLong(AnnotationValue value) { return valueOfType(value, Long.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(AnnotationVa... |
### Question:
AnnotationValues { public static ImmutableList<Long> getLongs(AnnotationValue value) { return LONGS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(... |
### Question:
AnnotationValues { public static byte getByte(AnnotationValue value) { return valueOfType(value, Byte.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(AnnotationVa... |
### Question:
AnnotationValues { public static ImmutableList<Byte> getBytes(AnnotationValue value) { return BYTES_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(... |
### Question:
AnnotationValues { public static short getShort(AnnotationValue value) { return valueOfType(value, Short.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annotatio... |
### Question:
AnnotationValues { public static ImmutableList<Short> getShorts(AnnotationValue value) { return SHORTS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirr... |
### Question:
AnnotationValues { public static float getFloat(AnnotationValue value) { return valueOfType(value, Float.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annotatio... |
### Question:
AnnotationValues { public static ImmutableList<Float> getFloats(AnnotationValue value) { return FLOATS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirr... |
### Question:
AnnotationValues { public static double getDouble(AnnotationValue value) { return valueOfType(value, Double.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annota... |
### Question:
AnnotationValues { public static ImmutableList<Double> getDoubles(AnnotationValue value) { return DOUBLES_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationM... |
### Question:
AnnotationValues { public static boolean getBoolean(AnnotationValue value) { return valueOfType(value, Boolean.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Ann... |
### Question:
AnnotationValues { public static ImmutableList<Boolean> getBooleans(AnnotationValue value) { return BOOLEANS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotati... |
### Question:
AnnotationValues { public static char getChar(AnnotationValue value) { return valueOfType(value, Character.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annotat... |
### Question:
AnnotationValues { public static ImmutableList<Character> getChars(AnnotationValue value) { return CHARS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMi... |
### Question:
SerializerFactoryImpl implements SerializerFactory { @Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get()... |
### Question:
ImmutableMapSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableMap(typeMirror)) { return Optional.empty(); } TypeMirror keyType = getKeyType(typeM... |
### Question:
ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getConta... |
### Question:
IdentitySerializerFactory { public static Serializer getSerializer(TypeMirror typeMirror) { return new IdentitySerializer(typeMirror); } private IdentitySerializerFactory(); static Serializer getSerializer(TypeMirror typeMirror); }### Answer:
@Test public void proxyFieldType_isUnchanged() throws Excepti... |
### Question:
Reformatter { static String fixup(String s) { StringBuilder out = new StringBuilder(); JavaScanner scanner = new JavaScanner(s); s = scanner.string(); int len = s.length(); for (int start = 0, previous = 0, braces = 0, parens = 0, end = 0; start < len; previous = start, start = end) { end = scanner.tokenE... |
### Question:
TemplateVars { String toText() { Map<String, Object> vars = toVars(); return parsedTemplate().evaluate(vars); } TemplateVars(); }### Answer:
@Test public void testHappy() { HappyVars happy = new HappyVars(); happy.integer = 23; happy.string = "wibble"; happy.list = ImmutableList.of(5, 17, 23); assertTha... |
### Question:
JavaScanner { int tokenEnd(int start) { if (start >= s.length()) { return s.length(); } switch (s.charAt(start)) { case ' ': case '\n': return spaceEnd(start); case '/': if (s.charAt(start + 1) == '*') { return blockCommentEnd(start); } else if (s.charAt(start + 1) == '/') { return lineCommentEnd(start); ... |
### Question:
TypeVariables { static boolean canAssignStaticMethodResult( ExecutableElement method, TypeMirror actualParameterType, TypeMirror targetType, Types typeUtils) { if (!targetType.getKind().equals(TypeKind.DECLARED) || !method.getModifiers().contains(Modifier.STATIC) || method.getParameters().size() != 1) { r... |
### Question:
PropertyNames { static String decapitalizeLikeJavaBeans(String propertyName) { if (propertyName != null && propertyName.length() >= 2 && Character.isUpperCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { return propertyName; } return decapitalizeNormally(propertyName); } ... |
### Question:
PropertyNames { static String decapitalizeNormally(String propertyName) { if (Strings.isNullOrEmpty(propertyName)) { return propertyName; } return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); } }### Answer:
@Test public void decapitalizeNormally() { NORMAL_CASES .forEach( ... |
### Question:
TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); }### Answer:
@Test pub... |
### Question:
TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); }### Answer:
@Test public void te... |
### Question:
SimpleValueType { public static SimpleValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_SimpleValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static SimpleValueType create(... |
### Question:
PackagelessValueType { public static PackagelessValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_PackagelessValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static Packagel... |
### Question:
BasicAnnotationProcessor extends AbstractProcessor { protected static Step asStep(ProcessingStep processingStep) { return new ProcessingStepAsStep(processingStep); } @Override final synchronized void init(ProcessingEnvironment processingEnv); @Override final ImmutableSet<String> getSupportedAnnotationTyp... |
### Question:
MoreElements { public static PackageElement getPackage(Element element) { while (element.getKind() != PACKAGE) { element = element.getEnclosingElement(); } return (PackageElement) element; } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element... |
### Question:
MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); stat... |
### Question:
MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Elem... |
### Question:
MoreElements { public static TypeElement asType(Element element) { return element.accept(TypeElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeEl... |
### Question:
MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); s... |
### Question:
MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element eleme... |
### Question:
MoreElements { public static boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationClass) { return getAnnotationMirror(element, annotationClass).isPresent(); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element e... |
### Question:
MoreElements { public static Optional<AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> annotationClass) { String annotationClassName = annotationClass.getCanonicalName(); for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { TypeElement annotationType... |
### Question:
MoreElements { public static ImmutableSet<ExecutableElement> getAllMethods( TypeElement type, Types typeUtils, Elements elementUtils) { return getAllMethods(type, new ExplicitOverrides(typeUtils)); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackag... |
### Question:
MoreTypes { public static ImmutableSet<TypeElement> referencedTypes(TypeMirror type) { checkNotNull(type); ImmutableSet.Builder<TypeElement> elements = ImmutableSet.builder(); type.accept(ReferencedTypes.INSTANCE, elements); return elements.build(); } private MoreTypes(); static Equivalence<TypeMirror> e... |
### Question:
MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeM... |
### Question:
MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(Typ... |
### Question:
SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String to... |
### Question:
SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirr... |
### Question:
AnnotationMirrors { public static Equivalence<AnnotationMirror> equivalence() { return ANNOTATION_MIRROR_EQUIVALENCE; } private AnnotationMirrors(); static Equivalence<AnnotationMirror> equivalence(); static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults(
Annotatio... |
### Question:
AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredV... |
### Question:
AnnotationMirrors { public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); } private AnnotationMirrors(); static Equivalence<AnnotationMirror> equivalence(); static Immutable... |
### Question:
AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnota... |
### Question:
BaseActionImpl { public BaseActionImpl() { } BaseActionImpl(); BaseActionImpl(InferenceConfigDefinition kpiDefinition); }### Answer:
@Test public void testBaseActionImpl() { assertEquals("AVERAGE",ExecutionActions.AVERAGE.toString()); } |
### Question:
OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try ... |
### Question:
OfflineDataProcessingExecutor extends TimerTask { public Boolean isQueryScheduledToRun(Long runSchedule, String lastRunTime, String cronSchedule) { if (lastRunTime == null && (cronSchedule == null || cronSchedule.trim().length() == 0)) { return Boolean.TRUE; } ZonedDateTime dateTime = null; ZonedDateTime ... |
### Question:
BaseActionImpl { protected String getEsQueryWithDates(JobSchedule schedule, String esQuery) { Long fromDate = InsightsUtils.getDataFromTime(schedule.name()); esQuery = esQuery.replace("__dataFromTime__", fromDate.toString()); Long toDate = InsightsUtils.getDataToTime(schedule.name()); esQuery = esQuery.re... |
### Question:
CountActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } CountActionImpl(InferenceConfigDefinition kpiDefinition); }### Answer:
@Test public void testExecute() { load(); Map<String, Object> resultMap = new HashMap<String,... |
### Question:
MinMaxActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } MinMaxActionImpl(InferenceConfigDefinition kpiDefinition); }### Answer:
@Test public void testExecute() throws InsightsJobFailedException { load(); Map<String, Obj... |
### Question:
OfflineDataProcessingExecutor extends TimerTask { public int executeOfflineProcessing() { File queryFolderPath = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH); File[] files = queryFolderPath.listFiles(); int jsonFileCount = 0; if (files == null) { return jsonFileCount; } for (File eachFile... |
### Question:
OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FA... |
### Question:
OfflineDataProcessingExecutor extends TimerTask { public Boolean processOfflineConfiguration(File jsonFile) { try { try (BufferedReader reader = new BufferedReader(new FileReader(jsonFile))) { DataEnrichmentModel[] dataEnrichmentModelArray = new Gson().fromJson(reader, DataEnrichmentModel[].class); List<D... |
### Question:
OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); }... |
### Question:
HttpMatch { public Method[] findInterfaceMethods(String methodName) { Method[] methods = interfaceClass.getMethods(); List<Method> ret = new ArrayList<Method>(); for (Method method : methods) { if (method.getName().equals(methodName)) ret.add(method); } return ret.toArray(new Method[] {}); } HttpMatch(Cla... |
### Question:
HttpMatch { public Method[] findRefMethods(Method[] interfaceMethods, String operationId, String requestMethod) { List<Method> ret = new ArrayList<Method>(); for (Method method : interfaceMethods) { Method m; try { m = refClass.getMethod(method.getName(), method.getParameterTypes()); final ApiOperation ap... |
### Question:
Reader { public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>()... |
### Question:
HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeO... |
### Question:
HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository,
@NonNull BaseScheduler scheduler); @Override void... |
### Question:
HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); @Override Single<UserResponse> fetchUsers(int page); }### Answer:
@Test public void fetch... |
### Question:
WsProducer extends DefaultProducer { public static void sendMessage(WebSocket webSocket, String msg, boolean streaming) { if (streaming && msg.length() > STREAM_BUFFER_SIZE) { int p = 0; while (p < msg.length()) { if (msg.length() - p < STREAM_BUFFER_SIZE) { webSocket.sendContinuationFrame(msg.substring(p... |
### Question:
DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvi... |
### Question:
Teleporter extends Tileable implements TileableListener { public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = d... |
### Question:
Teleporter extends Tileable implements TileableListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Ov... |
### Question:
HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean i... |
### Question:
HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnect... |
### Question:
HorizontalTrack extends Track { @Override public boolean accepts(Direction direction, Marble marble) { return allowsConnection(direction); } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override bool... |
### Question:
HorizontalTrack extends Track { @Override public boolean passesMidpoint(Direction direction, Marble marble) { return true; } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Dire... |
### Question:
HorizontalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case LEFT: case RIGHT: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } } boo... |
### Question:
VerticalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.TOP); Tile right = tile.get(Direction.BOTTOM); return left != null && right != null; } boolean isC... |
### Question:
VerticalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case TOP: case BOTTOM: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnectio... |
### Question:
VerticalTrack extends Track { @Override public boolean accepts(Direction direction, Marble marble) { return allowsConnection(direction); } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolea... |
### Question:
VerticalTrack extends Track { @Override public boolean passesMidpoint(Direction direction, Marble marble) { return true; } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direct... |
### Question:
VerticalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case TOP: case BOTTOM: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } } boole... |
### Question:
FilterTrack extends Track implements TileableListener { @Override public boolean isConnected() { return track.isConnected(); } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Override boolean allowsConnection(Direction direct... |
### Question:
FilterTrack extends Track implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Override boo... |
### Question:
FilterTrack extends Track implements TileableListener { @Override public boolean accepts(Direction direction, Marble marble) { return track.accepts(direction, marble); } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Overrid... |
### Question:
FilterTrack extends Track implements TileableListener { public Track getTrack() { return track; } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Override boolean allowsConnection(Direction direction); @Override boolean accep... |
### Question:
FilterTrack extends Track implements TileableListener { public MarbleType getMarbleType() { return marbleType; } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Override boolean allowsConnection(Direction direction); @Overrid... |
### Question:
FilterTrack extends Track implements TileableListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnect... |
### Question:
OneWayTrack extends Track { @Override public boolean isConnected() { return track.isConnected(); } OneWayTrack(Track track, Direction direction); Track getTrack(); Direction getDirection(); @Override void setTile(Tile tile); @Override boolean isConnected(); @Override boolean allowsConnection(Direction dir... |
### Question:
OneWayTrack extends Track { @Override public boolean allowsConnection(Direction direction) { return this.track.allowsConnection(direction); } OneWayTrack(Track track, Direction direction); Track getTrack(); Direction getDirection(); @Override void setTile(Tile tile); @Override boolean isConnected(); @Over... |
### Question:
OneWayTrack extends Track { @Override public boolean accepts(Direction direction, Marble marble) { return this.track.accepts(direction, marble); } OneWayTrack(Track track, Direction direction); Track getTrack(); Direction getDirection(); @Override void setTile(Tile tile); @Override boolean isConnected(); ... |
### Question:
OneWayTrack extends Track { @Override public void accept(Direction direction, Marble marble) { if (!accepts(direction, marble)) { throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } informAcceptation(direction, marble); } OneWayTrack(Track track, Directio... |
### Question:
OneWayTrack extends Track { public Track getTrack() { return this.track; } OneWayTrack(Track track, Direction direction); Track getTrack(); Direction getDirection(); @Override void setTile(Tile tile); @Override boolean isConnected(); @Override boolean allowsConnection(Direction direction); @Override boole... |
### Question:
OneWayTrack extends Track { public Direction getDirection() { return direction; } OneWayTrack(Track track, Direction direction); Track getTrack(); Direction getDirection(); @Override void setTile(Tile tile); @Override boolean isConnected(); @Override boolean allowsConnection(Direction direction); @Overrid... |
### Question:
Marble implements Entity { public MarbleType getType() { return type; } Marble(MarbleType type); MarbleType getType(); boolean isCompatible(Marble other); }### Answer:
@Test public void createPinkBall() { Marble marble = new Marble(MarbleType.PINK); assertThat(marble.getType()).isEqualTo(MarbleType.PINK)... |
### Question:
Marble implements Entity { public boolean isCompatible(Marble other) { return other != null && (type.equals(MarbleType.JOKER) || other.type.equals(MarbleType.JOKER) || type.equals(other.type)); } Marble(MarbleType type); MarbleType getType(); boolean isCompatible(Marble other); }### Answer:
@Test public ... |
### Question:
Empty extends Tileable { @Override public boolean accepts(Direction direction, Marble marble) { return false; } @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direction direction, Marble marble); @Override void accept(Direction direction, Marble marble); }### Answer:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.