mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0024742: Remove rarely used collection classes: Set
Classes NCollection_Set and NCollection_HSet removed as unused (along with NCollection_DefineSet.hxx and NCollection_DefineHSet.hxx). Classes TCollection_Set and TCollection_HSet removed (along with TCollection_SetIterator and TCollection_SetList nested classes). Code previously using Set classes updated to equivalent use of Sequence (Adaptor3d and Visual3d packages) or TColStd_PackedMapOfInteger (BRepAlgo package). In Adaptor3d_CurveOnSurface, calculation of continuity intervals refactored so as to build and store sorted sequence of reals, instead of collecting them to set, copying to array, and then sorting.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
-- Updated R.LEQUETTE Jan 1993
|
||||
-- Adding of modifying classes
|
||||
-- - Sequence, HSequence
|
||||
-- - Set, HSet
|
||||
-- - List
|
||||
-- - BasicMap, BasicMapIterator
|
||||
-- - Map, DataMap, DoubleMap, IndexedMap, IndexedDataMap
|
||||
@@ -63,12 +62,6 @@ is
|
||||
generic class HSequence;
|
||||
---Purpose: An indexed double list handle by reference.
|
||||
|
||||
generic class Set, SetIterator, SetList;
|
||||
---Purpose: A small set handled by value.
|
||||
|
||||
generic class HSet;
|
||||
---Purpose: A small set handled by reference.
|
||||
|
||||
generic class MapHasher;
|
||||
---Purpose: A Tool to instantiate Maps. Providing HashCode and
|
||||
-- Comparisons on Keys.
|
||||
|
@@ -1,155 +0,0 @@
|
||||
-- Created on: 1993-03-02
|
||||
-- Created by: Remi LEQUETTE
|
||||
-- Copyright (c) 1993-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
generic class HSet from TCollection
|
||||
(Item as any;
|
||||
TheSet as any) -- as Set from TCollection(Item))
|
||||
inherits TShared from MMgt
|
||||
|
||||
---Purpose: An HSet is a collection of non-ordered items without any
|
||||
-- duplicates. At each transaction, the system checks there are no duplicates.
|
||||
-- HSet objects are handles to sets.
|
||||
-- HSet is a generic class which depends on two parameters:
|
||||
-- - Item, the type of element in the set,
|
||||
-- - Set, the actual type of set handled by HSet. This is an
|
||||
-- instantiation with TCollection_Set generic class.
|
||||
|
||||
is
|
||||
|
||||
Create returns mutable HSet from TCollection;
|
||||
---Purpose: Construction of an empty set.
|
||||
|
||||
Extent(me) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the number of items in the set me.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
IsEmpty(me) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the set <me> is empty, Extent == 0.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Clear(me : mutable)
|
||||
---Level: Public
|
||||
---Purpose: Removes all the items from the set.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
|
||||
Add(me : mutable; T : Item) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Adds <T> to the set if this item does not
|
||||
-- already exist. Returns False if <T> was
|
||||
-- already in the set.
|
||||
---Example:
|
||||
-- before
|
||||
-- me = {a,b,c,d}, T = y
|
||||
-- after
|
||||
-- me = {a,b,c,d,y} returns True
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Remove(me : mutable; T : Item) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Removes <T> from the set and returns True.
|
||||
-- Returns False if <T> was not in the set.
|
||||
---Example:
|
||||
-- before
|
||||
-- me = {a,b,c,d}, T = a
|
||||
-- after
|
||||
-- me = {b,c,d} returns True
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Union(me; B : HSet from TCollection)
|
||||
returns mutable HSet from TCollection
|
||||
---Purpose: creation of a set containing all the items
|
||||
-- of the set <me> and all the items of the set B
|
||||
-- which are not in <me>.
|
||||
---Example:
|
||||
-- before
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- after
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- returns
|
||||
-- {a,b,c,d,f}
|
||||
is static;
|
||||
|
||||
Intersection(me; B : HSet from TCollection)
|
||||
returns mutable HSet from TCollection
|
||||
---Level: Public
|
||||
---Purpose: Creation of a set containing all the
|
||||
-- items which are both in the set <me> and in the set B
|
||||
---Example:
|
||||
-- before
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- after
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- returns
|
||||
-- {a}
|
||||
is static;
|
||||
|
||||
Difference(me; B: HSet from TCollection)
|
||||
returns mutable HSet from TCollection
|
||||
---Purpose: Compares set B with this set and deletes duplicates.
|
||||
--Example:
|
||||
-- before
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- after
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- returns
|
||||
-- {b,c}
|
||||
is static;
|
||||
|
||||
|
||||
Contains(me; T : Item) returns Boolean from Standard
|
||||
---Purpose: Returns True if an item is in the set me.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
IsASubset(me; S : HSet from TCollection) returns Boolean from Standard
|
||||
---Purpose: Returns True if a set is contained in the set me.
|
||||
-- The two sets can be identical.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
IsAProperSubset(me; S : HSet from TCollection)
|
||||
returns Boolean from Standard
|
||||
---Purpose: Returns True S is a subset and if all its elements are strictly included in this set.
|
||||
-- The two sets cannot be identical.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Set(me) returns TheSet
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the internal set. For implementation.
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
is static;
|
||||
|
||||
ChangeSet(me : mutable) returns TheSet
|
||||
---Level: Advanced
|
||||
---Purpose: Returns the internal set. For implementation.
|
||||
---C++: inline
|
||||
---C++: return &
|
||||
is static;
|
||||
|
||||
fields
|
||||
mySet : TheSet;
|
||||
|
||||
end HSet from TCollection;
|
@@ -1,84 +0,0 @@
|
||||
// Created on: 1993-03-03
|
||||
// Created by: Remi LEQUETTE
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : TCollection_HSet
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_HSet::TCollection_HSet()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Union
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HSet) TCollection_HSet::Union
|
||||
(const Handle(TCollection_HSet)& B) const
|
||||
{
|
||||
Handle(TCollection_HSet) R = new TCollection_HSet();
|
||||
R->ChangeSet() = mySet;
|
||||
R->ChangeSet().Union(B->Set());
|
||||
return R;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intersection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HSet) TCollection_HSet::Intersection
|
||||
(const Handle(TCollection_HSet)& B) const
|
||||
{
|
||||
Handle(TCollection_HSet) R = new TCollection_HSet();
|
||||
R->ChangeSet() = mySet;
|
||||
R->ChangeSet().Intersection(B->Set());
|
||||
return R;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Difference
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TCollection_HSet) TCollection_HSet::Difference
|
||||
(const Handle(TCollection_HSet)& B) const
|
||||
{
|
||||
Handle(TCollection_HSet) R = new TCollection_HSet();
|
||||
R->ChangeSet() = mySet;
|
||||
R->ChangeSet().Difference(B->Set());
|
||||
return R;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsSameState
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
//Standard_Boolean TCollection_HSet::IsSameState
|
||||
// (const Handle(TCollection_HSet)& Other) const
|
||||
//{
|
||||
// Handle(TCollection_HSet) S = Handle(TCollection_HSet)::DownCast(Other);
|
||||
// Standard_Boolean result = Standard_False;
|
||||
// if (!S.IsNull()) {
|
||||
// if (S->Extent() == Extent()) {
|
||||
// result = IsASubset(S);
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
//}
|
@@ -1,117 +0,0 @@
|
||||
// Created on: 1993-03-02
|
||||
// Created by: Remi LEQUETTE
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer TCollection_HSet::Extent() const
|
||||
{
|
||||
return mySet.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_HSet::IsEmpty() const
|
||||
{
|
||||
return mySet.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void TCollection_HSet::Clear()
|
||||
{
|
||||
mySet.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_HSet::Add(const Item& T)
|
||||
{
|
||||
return mySet.Add(T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_HSet::Remove(const Item& T)
|
||||
{
|
||||
return mySet.Remove(T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Contains
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_HSet::Contains(const Item& T) const
|
||||
{
|
||||
return mySet.Contains(T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsASubset
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_HSet::IsASubset
|
||||
(const Handle(TCollection_HSet)& S) const
|
||||
{
|
||||
return mySet.IsASubset(S->Set());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAProperSubset
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_HSet::IsAProperSubset
|
||||
(const Handle(TCollection_HSet)& S) const
|
||||
{
|
||||
return mySet.IsAProperSubset(S->Set());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TheSet& TCollection_HSet::Set() const
|
||||
{
|
||||
return mySet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeSet
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline TheSet& TCollection_HSet::ChangeSet()
|
||||
{
|
||||
return mySet;
|
||||
}
|
@@ -1,190 +0,0 @@
|
||||
-- Created on: 1993-03-02
|
||||
-- Created by: Remi LEQUETTE
|
||||
-- Copyright (c) 1993-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
generic class Set from TCollection (Item as any)
|
||||
|
||||
---Purpose: A set is an unordered collection of items without
|
||||
-- duplications. To test for duplications the operators == and !=
|
||||
-- are used on the items.
|
||||
-- Use a SetIterator to explore a Set.
|
||||
-- Warning
|
||||
-- A set generates the same result as a map. A map is
|
||||
-- more effective; therefore it is advisable to use maps instead of sets.
|
||||
-- Set is a generic class which consists of Items, types of elements in a set.
|
||||
raises
|
||||
NoSuchObject from Standard
|
||||
|
||||
private class SetList instantiates List from TCollection(Item);
|
||||
|
||||
class SetIterator from TCollection
|
||||
---Purpose: Functions used for iterating the contents of a Set.
|
||||
-- Note: an iterator class is automatically instantiated from
|
||||
-- this generic class at the time of instantiation of a Set.
|
||||
-- Warning
|
||||
-- - A set is a non-ordered data structure. The order in
|
||||
-- which entries of a set are explored by the iterator
|
||||
-- depends on its contents, and changes when the set is edited.
|
||||
-- - It is not recommended to modify the contents of a set
|
||||
-- during iteration: the result is unpredictable.
|
||||
|
||||
|
||||
raises NoSuchObject from Standard
|
||||
is
|
||||
Create returns SetIterator from TCollection;
|
||||
---Purpose: Creates an empty iterator for a Set;
|
||||
-- use the function Initialize to define the set to explore;.
|
||||
|
||||
Create(S : Set from TCollection) returns SetIterator from TCollection;
|
||||
---Purpose: Creates an iterator on the set <S>.
|
||||
|
||||
Initialize(me : in out; S : Set from TCollection)
|
||||
---Purpose: Sets or resets the iterator on the set <S>.
|
||||
is static;
|
||||
|
||||
More(me) returns Boolean from Standard
|
||||
---Purpose: Returns True if there are other items.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Next(me: in out)
|
||||
---Purpose: Positions the iterator to the next item.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Value(me) returns any Item
|
||||
raises NoSuchObject from Standard
|
||||
---Purpose: Returns the item value corresponding to the
|
||||
-- current position of the iterator.
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
myIterator : ListIteratorOfSetList;
|
||||
|
||||
end SetIterator from TCollection;
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create returns Set from TCollection;
|
||||
---Purpose: Creation of an empty set.
|
||||
|
||||
Create(Other : Set from TCollection)
|
||||
returns Set from TCollection
|
||||
is private;
|
||||
---Purpose: Creates by copying an existing Set.
|
||||
-- Warning: Prints a message when other is not empty. It is
|
||||
-- recommanded to use Assign (operator =).
|
||||
|
||||
Extent(me) returns Integer from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns the number of items in the set.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
IsEmpty(me) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the set is empty. i.e.
|
||||
-- Extent() == 0.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Clear(me : in out)
|
||||
---Level: Public
|
||||
---Purpose: Removes all items from the set.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
Add(me : in out; T : Item) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Adds the item <T> in the set if it does not
|
||||
-- already exist.Returns False if the item T already exists.
|
||||
-- Example:
|
||||
-- before
|
||||
-- me = {a,b,c,d}, T = y
|
||||
-- after
|
||||
-- me = {a,b,c,d,y} returns True
|
||||
is static;
|
||||
|
||||
Remove(me : in out; T : Item) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Removes the item <T> from the set. Returns True if
|
||||
-- the item was in the set.
|
||||
-- Example:
|
||||
-- before
|
||||
-- me = {a,b,c,d}, T = a
|
||||
-- after
|
||||
-- me = {b,c,d} returns True
|
||||
is static;
|
||||
|
||||
Union(me : in out; B : Set from TCollection)
|
||||
---Level: Public
|
||||
---Purpose: Add to <me> all the items of the set <B>
|
||||
-- which are not in <me>.
|
||||
-- Example:
|
||||
-- before
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- after
|
||||
-- me = {a,b,c,d,f}, B = {d,a,f}
|
||||
is static;
|
||||
|
||||
Intersection(me : in out; B : Set from TCollection)
|
||||
---Level: Public
|
||||
---Purpose: Removes from <me> all the items which are not in <B>.
|
||||
-- Example:
|
||||
-- before
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- after
|
||||
-- me = {a}, B = {d,a,f}
|
||||
is static;
|
||||
|
||||
Difference(me : in out; B: Set from TCollection)
|
||||
---Level: Public
|
||||
---Purpose: Removes from <me> all the items which are in <B>.
|
||||
-- Example:
|
||||
-- before
|
||||
-- me = {a,b,c}, B = {d,a,f}
|
||||
-- after
|
||||
-- me = {b,c}, B = {d,a,f}
|
||||
is static;
|
||||
|
||||
Contains(me; T : Item) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: Returns True if the item <T> is in the set.
|
||||
is static;
|
||||
|
||||
IsASubset(me; S : Set from TCollection) returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: returns True if <S> is a subset of <me>. i.e. all
|
||||
-- elements of <S> are in <me>.
|
||||
is static;
|
||||
|
||||
IsAProperSubset(me; S : Set from TCollection)
|
||||
returns Boolean from Standard
|
||||
---Level: Public
|
||||
---Purpose: returns True if <S> is strictly contained in <me>.
|
||||
-- i.e <S> is a subset and its extent is not equal to
|
||||
-- the extent of <me>.
|
||||
is static;
|
||||
|
||||
fields
|
||||
myItems : SetList;
|
||||
|
||||
friends
|
||||
class SetIterator from TCollection
|
||||
|
||||
end Set from TCollection;
|
@@ -1,174 +0,0 @@
|
||||
// Created on: 1993-03-02
|
||||
// Created by: Remi LEQUETTE
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : TCollection_Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_Set::TCollection_Set()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TCollection_Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_Set::TCollection_Set(const TCollection_Set& )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TCollection_Set::Add(const Item& T)
|
||||
{
|
||||
if (Contains(T))
|
||||
return Standard_False;
|
||||
else {
|
||||
myItems.Prepend(T);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TCollection_Set::Remove(const Item& T)
|
||||
{
|
||||
TCollection_ListIteratorOfSetList It(myItems);
|
||||
while (It.More()) {
|
||||
if (It.Value() == T) {
|
||||
myItems.Remove(It);
|
||||
return Standard_True;
|
||||
}
|
||||
It.Next();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Union
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TCollection_Set::Union(const TCollection_Set& B)
|
||||
{
|
||||
Standard_Integer N = Extent();
|
||||
Standard_Integer i;
|
||||
TCollection_ListIteratorOfSetList It1,It2;
|
||||
|
||||
// for each item in B
|
||||
for (It1.Initialize(B.myItems); It1.More(); It1.Next()) {
|
||||
// test with the N first items of me
|
||||
// because the other ones are imported from B
|
||||
It2.Initialize(myItems);
|
||||
Standard_Boolean found = Standard_False;
|
||||
for (i = 1; i <= N; i++) {
|
||||
if (It1.Value() == It2.Value()) {
|
||||
found = Standard_True;
|
||||
break;
|
||||
}
|
||||
It2.Next();
|
||||
}
|
||||
if (!found)
|
||||
myItems.Append(It1.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Intersection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TCollection_Set::Intersection(const TCollection_Set& B)
|
||||
{
|
||||
TCollection_ListIteratorOfSetList It(myItems);
|
||||
while (It.More()) {
|
||||
if (B.Contains(It.Value()))
|
||||
It.Next();
|
||||
else
|
||||
myItems.Remove(It);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Difference
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TCollection_Set::Difference(const TCollection_Set& B)
|
||||
{
|
||||
TCollection_ListIteratorOfSetList It(myItems);
|
||||
while (It.More()) {
|
||||
if (B.Contains(It.Value()))
|
||||
myItems.Remove(It);
|
||||
else
|
||||
It.Next();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Contains
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TCollection_Set::Contains(const Item& T) const
|
||||
{
|
||||
TCollection_ListIteratorOfSetList It(myItems);
|
||||
while (It.More()) {
|
||||
if (It.Value() == T) return Standard_True;
|
||||
It.Next();
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsASubset
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TCollection_Set::IsASubset(const TCollection_Set& S) const
|
||||
{
|
||||
if (S.Extent() > Extent()) return Standard_False;
|
||||
TCollection_ListIteratorOfSetList It(S.myItems);
|
||||
while (It.More()) {
|
||||
if (!Contains(It.Value())) return Standard_False;
|
||||
It.Next();
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAProperSubset
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TCollection_Set::IsAProperSubset
|
||||
(const TCollection_Set& S) const
|
||||
{
|
||||
if (S.Extent() >= Extent()) return Standard_False;
|
||||
return IsASubset(S);
|
||||
}
|
||||
|
||||
|
@@ -1,46 +0,0 @@
|
||||
// Created on: 1993-03-02
|
||||
// Created by: Remi LEQUETTE
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer TCollection_Set::Extent() const
|
||||
{
|
||||
return myItems.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_Set::IsEmpty() const
|
||||
{
|
||||
return myItems.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void TCollection_Set::Clear()
|
||||
{
|
||||
myItems.Clear();
|
||||
}
|
||||
|
@@ -1,46 +0,0 @@
|
||||
// Created on: 1993-03-03
|
||||
// Created by: Remi LEQUETTE
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : TCollection_SetIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_SetIterator::TCollection_SetIterator()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TCollection_SetIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_SetIterator::TCollection_SetIterator(const TCollection_Set& S)
|
||||
{
|
||||
Initialize(S);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TCollection_SetIterator::Initialize(const TCollection_Set& S)
|
||||
{
|
||||
myIterator.Initialize(S.myItems);
|
||||
}
|
||||
|
||||
|
@@ -1,45 +0,0 @@
|
||||
// Created on: 1993-03-02
|
||||
// Created by: Remi LEQUETTE
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//=======================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TCollection_SetIterator::More() const
|
||||
{
|
||||
return myIterator.More();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void TCollection_SetIterator::Next()
|
||||
{
|
||||
myIterator.Next();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Item& TCollection_SetIterator::Value() const
|
||||
{
|
||||
return myIterator.Value();
|
||||
}
|
Reference in New Issue
Block a user