spielwiese
Last change
on this file since 684544 was
684544,
checked in by Rüdiger Stobbe <stobbe@…>, 28 years ago
|
Initial revision
git-svn-id: file:///usr/local/Singular/svn/trunk@7 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
890 bytes
|
Line | |
---|
1 | // emacs edit mode for this file is -*- C++ -*- |
---|
2 | // $Id: ftmpl_factor.cc,v 1.0 1996-05-17 11:06:32 stobbe Exp $ |
---|
3 | |
---|
4 | /* |
---|
5 | $Log: not supported by cvs2svn $ |
---|
6 | */ |
---|
7 | |
---|
8 | #include <templates/factor.h> |
---|
9 | |
---|
10 | |
---|
11 | template <class T> |
---|
12 | Factor<T>& Factor<T>::operator= ( const Factor<T>& f ) |
---|
13 | { |
---|
14 | if ( this != &f ) { |
---|
15 | _factor = f._factor; |
---|
16 | _exp = f._exp; |
---|
17 | } |
---|
18 | return *this; |
---|
19 | } |
---|
20 | |
---|
21 | template <class T> |
---|
22 | Factor<T>& Factor<T>::operator= ( const T & f ) |
---|
23 | { |
---|
24 | _factor = f; |
---|
25 | _exp = 1; |
---|
26 | return *this; |
---|
27 | } |
---|
28 | |
---|
29 | template <class T> |
---|
30 | int operator== ( const Factor<T> &f1, const Factor<T> &f2 ) |
---|
31 | { |
---|
32 | return (f1.exp() == f2.exp()) && (f1.factor() == f2.factor()); |
---|
33 | } |
---|
34 | |
---|
35 | template <class T> |
---|
36 | void Factor<T>::print ( ostream& s ) const |
---|
37 | { |
---|
38 | if ( exp() == 1 ) |
---|
39 | s << factor(); |
---|
40 | else |
---|
41 | s << "(" << factor() << ")^" << exp(); |
---|
42 | } |
---|
43 | |
---|
44 | template <class T> |
---|
45 | ostream& operator<< ( ostream & os, const Factor<T> & f ) |
---|
46 | { |
---|
47 | f.print( os ); |
---|
48 | return os; |
---|
49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.