/* File: Vctr2Servant.java * Author: E. W. Grundke * * Comments: Servant for the 2-dimensional vector demo. */ import org.omg.CosNaming.*; import org.omg.CORBA.*; public class Vctr2Servant extends _Vctr2RotnImplBase { // extending the skeleton class private int n; private ORB orb; public Vctr2Servant(ORB orb){ this.orb = orb; } public Vctr2 rotate(Vctr2 v, double degrees) { n++; double rad = Math.PI * degrees / 180.0; // convert to radians double s = Math.sin(rad); // get sine and cosine double c = Math.cos(rad); return new Vctr2(c*v.x-s*v.y, s*v.x+c*v.y); // the rotation! } public int count() { return n; } }