jam/VectorAdder

From ggc

Jump to: navigation, search

01 package jam;
02 
03 import java.awt.geom.*;
04 import wiki.Wiki;
05 /**
06  * All about my class here.
07  @author Jam Jenkins
08  */
09 public class VectorAdder
10 {
11   public static final int ZERO=0;
12 
13   public static Point2D.Double add(Point2D.Double one, Point2D.Double two)
14   {
15     //one.x+=two.x;
16     //one.y+=two.y;
17     //return one;
18     //above has bad sad effect
19     return new Point2D.Double(one.x+two.x, one.y+two.y);
20   }
21 
22   public Point2D.Double instanceAdd(Point2D.Double one, Point2D.Double two)
23   {
24     //one.x+=two.x;
25     //one.y+=two.y;
26     //return one;
27     //above has bad sad effect
28     return new Point2D.Double(one.x+two.x, one.y+two.y);
29   }
30 
31   public static void main(String[] args)
32   {
33     int c=7+ZERO;
34     //ZERO=1;//can't do this
35     Point2D.Double a=new Point2D.Double(13);
36     Point2D.Double b=new Point2D.Double(26);
37     VectorAdder adder=new VectorAdder();
38     Point2D.Double result=adder.instanceAdd(a, b);
39     Wiki.out.println(a);
40     Wiki.out.println("plus");
41     Wiki.out.println(b);
42     Wiki.out.println("is");
43     Wiki.out.println(result);
44   }
45 }


Download/View jam/VectorAdder.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter