Class LocationBoundingVisitor

java.lang.Object
com.google.common.css.compiler.passes.LocationBoundingVisitor
All Implemented Interfaces:
UniformVisitor

public class LocationBoundingVisitor extends Object implements UniformVisitor
A pass for finding an approximation to a minimum-size SourceCodeLocation interval that contains a given node.

In typical CssTrees c. April 2013, most nodes do not have SourceCodeLocations, but suppose we have such a node A with descendent nodes D_0, ... D_n that do have locations:

     A
    / \
   -----
    |   \
   D_0  D_1
 

Then we know that the subtree rooted at A includes markup beginning by min_0^n(beginLocation(D_i)) and ending by max_0^n(endLocation(D_i)). Concretely, let

   node  getBeginCharacterIndex  getEndCharacterIndex
   ---   ---                     ---
   A     ?                       ?
   D_0   5                       15
   D_1   17                      19
 

Then we can estimate for A:

   A     5                       19