use of com.dat3m.dartagnan.solver.caat.misc.EdgeDirection in project Dat3M by hernanponcedeleon.
the class ExternalGraph method edgeStream.
@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
EventData e = getEvent(id);
Function<EventData, Edge> edgeMapping = dir == EdgeDirection.OUTGOING ? (x -> new Edge(id, x.getId())) : (x -> new Edge(x.getId(), id));
return threadEventsMap.entrySet().stream().filter(x -> x.getKey() != e.getThread()).flatMap(x -> x.getValue().stream()).map(edgeMapping);
}
use of com.dat3m.dartagnan.solver.caat.misc.EdgeDirection in project Dat3M by hernanponcedeleon.
the class FenceGraph method edgeStream.
@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
EventData e = getEvent(id);
if (!e.isMemoryEvent()) {
return Stream.empty();
}
List<EventData> threadEvents = model.getThreadEventsMap().get(e.getThread());
if (dir == EdgeDirection.OUTGOING) {
EventData fence = getNextFence(e);
return fence == null ? Stream.empty() : threadEvents.subList(fence.getLocalId() + 1, threadEvents.size()).stream().filter(EventData::isMemoryEvent).map(x -> new Edge(id, x.getId()));
} else {
EventData fence = getPreviousFence(e);
return fence == null ? Stream.empty() : threadEvents.subList(0, fence.getLocalId()).stream().filter(EventData::isMemoryEvent).map(x -> new Edge(x.getId(), id));
}
}
use of com.dat3m.dartagnan.solver.caat.misc.EdgeDirection in project Dat3M by hernanponcedeleon.
the class CoherenceGraph method edgeIterator.
@Override
public Iterator<Edge> edgeIterator(int id, EdgeDirection dir) {
EventData e = getEvent(id);
if (!e.isWrite()) {
return Collections.emptyIterator();
}
com.google.common.base.Function<EventData, Edge> mapping = dir == EdgeDirection.INGOING ? (event -> new Edge(event.getId(), id)) : (event -> new Edge(id, event.getId()));
return Iterators.transform(getCoSuccessorList(e, dir).iterator(), mapping);
}
use of com.dat3m.dartagnan.solver.caat.misc.EdgeDirection in project Dat3M by hernanponcedeleon.
the class CoherenceGraph method edgeStream.
@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
EventData e = getEvent(id);
if (!e.isWrite()) {
return Stream.empty();
}
Function<EventData, Edge> mapping = dir == EdgeDirection.INGOING ? (event -> new Edge(event.getId(), id)) : (event -> new Edge(id, event.getId()));
return getCoSuccessorList(e, dir).stream().map(mapping);
}
use of com.dat3m.dartagnan.solver.caat.misc.EdgeDirection in project Dat3M by hernanponcedeleon.
the class InternalGraph method edgeStream.
@Override
public Stream<Edge> edgeStream(int id, EdgeDirection dir) {
EventData e = getEvent(id);
Function<EventData, Edge> edgeMapping = dir == EdgeDirection.OUTGOING ? (x -> new Edge(id, x.getId())) : (x -> new Edge(x.getId(), id));
return threadEventsMap.get(e.getThread()).stream().map(edgeMapping);
}
Aggregations