Package org.chromium.debug.core.model

Examples of org.chromium.debug.core.model.StringMappingData


    this.directMappingData = directMappingData;
    this.backwardMappingData = backwardMappingData;
  }

  public TextPoint transform(TextPoint original, Direction direction) {
    StringMappingData sourceData =
        direction == Direction.REVERSE ? this.backwardMappingData : this.directMappingData;
    int pos = sourceData.findContainingSegment(original.getLine(), original.getColumn());

    StringMappingData targetData =
        direction == Direction.REVERSE ? this.directMappingData : this.backwardMappingData;

    int resLine;
    int resCol;
    if (sourceData.getSegmentBeginLine(pos) == original.getLine()) {
      resLine = targetData.getSegmentBeginLine(pos);
      resCol = original.getColumn() - sourceData.getSegmentBeginColumn(pos) +
          targetData.getSegmentBeginColumn(pos);
    } else {
      resLine = original.getLine() - sourceData.getSegmentBeginLine(pos) +
          targetData.getSegmentBeginLine(pos);
      resCol = original.getColumn();
    }
    if (pos < targetData.getLastSegmentId()) {
      int nextPos = StringMappingData.getNextSegmentId(pos);
      boolean exceed = resLine > targetData.getSegmentBeginLine(nextPos) ||
          (resLine == targetData.getSegmentBeginLine(nextPos) &&
              resCol >= targetData.getSegmentBeginColumn(nextPos));
      if (exceed) {
        if (targetData.getSegmentBeginLine(pos) == targetData.getSegmentBeginLine(nextPos) &&
            targetData.getSegmentBeginColumn(pos) == targetData.getSegmentBeginColumn(nextPos)) {
          resLine = targetData.getSegmentBeginLine(pos);
          resCol = targetData.getSegmentBeginColumn(pos);
        } else if (targetData.getSegmentBeginColumn(nextPos) > 0) {
          resLine = targetData.getSegmentBeginLine(nextPos);
          resCol = targetData.getSegmentBeginColumn(nextPos) - 1;
        } else {
          resLine = targetData.getSegmentBeginLine(nextPos) - 1;
          resCol = 0;
        }
      }
    }
View Full Code Here


      try {
        SourcePositionMapBuilder builder =
            data.getConnectedTargetData().getSourcePositionMapBuilder();

        // Unformatted text is a VM text.
        StringMappingData vmTextData = result.getInputTextData();

        // Formatter text is *like* original text in our case.
        StringMappingData originalTextData = result.getFormattedTextData();

        SourcePositionMapBuilder.ResourceSection vmResourceSection =
            new SourcePositionMapBuilder.ResourceSection(data.getVmResource().getId(), 0, 0,
                vmTextData.getEndLine(), vmTextData.getEndColumn());

        SourcePositionMapBuilder.ResourceSection originalResourceSection =
            new SourcePositionMapBuilder.ResourceSection(formattedResource.getId(), 0, 0,
                originalTextData.getEndLine(), originalTextData.getEndColumn());

        TextSectionMapping mapTable =
            new TextSectionMappingImpl(originalTextData, vmTextData);

        mappingHandle = builder.addMapping(originalResourceSection, vmResourceSection, mapTable);
View Full Code Here

      inputArray[i + 1] = intBuffer.get(i * 2 + 1);
      formattedArray[i] = intBuffer.get(i * 2 + 2);
      formattedArray[i + 1] = intBuffer.get(i * 2 + 3);
    }

    final StringMappingData inputTextData =
        new StringMappingData(inputArray, origPos.line, origPos.col);

    final StringMappingData formattedTextData =
        new StringMappingData(formattedArray, dstPos.line, dstPos.col);


    return new Result() {
      public String getFormattedText() {
        return builder.toString();
View Full Code Here

public class TextSectionMappingImplTest {

  @Test
  public void testBasic() {
    TextSectionMapping mapping = new TextSectionMappingImpl(
        new StringMappingData(
            new int[] { 0,0, 0,2, 0,12, 2,5, 2,10, 2,10, 2,103,0,   4,}5, 0),
        new StringMappingData(
            new int[] { 5,3, 5,5, 7,39,5, 9,10, 11,3, 11,17, 11,17, 12,0 }, 13, 0)
        );

    checkTwoWays(mapping, new TextPoint(0, 0), new TextPoint(5, 3));
    checkTwoWays(mapping, new TextPoint(0, 1), new TextPoint(5, 4));
View Full Code Here

  public void basicTest() throws CannotAddException {
    SourcePositionMapBuilder builder = new PositionMapBuilderImpl();
    builder.addMapping(new ResourceSection(new VmResourceId("source1.js", null), 0, 0, 5, 0),
        new ResourceSection(new VmResourceId("compiled.js", null), 0, 0, 1, 0),
        new TextSectionMappingImpl(
            new StringMappingData(new int [] { 0,0, 1,02,03,04,0 } , 5, 0),
            new StringMappingData(new int [] { 0,0, 0,10, 0,20, 0,30, 0,40 }, 0, 50)));

    builder.addMapping(new ResourceSection(new VmResourceId("source2.js", null), 0, 0, 5, 0),
        new ResourceSection(new VmResourceId("compiled.js", null), 1, 0, 2, 0),
        new TextSectionMappingImpl(
            new StringMappingData(new int [] { 0,0, 1,02,03,04,0}, 5, 0),
            new StringMappingData(new int [] { 1,0, 1,10, 1,20, 1,30, 1,40}, 1, 50)));

    builder.addMapping(new ResourceSection(new VmResourceId("source3.js", null), 0, 0, 5, 0),
        new ResourceSection(new VmResourceId("compiled.js", null), 2, 0, 3, 0),
        new TextSectionMappingImpl(
            new StringMappingData(new int [] {0,0, 1,02,03,04,0}, 5, 0),
            new StringMappingData(new int [] {2,0, 2,10, 2,20, 2,30, 2,40}, 2, 50)));

    SourcePositionMap map = builder.getSourcePositionMap();

    checkTwoWay(map, "other.js", 17, 4, "other.js", 17, 4, TranslateDirection.VM_TO_USER);
View Full Code Here

        ResourceSection vmSection, int index) throws CannotAddException {
      ResourceSection originalSection =
          new ResourceSection(new VmResourceId(("source" + index + ".js"), null), 0, 0, 5, 0);

      TextSectionMappingImpl textMapping = new TextSectionMappingImpl(
          new StringMappingData(
              new int [] { vmSection.getStart().getLine(), vmSection.getStart().getColumn() },
              vmSection.getEnd().getLine(), vmSection.getEnd().getColumn()),
          new StringMappingData((new int [] { 0, 0 }), 5, 0));

      return builder.addMapping(originalSection, vmSection, textMapping);
    }
View Full Code Here

TOP

Related Classes of org.chromium.debug.core.model.StringMappingData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.