1 package org.sentrysoftware.jawk.intermediate; 2 3 /*- 4 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ 5 * Jawk 6 * ჻჻჻჻჻჻ 7 * Copyright (C) 2006 - 2023 Sentry Software 8 * ჻჻჻჻჻჻ 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU Lesser General Public License as 11 * published by the Free Software Foundation, either version 3 of the 12 * License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Lesser Public License for more details. 18 * 19 * You should have received a copy of the GNU General Lesser Public 20 * License along with this program. If not, see 21 * <http://www.gnu.org/licenses/lgpl-3.0.html>. 22 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ 23 */ 24 25 /** 26 * A pointer to a tuple within the list of tuples. 27 * Addresses are used for jumps, especially in reaction to 28 * conditional checks (i.e., if false, jump to else block, etc.). 29 * <p> 30 * Addresses have the following properties: 31 * <ul> 32 * <li>A name (label). 33 * <li>An index into the tuple queue. 34 * </ul> 35 * An address may not necessarily have an index assigned upon creation. 36 * However, upon tuple traversal, all address indexes must 37 * point to a valid tuple. 38 * 39 * <p> 40 * All addresses should have a meaningful label. 41 * 42 * @author Danny Daglas 43 */ 44 public interface Address { 45 46 /** 47 * The label of the address. 48 * It is particularly useful when dumping tuples to an output stream. 49 * 50 * @return The label of the tuple. 51 */ 52 String label(); 53 54 /** 55 * Set the tuple index of this address. 56 * This can be deferred anytime after creation of the address, 57 * but the index must be assigned prior to traversing the tuples. 58 * 59 * @param idx The tuple location within the tuple list (queue) 60 * for this address. 61 */ 62 void assignIndex(int idx); 63 64 /** 65 * <p>index.</p> 66 * 67 * @return The index into the tuple queue/array. 68 */ 69 int index(); 70 }