public void updateContext(DrawContext ctx) {
   Coloring c =
       (Coloring) stringMap.get(ctx.getBuffer(), ctx.getTokenOffset(), ctx.getTokenLength());
   if (c != null) {
     c.apply(ctx);
   }
 }
 public void updateContext(DrawContext ctx) {
   if (coloring == null) {
     coloring = ctx.getEditorUI().getColoring(SettingsNames.INC_SEARCH_COLORING);
   }
   if (coloring != null) {
     coloring.apply(ctx);
   }
 }
 public void updateContext(DrawContext ctx) {
   if (coloring == null) {
     coloring = getColoring(ctx);
   }
   if (coloring != null) {
     coloring.apply(ctx);
   }
 }
 public void updateContext(DrawContext ctx) {
   int pos = ctx.getFragmentOffset();
   if (pos >= blocks[curInd] && pos < blocks[curInd + 1]) {
     if (coloring == null) {
       coloring = ctx.getEditorUI().getColoring(SettingsNames.HIGHLIGHT_SEARCH_COLORING);
     }
     if (coloring != null) {
       coloring.apply(ctx);
     }
   }
 }
    public void updateContext(DrawContext ctx) {
      // Get the token type and docColorings
      TokenID tokenID = ctx.getTokenID();
      TokenContextPath tcp = ctx.getTokenContextPath();
      if (tokenID != null && tcp != null) {
        // Get the coloring according the name of the token
        String fullName = tcp.getFullTokenName(tokenID);
        Coloring c = ctx.getEditorUI().getColoring(fullName);
        if (c != null) {
          c.apply(ctx);

        } else { // Token coloring null, try category
          TokenCategory cat = tokenID.getCategory();
          if (cat != null) {
            fullName = tcp.getFullTokenName(cat);
            c = ctx.getEditorUI().getColoring(fullName);
            if (c != null) {
              c.apply(ctx);
            }
          }
        }
      }
    }
  @Test
  public void test() {
    Coloring.inferenceOfMostProbableColorsOfNodes(this.edges);

    /**
     * Verify constraint: all connected nodes has different color <br>
     * Petersen graph <br>
     * <br>
     * 1: [3, 4, 10], <br>
     * 2: [5, 4, 9], <br>
     * 3: [1, 5, 8], <br>
     * 4: [2, 1, 7], <br>
     * 5: [2, 3, 6], <br>
     * 6: [5, 10, 7], <br>
     * 7: [4, 6, 8], <br>
     * 8: [3, 7, 9], <br>
     * 9: [2, 8, 10], <br>
     * 10: [1, 6, 9]
     */
    assertTrue(
        this.nodeIdToNode.get(1).getMostProbableState()
            != this.nodeIdToNode.get(3).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(1).getMostProbableState()
            != this.nodeIdToNode.get(4).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(1).getMostProbableState()
            != this.nodeIdToNode.get(10).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(2).getMostProbableState()
            != this.nodeIdToNode.get(5).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(2).getMostProbableState()
            != this.nodeIdToNode.get(4).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(2).getMostProbableState()
            != this.nodeIdToNode.get(9).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(3).getMostProbableState()
            != this.nodeIdToNode.get(1).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(3).getMostProbableState()
            != this.nodeIdToNode.get(5).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(3).getMostProbableState()
            != this.nodeIdToNode.get(8).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(4).getMostProbableState()
            != this.nodeIdToNode.get(2).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(4).getMostProbableState()
            != this.nodeIdToNode.get(1).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(4).getMostProbableState()
            != this.nodeIdToNode.get(7).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(5).getMostProbableState()
            != this.nodeIdToNode.get(2).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(5).getMostProbableState()
            != this.nodeIdToNode.get(3).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(5).getMostProbableState()
            != this.nodeIdToNode.get(6).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(6).getMostProbableState()
            != this.nodeIdToNode.get(5).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(6).getMostProbableState()
            != this.nodeIdToNode.get(10).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(6).getMostProbableState()
            != this.nodeIdToNode.get(7).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(7).getMostProbableState()
            != this.nodeIdToNode.get(4).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(7).getMostProbableState()
            != this.nodeIdToNode.get(6).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(7).getMostProbableState()
            != this.nodeIdToNode.get(8).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(8).getMostProbableState()
            != this.nodeIdToNode.get(3).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(8).getMostProbableState()
            != this.nodeIdToNode.get(7).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(8).getMostProbableState()
            != this.nodeIdToNode.get(9).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(9).getMostProbableState()
            != this.nodeIdToNode.get(2).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(9).getMostProbableState()
            != this.nodeIdToNode.get(8).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(9).getMostProbableState()
            != this.nodeIdToNode.get(10).getMostProbableState());

    assertTrue(
        this.nodeIdToNode.get(10).getMostProbableState()
            != this.nodeIdToNode.get(1).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(10).getMostProbableState()
            != this.nodeIdToNode.get(6).getMostProbableState());
    assertTrue(
        this.nodeIdToNode.get(10).getMostProbableState()
            != this.nodeIdToNode.get(9).getMostProbableState());
  }
 @Before
 public void init() {
   this.nodeIdToNode = Coloring.initializeNodesOfPetersenGraph();
   this.edges = Coloring.initializeEdgesOfPetersenGraph(this.nodeIdToNode);
 }