Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

-JAVA Create a UML diagram. The diagram should include the following elements wherever applicable: methods and instance variables. import android.graphics.Paint.Style; 1/** * A Visitor for

-JAVA Create a UML diagram. The diagram should include the following elements wherever applicable: methods and instance variables.

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

import android.graphics.Paint.Style; 1/** * A Visitor for drawing a shape to an Android canvas. */ public class Draw implements Visitor { // TODO entirely your job (except onCircle) private final Canvas canvas;| private final Paint paint; public Draw(final Canvas canvas, final Paint paint) { this.canvas = null; // FIXME this.paint = null; // FIXME paint.setStyle(Style. STROKE); } @Override public void onCircle(final Circle c) {...} @Override public void onStrokeColor(final StrokeColor c) { return null; } @Override public void onFill(final Fill f) { return null; } @Override public void onGroup(final Group g) { return null; ; } @Override public void onLocation(final Location 1) { return null; } @Override public void onRectangle(final Rectangle r) { return null; } @Override public void onOutline(Outline 0) { return null; } @Override public void onPolygon(final Polygon s) { final float[] pts = null; canvas.drawLines (pts, paint); return null; } } /** * A visitor to compute the number of basic shapes in a (possibly complex) * shape. */ public class Count implements Visitor { // TODO entirely your job @Override public Integer onPolygon(final Polygon p) { return -1; } @Override public Integer onCircle(final Circle c) { return -1; } @Override public Integer onGroup(final Group g) { return -1; } @Override public Integer onRectangle(final Rectangle q) { return -1; } @Override public Integer onOutline(final Outline 0) { return -1; } @Override public Integer onFill(final Fill c) { return -1; } @Override public Integer onLocation(final Location 1) { return -1; } @Override public Integer onStrokeColor(final StrokeColor c) { return -1; } } public class BoundingBox implements Visitor { // TODO entirely your job (except onCircle) @Override public Location onCircle(final Circle c) { final int radius = c.getRadius(); return new Location(-radius, -radius, new Rectangle( width: 2 * radius, height: 2 * radius)); } @Override public Location onFill(final Fill f) { return null; } @Override public Location onGroup(final Group g) { return null; . } @Override public Location onLocation(final Location 1) { return null; 1 } @Override public Location onRectangle(final Rectangle r) { return null; } ] @Override public Location onStrokeColor(final StrokeColor c) { return null; } @Override public Location onOutline(final Outline o) { return null; } @Override public Location onPolygon(final Polygon s) { return null; } 1/** * A decorator indicating that a shape should be drawn as a filled shape instead * of an outlined one. public class Fill implements Shape { protected final Shape shape; public Fill(final Shape shape) { this.shape = shape; } public Shape getShape() { return shape; } @Override public Result accept(final Visitor v) { return v.onFill( c: this); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

How could control charts be used? Give two examples.

Answered: 1 week ago