Loading...
Searching...
No Matches
ftmpl_list.cc File Reference
`#include "factory/templates/ftmpl_list.h"`

Go to the source code of this file.

## Functions

template<class T>
int | operator== (const List< T > &l1, const List< T > &l2)
template<class T>
OSTREAM & | operator<< (OSTREAM &os, const List< T > &l)
template<class T>
List< T > | Union (const List< T > &F, const List< T > &G)
template<class T>
List< T > | Union (const List< T > &F, const List< T > &G, int(*cmpf)(const T &, const T &), void(*insf)(T &, const T &))
template<class T>
List< T > | Union (const List< T > &F, const List< T > &G, int(*ecmpf)(const T &, const T &))
template<class T>
List< T > | Difference (const List< T > &F, const List< T > &G)
template<class T>
List< T > | Difference (const List< T > &F, const List< T > &G, int(*ecmpf)(const T &, const T &))
template<class T>
List< T > | Difference (const List< T > &F, const T &G, int(*ecmpf)(const T &, const T &))
template<class T>
List< T > | Difference (const List< T > &F, const T &G)
template<class T>
T | prod (const List< T > &F)
template<class T>
bool | find (const List< T > &F, const T &t)
template<class T>
bool | find (const List< T > &F, const T &t, int(*ecmpf)(const T &, const T &))

## Function Documentation

## Difference() [1/4]

template<class T>

List< T > Difference | ( | const List< T > & | F,
|  | const List< T > & | G )

Definition at line 622 of file ftmpl_list.cc.

{
List<T> L;
ListIterator<T> i, j;
T f;
int found;
for ( i = F; i.hasItem(); ++i )
{
f = i.getItem();
found = 0;
for ( j = G; j.hasItem() && (!found); ++j )
found = f == j.getItem();
if ( ! found )
L.append( f );
}
return L;
}
i
int i
Definition cfEzgcd.cc:132
f
FILE * f
Definition checklibs.c:9
ListIterator
Definition ftmpl_list.h:87
List
Definition ftmpl_list.h:52
List::append
void append(const T &)
Definition ftmpl_list.cc:256
found
bool found
Definition facFactorize.cc:55
j
int j
Definition facHensel.cc:110
T
STATIC_VAR jList * T
Definition janet.cc:30
G
STATIC_VAR TreeM * G
Definition janet.cc:31

## Difference() [2/4]

template<class T>

List< T > Difference | ( | const List< T > & | F,
|  | const List< T > & | G,
|  | int(* | ecmpf )(const T &, const T &) )

Definition at line 641 of file ftmpl_list.cc.

{
List<T> L;
ListIterator<T> i, j;
T f;
int found;
for ( i = F; i.hasItem(); ++i )
{
f = i.getItem();
found = 0;
for ( j = G; j.hasItem() && (!found); ++j )
found = ecmpf (f, j.getItem());
if ( ! found )
L.append( f );
}
return L;
}

## Difference() [3/4]

template<class T>

List< T > Difference | ( | const List< T > & | F,
|  | const T & | G )

Definition at line 675 of file ftmpl_list.cc.

{
List<T> L;
ListIterator<T> i;
int found;
for ( i = F; i.hasItem(); ++i )
{
found = G == i.getItem();
if ( ! found )
L.append( i.getItem() );
}
return L;
}

## Difference() [4/4]

template<class T>

List< T > Difference | ( | const List< T > & | F,
|  | const T & | G,
|  | int(* | ecmpf )(const T &, const T &) )

Definition at line 660 of file ftmpl_list.cc.

{
List<T> L;
ListIterator<T> i;
int found;
for ( i = F; i.hasItem(); ++i )
{
found = ecmpf (G, i.getItem());
if ( ! found )
L.append( i.getItem() );
}
return L;
}

## find() [1/2]

template<class T>

bool find | ( | const List< T > & | F,
|  | const T & | t )

Definition at line 700 of file ftmpl_list.cc.

{
if (F.length() == 0) return false;
ListIterator<T> J= F;
while (J.hasItem())
{
if (J.getItem() == t)
return true;
J++;
}
return false;
}
ListIterator::hasItem
int hasItem()
Definition ftmpl_list.cc:439
ListIterator::getItem
T & getItem() const
Definition ftmpl_list.cc:431
List::length
int length() const
Definition ftmpl_list.cc:273

## find() [2/2]

template<class T>

bool find | ( | const List< T > & | F,
|  | const T & | t,
|  | int(* | ecmpf )(const T &, const T &) )

Definition at line 714 of file ftmpl_list.cc.

{
if (F.length() == 0) return false;
ListIterator<T> J= F;
while (J.hasItem())
{
if (ecmpf (J.getItem(), t))
return true;
J++;
}
return false;
}

## operator<<()

template<class T>

OSTREAM & operator<< | ( | OSTREAM & | os,
|  | const List< T > & | l )

Definition at line 555 of file ftmpl_list.cc.

{
l.print( os );
return os;
}
l
int l
Definition cfEzgcd.cc:100

## operator==()

template<class T>

int operator== | ( | const List< T > & | l1,
|  | const List< T > & | l2 )

Definition at line 176 of file ftmpl_list.cc.

{
if (l1.length() != l2.length())
return 0;
ListIterator<T> iter2= l2;
for (ListIterator<T> iter1= l1; iter1.hasItem(); iter1++)
{
if (!(iter1.getItem() == iter2.getItem()))
return 0;
iter2++;
}
return 1;
}

## prod()

template<class T>

T prod | ( | const List< T > & | F | ) |

Definition at line 690 of file ftmpl_list.cc.

{
ListIterator<T> i;
T p = 1;
for ( i = F; i.hasItem(); i++ )
p *= i.getItem();
return p;
}
p
int p
Definition cfModGcd.cc:4086

## Union() [1/3]

template<class T>

List< T > Union | ( | const List< T > & | F,
|  | const List< T > & | G )

Definition at line 563 of file ftmpl_list.cc.

{
List<T> L = G;
ListIterator<T> i, j;
T f;
bool iselt;
for ( i = F; i.hasItem(); i++ )
{
f = i.getItem();
iselt = false;
j = G;
while ( ( ! iselt ) && j.hasItem() )
{
iselt = f == j.getItem();
j++;
}
if ( ! iselt )
L.append( f );
}
return L;
}

## Union() [2/3]

template<class T>

List< T > Union | ( | const List< T > & | F,
|  | const List< T > & | G,
|  | int(* | cmpf )(const T &, const T &),
|  | void(* | insf )(T &, const T &) )

Definition at line 587 of file ftmpl_list.cc.

{
List<T> L = G;
ListIterator<T> i;
for ( i = F; i.hasItem(); ++i )
L.insert( i.getItem(), cmpf, insf );
return L;
}
List::insert
void insert(const T &)
Definition ftmpl_list.cc:193

## Union() [3/3]

template<class T>

List< T > Union | ( | const List< T > & | F,
|  | const List< T > & | G,
|  | int(* | ecmpf )(const T &, const T &) )

Definition at line 598 of file ftmpl_list.cc.

{
List<T> L = G;
ListIterator<T> i, j;
T f;
bool iselt;
for ( i = F; i.hasItem(); i++ )
{
f = i.getItem();
iselt = false;
j = G;
while ( ( ! iselt ) && j.hasItem() )
{
iselt = ecmpf (f, j.getItem());
j++;
}
if ( ! iselt )
L.append( f );
}
return L;
}