Example #1
1
 @Test
 public void min4float() {
   assertEquals(-10.1f, Math.min(-10.1f, 5.45f, -3.12f, 36.9f), 0.0);
   assertEquals(-5.45f, Math.min(10.1f, -5.45f, -3.12f, 6.9f), 0.0);
   assertEquals(3.12f, Math.min(10.1f, 5.45f, 3.12f, 36.9f), 0.0);
   assertEquals(16.9f, Math.min(100.1f, 25.45f, 23.12f, 16.9f), 0.0);
 }
 public static double unitConverter(double quantity, String oldUnit, String newUnit) {
   quantity = getBytes(quantity, oldUnit);
   // strategy, show the most simplified representation with a single decimal
   switch (newUnit) {
     case "bytes":
       break;
     case "KB":
       quantity = quantity / 1024;
       break;
     case "MB":
       quantity = quantity / Math.pow(1024, 2);
       break;
     case "GB":
       quantity = quantity / Math.pow(1024, 3);
       break;
     case "TB":
       quantity = quantity / Math.pow(1024, 4);
       break;
     case "PB":
       quantity = quantity / Math.pow(1024, 5);
       break;
     default:
       throw new Error("Unknown storage size unit '" + newUnit + "' provided");
   }
   return quantity;
 }
Example #3
1
  /* gibt die Nummer einer Modellspalte zuruck */
  protected int getColumnForResize(int x, int y) {
    if (m_Model == null) return -1;
    if ((y <= 0)
        || (y
            >= m_Model.getFirstRowHeight()
                + (m_Model.getFixedRowCount() - 1) * m_Model.getRowHeight())) return -1;

    if (x < getFixedWidth() + 3) {
      for (int i = 0; i < m_Model.getFixedColumnCount(); i++)
        if (Math.abs(x - getColumnRight(i)) < 3) {
          if (m_Model.isColumnResizable(i)) return i;
          return -1;
        }
    }

    for (int i = m_LeftColumn; i < m_Model.getColumnCount(); i++) {
      int left = getColumnLeft(i);
      int right = left + m_Model.getColumnWidth(i);
      if (Math.abs(x - right) < 3) {
        if (m_Model.isColumnResizable(i)) return i;
        return -1;
      }
      if ((x >= left + 3) && (x <= right - 3)) break;
    }
    return -1;
  }
class Tetrahedron extends Area {
  static final double phi = 109.47122055D;
  static final double h = Math.cos(1.230959418815415D);
  static final double r = Math.sin(1.230959418815415D);
  protected Vector A;
  protected Vector B;
  protected Vector C;
  protected Vector D;
  protected Vector N1;
  protected Vector N2;
  protected Vector N3;
  protected Vector N4;

  public Tetrahedron() {}

  public Tetrahedron(double base, double growth) {
    super(base, growth);
  }

  public void Instantiate(Vector heading) {
    double xz = Math.sqrt(heading.getX() * heading.getX() + heading.getZ() * heading.getZ());

    this.A = new Vector(0, 1, 0);
    this.B = new Vector();
  }

  public boolean In(int size, int dx, int dy, int dz) {
    return false;
  }

  public boolean OnBorder(int size, int dx, int dy, int dz) {
    return false;
  }
}
Example #5
1
 static void rand() // 중복되지 않는 랜덤 숫자배열 두개 만들기
     {
   int su = 0; // 난수 발생시 저장할 변수
   boolean bDash = false; // 중복여부 확인
   for (int i = 0; i < 75; i++) {
     bDash = true;
     while (bDash) // 난수발생, 중복 학인
     {
       su = (int) (Math.random() * 75) + 1; // 판 크기+10개(상대가 못맞출 수도 있게)의 난수 입력
       bDash = false;
       for (int j = 0; j < i; j++) {
         if (numArr1[j] == su) {
           bDash = true; // 중복이 있으면 멈추고 while문을 다시 수행(랜덤값을 다시 줌)
           break;
         }
       }
     }
     numArr1[i] = su;
   }
   for (int i = 0; i < 75; i++) {
     bDash = true;
     while (bDash) // 난수발생, 중복 학인
     {
       su = (int) (Math.random() * 75) + 1; // 판 크기+10개(상대가 못맞출 수도 있게)의 난수 입력
       bDash = false;
       for (int j = 0; j < i; j++) {
         if (numArr2[j] == su) {
           bDash = true; // 중복이 있으면 멈추고 while문을 다시 수행(랜덤값을 다시 줌)
           break;
         }
       }
     }
     numArr2[i] = su;
   }
 }
Example #6
1
  @Override
  public void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);
    log("onLayout (%d, %d, %d, %d)", left, top, right, bottom);

    mHeight = bottom - top;
    mWidth = right - left;

    mLongSide = (int) (mImageRatio * Math.max(mWidth, mHeight));
    mShortSide = (int) (mImageRatio * Math.min(mWidth, mHeight));

    boolean isLandscape = mWidth > mHeight;
    if (mIsLandscape != isLandscape) {
      for (View photo : mOnTable) {
        if (photo != getSelection()) {
          dropOnTable(photo);
        }
      }
      if (hasSelection()) {
        pickUp(getSelection());
        for (int slot = 0; slot < mOnDeck.length; slot++) {
          if (mOnDeck[slot] != null) {
            placeOnDeck(mOnDeck[slot], slot);
          }
        }
      }
      mIsLandscape = isLandscape;
    }
    start();
  }
  /**
   * Test that the scoring function works even when we don't spend the night at home, but don't end
   * the day with an ongoing activity at all. This is half of the case when the first and last
   * activity aren't the same.
   */
  @Test
  public void testNoNightActivity() {

    double zeroUtilDurW = getZeroUtilDuration_hrs(3.0, 1.0);
    double zeroUtilDurH = getZeroUtilDuration_hrs(7.0, 1.0);
    double perf = +3.0;

    Fixture f = new Fixture();
    // Need to change the typical duration of the home activity
    // for this test, since with the setting of 15 hours for "home",
    // this would amount to a smaller-than-zero expected contribution of
    // the home activity at 7 hours, and smaller-than-zero contributions
    // are truncated, so we wouldn't test anything. :-/
    f.config.planCalcScore().getActivityParams("h").setTypicalDuration(7.0 * 3600);
    f.config.planCalcScore().setPerforming_utils_hr(perf);

    ScoringFunction testee = getScoringFunctionInstance(f, f.person);
    testee.handleActivity((Activity) f.plan.getPlanElements().get(0));
    testee.handleLeg((Leg) f.plan.getPlanElements().get(1));
    testee.handleActivity((Activity) f.plan.getPlanElements().get(2));
    testee.finish();

    assertEquals(
        perf * 3.0 * Math.log(2.5 / zeroUtilDurW) + perf * 7.0 * Math.log(7.0 / zeroUtilDurH),
        testee.getScore(),
        EPSILON);
  }
      @Override
      public void visit(PostSynapticSite synapticSite) {

        if (pass != 0) return;

        RealPoint displayPosition = new RealPoint(3);
        viewerTransform.apply(synapticSite.getPosition(), displayPosition);

        setAlpha(displayPosition.getDoublePosition(2));

        final int radius = 10;
        if (synapticSite == controller.getSelectedAnnotation())
          g2d.setPaint(postSynapticSiteColor.brighter().brighter());
        else g2d.setPaint(postSynapticSiteColor);
        g2d.setStroke(new BasicStroke(2.0f));
        g2d.fillOval(
            Math.round(displayPosition.getFloatPosition(0) - radius),
            Math.round(displayPosition.getFloatPosition(1) - radius),
            2 * radius + 1,
            2 * radius + 1);
        g2d.setPaint(postSynapticSiteColor.darker());
        g2d.drawOval(
            Math.round(displayPosition.getFloatPosition(0) - radius),
            Math.round(displayPosition.getFloatPosition(1) - radius),
            2 * radius + 1,
            2 * radius + 1);
      }
Example #9
1
 @Test
 public void max4int() {
   assertEquals(5, Math.max(-10, 5, 3, 1));
   assertEquals(10, Math.max(10, 5, 3, 1));
   assertEquals(13, Math.max(-10, 5, 13, 1));
   assertEquals(15, Math.max(-10, 5, 3, 15));
 }
Example #10
1
 @Test
 public void max3float() {
   assertEquals(0.3f, Math.max(0.1f, 0.2f, 0.3f), 0.0);
   assertEquals(0.31f, Math.max(0.31f, 0.2f, 0.3f), 0.0);
   assertEquals(0.5f, Math.max(0.1f, 0.5f, 0.3f), 0.0);
   assertEquals(0.5f, Math.max(-10.1f, 0.5f, -0.3f), 0.0);
 }
Example #11
1
  public void yawAdapt(float leaderYawInit, float myYawInit) {
    float leaderYaw = leader.getNavDataHandler().getNavDataDemo().getYaw() - leaderYawInit;
    float myYaw = this.drone.getNavDataHandler().getNavDataDemo().getYaw() - myYawInit;
    // System.out.println("leader :"+leaderYaw);
    // System.out.println("suiveur :"+myYaw);
    if (Math.abs(leaderYaw - myYaw) > 10) {
      if (leaderYaw * myYaw > 0) {
        this.drone.setSpeedYaw(
            (leaderYaw - myYaw)
                / Math.abs(leaderYaw - myYaw)
                * Math.min(Math.abs(leaderYaw - myYaw) / 30, 1));
      } else {
        if (myYaw < 0) {
          if (leaderYaw - myYaw < 360 - leaderYaw + myYaw) {
            this.drone.setSpeedYaw(Math.min(1, (leaderYaw - myYaw) / 30));
          } else {
            this.drone.setSpeedYaw(-Math.min(1, Math.abs(360 - leaderYaw + myYaw) / 30));
          }
        } else {
          if (-leaderYaw + myYaw < 360 + leaderYaw - myYaw) {
            this.drone.setSpeedYaw(-Math.min(1, (-leaderYaw + myYaw) / 30));
          } else {
            this.drone.setSpeedYaw(Math.min(1, Math.abs(360 + leaderYaw - myYaw) / 30));
          }
        }
      }

    } else {
      this.drone.setSpeedYaw(0);
    }
    // System.out.println("consigne yaw :"+this.drone.speedYaw);
  }
      @Override
      public void visit(Synapse s) {

        RealPoint displayPosition = new RealPoint(3);
        viewerTransform.apply(s.getPosition(), displayPosition);

        double sx = displayPosition.getDoublePosition(0);
        double sy = displayPosition.getDoublePosition(1);
        double sz = displayPosition.getDoublePosition(2);

        setAlpha(sz);

        if (pass == 1) {

          final int radius = 10;
          if (s == controller.getSelectedAnnotation())
            g2d.setPaint(synapseColor.brighter().brighter());
          else g2d.setPaint(synapseColor);
          g2d.setStroke(new BasicStroke(2.0f));
          g2d.fillOval(
              (int) Math.round(sx - radius),
              (int) Math.round(sy - radius),
              2 * radius + 1,
              2 * radius + 1);
          g2d.setPaint(synapseColor.darker());
          g2d.drawOval(
              (int) Math.round(sx - radius),
              (int) Math.round(sy - radius),
              2 * radius + 1,
              2 * radius + 1);
        }
      }
Example #13
0
  /** Turns to the movement direction, and walks the current distance if facing it. */
  public static boolean SV_StepDirection(edict_t ent, float yaw, float dist) {
    float[] move = {0, 0, 0};
    float[] oldorigin = {0, 0, 0};
    float delta;

    ent.ideal_yaw = yaw;
    M.M_ChangeYaw(ent);

    yaw = (float) (yaw * Math.PI * 2 / 360);
    move[0] = (float) Math.cos(yaw) * dist;
    move[1] = (float) Math.sin(yaw) * dist;
    move[2] = 0;

    Math3D.VectorCopy(ent.s.origin, oldorigin);
    if (SV_movestep(ent, move, false)) {
      delta = ent.s.angles[Defines.YAW] - ent.ideal_yaw;
      if (delta > 45 && delta < 315) { // not turned far enough, so don't
        // take the step
        Math3D.VectorCopy(oldorigin, ent.s.origin);
      }
      GameBase.gi.linkentity(ent);
      GameBase.G_TouchTriggers(ent);
      return true;
    }
    GameBase.gi.linkentity(ent);
    GameBase.G_TouchTriggers(ent);
    return false;
  }
 public Particle(int x, int y, Color c, long birthday) {
   super(x, y, 6, 6);
   this.dx = 0.5 - Math.random();
   this.dy = 0.5 - Math.random();
   this.c = c;
   this.birthday = birthday;
 }
Example #15
0
 @Test
 public void min4int() {
   assertEquals(-10, Math.min(-10, 5, 3, 1));
   assertEquals(-5, Math.min(10, -5, 13, 1));
   assertEquals(3, Math.min(10, 5, 3, 15));
   assertEquals(1, Math.min(10, 5, 3, 1));
 }
Example #16
0
 @Test
 public void max4float() {
   assertEquals(36.9f, Math.max(10.1f, 5.45f, -3.12f, 36.9f), 0.0);
   assertEquals(10.1f, Math.max(10.1f, 5.45f, -3.12f, 6.9f), 0.0);
   assertEquals(-3.12f, Math.max(-10.1f, -5.45f, -3.12f, -36.9f), 0.0);
   assertEquals(25.45f, Math.max(10.1f, 25.45f, -3.12f, 16.9f), 0.0);
 }
Example #17
0
 /**
  * Draws only the vertices of the given shape in white. Normals and indices are ignored. TODO:
  * negative W are possible, fix plx?
  *
  * @param shape
  * @param t
  */
 private void drawDotty(Shape shape, Matrix4f t) {
   float[] points = null, colors = null;
   for (VertexElement ve : shape.getVertexData().getElements()) {
     switch (ve.getSemantic()) {
       case POSITION:
         points = ve.getData();
         break;
       case COLOR:
         colors = ve.getData();
         break;
       case NORMAL:
         // DO NOT WANT
         break;
       case TEXCOORD:
         // DO NOT WANT
         break;
     }
   }
   for (int i = 0; i < points.length; i += 3) {
     Point4f v = new Point4f(points[i], points[i + 1], points[i + 2], 1);
     Color3f c = new Color3f(colors[i], colors[i + 1], colors[i + 2]);
     t.transform(v);
     int x = Math.round(v.x / v.w);
     int y = Math.round(v.y / v.w);
     if (x >= 0 && y >= 0 && y < colorBuffer.getHeight() && x < colorBuffer.getWidth())
       drawPointAt(x, y, c.get().getRGB());
   }
 }
  /**
   * calcEffort Calculates the effort with the Putnam model Putnam Effort = ( Size / ( (PP *
   * Dev.Time (Years) ) ^ (4/3) ) ^ 3 ) * E
   *
   * @param cocomoResult
   * @param PP
   * @param Sourcelines of code
   * @return calculated Putnam-Effort
   * @throws PutnamCalcException
   */
  private float calcEffort(float sloc, float pp, float cocomoResult) throws PutnamCalcException {

    if (sloc == 0) {
      this.logger.error("calcEffort: Sourcelines of code were zero");
      throw new PutnamCalcException("Sourcelines of code were zero.");
    } else if (pp == 0) {
      this.logger.error("calcEffort: PP was zero");
      throw new PutnamCalcException("PP was zero.");
    } else if (cocomoResult == 0) {
      this.logger.error("calcEffort: COCOMO time was zero");
      throw new PutnamCalcException("COCOMO time was zero.");
    }

    float result;

    // should load a value dependence on the sloc
    float e = getE((int) sloc);

    if ((pp * Math.pow(cocomoResult / 12.0, 4.0 / 3.0)) == 0) {
      this.logger.error("calcEffort: Division by zero");
      throw new PutnamCalcException("Division by zero.");
    }

    result = (float) Math.pow(sloc / (pp * Math.pow(cocomoResult / 12.0, 4.0 / 3.0)), 3.0) * e;

    return result;
  }
  /** {@inheritDoc} */
  @Override
  public Move determineNextMove(Player currentPlayer, Player otherPlayer) {

    int ttl =
        Math.min(
            this.historyCount,
            Math.min(currentPlayer.getNumberOfRounds(), otherPlayer.getNumberOfRounds()));
    double p;

    if (ttl == 0) p = this.thresholdWon;
    else {
      int won = 0;
      for (int i = 0; i < ttl; i++) {
        BigDecimal curGin = currentPlayer.getRound(-i - 1).getGain();
        BigDecimal othGin = otherPlayer.getRound(-i - 1).getGain();
        if (curGin.doubleValue() / curGin.add(othGin).doubleValue() > this.thresholdWon) won++;
      }

      p = (double) won / ttl > this.thresholdWon ? this.probabilityWon : this.probabilityLost;
      //		if (currentPlayer.getNumberOfRounds() > 0 && currentPlayer.getRound(- 1).getMove() !=
      // Move.COOPERATE)
      //			p = 1 - p;
    }

    return random.nextDouble() < p ? Move.COOPERATE : Move.DECEIVE;
  }
  private void setupContentDimensions(int count) {
    ArrayList<View> list = getItemsInReadingOrder();

    int countX = mContent.getCountX();
    int countY = mContent.getCountY();
    boolean done = false;

    while (!done) {
      int oldCountX = countX;
      int oldCountY = countY;
      if (countX * countY < count) {
        // Current grid is too small, expand it
        if ((countX <= countY || countY == mMaxCountY) && countX < mMaxCountX) {
          countX++;
        } else if (countY < mMaxCountY) {
          countY++;
        }
        if (countY == 0) countY++;
      } else if ((countY - 1) * countX >= count && countY >= countX) {
        countY = Math.max(0, countY - 1);
      } else if ((countX - 1) * countY >= count) {
        countX = Math.max(0, countX - 1);
      }
      done = countX == oldCountX && countY == oldCountY;
    }
    mContent.setGridSize(countX, countY);
    arrangeChildren(list);
  }
  /** Calculate probabilities */
  void probabilities() {
    // Already done, nothing to do
    if (prob != null) return;

    // Get total length and count for chromosomes (chromosome size is total genome length)
    String chrType = Chromosome.class.getSimpleName();
    long chrSize = countBases.get(chrType);
    long chrCount = countMarkers.get(chrType);
    if (chrCount <= 0) return; // Zero length genome? Forgot to count bases?

    // Correct readLength
    int readLength = this.readLength;
    if (readLength < 1) readLength = 1;

    // Probabilities for each marker
    prob = new CountByType();
    for (String mtype : countMarkers.keysSorted()) {
      long size = countBases.get(mtype);
      long count = countMarkers.get(mtype);

      // Calculate and cap probability value
      double p =
          ((double) (size + (readLength - 1) * count))
              / ((double) (chrSize - (readLength - 1) * chrCount));
      p = Math.min(1.0, p);
      p = Math.max(0.0, p);

      prob.setScore(mtype, p);
    }
  }
 public static int getLeftDrawerWidth(Context ctx) {
   Configuration config = ctx.getResources().getConfiguration();
   int screenWidthDp = Math.round(dpToPx(ctx.getResources(), config.smallestScreenWidthDp));
   int toolbarHeight = getDimenFromAttribute(ctx, R.attr.actionBarSize);
   return Math.min(
       screenWidthDp - toolbarHeight, dimenInPx(ctx.getResources(), R.dimen.drawer_max_width));
 }
  /**
   * Test how the scoring function reacts when the first and the last activity do not have the same
   * act-type.
   */
  @Test
  public void testDifferentFirstLastAct() {
    Fixture f = new Fixture();
    // change the last act to something different than the first act
    ((Activity) f.plan.getPlanElements().get(8)).setType("h2");

    PlanCalcScoreConfigGroup.ActivityParams params =
        new PlanCalcScoreConfigGroup.ActivityParams("h2");
    params.setTypicalDuration(8 * 3600);
    f.config.planCalcScore().addActivityParams(params);
    f.config.planCalcScore().getActivityParams("h").setTypicalDuration(6.0 * 3600);

    double perf = +6.0;
    f.config.planCalcScore().setPerforming_utils_hr(perf);
    double zeroUtilDurW = getZeroUtilDuration_hrs(3.0, 1.0);
    double zeroUtilDurH = getZeroUtilDuration_hrs(6.0, 1.0);
    double zeroUtilDurH2 = getZeroUtilDuration_hrs(8.0, 1.0);

    assertEquals(
        perf * 3.0 * Math.log(2.5 / zeroUtilDurW)
            + perf * 3.0 * Math.log(2.75 / zeroUtilDurW)
            + perf * 3.0 * Math.log(2.5 / zeroUtilDurW)
            + perf * 6.0 * Math.log(7.0 / zeroUtilDurH)
            + perf * 8.0 * Math.log(7.75 / zeroUtilDurH2),
        calcScore(f),
        EPSILON);
  }
Example #24
0
 @Override
 public void paint(Graphics g) {
   int x = (int) Math.round(this.getX());
   int y = (int) Math.round(this.getY());
   int diameter = (int) this.radius * 2;
   g.drawOval(x, y, diameter, diameter);
 }
Example #25
0
 public static int stepSize(int recordNumber, double multiplier) {
   int[] bumps = {1, 2, 5};
   double log = Math.floor(multiplier * Math.log10(recordNumber));
   int bump = bumps[(int) log % bumps.length];
   int scale = (int) Math.pow(10, Math.floor(log / bumps.length));
   return bump * scale;
 }
Example #26
0
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String input = scan.nextLine();
    String[] intStrings = input.split(" ");
    // Konverter til integer:
    int[] measurements = new int[intStrings.length];
    int sum = 0;
    // En slags loop
    for (int i = 0; i < intStrings.length; i++) {
      int j = Integer.parseInt(intStrings[i]);
      measurements[i] = j;
      sum += j;
    }
    double mean = ((double) sum) / measurements.length;

    double varSum = 0;
    // Iteration
    for (int i : measurements) {
      varSum += Math.pow(i - mean, 2);
    }

    System.out.println("Mean: " + mean);
    System.out.println("Standard deviation: " + Math.sqrt(varSum / measurements.length));
    scan.close();
  }
    public void onLocationChanged(Location location) {

      String message =
          String.format(
              "New Location \n Longitude: %1$s \n Latitude: %2$s",
              location.getLongitude(), location.getLatitude());
      Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
      if (Math.abs(oldlat - location.getLatitude()) + Math.abs(oldlong - location.getLongitude())
          > 0) ;
      oldlat = location.getLatitude();
      oldlong = location.getLongitude();

      dbh.addPlace(oldlat, oldlong, 2.2);
      Toast.makeText(MainActivity.this, "Newer", Toast.LENGTH_LONG).show();
      List<location> contacts = dbh.getAllplaces();
      location newc = new location();
      newc.setlong("6.9");
      newc.setlat("9.6");
      newc.ID = 5;
      newc.radius = 2.0;
      dbh.deleteplace(newc);
      for (location cn : contacts) {
        Toast.makeText(MainActivity.this, "" + cn.getlat(), Toast.LENGTH_LONG).show();
      }
    }
 public static void setBestExposure(Camera.Parameters parameters, boolean lightOn) {
   int minExposure = parameters.getMinExposureCompensation();
   int maxExposure = parameters.getMaxExposureCompensation();
   float step = parameters.getExposureCompensationStep();
   if ((minExposure != 0 || maxExposure != 0) && step > 0.0f) {
     // Set low when light is on
     float targetCompensation = lightOn ? MIN_EXPOSURE_COMPENSATION : MAX_EXPOSURE_COMPENSATION;
     int compensationSteps = Math.round(targetCompensation / step);
     float actualCompensation = step * compensationSteps;
     // Clamp value:
     compensationSteps = Math.max(Math.min(compensationSteps, maxExposure), minExposure);
     if (parameters.getExposureCompensation() == compensationSteps) {
       Log.i(
           TAG,
           "Exposure compensation already set to "
               + compensationSteps
               + " / "
               + actualCompensation);
     } else {
       Log.i(
           TAG,
           "Setting exposure compensation to " + compensationSteps + " / " + actualCompensation);
       parameters.setExposureCompensation(compensationSteps);
     }
   } else {
     Log.i(TAG, "Camera does not support exposure compensation");
   }
 }
 public static void main(String[] args) {
   System.out.println("Berechnung der Fläche eines Ringes");
   System.out.println("==================================\n");
   System.out.print("Bitte geben Sie den Außenradius der Ringes ein: ");
   double aussenradius;
   aussenradius = Tastatur.leseKommazahl();
   if (aussenradius > 0) {
     System.out.print("Bitte geben Sie den Innenradius der Ringes ein: ");
     double innenradius;
     innenradius = Tastatur.leseKommazahl();
     if (innenradius > 0) {
       if (aussenradius > innenradius) {
         double innenflaeche;
         double aussenflaeche;
         double pi = Math.PI;
         double ringflaeche;
         innenflaeche = Math.pow(innenradius, 2) * pi;
         aussenflaeche = Math.pow(aussenradius, 2) * pi;
         ringflaeche = aussenflaeche - innenradius;
         System.out.println("Die Ringflaeche beträgt: " + ringflaeche);
       } else {
         System.err.println("ERROR: Der Innenradius ist gleich oder größer als der Außenradius");
       }
     } else {
       System.err.println("ERROR: Der Innenradius ist negative oder gleich 0");
     }
   } else {
     System.err.println("ERROR: Der Außenradius ist negative oder gleich 0");
   }
 }
  /**
   * Find all News entities.
   *
   * @param rowStartIdxAndCount Optional int varargs. rowStartIdxAndCount[0] specifies the the row
   *     index in the query result-set to begin collecting the results. rowStartIdxAndCount[1]
   *     specifies the the maximum count of results to return.
   * @return List<News> all News entities
   */
  @SuppressWarnings("unchecked")
  public List<News> findAll(final int... rowStartIdxAndCount) {
    LogUtil.log("finding all News instances", Level.INFO, null);
    try {
      final String queryString = "select model from News model";
      Query query = entityManager.createQuery(queryString);
      if (rowStartIdxAndCount != null && rowStartIdxAndCount.length > 0) {
        int rowStartIdx = Math.max(0, rowStartIdxAndCount[0]);
        if (rowStartIdx > 0) {
          query.setFirstResult(rowStartIdx);
        }

        if (rowStartIdxAndCount.length > 1) {
          int rowCount = Math.max(0, rowStartIdxAndCount[1]);
          if (rowCount > 0) {
            query.setMaxResults(rowCount);
          }
        }
      }
      return query.getResultList();
    } catch (RuntimeException re) {
      LogUtil.log("find all failed", Level.SEVERE, re);
      throw re;
    }
  }