View Javadoc
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   * Marks a position within the tuple list (queue).
27   *
28   * @author Danny Daglas
29   */
30  public interface Position {
31  
32  	/**
33  	 * <p>isEOF.</p>
34  	 *
35  	 * @return true whether we are at the end
36  	 *   of the tuple list, false otherwise
37  	 */
38  	boolean isEOF();
39  
40  	/**
41  	 * Advances the position to the next tuple,
42  	 * as ordered within the tuple list (queue).
43  	 */
44  	void next();
45  
46  	/**
47  	 * <p>opcode.</p>
48  	 *
49  	 * @return the opcode for the tuple at this
50  	 *	position
51  	 */
52  	int opcode();
53  
54  	/**
55  	 * Get the integer representation for a particular
56  	 * element within the tuple.
57  	 *
58  	 * @param idx The item to retrieve from the tuple.
59  	 * @return the integer representation of the item.
60  	 */
61  	long intArg(int idx);
62  
63  	/**
64  	 * Get the boolean representation for a particular
65  	 * element within the tuple.
66  	 *
67  	 * @param idx The item to retrieve from the tuple.
68  	 * @return the boolean representation of the item.
69  	 */
70  	boolean boolArg(int idx);
71  
72  	/**
73  	 * Get a reference to a particular element
74  	 * within the tuple.
75  	 *
76  	 * @param idx The item to retrieve from the tuple.
77  	 * @return a reference to the item.
78  	 */
79  	Object arg(int idx);
80  
81  	/**
82  	 * Obtain the address argument for this tuple.
83  	 * <p>
84  	 * This is a special form in that the tuple
85  	 * has only the address argument, and nothing else.
86  	 *
87  	 * @return a {@link org.sentrysoftware.jawk.intermediate.Address} object
88  	 */
89  	Address addressArg();
90  
91  	/**
92  	 * Obtain the class argument for this tuple.
93  	 * <p>
94  	 * This is a special form in that the tuple
95  	 * has only the class argument, and nothing else.
96  	 *
97  	 * @return a {@link java.lang.Class} object
98  	 */
99  	Class<?> classArg();
100 
101 	/**
102 	 * Get the source line number for this position.
103 	 *
104 	 * @return a int
105 	 */
106 	int lineNumber();
107 }