Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class GrapherTester extends XYGrapher {
- ArrayList<Coordinate> coordinate = new ArrayList<Coordinate>();
- private void instantiate() {
- coordinate.add(new Coordinate(-1,-1));
- coordinate.add(new Coordinate( 1,-1));
- coordinate.add(new Coordinate( 1, 1));
- coordinate.add(new Coordinate(-1, 1));
- coordinate.add(new Coordinate(-1,-1));
- }
- @Override
- public Coordinate xyStart() {
- // TODO Auto-generated method stub
- Coordinate obaby = new Coordinate(-2,-2);
- return obaby;
- }
- @Override
- public double xRange() {
- // TODO Auto-generated method stub
- return 4;
- }
- @Override
- public double yRange() {
- // TODO Auto-generated method stub
- return 4;
- }
- @Override
- public Coordinate getPoint(int pointNum) {
- // TODO Auto-generated method stub
- if(pointNum < coordinate.size()) {
- return coordinate.get(pointNum);
- }else {
- return null;
- }
- }
- public static void main (String args[]) {
- GrapherTester tester = new GrapherTester();
- tester.instantiate();
- tester.drawGraph((int)tester.xyStart().getX(),(int)tester.xyStart().getY(), (int)tester.xRange(), (int)tester.yRange());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement