public Enemy(Field field) { super(new Texture("enemy.png"), 0.75F); this.field = field; this.topBorder = field.getHeight() * 0.9F; this.bottomBorder = field.getHeight() * 0.1F; this.leftBorder = getWidth() / 2; this.rightBorder = field.getWidth() - (getWidth() / 2); randomizeImpulse(); relocate(); }
/** {@inheritDoc} */ @Override public synchronized int insert(Field field, Plugin plugin) { field.setIdField(newPrimaryKey(plugin)); field.setPosition(newPosition(plugin)); DAOUtil daoUtil = new DAOUtil(SQL_QUERY_INSERT, plugin); daoUtil.setInt(1, field.getIdField()); daoUtil.setInt(2, field.getEntry().getIdEntry()); daoUtil.setString(3, field.getTitle()); daoUtil.setString(4, field.getValue()); daoUtil.setInt(5, field.getHeight()); daoUtil.setInt(6, field.getWidth()); daoUtil.setBoolean(7, field.isDefaultValue()); daoUtil.setInt(8, field.getMaxSizeEnter()); daoUtil.setInt(9, field.getPosition()); daoUtil.setDate( 10, (field.getValueTypeDate() == null) ? null : new Date(field.getValueTypeDate().getTime())); daoUtil.setString(11, field.getRoleKey()); daoUtil.setString(12, field.getWorkgroup()); daoUtil.setBoolean(13, field.isShownInResultList()); daoUtil.setBoolean(14, field.isShownInResultRecord()); daoUtil.executeUpdate(); daoUtil.free(); return field.getIdField(); }
/** {@inheritDoc} */ @Override public void store(Field field, Plugin plugin) { DAOUtil daoUtil = new DAOUtil(SQL_QUERY_UPDATE, plugin); daoUtil.setInt(1, field.getIdField()); daoUtil.setInt(2, field.getEntry().getIdEntry()); daoUtil.setString(3, field.getTitle()); daoUtil.setString(4, field.getValue()); daoUtil.setInt(5, field.getHeight()); daoUtil.setInt(6, field.getWidth()); daoUtil.setBoolean(7, field.isDefaultValue()); daoUtil.setInt(8, field.getMaxSizeEnter()); daoUtil.setInt(9, field.getPosition()); daoUtil.setDate( 10, (field.getValueTypeDate() == null) ? null : new Date(field.getValueTypeDate().getTime())); daoUtil.setString(11, field.getRoleKey()); daoUtil.setString(12, field.getWorkgroup()); daoUtil.setBoolean(13, field.isShownInResultList()); daoUtil.setBoolean(14, field.isShownInResultRecord()); daoUtil.setInt(15, field.getIdField()); daoUtil.executeUpdate(); daoUtil.free(); }
public boolean isOutOfBoundaries(Field f) { if (this.location.x >= f.getWidth() || this.location.x < 0 || this.location.y >= f.getHeight()) return true; return false; }