1b5840353SAdam Hornáček /* 2b5840353SAdam Hornáček * CDDL HEADER START 3b5840353SAdam Hornáček * 4b5840353SAdam Hornáček * The contents of this file are subject to the terms of the 5b5840353SAdam Hornáček * Common Development and Distribution License (the "License"). 6b5840353SAdam Hornáček * You may not use this file except in compliance with the License. 7b5840353SAdam Hornáček * 8b5840353SAdam Hornáček * See LICENSE.txt included in this distribution for the specific 9b5840353SAdam Hornáček * language governing permissions and limitations under the License. 10b5840353SAdam Hornáček * 11b5840353SAdam Hornáček * When distributing Covered Code, include this CDDL HEADER in each 12b5840353SAdam Hornáček * file and include the License file at LICENSE.txt. 13b5840353SAdam Hornáček * If applicable, add the following below this CDDL HEADER, with the 14b5840353SAdam Hornáček * fields enclosed by brackets "[]" replaced with your own identifying 15b5840353SAdam Hornáček * information: Portions Copyright [yyyy] [name of copyright owner] 16b5840353SAdam Hornáček * 17b5840353SAdam Hornáček * CDDL HEADER END 18b5840353SAdam Hornáček */ 19b5840353SAdam Hornáček 20b5840353SAdam Hornáček /* 21*d051e170SChris Fraire * Copyright (c) 2017, 2020, Chris Fraire <cfraire@me.com>. 22b5840353SAdam Hornáček */ 239805b761SAdam Hornáček package org.opengrok.indexer.analysis; 24b5840353SAdam Hornáček 25b5840353SAdam Hornáček // "How do I make a Class extend Observable when it has extended another class too?" 26b5840353SAdam Hornáček // Answered by adamski, https://stackoverflow.com/users/127479/adamski, 27b5840353SAdam Hornáček // https://stackoverflow.com/a/1658735/933163, 28b5840353SAdam Hornáček // https://stackoverflow.com/questions/1658702/how-do-i-make-a-class-extend-observable-when-it-has-extended-another-class-too 29b5840353SAdam Hornáček 30b5840353SAdam Hornáček /** 31b5840353SAdam Hornáček * Represents an event raised when a symbol matcher matches a string that 32b5840353SAdam Hornáček * might be published as a symbol. 33b5840353SAdam Hornáček */ 34b5840353SAdam Hornáček public class SymbolMatchedEvent { 35b5840353SAdam Hornáček 36b5840353SAdam Hornáček private final Object source; 37b5840353SAdam Hornáček private final String str; 38*d051e170SChris Fraire private final long start; 39*d051e170SChris Fraire private final long end; 40b5840353SAdam Hornáček 41b5840353SAdam Hornáček /** 42b5840353SAdam Hornáček * Initializes an immutable instance of {@link SymbolMatchedEvent}. 43b5840353SAdam Hornáček * @param source the event source 44b5840353SAdam Hornáček * @param str the symbol string 45b5840353SAdam Hornáček * @param start the symbol start position 46b5840353SAdam Hornáček * @param end the symbol end position 47b5840353SAdam Hornáček */ SymbolMatchedEvent(Object source, String str, long start, long end)48*d051e170SChris Fraire public SymbolMatchedEvent(Object source, String str, long start, long end) { 49b5840353SAdam Hornáček this.source = source; 50b5840353SAdam Hornáček this.str = str; 51b5840353SAdam Hornáček this.start = start; 52b5840353SAdam Hornáček this.end = end; 53b5840353SAdam Hornáček } 54b5840353SAdam Hornáček 55b5840353SAdam Hornáček /** 56b5840353SAdam Hornáček * Gets the event source. 57b5840353SAdam Hornáček * @return the initial value 58b5840353SAdam Hornáček */ getSource()59b5840353SAdam Hornáček public Object getSource() { 60b5840353SAdam Hornáček return source; 61b5840353SAdam Hornáček } 62b5840353SAdam Hornáček 63b5840353SAdam Hornáček /** 64b5840353SAdam Hornáček * Gets the symbol string. 65b5840353SAdam Hornáček * @return the initial value 66b5840353SAdam Hornáček */ getStr()67b5840353SAdam Hornáček public String getStr() { 68b5840353SAdam Hornáček return str; 69b5840353SAdam Hornáček } 70b5840353SAdam Hornáček 71b5840353SAdam Hornáček /** 72b5840353SAdam Hornáček * Gets the symbol start position. 73b5840353SAdam Hornáček * @return the initial value 74b5840353SAdam Hornáček */ getStart()75*d051e170SChris Fraire public long getStart() { 76b5840353SAdam Hornáček return start; 77b5840353SAdam Hornáček } 78b5840353SAdam Hornáček 79b5840353SAdam Hornáček /** 80b5840353SAdam Hornáček * Gets the symbol end position. 81b5840353SAdam Hornáček * @return the initial value 82b5840353SAdam Hornáček */ getEnd()83*d051e170SChris Fraire public long getEnd() { 84b5840353SAdam Hornáček return end; 85b5840353SAdam Hornáček } 86b5840353SAdam Hornáček } 87