/** * @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; }
@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); } }
@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); }
/** * @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; }
public void setSeverity(int severity) { setSeverity(Severity.forValue(severity)); }
public void setFatalSeverity(String severity) { this.fatalSeverity = Severity.valueOf(severity.toUpperCase()); }
public String getDebugSeverity() { return debugSeverity.toString(); }
public void setInfoSeverity(String severity) { this.infoSeverity = Severity.valueOf(severity.toUpperCase()); }
public String getInfoSeverity() { return infoSeverity.toString(); }
public void setWarnSeverity(String severity) { this.warnSeverity = Severity.valueOf(severity.toUpperCase()); }
public String getWarnSeverity() { return warnSeverity.toString(); }
public void setErrorSeverity(String severity) { this.errorSeverity = Severity.valueOf(severity.toUpperCase()); }
public String getErrorSeverity() { return errorSeverity.toString(); }
public boolean includes(@NotNull Severity severity) { return severity.compareTo(this) <= 0; }
public void setDebugSeverity(String severity) { this.debugSeverity = Severity.valueOf(severity.toUpperCase()); }
public String getFatalSeverity() { return fatalSeverity.toString(); }