Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/util Compare.java

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/java/org/joist/util Compare.java

Author commitlogger at hocus dot collab dot net
Full name commitlogger at hocus dot collab dot net
Date 2000-04-17 12:58:14 PDT
Message User: davidp
  Date: 00/04/17 12:58:14

  Added: java/org/joist/util Compare.java
  Log:
  Comparison operators for string representations of integers. These are intended
  for use within webmacro templates.
  
  Revision Changes Path
  1.1 joist/java/org/joist​/util/Compare.java
  
  Index: Compare.java
  ====================​====================​====================​=======
  package org.sourcexchange.util;
  
  import java.util.*;
  import javax.servlet.http.*;
  
  import org.webmacro.util.*;
  import org.webmacro.servlet.*;
  
  /**
    * Returns a series of sequential integers.
    * Holds onto a number and increments it on demand.
    *
    * @author David C. Pellegrini <A HREF="mailto:davidp@​dataweb-systems.com"​>davidp@dataweb-s​ystems.com</A>​
    * @version $Revision: 1.1 $
    *
    * Copyright (c) 1999 dataweb systems, inc.
    */
  
  public class Compare extends Object
  {
      /**
       * Determines whether the first arg is equal to the second arg
       *
       * @param value1 the value on the lhs of the comparison operator
       * @param value2 the value on the rhs of the comparison operator
       * @return true iff value1 == value2
       */
      public boolean
      equal (String value1, String value2)
          throws NumberFormatException
      {
      return Integer.parseInt(value1) == Integer.parseInt(value2);
      }
  
      /**
       * Determines whether the first arg is not equal to the second arg
       *
       * @param value1 the value on the lhs of the comparison operator
       * @param value2 the value on the rhs of the comparison operator
       * @return true iff value1 != value2
       */
      public boolean
      notEqual (String value1, String value2)
          throws NumberFormatException
      {
      return Integer.parseInt(value1) != Integer.parseInt(value2);
      }
  
      /**
       * Determines whether the first arg is greater then the second arg
       *
       * @param value1 the value on the lhs of the comparison operator
       * @param value2 the value on the rhs of the comparison operator
       * @return true iff value1 > value2
       */
      public boolean
      greaterThan (String value1, String value2)
          throws NumberFormatException
      {
      return Integer.parseInt(value1) > Integer.parseInt(value2);
      }
  
      /**
       * Determines whether the first arg is greater than or equal to the second
       * arg
       *
       * @param value1 the value on the lhs of the comparison operator
       * @param value2 the value on the rhs of the comparison operator
       * @return true iff value1 >= value2
       */
      public boolean
      greaterThanOrEqual (String value1, String value2)
          throws NumberFormatException
      {
      return Integer.parseInt(value1) >= Integer.parseInt(value2);
      }
  
      /**
       * Determines whether the first arg is less than the second arg
       *
       * @param value1 the value on the lhs of the comparison operator
       * @param value2 the value on the rhs of the comparison operator
       * @return true iff value1 < value2
       */
      public boolean
      lessThan (String value1, String value2)
          throws NumberFormatException
      {
      return Integer.parseInt(value1) < Integer.parseInt(value2);
      }
  
      /**
       * Determines whether the first arg is less than or equal to the second arg
       *
       * @param value1 the value on the lhs of the comparison operator
       * @param value2 the value on the rhs of the comparison operator
       * @return true iff value1 <= value2
       */
      public boolean
      lessThanOrEqual (String value1, String value2)
          throws NumberFormatException
      {
      return Integer.parseInt(value1) <= Integer.parseInt(value2);
      }
  }

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/java/org/joist/util Compare.java commitlogger at hocus dot collab dot net commitlogger at hocus dot collab dot net 2000-04-17 12:58:14 PDT
Messages per page: