You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2019/01/02 13:40:27 UTC

[myfaces-tobago] branch master updated: cleanup: remove deprecated code

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f1e48e  cleanup: remove deprecated code
4f1e48e is described below

commit 4f1e48e3f23e20cae07657f7a7735c08d8ca99be
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Jan 2 14:40:11 2019 +0100

    cleanup: remove deprecated code
---
 .../myfaces/tobago/application/ProjectStage.java   |  35 -------
 .../apache/myfaces/tobago/config/TobagoConfig.java |   3 -
 .../tobago/internal/component/AbstractUISheet.java |  18 ----
 .../tobago/internal/config/TobagoConfigImpl.java   |  11 --
 .../myfaces/tobago/internal/layout/MathUtils.java  | 114 ---------------------
 .../tobago/internal/layout/MathUtilsUnitTest.java  | 101 ------------------
 6 files changed, 282 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/application/ProjectStage.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/application/ProjectStage.java
deleted file mode 100644
index 4a529df..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/application/ProjectStage.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.tobago.application;
-
-/**
- * @deprecated use javax.faces.application.ProjectStage
- */
-@Deprecated
-public enum ProjectStage {
-    Development,
-    Production,
-    SystemTest,
-    UnitTest;
-
-    public static final String PROJECT_STAGE_JNDI_NAME = "java:comp/env/jsf/ProjectStage";
-
-    public static final String PROJECT_STAGE_PARAM_NAME = "javax.faces.PROJECT_STAGE";
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
index 86f6ff4..8514635 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
@@ -24,7 +24,6 @@ import org.apache.myfaces.tobago.internal.config.ContentSecurityPolicy;
 import org.apache.myfaces.tobago.internal.config.SecurityAnnotation;
 import org.apache.myfaces.tobago.sanitizer.Sanitizer;
 
-import javax.faces.application.ProjectStage;
 import javax.faces.context.FacesContext;
 import javax.servlet.ServletContext;
 import java.util.List;
@@ -48,8 +47,6 @@ public abstract class TobagoConfig {
 
   public abstract Theme getDefaultTheme();
 
-  public abstract ProjectStage getProjectStage();
-
   public abstract boolean isCreateSessionSecret();
 
   public abstract boolean isCheckSessionSecret();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
index a2177e1..a896a12 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
@@ -162,15 +162,6 @@ public abstract class AbstractUISheet extends AbstractUIData
   }
 
   /**
-   * @deprecated since 1.5.5, the name of this method is ambiguous. You may use {@link #getLastRowIndexOfCurrentPage()}.
-   */
-  @Deprecated
-  public int getLast() {
-    final int last = getFirst() + getRows();
-    return last < getRowCount() ? last : getRowCount();
-  }
-
-  /**
    * The rowIndex of the last row on the current page plus one (because of zero based iterating).
    *
    * @throws IllegalArgumentException If the number of rows in the model returned
@@ -206,15 +197,6 @@ public abstract class AbstractUISheet extends AbstractUIData
   }
 
   /**
-   * @return returns the current page (based by 1).
-   * @deprecated since 1.5.5, please use {@link #getCurrentPage()} which returns the value zero-based.
-   */
-  @Deprecated
-  public int getPage() {
-    return getCurrentPage() + 1;
-  }
-
-  /**
    * The number of pages to render.
    *
    * @throws IllegalArgumentException If the number of rows in the model returned
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
index c850fae..fa1827b 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
@@ -28,7 +28,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.faces.application.Application;
-import javax.faces.application.ProjectStage;
 import javax.faces.context.FacesContext;
 import java.lang.invoke.MethodHandles;
 import java.util.ArrayList;
@@ -208,16 +207,6 @@ public class TobagoConfigImpl extends TobagoConfig {
     return availableThemes;
   }
 
-  /**
-   * @deprecated since 4.0.0, use FacesContext.isProjectStage
-   * @return the ProjectStage
-   */
-  @Override
-  @Deprecated
-  public ProjectStage getProjectStage() {
-    return FacesContext.getCurrentInstance().getApplication().getProjectStage();
-  }
-
   protected synchronized void initDefaultValidatorInfo() {
     if (defaultValidatorInfo != null) {
       checkLocked();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java
deleted file mode 100644
index fc20f7d..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/layout/MathUtils.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.tobago.internal.layout;
-
-/**
- * @deprecated since 3.0.1
- */
-@Deprecated
-public final class MathUtils {
-
-  /**
-   * Values smaller than this EPSILON should be treated as zero.
-   */
-  public static final double EPSILON = 0.0000001;
-
-  private MathUtils() {
-  }
-
-  /**
-   * Adjusts the list of double values to rounded values with the same sum.
-   * E. g. 2.3, 2.4, 2.5, 2.8 -&gt; 2.0, 2.0, 3.0, 3.0
-   */
-  public static void adjustRemainders(final double[] list, final double initialBias) {
-    double bias = initialBias;
-    for (final double ignored : list) {
-      final double lastBias;
-      if (bias < 0.0) {
-        lastBias = findAndAdjustMaxRemainder(list);
-      } else {
-        lastBias = findAndAdjustMinRemainder(list);
-      }
-      if (isZero(lastBias)) {
-        break;
-      }
-      bias += lastBias;
-    }
-
-    assert isZero(bias);
-  }
-
-  public static double findAndAdjustMaxRemainder(final double[] list) {
-    double max = 0.0;
-    Integer indexOfMax = null;
-    for (int i = 0; i < list.length; i++) {
-      final double remainder = remainder(list[i]);
-      if (remainder > max + EPSILON) {
-        max = remainder;
-        indexOfMax = i;
-      }
-    }
-    if (indexOfMax != null) {
-      list[indexOfMax] += 1.0 - max;
-      return 1.0 - max;
-    }
-    return 0.0;
-  }
-
-  public static double findAndAdjustMinRemainder(final double[] list) {
-    double min = 1.0;
-    Integer indexOfMin = null;
-    for (int i = 0; i < list.length; i++) {
-      final double remainder = remainder(list[i]);
-      if (Double.compare(remainder, 0) == 0) { // is zero
-        continue;
-      }
-      if (remainder < min - EPSILON) {
-        min = remainder;
-        indexOfMin = i;
-      }
-    }
-    if (indexOfMin != null) {
-      list[indexOfMin] -= min;
-      return -min;
-    }
-    return 0.0;
-  }
-
-  public static double remainder(final double v) {
-    return v - Math.floor(v);
-  }
-
-  public static boolean isZero(final double factor) {
-    return Math.abs(factor) < EPSILON;
-  }
-
-  public static boolean isNotZero(final double factor) {
-    return Math.abs(factor) >= EPSILON;
-  }
-
-  public static boolean isInteger(final double value) {
-    return isZero(value - Math.round(value));
-  }
-
-  public static boolean isNotInteger(final double value) {
-    return isNotZero(value - Math.round(value));
-  }
-}
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java
deleted file mode 100644
index 0ac3495..0000000
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/layout/MathUtilsUnitTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.tobago.internal.layout;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @deprecated since 3.0.1
- */
-@Deprecated
-public class MathUtilsUnitTest {
-
-  @Test
-  public void testAdjust() {
-    final double[] d = {6.3, 7.9, 8.7, 9.2, 10.3, 11.6};
-    MathUtils.adjustRemainders(d, 0.0);
-    Assert.assertArrayEquals("mixed", new double[]{6, 8, 9, 9, 10, 12}, d, MathUtils.EPSILON);
-  }
-
-  @Test
-  public void testAdjust999() {
-    final double[] d = {9.9, 9.9, 9.9, 9.9, 9.9, 9.9, 9.9, 9.9, 9.9, 9.9};
-    MathUtils.adjustRemainders(d, 0.0);
-    Assert.assertArrayEquals(
-        "9.9, ...", new double[]{9, 10, 10, 10, 10, 10, 10, 10, 10, 10}, d, MathUtils.EPSILON);
-  }
-
-  @Test
-  public void testAdjust111() {
-    final double[] d = {1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1};
-    MathUtils.adjustRemainders(d, 0.0);
-    Assert.assertArrayEquals(
-        "1.1, ...", new double[]{1, 2, 1, 1, 1, 1, 1, 1, 1, 1}, d, MathUtils.EPSILON);
-  }
-
-  @Test
-  public void testAdjust133() {
-    final double[] d = {1, 1, 1, 1.333333333, 1.333333333, 1.333333333, 1, 1, 1};
-    MathUtils.adjustRemainders(d, 0.0);
-    Assert.assertArrayEquals(
-        "1, ..., 1.333...", new double[]{1, 1, 1, 1, 2, 1, 1, 1, 1}, d, MathUtils.EPSILON);
-  }
-
-  @Test
-  public void testInitialBias() {
-    final double[] d = {5.5};
-    MathUtils.adjustRemainders(d, 0.5);
-    Assert.assertArrayEquals("initial bias", new double[]{5}, d, MathUtils.EPSILON);
-  }
-
-
-  @Test
-  public void testIsZero() {
-    Assert.assertTrue(MathUtils.isZero(0));
-    Assert.assertFalse(MathUtils.isZero(1.0/1000.0));
-    Assert.assertTrue(MathUtils.isZero(1.0/1000000000.0));
-    Assert.assertTrue(MathUtils.isZero(-1.0/1000000000.0));
-  }
-
-  @Test
-  public void testIsNotZero() {
-    Assert.assertFalse(MathUtils.isNotZero(0));
-    Assert.assertTrue(MathUtils.isNotZero(1.0/1000.0));
-    Assert.assertFalse(MathUtils.isNotZero(1.0/1000000000.0));
-    Assert.assertFalse(MathUtils.isNotZero(-1.0/1000000000.0));
-  }
-
-  @Test
-  public void testIsInteger() {
-    Assert.assertTrue(MathUtils.isInteger(1.0));
-    Assert.assertTrue(MathUtils.isInteger(0.0));
-    Assert.assertTrue(MathUtils.isInteger(1.0/1000000000.0));
-    Assert.assertFalse(MathUtils.isInteger(1.0/1000.0));
-  }
-
-  @Test
-  public void testIsNotInteger() {
-    Assert.assertFalse(MathUtils.isNotInteger(1.0));
-    Assert.assertFalse(MathUtils.isNotInteger(0.0));
-    Assert.assertFalse(MathUtils.isNotInteger(1.0/1000000000.0));
-    Assert.assertTrue(MathUtils.isNotInteger(1.0/1000.0));
-  }
-}