EmptyUtils.java :  » Tools » berrys-toolbox » org » berrylike » android » view » utils » Android Open Source

Android Open Source » Tools » berrys toolbox 
berrys toolbox » org » berrylike » android » view » utils » EmptyUtils.java
package org.berrylike.android.view.utils;

import java.util.List;

import org.berrylike.android.view.InternalViewTag;
import org.berrylike.android.view.OverlayLayoutParams.Margin;
import org.berrylike.android.view.OverlayLayoutParams.Quantity;

import android.graphics.drawable.Drawable;
import android.widget.ImageView.ScaleType;

public class EmptyUtils {
  private EmptyUtils() {}
  public static boolean isEmpty(String s) {
    if(s==null) 
      return true;
    return s.trim().length() == 0;
  }
  public static boolean isNotEmpty(String s) {
    return !isEmpty(s);
  }
  public static boolean isEmpty(Float f) {
    if(f==null || f.isNaN()) 
      return true;
    return f.floatValue() == 0.0f;
  }
  public static boolean isNotEmpty(Float f) {
    return !isEmpty(f);
  }
  public static boolean isEmpty(Integer i) {
    if(i==null) 
      return true;
    return i.intValue() == 0;
  }
  public static boolean isNotEmpty(Integer i) {
    return !isEmpty(i);
  }
  public static boolean isEmpty(Short s) {
    if(s==null) 
      return true;
    return s.shortValue() == 0;
  }
  public static boolean isNotEmpty(Short s) {
    return !isEmpty(s);
  }
  public static boolean isEmpty(ScaleType s) {
    return (s==null);
  }
  public static boolean isNotEmpty(ScaleType s) {
    return !isEmpty(s);
  }
  public static boolean isEmpty(Drawable d) {
    return (d==null);
  }
  public static boolean isNotEmpty(Drawable d) {
    return !isEmpty(d);
  }
  public static boolean isEmpty(InternalViewTag vt) {
    return (vt==null);
  }
  public static boolean isNotEmpty(InternalViewTag vt) {
    return !isEmpty(vt);
  }
  public static boolean isEmpty(Quantity q) {
    return q==null;
  }
  public static boolean isNotEmpty(Quantity q) {
    return !isEmpty(q);
  }
  public static boolean isEmpty(Margin m) {
    return m==null;
  }
  public static boolean isNotEmpty(Margin m) {
    return !isEmpty(m);
  }
  public static boolean isEmpty(List<?> list) {
    return (list == null || list.size() < 1);
  }
  public static boolean isNotEmpty(List<?> list) {
    return !isEmpty(list);
  }
  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.