Пример #1
0
  /**
   * @param n
   * @return
   */
  public static Severity getByNumber(int n) {

    Severity result = null;

    for (Severity e : Severity.values()) {

      if (e.getSeverityNumber() == n) {
        result = e;
        break;
      }
    }

    return result;
  }
Пример #2
0
 @Override
 public void parserProblem(
     Severity problemSeverity,
     String problemMessage,
     String processingContext,
     int startOffset,
     int endOffset) {
   IPrsStream prsStream = getIPrsStream();
   int leftToken = prsStream.getTokenIndexAtCharacter(startOffset);
   int rightToken = prsStream.getTokenIndexAtCharacter(endOffset);
   int leftTokenLoc = (leftToken > rightToken ? rightToken : leftToken);
   int rightTokenLoc = rightToken;
   int line = prsStream.getLine(leftTokenLoc) + getErrorReportLineOffset();
   CustomDiagnostic diagnostic =
       new CustomDiagnostic(
           problemSeverity.getDiagnosticSeverity(),
           "org.eclipse.ocl",
           1,
           problemMessage,
           new Object[] {processingContext});
   if (line > 0) {
     diagnostic.setStartLine(prsStream.getLine(leftTokenLoc) + getErrorReportLineOffset());
     diagnostic.setStartPosition(prsStream.getColumn(leftTokenLoc));
     diagnostic.setEndPosition(prsStream.getEndColumn(rightTokenLoc));
     diagnostic.setEndLine(prsStream.getEndLine(rightTokenLoc) + getErrorReportLineOffset());
   }
   if (diagnostics == null) {
     diagnostics = diagnostic;
   } else {
     diagnostics.add(diagnostic);
   }
 }
Пример #3
0
 @Override
 public int hashCode() {
   int result = severity.hashCode();
   result = 31 * result + message.hashCode();
   result = 31 * result + (details != null ? details.hashCode() : 0);
   return result;
 }
 private void readFromParcel(Parcel in) {
   mBody = in.readString();
   mServiceCategory = in.readInt();
   mSeverity = Severity.values()[in.readInt()];
   mUrgency = Urgency.values()[in.readInt()];
   mCertainty = Certainty.values()[in.readInt()];
   mLanguageCode = in.readInt();
 }
 public void writeToParcel(Parcel dest, int flags) {
   dest.writeString(mBody);
   dest.writeInt(mServiceCategory);
   dest.writeInt(mSeverity.ordinal());
   dest.writeInt(mUrgency.ordinal());
   dest.writeInt(mCertainty.ordinal());
   dest.writeInt(mLanguageCode);
 }
Пример #6
0
  /**
   * @param n
   * @return
   */
  public static Severity getByName(String name) {

    Severity result = null;

    if (name == null) {
      return result;
    }

    for (Severity e : Severity.values()) {

      if (e.getName().compareToIgnoreCase(name) == 0) {
        result = e;
        break;
      }
    }

    return result;
  }
Пример #7
0
 public void setSeverity(int severity) {
   setSeverity(Severity.forValue(severity));
 }
Пример #8
0
 public void setFatalSeverity(String severity) {
   this.fatalSeverity = Severity.valueOf(severity.toUpperCase());
 }
Пример #9
0
 public String getDebugSeverity() {
   return debugSeverity.toString();
 }
Пример #10
0
 public void setInfoSeverity(String severity) {
   this.infoSeverity = Severity.valueOf(severity.toUpperCase());
 }
Пример #11
0
 public String getInfoSeverity() {
   return infoSeverity.toString();
 }
Пример #12
0
 public void setWarnSeverity(String severity) {
   this.warnSeverity = Severity.valueOf(severity.toUpperCase());
 }
Пример #13
0
 public String getWarnSeverity() {
   return warnSeverity.toString();
 }
Пример #14
0
 public void setErrorSeverity(String severity) {
   this.errorSeverity = Severity.valueOf(severity.toUpperCase());
 }
Пример #15
0
 public String getErrorSeverity() {
   return errorSeverity.toString();
 }
Пример #16
0
 public boolean includes(@NotNull Severity severity) {
   return severity.compareTo(this) <= 0;
 }
Пример #17
0
 public void setDebugSeverity(String severity) {
   this.debugSeverity = Severity.valueOf(severity.toUpperCase());
 }
Пример #18
0
 public String getFatalSeverity() {
   return fatalSeverity.toString();
 }