import java.util.TreeMap;
import java.util.Vector;
-import javax.measure.quantity.Area;
-import javax.measure.quantity.Length;
import javax.measure.quantity.Quantity;
-import javax.measure.unit.SI;
-import javax.swing.JFrame;
-import javax.swing.JSplitPane;
import org.jscience.physics.amount.Amount;
-import com.billkuker.rocketry.motorsim.grain.EndBurner;
-import com.billkuker.rocketry.motorsim.visual.Chart;
-
public class GraphSimplifier<X extends Quantity, Y extends Quantity> {
Method f;
Amount<Y> y;
}
+ @SuppressWarnings("rawtypes")
private class DDEntry implements Comparable<DDEntry> {
Amount<X> x;
Amount dd;
+ @SuppressWarnings("unchecked")
@Override
public int compareTo(DDEntry o) {
return o.dd.compareTo(dd);
Entry max = null;
while (domain.hasNext()) {
Amount<X> x = domain.next();
+ @SuppressWarnings("unchecked")
Amount<Y> y = (Amount<Y>) f.invoke(source, x);
Entry e = new Entry();
e.x = x;
out.put(middle.x, middle.y);
}
+ @SuppressWarnings("rawtypes")
Amount d1, d2, dd;
d1 = middle.y.minus(low.y).divide(middle.x.minus(low.x));
break;
}
-
-
- }
-
- public static void main(String args[]) throws Exception {
- /*
- CoredCylindricalGrain g = new CoredCylindricalGrain();
- g.setLength(Amount.valueOf(70, SI.MILLIMETER));
- g.setOD(Amount.valueOf(30, SI.MILLIMETER));
- g.setID(Amount.valueOf(10, SI.MILLIMETER));
- */
- EndBurner g = new EndBurner();
- g.setLength(Amount.valueOf(70, SI.MILLIMETER));
- g.setOD(Amount.valueOf(30, SI.MILLIMETER));
- g.setPuntDepth(Amount.valueOf(10, SI.MILLIMETER));
- g.setPuntDiameter(Amount.valueOf(10, SI.MILLIMETER));
-
- JFrame f = new JFrame();
- f.setSize(1024, 768);
- f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
- f.add(jsp);
-
- Chart<Length, Area> c = new Chart<Length, Area>(SI.MILLIMETER,
- SI.MILLIMETER.pow(2).asType(Area.class), g, "surfaceArea");
- c.setDomain(c.new IntervalDomain(Amount.valueOf(0, SI.CENTIMETER), g
- .webThickness()));
- jsp.setTopComponent(c);
-
- GraphSimplifier<Length, Area> gs = new GraphSimplifier(g,
- "surfaceArea", c.new IntervalDomain(Amount.valueOf(0,
- SI.CENTIMETER), g.webThickness()).iterator());
-
- Chart<Length, Area> d = new Chart<Length, Area>(SI.MILLIMETER,
- SI.MILLIMETER.pow(2).asType(Area.class), gs, "value");
- d.setDomain(gs.getDomain());
- jsp.setBottomComponent(d);
-
-
-
- f.setVisible(true);
- jsp.setDividerLocation(.5);
- jsp.revalidate();
}
+
}