Search in sources :

Example 1 with TimeGraphStateInterval

use of com.efficios.jabberwocky.views.timegraph.model.render.states.TimeGraphStateInterval in project lttng-scope by lttng.

the class StubModelStateProvider method getStateRender.

@Override
public TimeGraphStateRender getStateRender(TimeGraphTreeElement treeElement, TimeRange timeRange, long resolution, @Nullable FutureTask<?> task) {
    if (treeElement == StubModelProvider.ROOT_ELEMENT) {
        return TimeGraphStateRender.EMPTY_RENDER;
    }
    int entryIndex = Integer.valueOf(treeElement.getName().substring(StubModelProvider.ENTRY_NAME_PREFIX.length()));
    long stateLength = entryIndex * DURATION_FACTOR;
    List<TimeGraphStateInterval> intervals = LongStream.iterate(timeRange.getStartTime(), i -> i + stateLength).limit((timeRange.getDuration() / stateLength) + 1).mapToObj(startTime -> {
        long endTime = startTime + stateLength - 1;
        StateDefinition stateDef = getNextStateDef();
        return new BasicTimeGraphStateInterval(startTime, endTime, treeElement, stateDef, stateDef.getName(), Collections.emptyMap());
    }).collect(Collectors.toList());
    return new TimeGraphStateRender(timeRange, treeElement, intervals);
}
Also used : TimeRange(com.efficios.jabberwocky.common.TimeRange) LongStream(java.util.stream.LongStream) Iterator(java.util.Iterator) TimeGraphStateInterval(com.efficios.jabberwocky.views.timegraph.model.render.states.TimeGraphStateInterval) TimeGraphTreeElement(com.efficios.jabberwocky.views.timegraph.model.render.tree.TimeGraphTreeElement) FutureTask(java.util.concurrent.FutureTask) ColorDefinition(com.efficios.jabberwocky.views.common.ColorDefinition) Collectors(java.util.stream.Collectors) Iterators(com.google.common.collect.Iterators) TimeGraphModelStateProvider(com.efficios.jabberwocky.views.timegraph.model.provider.states.TimeGraphModelStateProvider) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) StateDefinition(com.efficios.jabberwocky.views.timegraph.model.render.StateDefinition) ImmutableList(com.google.common.collect.ImmutableList) LineThickness(com.efficios.jabberwocky.views.timegraph.model.render.LineThickness) TimeGraphStateRender(com.efficios.jabberwocky.views.timegraph.model.render.states.TimeGraphStateRender) BasicTimeGraphStateInterval(com.efficios.jabberwocky.views.timegraph.model.render.states.BasicTimeGraphStateInterval) Collections(java.util.Collections) StateDefinition(com.efficios.jabberwocky.views.timegraph.model.render.StateDefinition) TimeGraphStateInterval(com.efficios.jabberwocky.views.timegraph.model.render.states.TimeGraphStateInterval) BasicTimeGraphStateInterval(com.efficios.jabberwocky.views.timegraph.model.render.states.BasicTimeGraphStateInterval) BasicTimeGraphStateInterval(com.efficios.jabberwocky.views.timegraph.model.render.states.BasicTimeGraphStateInterval) TimeGraphStateRender(com.efficios.jabberwocky.views.timegraph.model.render.states.TimeGraphStateRender)

Aggregations

TimeRange (com.efficios.jabberwocky.common.TimeRange)1 ColorDefinition (com.efficios.jabberwocky.views.common.ColorDefinition)1 TimeGraphModelStateProvider (com.efficios.jabberwocky.views.timegraph.model.provider.states.TimeGraphModelStateProvider)1 LineThickness (com.efficios.jabberwocky.views.timegraph.model.render.LineThickness)1 StateDefinition (com.efficios.jabberwocky.views.timegraph.model.render.StateDefinition)1 BasicTimeGraphStateInterval (com.efficios.jabberwocky.views.timegraph.model.render.states.BasicTimeGraphStateInterval)1 TimeGraphStateInterval (com.efficios.jabberwocky.views.timegraph.model.render.states.TimeGraphStateInterval)1 TimeGraphStateRender (com.efficios.jabberwocky.views.timegraph.model.render.states.TimeGraphStateRender)1 TimeGraphTreeElement (com.efficios.jabberwocky.views.timegraph.model.render.tree.TimeGraphTreeElement)1 ImmutableList (com.google.common.collect.ImmutableList)1 Iterators (com.google.common.collect.Iterators)1 Collections (java.util.Collections)1 Iterator (java.util.Iterator)1 List (java.util.List)1 FutureTask (java.util.concurrent.FutureTask)1 Collectors (java.util.stream.Collectors)1 LongStream (java.util.stream.LongStream)1 Nullable (org.jetbrains.annotations.Nullable)1