wasCSharpSQLite – Blame information for rev
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * SearchId.java |
||
3 | * |
||
4 | * Copyright (c) 1997 Sun Microsystems, Inc. |
||
5 | * |
||
6 | * See the file "license.terms" for information on usage and |
||
7 | * redistribution of this file, and for a DISCLAIMER OF ALL |
||
8 | * WARRANTIES. |
||
9 | * |
||
10 | * Included in SQLite3 port to C# for use in testharness only; 2008 Noah B Hart |
||
11 | * |
||
12 | * RCS @(#) $Id: SearchId.java,v 1.1.1.1 1998/10/14 21:09:20 cvsadmin Exp $ |
||
13 | * |
||
14 | */ |
||
15 | using System; |
||
16 | using System.Collections; |
||
17 | |||
18 | namespace tcl.lang |
||
19 | { |
||
20 | |||
21 | /// <summary> SearchId is used only by the ArrayVar class. When searchstart is |
||
22 | /// called on an Tcl array, a SearchId is created that contains the |
||
23 | /// Enumerated list of all the array keys; a String that uniquely |
||
24 | /// identifies the searchId for the Tcl array, and an index that is |
||
25 | /// used when to generate other unique strings. |
||
26 | /// </summary> |
||
27 | public sealed class SearchId |
||
28 | { |
||
29 | /// <summary> Return the Enumeration for the SearchId object. This is |
||
30 | /// used in the ArrayCmd class for the anymore, donesearch, |
||
31 | /// and nextelement functions. |
||
32 | /// |
||
33 | /// </summary> |
||
34 | /// <param name="">none |
||
35 | /// </param> |
||
36 | /// <returns> The Enumeration for the SearchId object |
||
37 | /// </returns> |
||
38 | private IDictionaryEnumerator Enum |
||
39 | { |
||
40 | get |
||
41 | { |
||
42 | return enum_Renamed; |
||
43 | } |
||
44 | |||
45 | } |
||
46 | /// <summary> Return the integer value of the index. Used in ArrayVar to |
||
47 | /// generate the next unique SearchId string. |
||
48 | /// |
||
49 | /// </summary> |
||
50 | /// <param name="">none |
||
51 | /// </param> |
||
52 | /// <returns>h The integer value of the index |
||
53 | /// </returns> |
||
54 | internal int Index |
||
55 | { |
||
56 | get |
||
57 | { |
||
58 | return index; |
||
59 | } |
||
60 | |||
61 | } |
||
62 | private bool hasMore = true; |
||
63 | internal bool HasMore |
||
64 | { |
||
65 | get |
||
66 | { |
||
67 | return hasMore; |
||
68 | } |
||
69 | } |
||
70 | private DictionaryEntry entry; |
||
71 | internal DictionaryEntry nextEntry() |
||
72 | { |
||
73 | DictionaryEntry cEntry = entry; |
||
74 | hasMore = enum_Renamed.MoveNext(); |
||
75 | if ( hasMore ) |
||
76 | entry = enum_Renamed.Entry; |
||
77 | return cEntry; |
||
78 | } |
||
79 | |||
80 | |||
81 | /// <summary> An Enumeration that stores the list of keys for |
||
82 | /// the ArrayVar. |
||
83 | /// </summary> |
||
84 | private IDictionaryEnumerator enum_Renamed; |
||
85 | |||
86 | /// <summary> The unique searchId string</summary> |
||
87 | private string str; |
||
88 | |||
89 | /// <summary> Unique index used for generating unique searchId strings</summary> |
||
90 | private int index; |
||
91 | |||
92 | /// <summary> A SearchId is only created from an ArrayVar object. The ArrayVar |
||
93 | /// constructs a new SearchId object by passing it's current keys |
||
94 | /// stored as an enumeration, a unique string that ArrayVar creates, |
||
95 | /// and an index value used for future SearchId objects. |
||
96 | /// |
||
97 | /// </summary> |
||
98 | /// <param name="e">initial Enumeration |
||
99 | /// </param> |
||
100 | /// <param name="s">String as the unique identifier for the searchId |
||
101 | /// </param> |
||
102 | /// <param name="e">index value for this object |
||
103 | /// </param> |
||
104 | internal SearchId( IDictionaryEnumerator e, string s, int i ) |
||
105 | { |
||
106 | enum_Renamed = e; |
||
107 | str = s; |
||
108 | index = i; |
||
109 | hasMore = enum_Renamed.MoveNext(); |
||
110 | if ( hasMore ) |
||
111 | entry = enum_Renamed.Entry; |
||
112 | } |
||
113 | |||
114 | /// <summary> Return the str that is the unique identifier of the SearchId</summary> |
||
115 | public override string ToString() |
||
116 | { |
||
117 | return str; |
||
118 | } |
||
119 | |||
120 | /// <summary> Tests for equality based on the value of str</summary> |
||
121 | /// <param name="">none |
||
122 | /// </param> |
||
123 | /// <returns> boolean based on the equality of the string |
||
124 | /// </returns> |
||
125 | internal bool equals( string s ) |
||
126 | { |
||
127 | return str.Equals( s ); |
||
128 | } |
||
129 | } |
||
130 | } |