1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * See LICENSE.txt included in this distribution for the specific 9 * language governing permissions and limitations under the License. 10 * 11 * When distributing Covered Code, include this CDDL HEADER in each 12 * file and include the License file at LICENSE.txt. 13 * If applicable, add the following below this CDDL HEADER, with the 14 * fields enclosed by brackets "[]" replaced with your own identifying 15 * information: Portions Copyright [yyyy] [name of copyright owner] 16 * 17 * CDDL HEADER END 18 */ 19 20 /* 21 * Copyright (c) 2017, 2020, Chris Fraire <cfraire@me.com>. 22 */ 23 package org.opengrok.indexer.analysis; 24 25 /** 26 * Represents an event raised when a language lexer indicates that scope has 27 * changed. 28 */ 29 public class ScopeChangedEvent { 30 31 private final Object source; 32 private final ScopeAction action; 33 private final String str; 34 private final long start; 35 private final long end; 36 37 /** 38 * Initializes an immutable instance of {@link ScopeChangedEvent}. 39 * @param source the event source 40 * @param action the scope change action 41 * @param str the text string 42 * @param start the text start position 43 * @param end the text end position 44 */ ScopeChangedEvent(Object source, ScopeAction action, String str, long start, long end)45 public ScopeChangedEvent(Object source, ScopeAction action, String str, long start, long end) { 46 this.source = source; 47 this.action = action; 48 this.str = str; 49 this.start = start; 50 this.end = end; 51 } 52 53 /** 54 * Gets the event source. 55 * @return the initial value 56 */ getSource()57 public Object getSource() { 58 return source; 59 } 60 61 /** 62 * Gets the scope change action. 63 * @return the initial value 64 */ getAction()65 public ScopeAction getAction() { 66 return action; 67 } 68 69 /** 70 * Gets the text string. 71 * @return the text string 72 */ getStr()73 public String getStr() { 74 return str; 75 } 76 77 /** 78 * Gets the text start position. 79 * @return the initial value 80 */ getStart()81 public long getStart() { 82 return start; 83 } 84 85 /** 86 * Gets the text end position. 87 * @return the initial value 88 */ getEnd()89 public long getEnd() { 90 return end; 91 } 92 } 93