/** * Creates a new abstract trace with the given parameters. * * @param traceId * The trace ID to use for the new trace * @param sessionId * The session ID to use for the new trace */ public AbstractTrace(final long traceId, final String sessionId) { this.traceInformation = new TraceInformation(traceId, sessionId); }
/** * Delivers the ID of the session. * * @return The session ID. */ public String getSessionId() { return this.traceInformation.getSessionId(); }
/** * Returns this trace's trace ID. * * @return See above */ public long getTraceId() { return this.traceInformation.getTraceId(); }
@Override public int hashCode() { return (int) this.getTraceId(); }
/** * {@inheritDoc} */ @Override protected IOriginRetentionPolicy getDesiredOriginRetentionPolicy() throws AnalysisConfigurationException { final TraceColorRepository colorRepository = (TraceColorRepository) super.getRepository(COLOR_REPOSITORY_PORT_NAME); final Set<TraceInformation> desiredTraces = new HashSet<>(); for (final Long traceId : colorRepository.getColorMap().keySet()) { desiredTraces.add(new TraceInformation(traceId, null)); } return SpecificOriginRetentionPolicy.createInstance(desiredTraces); } }
@Override public boolean equals(final Object other) { if (!(other instanceof TraceInformation)) { return false; } // The equality currently relies only on the trace ID to facilitate trace coloring. final TraceInformation otherTraceInformation = (TraceInformation) other; return this.getTraceId() == otherTraceInformation.getTraceId(); }
private void handleGraphElement(final AbstractGraphElement<TraceInformation> element) { TraceInformation relevantTraceInformation = null; int relevantOrigins = 0; // Count the relevant origins from the origin set final Iterator<TraceInformation> origins = element.getOrigins().iterator(); while (origins.hasNext()) { final TraceInformation traceInformation = origins.next(); final long traceId = traceInformation.getTraceId(); if (this.colorMap.containsKey(traceId)) { relevantTraceInformation = traceInformation; relevantOrigins++; } } // Choose the color depending on the number of relevant origins if (relevantOrigins == 0) { element.setColor(this.defaultColor); } else if (relevantOrigins > 1) { element.setColor(this.collisionColor); } else { final long traceId = relevantTraceInformation.getTraceId(); final Color color = this.colorMap.get(traceId); element.setColor(color); } }