return new PathAndMax(request.getPath(), request.getMax());
}
}
);
PathAnalyzer analyzer = new PathAnalyzer(context.getExhibitor(), pathAndMaxes);
Analysis analysis = analyzer.analyze();
Iterable<PathAnalysisNode> transformed = Iterables.transform
(
analysis.getCompleteData(),
new Function<PathComplete, PathAnalysisNode>()
{
@Override
public PathAnalysisNode apply(PathComplete pathComplete)
{
return new PathAnalysisNode(pathComplete.getPath(), pathComplete.getMax(), pathComplete.getChildIds());
}
}
);
Iterable<IdList> transformedPossibleCycles = Iterables.transform
(
analysis.getPossibleCycles(),
new Function<Set<String>, IdList>()
{
@Override
public IdList apply(Set<String> s)
{
return new IdList(Lists.newArrayList(s));
}
}
);
String error = analysis.getError();
PathAnalysis response;
try
{
response = new PathAnalysis((error != null) ? error : "", Lists.newArrayList(transformed), Lists.newArrayList(transformedPossibleCycles));
}