/*
Runs the given visitor for the given trace on this event.

(non-Javadoc)
@see org.deckfour.xes.model.XEvent#accept(org.deckfour.xes.model.XVisitor, org.deckfour.xes.model.XTrace)
199131
public void accept(XVisitor visitor, XTrace trace) {
		/*
		 * First call.
		 */
		visitor.visitEventPre(this, trace);
		/*
		 * Visit the attributes.
		 */
		for (XAttribute attribute: attributes.values()) {
			attribute.accept(visitor, this);
		}
		/*
		 * Last call.
		 */
		visitor.visitEventPost(this, trace);
	}
366704
@Override
	public void accept(Visitor<OptimizerNode> visitor) {
		if (visitor.preVisit(this)) {
			if (getPredecessorNode() != null) {
				getPredecessorNode().accept(visitor);
			} else {
				throw new CompilerException();
			}
			for (DagConnection connection : getBroadcastConnections()) {
				connection.getSource().accept(visitor);
			}
			visitor.postVisit(this);
		}
	}
1300238
public void accept(final MethodVisitor mv) {
        mv.visitTryCatchBlock(start.getLabel(), end.getLabel(),
                handler == null ? null : handler.getLabel(), type);
        int n = visibleTypeAnnotations == null ? 0 : visibleTypeAnnotations
                .size();
        for (int i = 0; i < n; ++i) {
            TypeAnnotationNode an = visibleTypeAnnotations.get(i);
            an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath,
                    an.desc, true));
        }
        n = invisibleTypeAnnotations == null ? 0 : invisibleTypeAnnotations
                .size();
        for (int i = 0; i < n; ++i) {
            TypeAnnotationNode an = invisibleTypeAnnotations.get(i);
            an.accept(mv.visitTryCatchAnnotation(an.typeRef, an.typePath,
                    an.desc, false));
        }
    }
1261399
protected <R, C> R accept(AstVisitor<R, C> visitor, C context)
    {
        return visitor.visitNode(this, context);
    }
1082279
public static void traceException(TraceComponent callersTrace, Throwable ex)
   {
     if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {

       // Find XA completion code if one exists, as this isn't in a normal dump
       String xaErrStr = null;
       if (ex instanceof XAException) {
         XAException xaex = (XAException)ex; 
         xaErrStr = "XAExceptionErrorCode: " + xaex.errorCode;
       }

       // Trace using the correct trace group
       if (light_tc.isDebugEnabled()) {
         if (xaErrStr != null) SibTr.debug(light_tc, xaErrStr);
         SibTr.exception(light_tc, ex);
       }
       else {
         if (xaErrStr != null) SibTr.debug(callersTrace, xaErrStr);
         SibTr.exception(callersTrace, ex);
       }
     }
   }
691649
public final void trace(Object message, Throwable t) {

        if (isLevelEnabled(SimpleLog.LOG_LEVEL_TRACE)) {
            log(SimpleLog.LOG_LEVEL_TRACE, message, t);
        }
    }
673476
@Override
    public void trace( F0<Throwable> exception )
    {
        if ( compilerLogger.isDebugEnabled() )
        {
            compilerLogger.debug( exception.apply() );
        }
    }
1149240
@Override
	public void accept(Visitor<OptimizerNode> visitor) {
		if (visitor.preVisit(this)) {
			if (getPredecessorNode() != null) {
				getPredecessorNode().accept(visitor);
			} else {
				throw new CompilerException();
			}
			visitor.postVisit(this);
		}
	}
168054
public void accept(InteractionUnitVisitor visitor)
    {
        visitor.startVisit(this);
        for (InteractionUnit child : children)
        {
            child.accept(visitor);
        }
        visitor.endVisit(this);
    }
444202
public void setTraces(Trace... traces) {
        if (this.httpClient instanceof DefaultHttpClient) {
            ((DefaultHttpClient)this.httpClient).setTraces(traces);
        }
        else
            throw new UnsupportedOperationException("Invalid operation for class " + this.httpClient.getClass());
    }
998658
@Override
    public boolean accept(File pathname) {
        boolean accept = super.accept(pathname);
        if (accept) {
            try {
                accept &= shouldProcess(pathname);
            } catch (AnalysisException ex) {
                throw new UnexpectedAnalysisException(ex.getMessage(), ex.getCause());
            }
        }
        return accept;
    }
196431
public void accept() throws NotConnectedException, InterruptedException {
        Stanza acceptPacket = new AcceptPacket(this.session.getWorkgroupJID());
        connection.sendStanza(acceptPacket);
        // TODO: listen for a reply.
        accepted = true;
    }
922667
public void acceptVisitor(CFG cfg, PathVisitor visitor) {
        if (getLength() > 0) {
            BasicBlock startBlock = cfg.lookupBlockByLabel(getBlockIdAt(0));
            acceptVisitorStartingFromLocation(cfg, visitor, startBlock, startBlock.getFirstInstruction());
        }
    }
410305
@Override
    public void trace(String format, Object arg) {
        if (logger.isTraceEnabled()) {
            FormattingTuple ft = MessageFormatter.format(format, arg);
            logger.trace(ft.getMessage(), ft.getThrowable());
        }
    }
902612
@Override public Call<Void> accept(List<Span> input) {
    if (input.isEmpty()) return Call.create(null);

    Set<InsertSpan.Input> spans = new LinkedHashSet<>();
    Set<InsertServiceRemoteService.Input> serviceRemoteServices = new LinkedHashSet<>();
    Set<InsertServiceSpan.Input> serviceSpans = new LinkedHashSet<>();
    Set<InsertTraceByServiceRemoteService.Input> traceByServiceRemoteServices =
      new LinkedHashSet<>();
    Set<InsertTraceByServiceSpan.Input> traceByServiceSpans = new LinkedHashSet<>();
    Set<Map.Entry<String, String>> autocompleteTags = new LinkedHashSet<>();

    for (Span s : input) {
      // indexing occurs by timestamp, so derive one if not present.
      long ts_micro = s.timestampAsLong();
      if (ts_micro == 0L) ts_micro = guessTimestamp(s);

      // fallback to current time on the ts_uuid for span data, so we know when it was inserted
      UUID ts_uuid =
        new UUID(
          UUIDs.startOf(ts_micro != 0L ? (ts_micro / 1000L) : System.currentTimeMillis())
            .getMostSignificantBits(),
          UUIDs.random().getLeastSignificantBits());

      spans.add(insertSpan.newInput(s, ts_uuid));

      if (!searchEnabled) continue;

      // Empty values allow for api queries with blank service or span name
      String service = s.localServiceName() != null ? s.localServiceName() : "";
      String span =
        null != s.name() ? s.name() : ""; // Empty value allows for api queries without span name

      if (null == s.localServiceName()) continue; // don't index further w/o a service name

      // service span and remote service indexes is refreshed regardless of timestamp
      String remoteService = s.remoteServiceName();
      if (insertServiceRemoteService != null && remoteService != null) {
        serviceRemoteServices.add(insertServiceRemoteService.newInput(service, remoteService));
      }
      serviceSpans.add(insertServiceSpan.newInput(service, span));

      if (ts_micro == 0L) continue; // search is only valid with a timestamp, don't index w/o it!
      int bucket = durationIndexBucket(ts_micro); // duration index is milliseconds not microseconds
      long duration = s.durationAsLong() / 1000L;
      traceByServiceSpans.add(
        insertTraceByServiceSpan.newInput(service, span, bucket, ts_uuid, s.traceId(), duration));
      if (span.isEmpty()) continue;

      if (insertServiceRemoteService != null && remoteService != null) {
        traceByServiceRemoteServices.add(
          insertTraceByServiceRemoteService.newInput(service, remoteService, bucket, ts_uuid,
            s.traceId()));
      }
      traceByServiceSpans.add( // Allows lookup without the span name
        insertTraceByServiceSpan.newInput(service, "", bucket, ts_uuid, s.traceId(), duration));

      if (insertAutocompleteValue != null) {
        for (Map.Entry<String, String> entry : s.tags().entrySet()) {
          if (autocompleteKeys.contains(entry.getKey())) autocompleteTags.add(entry);
        }
      }
    }
    List<Call<Void>> calls = new ArrayList<>();
    for (InsertSpan.Input span : spans) {
      calls.add(insertSpan.create(span));
    }
    for (InsertServiceSpan.Input serviceSpan : serviceSpans) {
      insertServiceSpan.maybeAdd(serviceSpan, calls);
    }
    for (InsertServiceRemoteService.Input serviceRemoteService : serviceRemoteServices) {
      insertServiceRemoteService.maybeAdd(serviceRemoteService, calls);
    }
    for (InsertTraceByServiceSpan.Input serviceSpan : traceByServiceSpans) {
      calls.add(insertTraceByServiceSpan.create(serviceSpan));
    }
    for (InsertTraceByServiceRemoteService.Input serviceRemoteService : traceByServiceRemoteServices) {
      calls.add(insertTraceByServiceRemoteService.create(serviceRemoteService));
    }
    for (Map.Entry<String, String> autocompleteTag : autocompleteTags) {
      insertAutocompleteValue.maybeAdd(autocompleteTag, calls);
    }
    return calls.isEmpty() ? Call.create(null) : AggregateCall.newVoidCall(calls);
  }
754011
public void accept(final WebAppVisitor visitor) {
		visitor.visit(this); // First do everything else

		for (WebAppListener listener : listeners) {
			visitor.visit(listener);
		}
		if (!filters.isEmpty()) {
			// first visit the filters with a filter mapping in mapping order
			final List<WebAppFilter> remainingFilters = new ArrayList<>(
					filters.values());
			for (String filterName : orderedFilters) {
				final WebAppFilter filter = filters.get(filterName);
				visitor.visit(filter);
				remainingFilters.remove(filter);
			}
			// then visit filters without a mapping order in the order they were
			// added
			for (WebAppFilter filter : remainingFilters) {
				visitor.visit(filter);
			}
		}
		if (!servlets.isEmpty()) {
			for (WebAppServlet servlet : getSortedWebAppServlet()) {
				// Fix for PAXWEB-205
				visitor.visit(servlet);
			}
		}
		if (!constraintsMapping.isEmpty()) {
			for (WebAppConstraintMapping constraintMapping : constraintsMapping) {
				visitor.visit(constraintMapping);
			}

		}

		for (WebAppErrorPage errorPage : errorPages) {
			visitor.visit(errorPage);
		}

		visitor.end();
	}
126464
@Override
    protected <R, C> R accept(AstVisitor<R, C> visitor, C context)
    {
        return visitor.visitExpression(this, context);
    }