From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:21:36 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- .../opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java | 96 +++++++++++----------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java') diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java index f83b3a805..338d7e6d6 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java @@ -67,17 +67,17 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Matrixes autoloading */ - private boolean autoloadmode; + private final boolean autoloadmode; /** * Using callback */ - private int callBackFlag; + private final int callBackFlag; /** * Object for error call backs */ - private Object errorCallback; + private final Object errorCallback; /** * List of map definitions @@ -122,7 +122,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object holding rendering settings */ - private Renderhints renderhints; + private final Renderhints renderhints; /** * Display list @@ -132,7 +132,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object for subdividing curves and surfaces */ - private Subdivider subdivider; + private final Subdivider subdivider; /** * Object responsible for rendering @@ -221,13 +221,13 @@ public class GLUgl2nurbsImpl implements GLUnurbs { defineMap(GL2.GL_MAP1_INDEX, 0, 1); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_PIXEL_TOLERANCE, (float) 50.0); @@ -276,7 +276,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_u_rate(double d) { + private void set_domain_distance_u_rate(final double d) { // DONE subdivider.set_domain_distance_u_rate(d); } @@ -287,7 +287,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_v_rate(double d) { + private void set_domain_distance_v_rate(final double d) { // DONE subdivider.set_domain_distance_v_rate(d); } @@ -297,7 +297,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgncurve() { // DONE - O_curve o_curve = new O_curve(); + final O_curve o_curve = new O_curve(); thread("do_bgncurve", o_curve); } @@ -309,9 +309,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param arg * parameter to be passed to called method */ - private void thread(String name, Object arg) { + private void thread(final String name, final Object arg) { // DONE - Class partype[] = new Class[1]; + final Class partype[] = new Class[1]; partype[0] = arg.getClass(); Method m; try { @@ -321,7 +321,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { } else { m.invoke(this, new Object[] { arg }); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } @@ -333,16 +333,16 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param name * name of a method to be called */ - private void thread2(String name) { + private void thread2(final String name) { // DONE try { - Method m = this.getClass().getMethod(name, (Class[]) null); + final Method m = this.getClass().getMethod(name, (Class[]) null); if (dl != null) { dl.append(this, m, null); } else { m.invoke(this, (Object[]) null); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } } @@ -353,7 +353,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_curve * curve object */ - public void do_bgncurve(O_curve o_curve) { + public void do_bgncurve(final O_curve o_curve) { if (inCurve > 0) { do_nurbserror(6); endcurve(); @@ -385,7 +385,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_surface * surface object */ - public void do_bgnsurface(O_surface o_surface) { + public void do_bgnsurface(final O_surface o_surface) { // DONE if (inSurface > 0) { do_nurbserror(27); @@ -507,7 +507,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * error code */ - private void do_nurbserror(int i) { + private void do_nurbserror(final int i) { // TODO nurberror // System.out.println("TODO nurbserror " + i); } @@ -553,10 +553,10 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param realType * type of the curve */ - public void nurbscurve(int nknots, float[] knot, int stride, - float[] ctlarray, int order, int realType) { + public void nurbscurve(final int nknots, final float[] knot, final int stride, + final float[] ctlarray, final int order, final int realType) { // DONE - Mapdesc mapdesc = maplist.locate(realType); + final Mapdesc mapdesc = maplist.locate(realType); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -572,14 +572,14 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector knots = new Knotvector(nknots, stride, order, knot); + final Knotvector knots = new Knotvector(nknots, stride, order, knot); if (!do_check_knots(knots, "curve")) return; - O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); + final O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); o_nurbscurve.bezier_curves = new Quilt(mapdesc); - CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); o_nurbscurve.bezier_curves.toBezier(knots, ctrlcarr, mapdesc .getNCoords()); thread("do_nurbscurve", o_nurbscurve); @@ -594,9 +594,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * error message * @return knot vector is / is not valid */ - public boolean do_check_knots(Knotvector knots, String msg) { + public boolean do_check_knots(final Knotvector knots, final String msg) { // DONE - int status = knots.validate(); + final int status = knots.validate(); if (status > 0) { do_nurbserror(status); if (renderhints.errorchecking != NurbsConsts.N_NOMSG) @@ -611,7 +611,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbscurve * NURBS curve object */ - public void do_nurbscurve(O_nurbscurve o_nurbscurve) { + public void do_nurbscurve(final O_nurbscurve o_nurbscurve) { // DONE if (inCurve <= 0) { @@ -664,7 +664,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbssurface * NURBS surface object */ - public void do_nurbssurface(O_nurbssurface o_nurbssurface) { + public void do_nurbssurface(final O_nurbssurface o_nurbssurface) { // DONE if (inSurface <= 0) { bgnsurface(); @@ -712,7 +712,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param ncoords * number of control point coordinates */ - public void defineMap(int type, int rational, int ncoords) { + public void defineMap(final int type, final int rational, final int ncoords) { // DONE maplist.define(type, rational, ncoords); } @@ -727,9 +727,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param value * property value */ - public void setnurbsproperty(int type, int tag, float value) { + public void setnurbsproperty(final int type, final int tag, final float value) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); return; @@ -738,7 +738,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { do_nurbserror(26); return; } - Property prop = new Property(type, tag, value); + final Property prop = new Property(type, tag, value); thread("do_setnurbsproperty2", prop); } @@ -748,8 +748,8 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property */ - public void do_setnurbsproperty2(Property prop) { - Mapdesc mapdesc = maplist.find(prop.type); + public void do_setnurbsproperty2(final Property prop) { + final Mapdesc mapdesc = maplist.find(prop.type); mapdesc.setProperty(prop.tag, prop.value); } @@ -759,7 +759,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property to be set */ - public void do_setnurbsproperty(Property prop) { + public void do_setnurbsproperty(final Property prop) { // DONE renderhints.setProperty(prop); // TODO freeproperty? @@ -771,7 +771,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * domain distance sampling flag */ - public void set_is_domain_distance_sampling(int i) { + public void set_is_domain_distance_sampling(final int i) { // DONE subdivider.set_is_domain_distance_sampling(i); } @@ -781,7 +781,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgnsurface() { // DONE - O_surface o_surface = new O_surface(); + final O_surface o_surface = new O_surface(); // TODO nuid // System.out.println("TODO glunurbs.bgnsurface nuid"); thread("do_bgnsurface", o_surface); @@ -827,11 +827,11 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param type * NURBS surface type (rational,...) */ - public void nurbssurface(int sknot_count, float[] sknot, int tknot_count, - float[] tknot, int s_stride, int t_stride, float[] ctlarray, - int sorder, int torder, int type) { + public void nurbssurface(final int sknot_count, final float[] sknot, final int tknot_count, + final float[] tknot, final int s_stride, final int t_stride, final float[] ctlarray, + final int sorder, final int torder, final int type) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -842,19 +842,19 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, + final Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, sknot); if (!do_check_knots(sknotvector, "surface")) return; - Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, + final Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, tknot); if (!do_check_knots(tknotvector, "surface")) return; - O_nurbssurface o_nurbssurface = new O_nurbssurface(type); + final O_nurbssurface o_nurbssurface = new O_nurbssurface(type); o_nurbssurface.bezier_patches = new Quilt(mapdesc); - CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); o_nurbssurface.bezier_patches.toBezier(sknotvector, tknotvector, ctrlarr, mapdesc.getNCoords()); thread("do_nurbssurface", o_nurbssurface); -- cgit v1.2.3