/*
 * Copyright (C) 2015 Pedro Vicente Gomez Sanchez.
 *
 * Licensed 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 com.github.pedrovgs.lynx.model;

/**
 * Logcat trace representation. All traces contains a message and a TraceLevel assigned.
 *
 * @author Pedro Vicente Gómez Sánchez.
 */
public class Trace {

  private final TraceLevel level;
  private final String message;

  public Trace(TraceLevel level, String message) {
    this.level = level;
    this.message = message;
  }

  public TraceLevel getLevel() {
    return level;
  }

  public String getMessage() {
    return message;
  }

  @Override public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof Trace)) {
      return false;
    }

    Trace trace = (Trace) o;
    return level == trace.level && message.equals(trace.message);
  }

  @Override public int hashCode() {
    int result = level.hashCode();
    result = 31 * result + message.hashCode();
    return result;
  }

  @Override public String toString() {
    return "Trace{" +
        "level=" + level +
        ", message='" + message + '\'' +
        '}';
  }
}

@@ -647,16 +647,82 @@
 model;%0A%0A
+import com.github.pedrovgs.lynx.exception.IllegalTraceException;%0A%0A
 /**%0A * L
@@ -875,16 +875,737 @@
 race %7B%0A%0A
+  private static final char TRACE_LEVEL_SEPARATOR = '/';%0A%0A  /**%0A   * Factory method used to create a Trace instance from a String. The format of the input string%0A   * should be something like: %22D/LogMessage%22%0A   */%0A  public static Trace fromString(String logcatTrace) throws IllegalTraceException %7B%0A    if (logcatTrace == null%0A        %7C%7C logcatTrace.length() %3C 2%0A        %7C%7C logcatTrace.charAt(1) != TRACE_LEVEL_SEPARATOR) %7B%0A      throw new IllegalTraceException(%0A          %22You are trying to create a Trace object from a invalid String. Your trace should be something like: 'D/TraceMessage'.%22);%0A    %7D%0A    TraceLevel level = getTraceLevel(logcatTrace.charAt(0));%0A    return new Trace(level, logcatTrace.substring(2));%0A  %7D%0A%0A
   privat
@@ -1630,16 +1630,17 @@
  level;%0A
+%0A
   privat
@@ -1855,24 +1855,24 @@
 Message() %7B%0A
-
     return m
@@ -1880,24 +1880,650 @@
 ssage;%0A  %7D%0A%0A
+  private static TraceLevel getTraceLevel(char traceString) %7B%0A    TraceLevel traceLevel;%0A    switch (traceString) %7B%0A      case 'V':%0A        traceLevel = TraceLevel.VERBOSE;%0A        break;%0A      case 'A':%0A        traceLevel = TraceLevel.ASSERT;%0A        break;%0A      case 'I':%0A        traceLevel = TraceLevel.INFO;%0A        break;%0A      case 'W':%0A        traceLevel = TraceLevel.WARNING;%0A        break;%0A      case 'E':%0A        traceLevel = TraceLevel.ERROR;%0A        break;%0A      case 'F':%0A        traceLevel = TraceLevel.WTF;%0A        break;%0A      default:%0A        traceLevel = TraceLevel.DEBUG;%0A    %7D%0A    return traceLevel;%0A  %7D%0A%0A
   @Override 

Add factory method to Trace class