virtual class set_base #( type T = int ) extends collection#( T )
virtual Defines the core functionality of a set.
| T | optional The type of data collected in a set. The default is int. |
| set_base | virtual Defines the core functionality of a set. |
| Functions | |
| equals | virtual Returns 1 if the given collection equals this set. |
| remove_all | virtual Removes the elements in the given collection from this set. |
virtual function bit equals( collection#(T) c )
virtual Returns 1 if the given collection equals this set.
| c | A collection to compare with. |
If the given collection is this set, returns 1. If the size of the given collection is not the same as the size of this set, returns 0. If the sizes are the same and this set contains all the elements in the given collection, returns 1. Otherwise, returns 0.
set#(int) int_set0 = new(); set#(int) int_set1 = new(); void'( int_set0.add( 123 ) ); void'( int_set1.add( 123 ) ); assert( int_set0.equals( int_set1 ) == 1 );
virtual function bit remove_all( collection#(T) c )
virtual Removes the elements in the given collection from this set.
| c | A collection containing elements to be removed from this set. |
If this set changed as a result of the call, 1 is returned. Otherwise, 0 is returned.
set#(int) int_set0 = new(); set#(int) int_set1 = new(); void'( int_set0.add( 123 ) ); void'( int_set0.add( 456 ) ); void'( int_set1.add( 123 ) ); assert( int_set0.remove_all( int_set1 ) == 1 );
virtual Defines the core functionality of a set.
virtual class set_base #( type T = int ) extends collection#( T )
Implements the set_base using an associative array.
class set #( type T = int ) extends set_base#( T )
virtual Returns 1 if the given collection equals this set.
virtual function bit equals( collection#(T) c )
virtual Removes the elements in the given collection from this set.
virtual function bit remove_all( collection#(T) c )