LogEntry.java :  » Log » alogcat » org » jtb » alogcat » Android Open Source

Android Open Source » Log » alogcat 
alogcat » org » jtb » alogcat » LogEntry.java
package org.jtb.alogcat;

public class LogEntry {
  private Level level = Level.V;
  private String text = null;
  private Integer hash = null;

  public LogEntry(String text, Level level) {
    this.text = text;
    this.level = level;
  }

  public Level getLevel() {
    return level;
  }

  public String getText() {
    return text;
  }

  @Override
  public int hashCode() {
    if (hash == null) {
      final int prime = 31;
      int result = 1;
      result = prime * result + ((level == null) ? 0 : level.hashCode());
      result = prime * result + ((text == null) ? 0 : text.hashCode());
      hash = result;
    }

    return hash;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    LogEntry other = (LogEntry) obj;
    if (level != other.level)
      return false;
    if (text == null) {
      if (other.text != null)
        return false;
    } else if (!text.equals(other.text))
      return false;
    return true;
  }
}
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.