merge fixing
This commit is contained in:
parent
e8abfbd306
commit
683c11072a
@ -3,8 +3,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.sf.openrocket.gui.print.visitor;
|
package net.sf.openrocket.gui.print.visitor;
|
||||||
|
|
||||||
import com.itextpdf.text.Document;
|
import java.util.HashSet;
|
||||||
import com.itextpdf.text.pdf.PdfWriter;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.BodyComponent;
|
import net.sf.openrocket.rocketcomponent.BodyComponent;
|
||||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
||||||
@ -24,8 +26,8 @@ import net.sf.openrocket.rocketcomponent.Stage;
|
|||||||
import net.sf.openrocket.rocketcomponent.Transition;
|
import net.sf.openrocket.rocketcomponent.Transition;
|
||||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import com.itextpdf.text.Document;
|
||||||
import java.util.Set;
|
import com.itextpdf.text.pdf.PdfWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This abstract class contains boilerplate functionality to support visiting the components of a rocket. It is a
|
* This abstract class contains boilerplate functionality to support visiting the components of a rocket. It is a
|
||||||
@ -61,7 +63,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
/**
|
/**
|
||||||
* Default no-arg constructor.
|
* Default no-arg constructor.
|
||||||
*/
|
*/
|
||||||
public BaseVisitorStrategy () {
|
public BaseVisitorStrategy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,7 +71,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @param doc the iText document
|
* @param doc the iText document
|
||||||
*/
|
*/
|
||||||
public BaseVisitorStrategy (Document doc) {
|
public BaseVisitorStrategy(Document doc) {
|
||||||
this(doc, null);
|
this(doc, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +81,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* @param doc the iText document
|
* @param doc the iText document
|
||||||
* @param theWriter an iText byte writer
|
* @param theWriter an iText byte writer
|
||||||
*/
|
*/
|
||||||
public BaseVisitorStrategy (Document doc, PdfWriter theWriter) {
|
public BaseVisitorStrategy(Document doc, PdfWriter theWriter) {
|
||||||
this(doc, theWriter, new HashSet<Integer>());
|
this(doc, theWriter, new HashSet<Integer>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +92,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* @param theWriter an iText byte writer
|
* @param theWriter an iText byte writer
|
||||||
* @param theStages a set of stage numbers
|
* @param theStages a set of stage numbers
|
||||||
*/
|
*/
|
||||||
public BaseVisitorStrategy (Document doc, PdfWriter theWriter, Set<Integer> theStages) {
|
public BaseVisitorStrategy(Document doc, PdfWriter theWriter, Set<Integer> theStages) {
|
||||||
document = doc;
|
document = doc;
|
||||||
writer = theWriter;
|
writer = theWriter;
|
||||||
stages = theStages;
|
stages = theStages;
|
||||||
@ -103,7 +105,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @return true if the visitor strategy contains the stage number provided
|
* @return true if the visitor strategy contains the stage number provided
|
||||||
*/
|
*/
|
||||||
public boolean shouldVisitStage (int stageNumber) {
|
public boolean shouldVisitStage(int stageNumber) {
|
||||||
if (stages == null || stages.isEmpty()) {
|
if (stages == null || stages.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -122,8 +124,8 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @param root the root component; all children will be visited recursively
|
* @param root the root component; all children will be visited recursively
|
||||||
*/
|
*/
|
||||||
protected void goDeep (final RocketComponent root) {
|
protected void goDeep(final RocketComponent root) {
|
||||||
RocketComponent[] rc = root.getChildren();
|
List<RocketComponent> rc = root.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @param theRc an array of rocket components; all children will be visited recursively
|
* @param theRc an array of rocket components; all children will be visited recursively
|
||||||
*/
|
*/
|
||||||
protected void goDeep (final RocketComponent[] theRc) {
|
protected void goDeep(final List<RocketComponent> theRc) {
|
||||||
level++;
|
level++;
|
||||||
for (RocketComponent rocketComponent : theRc) {
|
for (RocketComponent rocketComponent : theRc) {
|
||||||
rocketComponent.accept(parent);
|
rocketComponent.accept(parent);
|
||||||
@ -146,7 +148,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @return an internal Dimension
|
* @return an internal Dimension
|
||||||
*/
|
*/
|
||||||
protected Dimension getPageSize () {
|
protected Dimension getPageSize() {
|
||||||
return new Dimension(document.getPageSize().getWidth(),
|
return new Dimension(document.getPageSize().getWidth(),
|
||||||
document.getPageSize().getHeight());
|
document.getPageSize().getHeight());
|
||||||
}
|
}
|
||||||
@ -155,7 +157,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Rocket visitable) {
|
public void visit(final Rocket visitable) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +165,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RocketComponent visitable) {
|
public void visit(final RocketComponent visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -173,7 +175,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Stage visitable) {
|
public void visit(final Stage visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -183,7 +185,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final ExternalComponent visitable) {
|
public void visit(final ExternalComponent visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -193,7 +195,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final BodyComponent visitable) {
|
public void visit(final BodyComponent visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -203,7 +205,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RingComponent visitable) {
|
public void visit(final RingComponent visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -213,7 +215,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final InnerTube visitable) {
|
public void visit(final InnerTube visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -223,7 +225,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final LaunchLug visitable) {
|
public void visit(final LaunchLug visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -233,7 +235,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Transition visitable) {
|
public void visit(final Transition visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -243,7 +245,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RadiusRingComponent visitable) {
|
public void visit(final RadiusRingComponent visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -253,7 +255,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final MassObject visitable) {
|
public void visit(final MassObject visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -263,7 +265,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final NoseCone visitable) {
|
public void visit(final NoseCone visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -273,7 +275,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final BodyTube visitable) {
|
public void visit(final BodyTube visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -283,7 +285,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final TrapezoidFinSet visitable) {
|
public void visit(final TrapezoidFinSet visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -293,7 +295,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final EllipticalFinSet visitable) {
|
public void visit(final EllipticalFinSet visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -303,7 +305,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final FreeformFinSet visitable) {
|
public void visit(final FreeformFinSet visitable) {
|
||||||
if (shouldVisitStage(visitable.getStageNumber())) {
|
if (shouldVisitStage(visitable.getStageNumber())) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -313,7 +315,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setParent (final ComponentVisitor theParent) {
|
public void setParent(final ComponentVisitor theParent) {
|
||||||
parent = theParent;
|
parent = theParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +323,7 @@ public abstract class BaseVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close () {
|
public void close() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,16 +331,16 @@ class Dimension {
|
|||||||
public float width;
|
public float width;
|
||||||
public float height;
|
public float height;
|
||||||
|
|
||||||
public Dimension (float w, float h) {
|
public Dimension(float w, float h) {
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getWidth () {
|
public float getWidth() {
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHeight () {
|
public float getHeight() {
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,18 +3,14 @@
|
|||||||
*/
|
*/
|
||||||
package net.sf.openrocket.gui.print.visitor;
|
package net.sf.openrocket.gui.print.visitor;
|
||||||
|
|
||||||
import com.itextpdf.text.BadElementException;
|
import java.io.IOException;
|
||||||
import com.itextpdf.text.Chunk;
|
import java.text.NumberFormat;
|
||||||
import com.itextpdf.text.Document;
|
import java.util.Collection;
|
||||||
import com.itextpdf.text.DocumentException;
|
import java.util.List;
|
||||||
import com.itextpdf.text.Element;
|
import java.util.Set;
|
||||||
import com.itextpdf.text.Font;
|
|
||||||
import com.itextpdf.text.Image;
|
import javax.swing.ImageIcon;
|
||||||
import com.itextpdf.text.Phrase;
|
|
||||||
import com.itextpdf.text.Rectangle;
|
|
||||||
import com.itextpdf.text.pdf.PdfPCell;
|
|
||||||
import com.itextpdf.text.pdf.PdfPTable;
|
|
||||||
import com.itextpdf.text.pdf.PdfWriter;
|
|
||||||
import net.sf.openrocket.gui.main.ComponentIcons;
|
import net.sf.openrocket.gui.main.ComponentIcons;
|
||||||
import net.sf.openrocket.gui.print.ITextHelper;
|
import net.sf.openrocket.gui.print.ITextHelper;
|
||||||
import net.sf.openrocket.gui.print.PrintUtilities;
|
import net.sf.openrocket.gui.print.PrintUtilities;
|
||||||
@ -41,11 +37,18 @@ import net.sf.openrocket.unit.Unit;
|
|||||||
import net.sf.openrocket.unit.UnitGroup;
|
import net.sf.openrocket.unit.UnitGroup;
|
||||||
import net.sf.openrocket.util.Coordinate;
|
import net.sf.openrocket.util.Coordinate;
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
import com.itextpdf.text.BadElementException;
|
||||||
import java.io.IOException;
|
import com.itextpdf.text.Chunk;
|
||||||
import java.text.NumberFormat;
|
import com.itextpdf.text.Document;
|
||||||
import java.util.Collection;
|
import com.itextpdf.text.DocumentException;
|
||||||
import java.util.Set;
|
import com.itextpdf.text.Element;
|
||||||
|
import com.itextpdf.text.Font;
|
||||||
|
import com.itextpdf.text.Image;
|
||||||
|
import com.itextpdf.text.Phrase;
|
||||||
|
import com.itextpdf.text.Rectangle;
|
||||||
|
import com.itextpdf.text.pdf.PdfPCell;
|
||||||
|
import com.itextpdf.text.pdf.PdfPTable;
|
||||||
|
import com.itextpdf.text.pdf.PdfWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor strategy for creating documentation about parts details.
|
* A visitor strategy for creating documentation about parts details.
|
||||||
@ -69,7 +72,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* @param theWriter The direct iText writer
|
* @param theWriter The direct iText writer
|
||||||
* @param theStagesToVisit The stages to be visited by this strategy
|
* @param theStagesToVisit The stages to be visited by this strategy
|
||||||
*/
|
*/
|
||||||
public PartsDetailVisitorStrategy (Document doc, PdfWriter theWriter, Set<Integer> theStagesToVisit) {
|
public PartsDetailVisitorStrategy(Document doc, PdfWriter theWriter, Set<Integer> theStagesToVisit) {
|
||||||
super(doc, theWriter, theStagesToVisit);
|
super(doc, theWriter, theStagesToVisit);
|
||||||
PrintUtilities.addText(doc, PrintUtilities.BIG_BOLD, "Parts Detail");
|
PrintUtilities.addText(doc, PrintUtilities.BIG_BOLD, "Parts Detail");
|
||||||
}
|
}
|
||||||
@ -78,7 +81,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Stage visitable) {
|
public void visit(final Stage visitable) {
|
||||||
try {
|
try {
|
||||||
if (grid != null) {
|
if (grid != null) {
|
||||||
document.add(grid);
|
document.add(grid);
|
||||||
@ -87,11 +90,10 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
grid = new PdfPTable(TABLE_COLUMNS);
|
grid = new PdfPTable(TABLE_COLUMNS);
|
||||||
grid.setWidthPercentage(100);
|
grid.setWidthPercentage(100);
|
||||||
grid.setHorizontalAlignment(Element.ALIGN_LEFT);
|
grid.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||||
}
|
} catch (DocumentException e) {
|
||||||
catch (DocumentException e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,7 +102,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final ExternalComponent visitable) {
|
public void visit(final ExternalComponent visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
grid.addCell(createNameCell(visitable.getName(), true));
|
grid.addCell(createNameCell(visitable.getName(), true));
|
||||||
|
|
||||||
@ -109,7 +111,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
grid.addCell(createLengthCell(visitable.getLength()));
|
grid.addCell(createLengthCell(visitable.getLength()));
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
|
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,10 +119,10 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final BodyComponent visitable) {
|
public void visit(final BodyComponent visitable) {
|
||||||
grid.addCell(visitable.getName());
|
grid.addCell(visitable.getName());
|
||||||
grid.completeRow();
|
grid.completeRow();
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +130,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RingComponent visitable) {
|
public void visit(final RingComponent visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
grid.addCell(createNameCell(visitable.getName(), true));
|
grid.addCell(createNameCell(visitable.getName(), true));
|
||||||
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
||||||
@ -136,7 +138,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
grid.addCell(createLengthCell(visitable.getLength()));
|
grid.addCell(createLengthCell(visitable.getLength()));
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
|
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +146,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final InnerTube visitable) {
|
public void visit(final InnerTube visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
final PdfPCell pCell = createNameCell(visitable.getName(), true);
|
final PdfPCell pCell = createNameCell(visitable.getName(), true);
|
||||||
grid.addCell(pCell);
|
grid.addCell(pCell);
|
||||||
@ -153,7 +155,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
grid.addCell(createLengthCell(visitable.getLength()));
|
grid.addCell(createLengthCell(visitable.getLength()));
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
|
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +163,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final LaunchLug visitable) {
|
public void visit(final LaunchLug visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
grid.addCell(createNameCell(visitable.getName(), true));
|
grid.addCell(createNameCell(visitable.getName(), true));
|
||||||
|
|
||||||
@ -175,7 +177,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Transition visitable) {
|
public void visit(final Transition visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
grid.addCell(createNameCell(visitable.getName(), true));
|
grid.addCell(createNameCell(visitable.getName(), true));
|
||||||
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
||||||
@ -191,7 +193,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
grid.addCell(createLengthCell(visitable.getLength()));
|
grid.addCell(createLengthCell(visitable.getLength()));
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
|
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,14 +201,14 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RadiusRingComponent visitable) {
|
public void visit(final RadiusRingComponent visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
grid.addCell(createNameCell(visitable.getName(), true));
|
grid.addCell(createNameCell(visitable.getName(), true));
|
||||||
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
||||||
grid.addCell(createOuterDiaCell(visitable));
|
grid.addCell(createOuterDiaCell(visitable));
|
||||||
grid.addCell(createLengthCell(visitable.getLength()));
|
grid.addCell(createLengthCell(visitable.getLength()));
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +216,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final MassObject visitable) {
|
public void visit(final MassObject visitable) {
|
||||||
PdfPCell cell = ITextHelper.createCell();
|
PdfPCell cell = ITextHelper.createCell();
|
||||||
cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
|
cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
|
||||||
cell.setPaddingBottom(12f);
|
cell.setPaddingBottom(12f);
|
||||||
@ -228,7 +230,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
grid.addCell(cell);
|
grid.addCell(cell);
|
||||||
grid.addCell(cell);
|
grid.addCell(cell);
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,14 +238,14 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final NoseCone visitable) {
|
public void visit(final NoseCone visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
grid.addCell(createNameCell(visitable.getName(), true));
|
grid.addCell(createNameCell(visitable.getName(), true));
|
||||||
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
||||||
grid.addCell(ITextHelper.createCell(visitable.getType().getName(), PdfPCell.BOTTOM));
|
grid.addCell(ITextHelper.createCell(visitable.getType().getName(), PdfPCell.BOTTOM));
|
||||||
grid.addCell(createLengthCell(visitable.getLength()));
|
grid.addCell(createLengthCell(visitable.getLength()));
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,14 +253,14 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final BodyTube visitable) {
|
public void visit(final BodyTube visitable) {
|
||||||
grid.addCell(iconToImage(visitable));
|
grid.addCell(iconToImage(visitable));
|
||||||
grid.addCell(createNameCell(visitable.getName(), true));
|
grid.addCell(createNameCell(visitable.getName(), true));
|
||||||
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
grid.addCell(createMaterialCell(visitable.getMaterial()));
|
||||||
grid.addCell(createOuterDiaCell(visitable));
|
grid.addCell(createOuterDiaCell(visitable));
|
||||||
grid.addCell(createLengthCell(visitable.getLength()));
|
grid.addCell(createLengthCell(visitable.getLength()));
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +268,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final TrapezoidFinSet visitable) {
|
public void visit(final TrapezoidFinSet visitable) {
|
||||||
visitFins(visitable);
|
visitFins(visitable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +276,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final EllipticalFinSet visitable) {
|
public void visit(final EllipticalFinSet visitable) {
|
||||||
visitFins(visitable);
|
visitFins(visitable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +284,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final FreeformFinSet visitable) {
|
public void visit(final FreeformFinSet visitable) {
|
||||||
visitFins(visitable);
|
visitFins(visitable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,18 +292,17 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close () {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
if (grid != null) {
|
if (grid != null) {
|
||||||
document.add(grid);
|
document.add(grid);
|
||||||
}
|
}
|
||||||
}
|
} catch (DocumentException e) {
|
||||||
catch (DocumentException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PdfPCell createOuterDiaCell (final Coaxial visitable) {
|
private PdfPCell createOuterDiaCell(final Coaxial visitable) {
|
||||||
PdfPCell result = new PdfPCell();
|
PdfPCell result = new PdfPCell();
|
||||||
Phrase p = new Phrase();
|
Phrase p = new Phrase();
|
||||||
p.setLeading(12f);
|
p.setLeading(12f);
|
||||||
@ -326,7 +327,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createInnerDiaCell (final Coaxial visitable, PdfPCell cell) {
|
private void createInnerDiaCell(final Coaxial visitable, PdfPCell cell) {
|
||||||
Phrase p = new Phrase();
|
Phrase p = new Phrase();
|
||||||
p.setLeading(14f);
|
p.setLeading(14f);
|
||||||
Chunk c = new Chunk();
|
Chunk c = new Chunk();
|
||||||
@ -346,7 +347,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
cell.addElement(p);
|
cell.addElement(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void visitFins (FinSet visitable) {
|
private void visitFins(FinSet visitable) {
|
||||||
|
|
||||||
Image img = null;
|
Image img = null;
|
||||||
java.awt.Image awtImage = new PrintableFinSet(visitable).createImage();
|
java.awt.Image awtImage = new PrintableFinSet(visitable).createImage();
|
||||||
@ -355,11 +356,9 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
img = Image.getInstance(writer, awtImage, 0.25f);
|
img = Image.getInstance(writer, awtImage, 0.25f);
|
||||||
}
|
} catch (BadElementException e) {
|
||||||
catch (BadElementException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,19 +373,19 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
grid.addCell(ITextHelper.createCell());
|
grid.addCell(ITextHelper.createCell());
|
||||||
grid.addCell(createMassCell(visitable.getMass()));
|
grid.addCell(createMassCell(visitable.getMass()));
|
||||||
|
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PdfPCell createLengthCell (double length) {
|
protected PdfPCell createLengthCell(double length) {
|
||||||
return ITextHelper.createCell("Len: " + appendLength(length), PdfPCell.BOTTOM);
|
return ITextHelper.createCell("Len: " + appendLength(length), PdfPCell.BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PdfPCell createMassCell (double mass) {
|
protected PdfPCell createMassCell(double mass) {
|
||||||
return ITextHelper.createCell("Mass: " + appendMass(mass), PdfPCell.BOTTOM);
|
return ITextHelper.createCell("Mass: " + appendMass(mass), PdfPCell.BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PdfPCell createNameCell (String v, boolean withIndent) {
|
protected PdfPCell createNameCell(String v, boolean withIndent) {
|
||||||
PdfPCell result = new PdfPCell();
|
PdfPCell result = new PdfPCell();
|
||||||
result.setBorder(Rectangle.BOTTOM);
|
result.setBorder(Rectangle.BOTTOM);
|
||||||
Chunk c = new Chunk();
|
Chunk c = new Chunk();
|
||||||
@ -402,7 +401,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PdfPCell createMaterialCell (Material material) {
|
protected PdfPCell createMaterialCell(Material material) {
|
||||||
PdfPCell cell = ITextHelper.createCell();
|
PdfPCell cell = ITextHelper.createCell();
|
||||||
cell.setLeading(13f, 0);
|
cell.setLeading(13f, 0);
|
||||||
|
|
||||||
@ -417,7 +416,7 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PdfPCell iconToImage (final RocketComponent visitable) {
|
protected PdfPCell iconToImage(final RocketComponent visitable) {
|
||||||
final ImageIcon icon = (ImageIcon) ComponentIcons.getLargeIcon(visitable.getClass());
|
final ImageIcon icon = (ImageIcon) ComponentIcons.getLargeIcon(visitable.getClass());
|
||||||
try {
|
try {
|
||||||
Image im = Image.getInstance(icon.getImage(), null);
|
Image im = Image.getInstance(icon.getImage(), null);
|
||||||
@ -428,29 +427,27 @@ public class PartsDetailVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
|
cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
|
||||||
cell.setBorder(PdfPCell.NO_BORDER);
|
cell.setBorder(PdfPCell.NO_BORDER);
|
||||||
return cell;
|
return cell;
|
||||||
}
|
} catch (BadElementException e) {
|
||||||
catch (BadElementException e) {
|
} catch (IOException e) {
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String appendLength (double length) {
|
protected String appendLength(double length) {
|
||||||
final Unit defaultUnit = UnitGroup.UNITS_LENGTH.getDefaultUnit();
|
final Unit defaultUnit = UnitGroup.UNITS_LENGTH.getDefaultUnit();
|
||||||
return NumberFormat.getNumberInstance().format(defaultUnit.toUnit(length)) + defaultUnit.toString();
|
return NumberFormat.getNumberInstance().format(defaultUnit.toUnit(length)) + defaultUnit.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String appendMass (double mass) {
|
protected String appendMass(double mass) {
|
||||||
final Unit defaultUnit = UnitGroup.UNITS_MASS.getDefaultUnit();
|
final Unit defaultUnit = UnitGroup.UNITS_MASS.getDefaultUnit();
|
||||||
return NumberFormat.getNumberInstance().format(defaultUnit.toUnit(mass)) + defaultUnit.toString();
|
return NumberFormat.getNumberInstance().format(defaultUnit.toUnit(mass)) + defaultUnit.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String appendMaterial (Material material) {
|
protected String appendMaterial(Material material) {
|
||||||
return material.getName();
|
return material.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String appendMaterialDensity (Material material) {
|
protected String appendMaterialDensity(Material material) {
|
||||||
return " (" + material.getType().getUnitGroup().getDefaultUnit().toStringUnit(material.getDensity()) + ")";
|
return " (" + material.getType().getUnitGroup().getDefaultUnit().toStringUnit(material.getDensity()) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
package net.sf.openrocket.gui.print.visitor;
|
package net.sf.openrocket.gui.print.visitor;
|
||||||
|
|
||||||
import com.itextpdf.text.Document;
|
import java.util.HashMap;
|
||||||
import com.itextpdf.text.pdf.PdfWriter;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||||
import net.sf.openrocket.rocketcomponent.Coaxial;
|
import net.sf.openrocket.rocketcomponent.Coaxial;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
||||||
@ -19,9 +22,8 @@ import net.sf.openrocket.rocketcomponent.RocketComponent;
|
|||||||
import net.sf.openrocket.rocketcomponent.Transition;
|
import net.sf.openrocket.rocketcomponent.Transition;
|
||||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import com.itextpdf.text.Document;
|
||||||
import java.util.Map;
|
import com.itextpdf.text.pdf.PdfWriter;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A visitor strategy for creating documentation about a parts list.
|
* A visitor strategy for creating documentation about a parts list.
|
||||||
@ -40,7 +42,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* @param theWriter The direct iText writer
|
* @param theWriter The direct iText writer
|
||||||
* @param theStagesToVisit The stages to be visited by this strategy
|
* @param theStagesToVisit The stages to be visited by this strategy
|
||||||
*/
|
*/
|
||||||
public PartsListVisitorStrategy (Document doc, PdfWriter theWriter, Set<Integer> theStagesToVisit) {
|
public PartsListVisitorStrategy(Document doc, PdfWriter theWriter, Set<Integer> theStagesToVisit) {
|
||||||
super(doc, theWriter, theStagesToVisit);
|
super(doc, theWriter, theStagesToVisit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RingComponent visitable) {
|
public void visit(final RingComponent visitable) {
|
||||||
final PartsAccumulator key = new PartsAccumulator(visitable);
|
final PartsAccumulator key = new PartsAccumulator(visitable);
|
||||||
PartsAccumulator pa = crap.get(key);
|
PartsAccumulator pa = crap.get(key);
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
@ -56,7 +58,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
crap.put(pa, pa);
|
crap.put(pa, pa);
|
||||||
}
|
}
|
||||||
pa.increment();
|
pa.increment();
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final InnerTube visitable) {
|
public void visit(final InnerTube visitable) {
|
||||||
final PartsAccumulator key = new PartsAccumulator(visitable);
|
final PartsAccumulator key = new PartsAccumulator(visitable);
|
||||||
PartsAccumulator pa = crap.get(key);
|
PartsAccumulator pa = crap.get(key);
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
@ -72,7 +74,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
crap.put(pa, pa);
|
crap.put(pa, pa);
|
||||||
}
|
}
|
||||||
pa.increment();
|
pa.increment();
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +82,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final LaunchLug visitable) {
|
public void visit(final LaunchLug visitable) {
|
||||||
final PartsAccumulator key = new PartsAccumulator(visitable);
|
final PartsAccumulator key = new PartsAccumulator(visitable);
|
||||||
PartsAccumulator pa = crap.get(key);
|
PartsAccumulator pa = crap.get(key);
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
@ -94,7 +96,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Transition visitable) {
|
public void visit(final Transition visitable) {
|
||||||
final PartsAccumulator key = new PartsAccumulator(visitable);
|
final PartsAccumulator key = new PartsAccumulator(visitable);
|
||||||
PartsAccumulator pa = crap.get(key);
|
PartsAccumulator pa = crap.get(key);
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
@ -102,7 +104,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
crap.put(pa, pa);
|
crap.put(pa, pa);
|
||||||
}
|
}
|
||||||
pa.increment();
|
pa.increment();
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +112,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RadiusRingComponent visitable) {
|
public void visit(final RadiusRingComponent visitable) {
|
||||||
final PartsAccumulator key = new PartsAccumulator(visitable);
|
final PartsAccumulator key = new PartsAccumulator(visitable);
|
||||||
PartsAccumulator pa = crap.get(key);
|
PartsAccumulator pa = crap.get(key);
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
@ -118,7 +120,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
crap.put(pa, pa);
|
crap.put(pa, pa);
|
||||||
}
|
}
|
||||||
pa.increment();
|
pa.increment();
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +128,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final NoseCone visitable) {
|
public void visit(final NoseCone visitable) {
|
||||||
final PartsAccumulator key = new PartsAccumulator(visitable);
|
final PartsAccumulator key = new PartsAccumulator(visitable);
|
||||||
PartsAccumulator pa = crap.get(key);
|
PartsAccumulator pa = crap.get(key);
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
@ -134,7 +136,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
crap.put(pa, pa);
|
crap.put(pa, pa);
|
||||||
}
|
}
|
||||||
pa.increment();
|
pa.increment();
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +144,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final BodyTube visitable) {
|
public void visit(final BodyTube visitable) {
|
||||||
final PartsAccumulator key = new PartsAccumulator(visitable);
|
final PartsAccumulator key = new PartsAccumulator(visitable);
|
||||||
PartsAccumulator pa = crap.get(key);
|
PartsAccumulator pa = crap.get(key);
|
||||||
if (pa == null) {
|
if (pa == null) {
|
||||||
@ -150,7 +152,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
crap.put(pa, pa);
|
crap.put(pa, pa);
|
||||||
}
|
}
|
||||||
pa.increment();
|
pa.increment();
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,28 +160,28 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final TrapezoidFinSet visitable) {
|
public void visit(final TrapezoidFinSet visitable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final EllipticalFinSet visitable) {
|
public void visit(final EllipticalFinSet visitable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final FreeformFinSet visitable) {
|
public void visit(final FreeformFinSet visitable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setParent (final ComponentVisitor theParent) {
|
public void setParent(final ComponentVisitor theParent) {
|
||||||
parent = theParent;
|
parent = theParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +189,7 @@ public class PartsListVisitorStrategy extends BaseVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close () {
|
public void close() {
|
||||||
for (PartsAccumulator partsAccumulator : crap.keySet()) {
|
for (PartsAccumulator partsAccumulator : crap.keySet()) {
|
||||||
System.err.println(partsAccumulator.component.getComponentName() + " " + partsAccumulator.quantity);
|
System.err.println(partsAccumulator.component.getComponentName() + " " + partsAccumulator.quantity);
|
||||||
}
|
}
|
||||||
@ -201,7 +203,7 @@ class PartsAccumulator {
|
|||||||
|
|
||||||
RocketComponent component;
|
RocketComponent component;
|
||||||
|
|
||||||
PartsAccumulator (RocketComponent theComponent) {
|
PartsAccumulator(RocketComponent theComponent) {
|
||||||
component = theComponent;
|
component = theComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,19 +215,18 @@ class PartsAccumulator {
|
|||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals (final Object o1) {
|
@Override
|
||||||
|
public boolean equals(final Object o1) {
|
||||||
if (this == o1) {
|
if (this == o1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RocketComponent that;
|
RocketComponent that;
|
||||||
if (o1 instanceof net.sf.openrocket.gui.print.visitor.PartsAccumulator) {
|
if (o1 instanceof net.sf.openrocket.gui.print.visitor.PartsAccumulator) {
|
||||||
that = ((net.sf.openrocket.gui.print.visitor.PartsAccumulator)o1).component;
|
that = ((net.sf.openrocket.gui.print.visitor.PartsAccumulator) o1).component;
|
||||||
}
|
} else if (o1 instanceof RocketComponent) {
|
||||||
else if (o1 instanceof RocketComponent) {
|
that = (RocketComponent) o1;
|
||||||
that = (RocketComponent)o1;
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,8 +239,8 @@ class PartsAccumulator {
|
|||||||
}
|
}
|
||||||
if (this.component instanceof Coaxial &&
|
if (this.component instanceof Coaxial &&
|
||||||
that instanceof Coaxial) {
|
that instanceof Coaxial) {
|
||||||
Coaxial cThis = (Coaxial)this.component;
|
Coaxial cThis = (Coaxial) this.component;
|
||||||
Coaxial cThat = (Coaxial)that;
|
Coaxial cThat = (Coaxial) that;
|
||||||
if (cThis.getInnerRadius() == cThat.getInnerRadius() &&
|
if (cThis.getInnerRadius() == cThat.getInnerRadius() &&
|
||||||
cThis.getOuterRadius() == cThat.getOuterRadius()) {
|
cThis.getOuterRadius() == cThat.getOuterRadius()) {
|
||||||
return true;
|
return true;
|
||||||
@ -250,6 +251,7 @@ class PartsAccumulator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return component.getComponentName().hashCode();
|
return component.getComponentName().hashCode();
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
package net.sf.openrocket.gui.print.visitor;
|
package net.sf.openrocket.gui.print.visitor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.sf.openrocket.rocketcomponent.BodyComponent;
|
import net.sf.openrocket.rocketcomponent.BodyComponent;
|
||||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||||
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
import net.sf.openrocket.rocketcomponent.ComponentVisitor;
|
||||||
@ -22,9 +25,6 @@ import net.sf.openrocket.rocketcomponent.Stage;
|
|||||||
import net.sf.openrocket.rocketcomponent.Transition;
|
import net.sf.openrocket.rocketcomponent.Transition;
|
||||||
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
import net.sf.openrocket.rocketcomponent.TrapezoidFinSet;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This visitor strategy accumulates Stage references in a Rocket hierarchy.
|
* This visitor strategy accumulates Stage references in a Rocket hierarchy.
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
public StageVisitorStrategy () {
|
public StageVisitorStrategy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,7 +55,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @return true, always
|
* @return true, always
|
||||||
*/
|
*/
|
||||||
public boolean shouldVisitStage (int stageNumber) {
|
public boolean shouldVisitStage(int stageNumber) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setParent (final ComponentVisitor theParent) {
|
public void setParent(final ComponentVisitor theParent) {
|
||||||
parent = theParent;
|
parent = theParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Rocket visitable) {
|
public void visit(final Rocket visitable) {
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,13 +79,13 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Stage visitable) {
|
public void visit(final Stage visitable) {
|
||||||
|
|
||||||
if (mass > 0d) {
|
if (mass > 0d) {
|
||||||
stageComponents.add(mass);
|
stageComponents.add(mass);
|
||||||
}
|
}
|
||||||
mass = 0d;
|
mass = 0d;
|
||||||
RocketComponent[] rc = visitable.getChildren();
|
List<RocketComponent> rc = visitable.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RocketComponent visitable) {
|
public void visit(final RocketComponent visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -103,8 +103,8 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @param root the root component; all children will be visited recursively
|
* @param root the root component; all children will be visited recursively
|
||||||
*/
|
*/
|
||||||
protected void goDeep (final RocketComponent root) {
|
protected void goDeep(final RocketComponent root) {
|
||||||
RocketComponent[] rc = root.getChildren();
|
List<RocketComponent> rc = root.getChildren();
|
||||||
goDeep(rc);
|
goDeep(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @param theRc an array of rocket components; all children will be visited recursively
|
* @param theRc an array of rocket components; all children will be visited recursively
|
||||||
*/
|
*/
|
||||||
protected void goDeep (final RocketComponent[] theRc) {
|
protected void goDeep(final List<RocketComponent> theRc) {
|
||||||
for (RocketComponent rocketComponent : theRc) {
|
for (RocketComponent rocketComponent : theRc) {
|
||||||
rocketComponent.accept(parent);
|
rocketComponent.accept(parent);
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final ExternalComponent visitable) {
|
public void visit(final ExternalComponent visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final BodyComponent visitable) {
|
public void visit(final BodyComponent visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RingComponent visitable) {
|
public void visit(final RingComponent visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final InnerTube visitable) {
|
public void visit(final InnerTube visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final LaunchLug visitable) {
|
public void visit(final LaunchLug visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final Transition visitable) {
|
public void visit(final Transition visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final RadiusRingComponent visitable) {
|
public void visit(final RadiusRingComponent visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final MassObject visitable) {
|
public void visit(final MassObject visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final NoseCone visitable) {
|
public void visit(final NoseCone visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final BodyTube visitable) {
|
public void visit(final BodyTube visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final TrapezoidFinSet visitable) {
|
public void visit(final TrapezoidFinSet visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final EllipticalFinSet visitable) {
|
public void visit(final EllipticalFinSet visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void visit (final FreeformFinSet visitable) {
|
public void visit(final FreeformFinSet visitable) {
|
||||||
mass += visitable.getMass();
|
mass += visitable.getMass();
|
||||||
goDeep(visitable);
|
goDeep(visitable);
|
||||||
}
|
}
|
||||||
@ -243,14 +243,15 @@ public class StageVisitorStrategy implements ComponentVisitorStrategy {
|
|||||||
*
|
*
|
||||||
* @return a sorted list of stages
|
* @return a sorted list of stages
|
||||||
*/
|
*/
|
||||||
public List<Double> getStages () {
|
public List<Double> getStages() {
|
||||||
return stageComponents;
|
return stageComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close by setting the last stage.
|
* Close by setting the last stage.
|
||||||
*/
|
*/
|
||||||
public void close () {
|
@Override
|
||||||
|
public void close() {
|
||||||
if (mass > 0d) {
|
if (mass > 0d) {
|
||||||
stageComponents.add(mass);
|
stageComponents.add(mass);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user