| @@ -8,7 +8,9 @@ import android.content.Context; | |||
| import android.database.sqlite.SQLiteDatabase; | |||
| import android.database.sqlite.SQLiteOpenHelper; | |||
| import ch.spherIC.recurvebowsight.database.scheme.data.TblRBSArcherySetup; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSRiser; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSSight; | |||
| /** | |||
| @@ -63,8 +65,8 @@ public final class RBSDatabaseHelper extends SQLiteOpenHelper { | |||
| // Tabellen erstellen | |||
| db.execSQL(TblRBSRiser.getCreateStatement()); | |||
| // db.execSQL(TblSBLineup.getCreateStatement()); | |||
| // db.execSQL(TblSBGameType.getCreateStatement()); | |||
| db.execSQL(TblRBSSight.getCreateStatement()); | |||
| db.execSQL(TblRBSArcherySetup.getCreateStatement()); | |||
| } | |||
| @@ -0,0 +1,87 @@ | |||
| /** | |||
| * Copyright (C) 2012 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.database.dao; | |||
| import android.content.ContentValues; | |||
| import android.database.Cursor; | |||
| import ch.spherIC.recurvebowsight.database.scheme.data.TblRBSArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.ArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IArcherySetup; | |||
| import ch.spherIC.recurvebowsight.model.IRiser; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| /** | |||
| * @author FC Smilari | |||
| */ | |||
| public final class ArcherySetupDao extends DAO<IArcherySetup> { | |||
| private static ArcherySetupDao instance; | |||
| private ArcherySetupDao() { | |||
| super(); | |||
| } | |||
| public static ArcherySetupDao getInstance() { | |||
| if (instance == null) { | |||
| instance = new ArcherySetupDao(); | |||
| } | |||
| return instance; | |||
| } | |||
| @Override | |||
| protected IArcherySetup cursorToEntity(final Cursor cursor) { | |||
| ISight sight = SightDao.getInstance().loadById(cursor.getLong(1)); | |||
| IRiser riser = RiserDao.getInstance().loadById(cursor.getLong(2)); | |||
| IArcherySetup archerySetup = new ArcherySetup(cursor.getLong(0), sight, riser, cursor.getDouble(3), // | |||
| cursor.getDouble(4), cursor.getDouble(5), cursor.getDouble(6), cursor.getDouble(7), | |||
| cursor.getDouble(8), cursor.getDouble(9), cursor.getDouble(10), cursor.getDouble(11), | |||
| cursor.getDouble(12), cursor.getDouble(13), cursor.getDouble(14)); | |||
| return archerySetup; | |||
| } | |||
| @Override | |||
| protected ContentValues getContentValues(final IArcherySetup entity) { | |||
| ContentValues values = new ContentValues(); | |||
| if (entity.getId() > 0) { | |||
| values.put(TblRBSArcherySetup.COL_ID, entity.getId()); | |||
| } | |||
| values.put(TblRBSArcherySetup.COL_SIGHT, entity.getSight() != null ? entity.getSight().getId() : 0); | |||
| values.put(TblRBSArcherySetup.COL_RISER, entity.getRiser() != null ? entity.getRiser().getId() : 0); | |||
| values.put(TblRBSArcherySetup.COL_ARROWDIAMETER, entity.getArrowDiameter() != null ? entity.getArrowDiameter() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWCW, entity.getArrowCw() != null ? entity.getArrowCw() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWWEIGHT, entity.getArrowWeight() != null ? entity.getArrowWeight() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWV0, entity.getArrowV0() != null ? entity.getArrowV0() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWCENTERHEIGHT, entity.getArrowCenterHeight() != null ? entity.getArrowCenterHeight() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_BOWPULLOUT, entity.getBowPullout() != null ? entity.getBowPullout() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_ARROWNOCKHEIGHT, entity.getArrowNockHeight() != null ? entity.getArrowNockHeight() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_HNA, entity.getHNA() != null ? entity.getHNA() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_DELTATIME, entity.getDeltaTime() != null ? entity.getDeltaTime() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_CALCPRECISION, entity.getCalcPrecision() != null ? entity.getCalcPrecision() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_SIGHTVERTSKALAMIDDLE, entity.getSightVertSkalaMiddle() != null ? entity.getSightVertSkalaMiddle() : 0d); | |||
| values.put(TblRBSArcherySetup.COL_SIGHTHORSETTING, entity.getSightHorSetting() != null ? entity.getSightHorSetting() : 0d); | |||
| return values; | |||
| } | |||
| @Override | |||
| protected String getTableName() { | |||
| return TblRBSArcherySetup.NAME; | |||
| } | |||
| @Override | |||
| protected String getIdColumn() { | |||
| return TblRBSArcherySetup.COL_ID; | |||
| } | |||
| } | |||
| @@ -0,0 +1,72 @@ | |||
| /** | |||
| * Copyright (C) 2012 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.database.dao; | |||
| import android.content.ContentValues; | |||
| import android.database.Cursor; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSSight; | |||
| import ch.spherIC.recurvebowsight.model.ISight; | |||
| import ch.spherIC.recurvebowsight.model.Sight; | |||
| /** | |||
| * @author FC Smilari | |||
| */ | |||
| public final class SightDao extends DAO<ISight> { | |||
| private static SightDao instance; | |||
| private SightDao() { | |||
| super(); | |||
| } | |||
| public static SightDao getInstance() { | |||
| if (instance == null) { | |||
| instance = new SightDao(); | |||
| } | |||
| return instance; | |||
| } | |||
| @Override | |||
| protected ISight cursorToEntity(final Cursor cursor) { | |||
| ISight sight = new Sight(cursor.getLong(0), cursor.getString(1), cursor.getString(2), cursor.getDouble(3), // | |||
| cursor.getDouble(4), cursor.getString(5), cursor.getDouble(6), cursor.getDouble(7)); | |||
| return sight; | |||
| } | |||
| @Override | |||
| protected ContentValues getContentValues(final ISight entity) { | |||
| ContentValues values = new ContentValues(); | |||
| if (entity.getId() > 0) { | |||
| values.put(TblRBSSight.COL_ID, entity.getId()); | |||
| } | |||
| values.put(TblRBSSight.COL_MANUFACTURER, !entity.getManufacturer().isEmpty() ? entity.getManufacturer() : ""); | |||
| values.put(TblRBSSight.COL_MODEL, !entity.getModel().isEmpty() ? entity.getModel() : ""); | |||
| values.put(TblRBSSight.COL_AV, entity.getAV() != null ? entity.getAV() : 0d); | |||
| values.put(TblRBSSight.COL_AH, entity.getAH() != null ? entity.getAH() : 0d); | |||
| values.put(TblRBSSight.COL_HEVIS, entity.getHeVis() != null ? entity.getHeVis() : ""); | |||
| values.put(TblRBSSight.COL_VERTSKALARANGE_MIN, entity.getVertSkalaRangeMin() != null ? entity.getVertSkalaRangeMin() : 0d); | |||
| values.put(TblRBSSight.COL_VERTSKALARANGE_MAX, entity.getVertSkalaRangeMax() != null ? entity.getVertSkalaRangeMax() : 0d); | |||
| return values; | |||
| } | |||
| @Override | |||
| protected String getTableName() { | |||
| return TblRBSSight.NAME; | |||
| } | |||
| @Override | |||
| protected String getIdColumn() { | |||
| return TblRBSSight.COL_ID; | |||
| } | |||
| } | |||
| @@ -0,0 +1,55 @@ | |||
| /** | |||
| * Copyright (C) 2012 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.database.scheme.data; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSRiser; | |||
| import ch.spherIC.recurvebowsight.database.scheme.masterdata.TblRBSSight; | |||
| public final class TblRBSArcherySetup { | |||
| public static final String NAME = "RBS_ARCHERYSETUP"; | |||
| public static final String COL_ID = "ARCHERYSETUP_ID"; | |||
| public static final String COL_SIGHT = "ARCHERYSETUP_SIGHT"; | |||
| public static final String COL_RISER = "ARCHERYSETUP_RISER"; | |||
| public static final String COL_ARROWDIAMETER = "ARCHERYSETUP_ARROWDIAMETER"; | |||
| public static final String COL_ARROWCW = "ARCHERYSETUP_ARROWCW"; | |||
| public static final String COL_ARROWWEIGHT = "ARCHERYSETUP_ARROWWEIGHT"; | |||
| public static final String COL_ARROWV0 = "ARCHERYSETUP_ARROWV0"; | |||
| public static final String COL_ARROWCENTERHEIGHT = "ARCHERYSETUP_ARROWCENTERHEIGHT"; | |||
| public static final String COL_BOWPULLOUT = "ARCHERYSETUP_BOWPULLOUT"; | |||
| public static final String COL_ARROWNOCKHEIGHT = "ARCHERYSETUP_ARROWNOCKHEIGHT"; | |||
| public static final String COL_HNA = "ARCHERYSETUP_HNA"; | |||
| public static final String COL_DELTATIME = "ARCHERYSETUP_DELTATIME"; | |||
| public static final String COL_CALCPRECISION = "ARCHERYSETUP_CALCPRECISION"; | |||
| public static final String COL_SIGHTVERTSKALAMIDDLE = "ARCHERYSETUP_SIGHTVERTSKALAMIDDLE"; | |||
| public static final String COL_SIGHTHORSETTING = "ARCHERYSETUP_SIGHTHORSETTING"; | |||
| private TblRBSArcherySetup() { | |||
| } | |||
| public static String getCreateStatement() { | |||
| return "create table " + NAME + "(" | |||
| + COL_ID + " Integer primary key autoincrement, " | |||
| + COL_SIGHT + " Integer NOT NULL REFERENCES RBS_SIGHT (" + TblRBSSight.COL_ID + "), " | |||
| + COL_RISER + " Integer NOT NULL REFERENCES RBS_RISER (" + TblRBSRiser.COL_ID + "), " | |||
| + COL_ARROWDIAMETER + " Real NOT NULL, " | |||
| + COL_ARROWCW + " Real NOT NULL, " | |||
| + COL_ARROWWEIGHT + " Real NOT NULL, " | |||
| + COL_ARROWV0 + " Real NOT NULL, " | |||
| + COL_ARROWCENTERHEIGHT + " Real NOT NULL, " | |||
| + COL_BOWPULLOUT + " Real NOT NULL, " | |||
| + COL_ARROWNOCKHEIGHT + " Real NOT NULL, " | |||
| + COL_HNA + " Real NOT NULL, " | |||
| + COL_DELTATIME + " Real NOT NULL, " | |||
| + COL_CALCPRECISION + " Real NOT NULL, " | |||
| + COL_SIGHTVERTSKALAMIDDLE + " Real NOT NULL, " | |||
| + COL_SIGHTHORSETTING + " Real NOT NULL, " | |||
| + "constraint UNIQUE_ARCHERYSETUP_SIGHT_RISER UNIQUE (" + COL_SIGHT + "," + COL_RISER + ")" | |||
| + ");"; | |||
| } | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| /** | |||
| * Copyright (C) 2012 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.database.scheme.masterdata; | |||
| public final class TblRBSSight { | |||
| public static final String NAME = "RBS_SIGHT"; | |||
| public static final String COL_ID = "SIGHT_ID"; | |||
| public static final String COL_MANUFACTURER = "SIGHT_MANUFACTURER"; | |||
| public static final String COL_MODEL = "SIGHT_MODEL"; | |||
| public static final String COL_AV = "SIGHT_AV"; | |||
| public static final String COL_AH = "SIGHT_AH"; | |||
| public static final String COL_HEVIS = "SIGHT_HEVIS"; | |||
| public static final String COL_VERTSKALARANGE_MIN = "SIGHT_VERTSKALARANGE_MIN"; | |||
| public static final String COL_VERTSKALARANGE_MAX = "SIGHT_VERTSKALARANGE_MAX"; | |||
| private TblRBSSight() { | |||
| } | |||
| public static String getCreateStatement() { | |||
| return "create table " + NAME + "(" | |||
| + COL_ID + " Integer primary key autoincrement, " | |||
| + COL_MANUFACTURER + " Text NOT NULL, " | |||
| + COL_MODEL + " Text NOT NULL, " | |||
| + COL_AV + " Real NOT NULL, " | |||
| + COL_AH + " Real NOT NULL, " | |||
| + COL_HEVIS + " Text NOT NULL, " | |||
| + COL_VERTSKALARANGE_MIN + " Real NOT NULL, " | |||
| + COL_VERTSKALARANGE_MAX + " Real NOT NULL, " | |||
| + "constraint UNIQUE_SIGHT_MF_MODEL UNIQUE (" + COL_MANUFACTURER + "," + COL_MODEL + ")" | |||
| + ");"; | |||
| } | |||
| } | |||
| @@ -0,0 +1,310 @@ | |||
| /** | |||
| * Copyright (C) 2005-2012 XELOG AG | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model; | |||
| /** | |||
| * @author FC Smilari | |||
| */ | |||
| public class ArcherySetup implements IArcherySetup { | |||
| private long id; | |||
| private ISight sight; | |||
| private IRiser riser; | |||
| private Double arrowDiameter; | |||
| private Double arrowCw; | |||
| private Double arrowWeight; | |||
| private Double arrowV0; | |||
| private Double arrowCenterHeight; | |||
| private Double bowPullout; | |||
| private Double arrowNockHeight; | |||
| private Double hNA; | |||
| private Double deltaTime; | |||
| private Double calcPrecision; | |||
| private Double sightVertSkalaMiddle; | |||
| private Double sightHorSetting; | |||
| /** | |||
| * Konstruktor. | |||
| * | |||
| * @param id | |||
| * @param sight | |||
| * @param riser | |||
| * @param arrowDiameter | |||
| * @param arrowCw | |||
| * @param arrowWeight | |||
| * @param arrowV0 | |||
| * @param arrowCenterHeight | |||
| * @param bowPullout | |||
| * @param arrowNockHeight | |||
| * @param hNA | |||
| * @param deltaTime | |||
| * @param calcPrecision | |||
| * @param sightVertSkalaMiddle | |||
| * @param sightHorSetting | |||
| */ | |||
| public ArcherySetup(final long id, final ISight sight, final IRiser riser, | |||
| final Double arrowDiameter, final Double arrowCw, final Double arrowWeight, | |||
| final Double arrowV0, final Double arrowCenterHeight, final Double bowPullout, | |||
| final Double arrowNockHeight, final Double hNA, final Double deltaTime, | |||
| final Double calcPrecision, final Double sightVertSkalaMiddle, | |||
| final Double sightHorSetting) { | |||
| super(); | |||
| this.id = id; | |||
| this.sight = sight; | |||
| this.riser = riser; | |||
| this.arrowDiameter = arrowDiameter; | |||
| this.arrowCw = arrowCw; | |||
| this.arrowWeight = arrowWeight; | |||
| this.arrowV0 = arrowV0; | |||
| this.arrowCenterHeight = arrowCenterHeight; | |||
| this.bowPullout = bowPullout; | |||
| this.arrowNockHeight = arrowNockHeight; | |||
| this.hNA = hNA; | |||
| this.deltaTime = deltaTime; | |||
| this.calcPrecision = calcPrecision; | |||
| this.sightVertSkalaMiddle = sightVertSkalaMiddle; | |||
| this.sightHorSetting = sightHorSetting; | |||
| } | |||
| /** | |||
| * @return the id | |||
| */ | |||
| @Override | |||
| public long getId() { | |||
| return this.id; | |||
| } | |||
| /** | |||
| * @param id the id to set | |||
| */ | |||
| @Override | |||
| public void setId(final long id) { | |||
| this.id = id; | |||
| } | |||
| /** | |||
| * @return the sight | |||
| */ | |||
| @Override | |||
| public ISight getSight() { | |||
| return this.sight; | |||
| } | |||
| /** | |||
| * @param sight the sight to set | |||
| */ | |||
| @Override | |||
| public void setSight(final ISight sight) { | |||
| this.sight = sight; | |||
| } | |||
| /** | |||
| * @return the riser | |||
| */ | |||
| @Override | |||
| public IRiser getRiser() { | |||
| return this.riser; | |||
| } | |||
| /** | |||
| * @param riser the riser to set | |||
| */ | |||
| @Override | |||
| public void setRiser(final IRiser riser) { | |||
| this.riser = riser; | |||
| } | |||
| /** | |||
| * @return the arrowDiameter | |||
| */ | |||
| @Override | |||
| public Double getArrowDiameter() { | |||
| return this.arrowDiameter; | |||
| } | |||
| /** | |||
| * @param arrowDiameter the arrowDiameter to set | |||
| */ | |||
| @Override | |||
| public void setArrowDiameter(final Double arrowDiameter) { | |||
| this.arrowDiameter = arrowDiameter; | |||
| } | |||
| /** | |||
| * @return the arrowCw | |||
| */ | |||
| @Override | |||
| public Double getArrowCw() { | |||
| return this.arrowCw; | |||
| } | |||
| /** | |||
| * @param arrowCw the arrowCw to set | |||
| */ | |||
| @Override | |||
| public void setArrowCw(final Double arrowCw) { | |||
| this.arrowCw = arrowCw; | |||
| } | |||
| /** | |||
| * @return the arrowWeight | |||
| */ | |||
| @Override | |||
| public Double getArrowWeight() { | |||
| return this.arrowWeight; | |||
| } | |||
| /** | |||
| * @param arrowWeight the arrowWeight to set | |||
| */ | |||
| @Override | |||
| public void setArrowWeight(final Double arrowWeight) { | |||
| this.arrowWeight = arrowWeight; | |||
| } | |||
| /** | |||
| * @return the arrowV0 | |||
| */ | |||
| @Override | |||
| public Double getArrowV0() { | |||
| return this.arrowV0; | |||
| } | |||
| /** | |||
| * @param arrowV0 the arrowV0 to set | |||
| */ | |||
| @Override | |||
| public void setArrowV0(final Double arrowV0) { | |||
| this.arrowV0 = arrowV0; | |||
| } | |||
| /** | |||
| * @return the arrowCenterHeight | |||
| */ | |||
| @Override | |||
| public Double getArrowCenterHeight() { | |||
| return this.arrowCenterHeight; | |||
| } | |||
| /** | |||
| * @param arrowCenterHeight the arrowCenterHeight to set | |||
| */ | |||
| @Override | |||
| public void setArrowCenterHeight(final Double arrowCenterHeight) { | |||
| this.arrowCenterHeight = arrowCenterHeight; | |||
| } | |||
| /** | |||
| * @return the bowPullout | |||
| */ | |||
| @Override | |||
| public Double getBowPullout() { | |||
| return this.bowPullout; | |||
| } | |||
| /** | |||
| * @param bowPullout the bowPullout to set | |||
| */ | |||
| @Override | |||
| public void setBowPullout(final Double bowPullout) { | |||
| this.bowPullout = bowPullout; | |||
| } | |||
| /** | |||
| * @return the arrowNockHeight | |||
| */ | |||
| @Override | |||
| public Double getArrowNockHeight() { | |||
| return this.arrowNockHeight; | |||
| } | |||
| /** | |||
| * @param arrowNockHeight the arrowNockHeight to set | |||
| */ | |||
| @Override | |||
| public void setArrowNockHeight(final Double arrowNockHeight) { | |||
| this.arrowNockHeight = arrowNockHeight; | |||
| } | |||
| /** | |||
| * @return the hNA | |||
| */ | |||
| @Override | |||
| public Double getHNA() { | |||
| return this.hNA; | |||
| } | |||
| /** | |||
| * @param hNA the hNA to set | |||
| */ | |||
| @Override | |||
| public void setHNA(final Double hNA) { | |||
| this.hNA = hNA; | |||
| } | |||
| /** | |||
| * @return the deltaTime | |||
| */ | |||
| @Override | |||
| public Double getDeltaTime() { | |||
| return this.deltaTime; | |||
| } | |||
| /** | |||
| * @param deltaTime the deltaTime to set | |||
| */ | |||
| @Override | |||
| public void setDeltaTime(final Double deltaTime) { | |||
| this.deltaTime = deltaTime; | |||
| } | |||
| /** | |||
| * @return the calcPrecision | |||
| */ | |||
| @Override | |||
| public Double getCalcPrecision() { | |||
| return this.calcPrecision; | |||
| } | |||
| /** | |||
| * @param calcPrecision the calcPrecision to set | |||
| */ | |||
| @Override | |||
| public void setCalcPrecision(final Double calcPrecision) { | |||
| this.calcPrecision = calcPrecision; | |||
| } | |||
| /** | |||
| * @return the sightVertSkalaMiddle | |||
| */ | |||
| @Override | |||
| public Double getSightVertSkalaMiddle() { | |||
| return this.sightVertSkalaMiddle; | |||
| } | |||
| /** | |||
| * @param sightVertSkalaMiddle the sightVertSkalaMiddle to set | |||
| */ | |||
| @Override | |||
| public void setSightVertSkalaMiddle(final Double sightVertSkalaMiddle) { | |||
| this.sightVertSkalaMiddle = sightVertSkalaMiddle; | |||
| } | |||
| /** | |||
| * @return the sightHorSetting | |||
| */ | |||
| @Override | |||
| public Double getSightHorSetting() { | |||
| return this.sightHorSetting; | |||
| } | |||
| /** | |||
| * @param sightHorSetting the sightHorSetting to set | |||
| */ | |||
| @Override | |||
| public void setSightHorSetting(final Double sightHorSetting) { | |||
| this.sightHorSetting = sightHorSetting; | |||
| } | |||
| } | |||
| @@ -0,0 +1,67 @@ | |||
| /** | |||
| * Copyright (C) 2012 - Florindo Smilari (spherIC) | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model; | |||
| /** | |||
| * @author FC Smilari | |||
| */ | |||
| public interface IArcherySetup extends IEntity { | |||
| ISight getSight(); | |||
| void setSight(ISight sight); | |||
| IRiser getRiser(); | |||
| void setRiser(IRiser riser); | |||
| Double getArrowDiameter(); | |||
| void setArrowDiameter(Double diameter); | |||
| Double getArrowCw(); | |||
| void setArrowCw(Double cw); | |||
| Double getArrowWeight(); | |||
| void setArrowWeight(Double weight); | |||
| Double getArrowV0(); | |||
| void setArrowV0(Double v0); | |||
| Double getArrowCenterHeight(); | |||
| void setArrowCenterHeight(Double arrowCenterHeight); | |||
| Double getBowPullout(); | |||
| void setBowPullout(Double bowPullout); | |||
| Double getArrowNockHeight(); | |||
| void setArrowNockHeight(Double bowPullout); | |||
| Double getHNA(); | |||
| void setHNA(Double bowPullout); | |||
| Double getDeltaTime(); | |||
| void setDeltaTime(Double bowPullout); | |||
| Double getCalcPrecision(); | |||
| void setCalcPrecision(Double bowPullout); | |||
| Double getSightVertSkalaMiddle(); | |||
| void setSightVertSkalaMiddle(Double middle); | |||
| Double getSightHorSetting(); | |||
| void setSightHorSetting(Double middle); | |||
| } | |||
| @@ -13,7 +13,7 @@ public interface ISight extends IEntity { | |||
| String getManufacturer(); | |||
| void setManufacturer(String maufacturer); | |||
| void setManufacturer(String manufacturer); | |||
| String getModel(); | |||
| @@ -31,13 +31,13 @@ public interface ISight extends IEntity { | |||
| void setHeVis(String heVis); | |||
| Double getVertSkalaRangMin(); | |||
| Double getVertSkalaRangeMin(); | |||
| void setVertSkalaRangMin(Double vertSkalaRangMin); | |||
| void setVertSkalaRangeMin(Double vertSkalaRangMin); | |||
| Double getVertSkalaRangMax(); | |||
| Double getVertSkalaRangeMax(); | |||
| void setVertSkalaRangMax(Double vertSkalaRangMax); | |||
| void setVertSkalaRangeMax(Double vertSkalaRangMax); | |||
| List<Double> getHeVisList(); | |||
| } | |||
| @@ -3,7 +3,9 @@ | |||
| */ | |||
| package ch.spherIC.recurvebowsight.model; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import java.util.StringTokenizer; | |||
| /** | |||
| @@ -33,9 +35,9 @@ public class Sight implements ISight { | |||
| * @param vertSkalaRangMin | |||
| * @param vertSkalaRangMax | |||
| */ | |||
| public Sight(long id, String manufacturer, String model, Double aV, | |||
| Double aH, String heVis, Double vertSkalaRangMin, | |||
| Double vertSkalaRangMax) { | |||
| public Sight(final long id, final String manufacturer, final String model, final Double aV, | |||
| final Double aH, final String heVis, final Double vertSkalaRangMin, | |||
| final Double vertSkalaRangMax) { | |||
| super(); | |||
| this.id = id; | |||
| this.manufacturer = manufacturer; | |||
| @@ -72,11 +74,11 @@ public class Sight implements ISight { | |||
| } | |||
| /** | |||
| * @param maufacturer the maufacturer to set | |||
| * @param manufacturer the manufacturer to set | |||
| */ | |||
| @Override | |||
| public void setManufacturer(final String maufacturer) { | |||
| this.manufacturer = maufacturer; | |||
| public void setManufacturer(final String manufacturer) { | |||
| this.manufacturer = manufacturer; | |||
| } | |||
| /** | |||
| @@ -102,7 +104,7 @@ public class Sight implements ISight { | |||
| } | |||
| @Override | |||
| public void setAV(Double aV) { | |||
| public void setAV(final Double aV) { | |||
| this.aV = aV; | |||
| } | |||
| @@ -112,7 +114,7 @@ public class Sight implements ISight { | |||
| } | |||
| @Override | |||
| public void setAH(Double aH) { | |||
| public void setAH(final Double aH) { | |||
| this.aH = aH; | |||
| } | |||
| @@ -122,33 +124,47 @@ public class Sight implements ISight { | |||
| } | |||
| @Override | |||
| public void setHeVis(String heVis) { | |||
| public void setHeVis(final String heVis) { | |||
| this.heVis = heVis; | |||
| } | |||
| @Override | |||
| public Double getVertSkalaRangMin() { | |||
| public Double getVertSkalaRangeMin() { | |||
| return this.vertSkalaRangMin; | |||
| } | |||
| @Override | |||
| public void setVertSkalaRangMin(Double vertSkalaRangMin) { | |||
| public void setVertSkalaRangeMin(final Double vertSkalaRangMin) { | |||
| this.vertSkalaRangMin = vertSkalaRangMin; | |||
| } | |||
| @Override | |||
| public Double getVertSkalaRangMax() { | |||
| public Double getVertSkalaRangeMax() { | |||
| return this.vertSkalaRangMax; | |||
| } | |||
| @Override | |||
| public void setVertSkalaRangMax(Double vertSkalaRangMax) { | |||
| public void setVertSkalaRangeMax(final Double vertSkalaRangMax) { | |||
| this.vertSkalaRangMax = vertSkalaRangMax; | |||
| } | |||
| @Override | |||
| public List<Double> getHeVisList() { | |||
| return null; | |||
| List<Double> list = new ArrayList<Double>(); | |||
| if (this.heVis != null && !this.heVis.isEmpty()) { | |||
| StringTokenizer st = new StringTokenizer(this.heVis, ","); | |||
| while (st.hasMoreTokens()) { | |||
| try { | |||
| list.add(Double.valueOf(st.nextToken())); | |||
| } catch (NumberFormatException e) { | |||
| continue; | |||
| } | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| } | |||