home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 1.8 KB | 79 lines |
- /*
- * @(#)Cursor.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
- /**
- * <P> Keeps track of the current position in the Expandable Set
- * and sets and returns its value.
- */
-
- package symantec.itools.db.beans.binding;
-
-
- class Cursor
- {
- String m_Name;
- int m_Position;
- Object m_FocusObject;
- ExpandableSet m_ExpandableSet;
-
- //Constructors
- /**
- * Constructor. Creates a cursor from a name and an expandable set
- *
- * @param name. Name.
- * @param set. The result set coming from the data base
- */
-
- Cursor (String name, ExpandableSet set) {
- m_Name = name;
- m_Position = -1;
- m_ExpandableSet = set;
- }
-
- /**
- * Gets the position of the current row
- * @return int. The position of the current row.
- */
- int getPosition() {
- return m_Position;
- }
-
- /**
- * Sets the position of the current row
- * @param int. The position of the current row.
- */
- void setPosition(int position) throws PositionOutOfRangeException {
- if (position >= 0) {
- try {
- m_FocusObject = m_ExpandableSet.getElementAt(position);
- m_Position = position;
- }
- catch (PositionOutOfRangeException e) {
- throw e;
- }
- }
- else {
- m_Position = position;
- }
- }
-
-
- /**
- * Gets the current row
- * @return Object. The current row.
- */
- public Object getFocusObject() {
- return m_FocusObject;
- }
-
- /**
- * Sets the current row
- * @param Object. The current row.
- */
- void setFocusObject(Object focus) {
- m_FocusObject = focus;
- }
- }