Results 1 to 4 of 4
  1. #1
    suri is offline Member
    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    Default error while compile code using javac

    hi,

    i dont have much knowledge on java. this is my code. i got it from a friend of mine. and i would like to use it. but when i create a class file there's an error occur. could anybody help me?

    Java Code:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import java.math.*;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import oracle.spatial.geometry.*;
    import quickhull3d.*;
    import vclip.ConvexPolyhedron;
    import vclip.PolyTree;
    import javax.vecmath.Vector3d;
    import javax.vecmath.Tuple3d;
    
    public class GM_SplineCurve implements SQLData  //SQL Data is the interface to mapping between SQL Data and Java Data
    {
      public String sql_type = "Pushi.GM_SplineCurve";
      public ARRAY cpt;  //mapping attribute "controlpoints"
      public GM_KnotVector knots; //mapping attribute "knots"
      public int degree;  //mapping attribute degree
      public int n;
      public double[] ordinates;
      //public ARRAY weights; //map attribute weights
      //public ARRAY trim;  //map attribute trim
      public GM_SplineCurve()
      {}
      public String getSQLTypeName() throws SQLException { return sql_type; } 
       public void readSQL(SQLInput stream, String typeName) throws SQLException //output from Java to SQL
      { 
        sql_type = typeName; 
        degree=stream.readInt();
        cpt=(ARRAY)stream.readArray();
        knots=(GM_KnotVector)stream.readObject(); 
        //if(typeName.equalsIgnoreCase("GM_NURBSCurve"))
        //{
       // weights=(ARRAY)stream.readArray();
        //trim=(ARRAY)stream.readArray();
        //}
      } 
      public void writeSQL(SQLOutput stream) throws SQLException   //input from SQL to Java
      {
      stream.writeInt(degree);
      stream.writeArray(cpt);
      stream.writeObject(knots);
      }
      public void initialize()   //inner data processing, change JDBC types to normal types
      {
        try{
        n=cpt.length()/3;
        ordinates=cpt.getDoubleArray();    }catch(Exception e){System.out.println("cuole");}  
      }
      public double[] getOrdinates()
      {
        initialize();
        return ordinates;
      }
      
      public boolean isClosed()    //mapping methods isclosed
      {
        initialize();
        if((ordinates[0]==ordinates[3*n-3])&&(ordinates[1]==ordinates[3*n-2])&&(ordinates[2]==ordinates[3*n-1]))
          return true;
        else 
          return false;   
      }
      public int N()  //mapping method N
      {
      initialize();
      return n;
      }
      
      public Connection getConnection()
      {
        Connection con=null;
        try
        {
        con=DriverManager.getConnection("jdbc:default:connection:");
        }
        catch(SQLException e){}
        return con;
      }
      public STRUCT CPolygon()  //mapping method cPolygon
      {
        JGeometry Ch=null;
        initialize();
        try
        {
        Ch=JGeometry.createLinearPolygon(ordinates,3,0);
        STRUCT obj=JGeometry.store(Ch,getConnection());
        return obj;
        }
        catch(SQLException e){System.err.println(e.getMessage());}
        return null;
      }
      
      public STRUCT ConvexHull()
      {
      JGeometry Ch;
      double[] tmp;
      STRUCT obj=null;
      
      Point3d[] vertices;
      initialize();
      QuickHull3D hull = new QuickHull3D();
      
      hull.build(ordinates);
      vertices=hull.getVertices();
      tmp=new double[vertices.length*3]; 
      for(int i=0;i<vertices.length;i++)
      {
        tmp[3*i]=vertices[i].x;
        tmp[3*i+1]=vertices[i].y;
        tmp[3*i+2]=vertices[i].z;
      }
     
      Ch=JGeometry.createLinearPolygon(tmp,3,0);
      try
        {
        obj=JGeometry.store(Ch,getConnection());
        }
        catch(SQLException e){}
      return obj;
      }
      
      
      public Vector3d center() 
      {
      double[] tmp;
      
      Point3d[] vertices;
      initialize();
      QuickHull3D hull = new QuickHull3D();
      hull.build(ordinates);
      vertices=hull.getVertices();
      tmp=new double[vertices.length*3]; 
      for(int i=0;i<vertices.length;i++)
      {
        tmp[3*i]=vertices[i].x;
        tmp[3*i+1]=vertices[i].y;
        tmp[3*i+2]=vertices[i].z;
      }
      
      ConvexPolyhedron poly = new ConvexPolyhedron(tmp, hull.getFaces());
      PolyTree pt1=new PolyTree("polytree",poly);
      Vector3d vc=new Vector3d();
      pt1.centerOfMass(vc);
      return vc;
      }
      
      public STRUCT Centroid()
      {
      STRUCT obj=null;
      JGeometry Ch;
      Vector3d v3d=center();
      double[] cpoint=new double[3];
      cpoint[0]=v3d.x;
      cpoint[1]=v3d.y;
      cpoint[2]=v3d.z;
      Ch=JGeometry.createPoint(cpoint,3,0);
      try
        {
        obj=JGeometry.store(Ch,getConnection());
        }
        catch(SQLException e){}
      return obj;
      }
    
      
      
    
      public String Bounding_Cube()  //mapping method Bounding_Cube
      {
        initialize();
        double[] b=new double[6];
        double minx,miny,minz,maxx,maxy,maxz;
        minx=maxx=ordinates[0];
        miny=maxy=ordinates[1];
        minz=maxz=ordinates[2];
        for(int i=0;i<n;i++)
        {
        if(ordinates[3*i]<minx)
          minx=ordinates[3*i];
        if(ordinates[3*i]>maxx)
          maxx=ordinates[3*i];
        if(ordinates[3*i+1]<miny)
          miny=ordinates[3*i+1];
        if(ordinates[3*i+1]<maxy)
          maxy=ordinates[3*i+1];
        if(ordinates[3*i+2]<minz)
          minz=ordinates[3*i+2];
        if(ordinates[3*i+2]<maxz)
          maxz=ordinates[3*i+2]; 
        }
        b[0]=minx;b[1]=maxx;
        b[2]=miny;b[3]=maxy;
        b[4]=minz;b[5]=maxz;
        
        String str;
        str="MinX:"+minx+" MaxX:"+maxx+" MinY:"+miny+" MaxY:"+maxy+" minZ:"+minz+"MaxZ:"+maxz;
        return str;
      }
     
      public GM_SplineCurve translation(float x,float y,float z)  //mapping method translation
      {
        initialize();
        for(int i=0;i<n;i++)
        {
          ordinates[3*i]=ordinates[3*i]+x;
          ordinates[3*i+1]=ordinates[3*i+1]+y;
          ordinates[3*i+2]=ordinates[3*i+2]+z;
        }
        try{
        cpt.setObjArray(ordinates);
        }catch(SQLException e){}
        return this;
      } 
      
      public GM_SplineCurve scale(float x,float y,float z)
      {
        initialize();
        for(int i=0;i<n;i++)
        {
        ordinates[3*i]=ordinates[3*i]*x;
        ordinates[3*i+1]=ordinates[3*i+1]*y;
        ordinates[3*i+2]=ordinates[3*i+2]*z;
        }
        try{
        cpt.setObjArray(ordinates);
        }catch(SQLException e){}
        return this;
      }
      
      public GM_SplineCurve rotateX(float a)
      {
        initialize();
        for(int i=0;i<n;i++)
        {
        ordinates[3*i+1]=Math.cos(a)*ordinates[3*i+1]-Math.sin(a)*ordinates[3*i+2];
        ordinates[3*i+2]=Math.sin(a)*ordinates[3*i+1]+Math.cos(a)*ordinates[3*i+2];
        }
        try{
        cpt.setObjArray(ordinates);
        }catch(SQLException e){}
        return this;
      }
      
       public GM_SplineCurve rotateY(float a)
      {
        initialize();
        for(int i=0;i<n;i++)
        {
        ordinates[3*i]=Math.cos(a)*ordinates[3*i]+Math.sin(a)*ordinates[3*i+2];
        ordinates[3*i+2]=-Math.sin(a)*ordinates[3*i]+Math.cos(a)*ordinates[3*i+2];
        }
        try{
        cpt.setObjArray(ordinates);
        }catch(SQLException e){}
        return this;
      }
      
       public GM_SplineCurve rotateZ(float a)
      {
        initialize();
        for(int i=0;i<n;i++)
        {
        ordinates[3*i]=Math.cos(a)*ordinates[3*i]-Math.sin(a)*ordinates[3*i+1];
        ordinates[3*i+1]=Math.sin(a)*ordinates[3*i]+Math.cos(a)*ordinates[3*i+1];
        }
        try{
        cpt.setObjArray(ordinates);
        }catch(SQLException e){}
        return this;
      }
      
      
    }
    HERE ARE THE ERRORS

    c:\JAVA>javac GM_NURBSSurface.java
    GM_NURBSSurface.java:152: illegal start of expression
    double[] cpoint=new double[(ordinates.length)*/3];
    ^
    GM_NURBSSurface.java:152: ']' expected
    double[] cpoint=new double[(ordinates.length)*/3];
    ^
    GM_NURBSSurface.java:167: illegal start of expression
    public String Bounding_Cube() //mapping method Bounding_Cube
    ^
    GM_NURBSSurface.java:270: ';' expected

    ^
    GM_NURBSSurface.java:276: '}' expected
    }
    ^
    5 errors
    Last edited by Eranga; 01-20-2010 at 10:08 AM. Reason: Added code tags

  2. #2
    Cbani is offline Member
    Join Date
    Jan 2010
    Posts
    90
    Rep Power
    0

    Default

    could you please post the comile time error?

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You failed to copy by missing some characters (most likely end closing brace).
    Better ask your friend about it since he wrote it.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. ===javac error===
    By solt in forum New To Java
    Replies: 21
    Last Post: 12-06-2009, 10:18 AM
  2. Replies: 3
    Last Post: 08-14-2009, 01:57 PM
  3. Code will not compile
    By ShotGunRockets in forum New To Java
    Replies: 17
    Last Post: 05-10-2009, 04:31 AM
  4. source code of 'javac'?
    By Pooja Deshpande in forum Advanced Java
    Replies: 2
    Last Post: 06-04-2008, 12:24 PM
  5. compile error
    By dirtycash in forum New To Java
    Replies: 6
    Last Post: 12-12-2007, 07:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •