0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / TCollection / TCollection_HSequence.gxx
1 // Created on: 1992-11-24
2 // Created by: Mireille MERCIEN
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 // ----------------------------------------------------------------------
18 // ----------------------------------------------------------------------
19
20 // ----------------------------------
21 // Clear : Clear the Current HSequence
22 // ----------------------------------
23 void TCollection_HSequence::Clear()
24 {
25    mySequence.Clear();
26 }
27
28 // -------------------------------------------------
29 // Append : Push an item  at the end of the sequence
30 // -------------------------------------------------
31 void TCollection_HSequence::Append(const Item& T)
32 {
33    mySequence.Append(T);   
34 }
35
36 // ---------------------------------------------------
37 // Append : Push a Sequence at the end of the sequence
38 // ---------------------------------------------------
39 void TCollection_HSequence::Append(const Handle(TCollection_HSequence)& S)
40 {
41   Standard_Integer i,l = S->Length();
42   for (i = 1; i <= l; i++) mySequence.Append(S->Value(i));
43 }
44
45 // ---------------------------------------------------------
46 // Prepend : Push an element at the begining of the sequence
47 // ---------------------------------------------------------
48 void TCollection_HSequence::Prepend(const Item& T)
49 {
50    mySequence.Prepend(T);   
51 }
52
53 // ---------------------------------------------------------
54 // Prepend : Push an element at the begining of the sequence
55 // ---------------------------------------------------------
56 void TCollection_HSequence::Prepend(const Handle(TCollection_HSequence)& S)
57 {
58   Standard_Integer i,l = S->Length();
59   for (i = 0; i < l; i++) mySequence.Prepend(S->Value(S->Length()-i));
60 }
61
62 // ---------------------------------------------------------
63 // Reverse : Reverse the order of a given sequence
64 // ---------------------------------------------------------
65 void TCollection_HSequence::Reverse()
66 {
67    mySequence.Reverse();   
68 }
69
70 // -------------------------------------------------------------------
71 // InsertBefore : Insert an item before a given index in the sequence
72 // --------------------------------------------------------------------
73 void TCollection_HSequence::InsertBefore(const Standard_Integer Index, 
74                                          const Item& T)
75 {
76    mySequence.InsertBefore(Index,T);   
77 }
78
79 // ----------------------------------------------------------------------
80 // InsertBefore : Insert a sequence before a specific index in a HSequence
81 // ----------------------------------------------------------------------
82 void TCollection_HSequence::InsertBefore(const Standard_Integer Index , 
83                                          const Handle(TCollection_HSequence)& S)
84 {   
85   Standard_Integer i,l = S->Length();
86   for (i = 1; i <= l; i++) mySequence.InsertBefore(Index+i-1,S->Value(i));
87 }
88
89 // -----------------------------------------------------------------
90 // InsertAfter : Insert an element after a given index in a sequence
91 // -----------------------------------------------------------------
92 void TCollection_HSequence::InsertAfter(const Standard_Integer Index, 
93                                         const Item& T)
94 {
95    mySequence.InsertAfter(Index,T);   
96 }
97
98 // -------------------------------------------------------------------
99 // InsertAfter : Insert a sequence after a given index in the sequence
100 // -------------------------------------------------------------------
101 void TCollection_HSequence::InsertAfter(const Standard_Integer Index, 
102                                         const Handle(TCollection_HSequence)& S)
103 {
104   Standard_Integer i,l = S->Length();
105   for (i = 1; i <= l; i++) mySequence.InsertAfter(Index+i-1,S->Value(i));
106 }
107
108 // ----------------------------------------
109 // Exchange : Exchange two elements in the sequence
110 // ----------------------------------------
111 void TCollection_HSequence::Exchange(const Standard_Integer I, 
112                                    const Standard_Integer J)
113 {
114    mySequence.Exchange(I,J);   
115 }
116
117 // ---------------------------------------------
118 // Split : Split a sequence in two sub-sequences
119 // ---------------------------------------------
120 Handle (TCollection_HSequence) 
121             TCollection_HSequence::Split(const Standard_Integer Index)
122 {
123   TheSequence SS;
124   mySequence.Split(Index,SS);
125   Handle(TCollection_HSequence) NS = new TCollection_HSequence();
126   Standard_Integer i,l = SS.Length();
127   for (i=1; i<= l; i++) NS->Append(SS(i));
128   return NS;
129 }
130
131 // ----------------------------------------------------------
132 // SetValue : Change the element of a given index in a sequence
133 // ----------------------------------------------------------
134 void TCollection_HSequence::SetValue(const Standard_Integer Index, 
135                                    const Item& T)
136 {
137   mySequence(Index) = T;   
138 }
139
140 // -----------------------------------------
141 // Value : Return the value of a given index
142 // -----------------------------------------
143 const Item& TCollection_HSequence::Value(const Standard_Integer Index) const
144 {
145    return (mySequence(Index));   
146 }
147
148 // -----------------------------------------
149 // ChangeValue : Return the value of a given index
150 // -----------------------------------------
151 Item& TCollection_HSequence::ChangeValue(const Standard_Integer Index)
152 {
153    return (mySequence(Index));   
154 }
155
156 // -------------------------------------
157 // Remove : Remove an item in a sequence
158 // -------------------------------------
159 void TCollection_HSequence::Remove(const Standard_Integer Index)
160 {
161    mySequence.Remove(Index);
162 }
163
164 // ---------------------
165 // Remove a set of items
166 // --------------------- 
167 void TCollection_HSequence::Remove(const Standard_Integer From,
168                                    const Standard_Integer To)
169 {
170    mySequence.Remove(From,To);   
171 }
172
173 // ----------------------------------------------------------------------------
174 // IsSamestate
175 // ----------------------------------------------------------------------------
176 // Standard_Boolean TCollection_HSequence::IsSameState
177 //   (const Handle(TCollection_HSequence)& other) const
178 // {
179 //   Handle(TCollection_HSequence) Seq = 
180 //     Handle(TCollection_HSequence)::DownCast(other);
181 //   if (Seq->Length() != Length()) return Standard_False;
182 //   for (Standard_Integer I = 1; I<= Length(); I++) {
183 //     if ( !(Value(I) == Seq->Value(I)) ) return Standard_False;
184 //   }
185 //   return Standard_True;   
186 // }
187
188
189
190
191
192         
193         
194
195
196