X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=core%2Fsrc%2Fnet%2Fsf%2Fopenrocket%2Faerodynamics%2FWarning.java;h=363606d722c7984a446b191842ceb0d452640083;hb=9349577cdfdff682b2aabd6daa24fdc3a7449b58;hp=52911df091269c9098df6b9eb38a6655fa2c0d39;hpb=14741cf4601ad20c797f56024736f2c46cb4dfdf;p=debian%2Fopenrocket diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index 52911df0..363606d7 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -1,6 +1,7 @@ package net.sf.openrocket.aerodynamics; import net.sf.openrocket.l10n.Translator; +import net.sf.openrocket.motor.Motor; import net.sf.openrocket.startup.Application; import net.sf.openrocket.unit.UnitGroup; @@ -91,6 +92,160 @@ public abstract class Warning { } } + public static class MissingMotor extends Warning { + + private Motor.Type type = null; + private String manufacturer = null; + private String designation = null; + private String digest = null; + private double diameter = Double.NaN; + private double length = Double.NaN; + private double delay = Double.NaN; + + @Override + public String toString() { + String str = "No motor with designation '" + designation + "'"; + if (manufacturer != null) + str += " for manufacturer '" + manufacturer + "'"; + str += " found."; + return str; + } + + public Motor.Type getType() { + return type; + } + + + public void setType(Motor.Type type) { + this.type = type; + } + + + public String getManufacturer() { + return manufacturer; + } + + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } + + + public String getDesignation() { + return designation; + } + + + public void setDesignation(String designation) { + this.designation = designation; + } + + + public String getDigest() { + return digest; + } + + + public void setDigest(String digest) { + this.digest = digest; + } + + + public double getDiameter() { + return diameter; + } + + + public void setDiameter(double diameter) { + this.diameter = diameter; + } + + + public double getLength() { + return length; + } + + + public void setLength(double length) { + this.length = length; + } + + + public double getDelay() { + return delay; + } + + + public void setDelay(double delay) { + this.delay = delay; + } + + + @Override + public boolean replaceBy(Warning other) { + return false; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + long temp; + temp = Double.doubleToLongBits(delay); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + + ((designation == null) ? 0 : designation.hashCode()); + temp = Double.doubleToLongBits(diameter); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + + ((digest == null) ? 0 : digest.hashCode()); + temp = Double.doubleToLongBits(length); + result = prime * result + (int) (temp ^ (temp >>> 32)); + result = prime * result + + ((manufacturer == null) ? 0 : manufacturer.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + MissingMotor other = (MissingMotor) obj; + if (Double.doubleToLongBits(delay) != Double + .doubleToLongBits(other.delay)) + return false; + if (designation == null) { + if (other.designation != null) + return false; + } else if (!designation.equals(other.designation)) + return false; + if (Double.doubleToLongBits(diameter) != Double + .doubleToLongBits(other.diameter)) + return false; + if (digest == null) { + if (other.digest != null) + return false; + } else if (!digest.equals(other.digest)) + return false; + if (Double.doubleToLongBits(length) != Double + .doubleToLongBits(other.length)) + return false; + if (manufacturer == null) { + if (other.manufacturer != null) + return false; + } else if (!manufacturer.equals(other.manufacturer)) + return false; + if (type != other.type) + return false; + return true; + } + + } /** @@ -161,4 +316,13 @@ public abstract class Warning { //// Invalid parameter encountered, ignoring. public static final Warning FILE_INVALID_PARAMETER = new Other(trans.get("Warning.FILE_INVALID_PARAMETER")); + + public static final Warning PARALLEL_FINS = + new Other(trans.get("Warning.PARALLEL_FINS")); + + public static final Warning SUPERSONIC = + new Other(trans.get("Warning.SUPERSONIC")); + + public static final Warning RECOVERY_LAUNCH_ROD = + new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD")); }