Changeset 62b35b6 in git for factory/cf_map.cc
- Timestamp:
- Sep 8, 1997, 1:08:40 PM (26 years ago)
- Branches:
- (u'spielwiese', 'a719bcf0b8dbc648b128303a49777a094b57592c')
- Children:
- f2e9720fc9b4b4de4841d283700d4dc41f0eb53b
- Parents:
- 38eab603130b954c28838dc7d34d13ea7784b0ae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/cf_map.cc
r38eab60 r62b35b6 1 1 /* emacs edit mode for this file is -*- C++ -*- */ 2 /* $Id: cf_map.cc,v 1. 8 1997-08-01 11:45:54schmidt Exp $ */2 /* $Id: cf_map.cc,v 1.9 1997-09-08 11:08:40 schmidt Exp $ */ 3 3 4 4 //{{{ docu … … 21 21 #endif 22 22 23 //{{{ MapPair & MapPair::operator = ( const MapPair & p ) 24 //{{{ docu 25 // 26 // MapPair::operator = - assignment operator. 27 // 28 //}}} 29 MapPair & 30 MapPair::operator = ( const MapPair & p ) 31 { 32 if ( this != &p ) { 33 V = p.V; 34 S = p.S; 35 } 36 return *this; 37 } 38 //}}} 39 40 #ifndef NOSTREAMIO 41 //{{{ ostream & operator << ( ostream & s, const MapPair & p ) 42 //{{{ docu 43 // 44 // operator << - print a map pair ("V -> S"). 45 // 46 //}}} 47 ostream & 48 operator << ( ostream & s, const MapPair & p ) 49 { 50 s << p.var() << " -> " << p.subst(); 51 return s; 52 } 53 //}}} 54 #endif /* NOSTREAMIO */ 55 56 //{{{ CFMap::CFMap ( const CFList & L ) 57 //{{{ docu 58 // 59 // CFMap::CFMap() - construct a CFMap from a CFList. 60 // 61 // Variable[i] will be mapped to CFList[i] under the resulting 62 // map. 63 // 64 //}}} 65 CFMap::CFMap ( const CFList & L ) 66 { 67 CFListIterator i; 68 int j; 69 for ( i = L, j = 1; i.hasItem(); i++, j++ ) 70 P.insert( MapPair( Variable(j), i.getItem() ) ); 71 } 72 //}}} 73 74 //{{{ CFMap & CFMap::operator = ( const CFMap & m ) 75 //{{{ docu 76 // 77 // CFMap::operator = - assignment operator. 78 // 79 //}}} 80 CFMap & 81 CFMap::operator = ( const CFMap & m ) 82 { 83 if ( this != &m ) 84 P = m.P; 85 return *this; 86 } 87 //}}} 88 23 89 //{{{ static int cmpfunc ( const MapPair & p1, const MapPair & p2 ) 24 90 //{{{ docu … … 45 111 // 46 112 // cmpfunc() and insfunc() are used as functions for inserting a 47 // map pair into a Map.113 // map pair into a map by CFMap::newpair(). 48 114 // 49 115 //}}} … … 55 121 //}}} 56 122 57 //{{{ static CanonicalForm subsrec( const CanonicalForm & f, const MPListIterator & i ) 123 //{{{ void CFMap::newpair ( const Variable & v, const CanonicalForm & s ) 124 //{{{ docu 125 // 126 // CFMap::newpair() - insert a MapPair into a CFMap. 127 // 128 //}}} 129 void 130 CFMap::newpair ( const Variable & v, const CanonicalForm & s ) 131 { 132 P.insert( MapPair( v, s ), cmpfunc, insfunc ); 133 } 134 //}}} 135 136 //{{{ static CanonicalForm subsrec ( const CanonicalForm & f, const MPListIterator & i ) 58 137 //{{{ docu 59 138 // … … 63 142 // expression are not subject to further substitutions. 64 143 // 144 // Used by: CFMap::operator ()(). 145 // 65 146 //}}} 66 147 static CanonicalForm 67 subsrec ( const CanonicalForm & f, const MPListIterator & i )148 subsrec ( const CanonicalForm & f, const MPListIterator & i ) 68 149 { 69 150 if ( f.inBaseDomain() ) return f; … … 100 181 //}}} 101 182 102 //{{{ MapPair& MapPair::operator = ( const MapPair & p )103 //{{{ docu104 //105 // MapPair::operator = - assignment operator.106 //107 //}}}108 MapPair&109 MapPair::operator = ( const MapPair & p )110 {111 if ( this != &p ) {112 V = p.V;113 S = p.S;114 }115 return *this;116 }117 //}}}118 119 #ifndef NOSTREAMIO120 //{{{ ostream& operator << ( ostream& s, const MapPair & p )121 //{{{ docu122 //123 // operator << - print a map pair ("V -> S").124 //125 //}}}126 ostream&127 operator << ( ostream& s, const MapPair & p )128 {129 s << p.var() << " -> " << p.subst();130 return s;131 }132 //}}}133 #endif /* NOSTREAMIO */134 135 //{{{ CFMap::CFMap ( const CFList & L )136 //{{{ docu137 //138 // CFMap::CFMap() - construct a CFMap from a CFList.139 //140 // Variable[i] will be mapped to CFList[i] under the resulting141 // map.142 //143 //}}}144 CFMap::CFMap ( const CFList & L )145 {146 CFListIterator i;147 int j;148 for ( i = L, j = 1; i.hasItem(); i++, j++ )149 P.insert( MapPair( Variable(j), i.getItem() ) );150 }151 //}}}152 153 //{{{ CFMap& CFMap::operator = ( const CFMap & m )154 //{{{ docu155 //156 // CFMap::operator = - assignment operator.157 //158 //}}}159 CFMap&160 CFMap::operator = ( const CFMap & m )161 {162 if ( this != &m )163 P = m.P;164 return *this;165 }166 //}}}167 168 //{{{ void CFMap::newpair( const Variable & v, const CanonicalForm & s )169 //{{{ docu170 //171 // CFMap::newpair() - inserts a MapPair into a CFMap.172 //173 //}}}174 void175 CFMap::newpair( const Variable & v, const CanonicalForm & s )176 {177 P.insert( MapPair( v, s ), cmpfunc, insfunc );178 }179 //}}}180 181 183 //{{{ CanonicalForm CFMap::operator () ( const CanonicalForm & f ) const 182 184 //{{{ docu 183 185 // 184 // CFMap::operator () - apply the mapto f.186 // CFMap::operator () - apply CO to f. 185 187 // 186 188 // See subsrec() for more detailed information. … … 196 198 197 199 #ifndef NOSTREAMIO 198 //{{{ ostream & operator << ( ostream& s, const CFMap & m )200 //{{{ ostream & operator << ( ostream & s, const CFMap & m ) 199 201 //{{{ docu 200 202 // … … 202 204 // 203 205 //}}} 204 ostream &205 operator << ( ostream & s, const CFMap & m )206 ostream & 207 operator << ( ostream & s, const CFMap & m ) 206 208 { 207 209 return s << m.P;
Note: See TracChangeset
for help on using the changeset viewer.