src/main/java/org/jboss/util/Counter.java
/**
    * Returns a directional counter.
    *
    * @param counter       Counter to make directional.
    * @param increasing    True to create an increasing only
    *                      or false to create a decreasing only.
    * @return              A directional counter.
    */
Returns a directional counter.
@param counter       Counter to make directional.
@param increasing    True to create an increasing only
or false to create a decreasing only.
@return              A directional counter.
Returns a directional counter . @param counter Counter to make directional . @param increasing True to create an increasing only or false to create a decreasing only . @return A directional counter .
public static Counter makeDirectional(final Counter counter,
                                         final boolean increasing)
   {
      Counter temp;
      if (increasing) {
         temp = new Wrapper(counter) {
               /** The serialVersionUID */
            private static final long serialVersionUID = 2161377898611431781L;
               public int decrement() {
                  throw new UnsupportedOperationException();
               }
               public void reset() {
                  throw new UnsupportedOperationException();
               }
            };
      }
      else {
         temp = new Wrapper(counter) {
            /** The serialVersionUID */
            private static final long serialVersionUID = -4683457706354663230L;
               public int increment() {
                  throw new UnsupportedOperationException();
               }
            };
      }
      return temp;
   }
public static Counter makeDirectional ( final Counter counter , final boolean increasing ) { Counter temp ; if ( increasing ) { temp = new Wrapper ( counter ) { /** The serialVersionUID */ private static final long serialVersionUID = 2161377898611431781L ; public int decrement ( ) { throw new UnsupportedOperationException ( ) ; } public void reset ( ) { throw new UnsupportedOperationException ( ) ; } } ; } else { temp = new Wrapper ( counter ) { /** The serialVersionUID */ private static final long serialVersionUID = - 4683457706354663230L ; public int increment ( ) { throw new UnsupportedOperationException ( ) ; } } ; } return temp ; }
Returns a directional counter.
Returns a directional counter .