42 template <
typename TFraction>
48 template <
typename TFraction>
55 template <
typename TFraction>
58 : mySlope( other.mySlope )
62 template <
typename TFraction>
71 template <
typename TFraction>
82 template <
typename TFraction>
88 if ( mySlope.null() )
return "eps";
89 else if ( mySlope.k() == -2 )
111 mySlope.getSplitBerstel( f1, nb1, f2, nb2 );
115 for (
Quotient i = 0; i < nb1; ++i ) s += p1.
rE();
116 for (
Quotient i = 0; i < nb2; ++i ) s += p2.
rE();
121 template <
typename TFraction>
125 rEs(
const std::string & seps )
const
127 if ( mySlope.null() )
return "eps";
128 else if ( mySlope.k() == -2 )
150 mySlope.getSplitBerstel( f1, nb1, f2, nb2 );
151 std::string s( 1, seps[ 0 ] );
154 for (
Quotient i = 0; i < nb1; ++i ) s += p1.
rEs( seps );
156 for (
Quotient i = 0; i < nb2; ++i ) s += p2.
rEs( seps );
162 template <
typename TFraction>
171 template <
typename TFraction>
177 return mySlope.p() + mySlope.q();
180 template <
typename TFraction>
186 ASSERT( ! slope().null() );
189 else return length() * ((
Integer) k);
192 template <
typename TFraction>
198 ASSERT( ! slope().null() );
199 Integer pL = slope().odd() ? length() - previousPattern().length()
200 : previousPattern().length();
203 else return pL + length() * ((
Integer) k);
206 template <
typename TFraction>
212 ASSERT( ! slope().null() );
224 template <
typename TFraction>
230 ASSERT( ! slope().null() );
240 template <
typename TFraction>
247 ? U( 1 ) - previousPattern().
U( 1 )
248 : previousPattern().U( 1 );
251 template <
typename TFraction>
257 return Vector2I( slope().q(), slope().p() );
260 template <
typename TFraction>
266 ASSERT( ( ! slope().null() ) );
268 return Self( slope().previousPartial() );
278 template <
typename TFraction>
286 bool reversed )
const
288 bool different =
false;
290 ASSERT( ( 0 <= posA ) && ( posA < posB ) && ( posB <= l ) );
291 if ( slope().p() == 0 || slope().q() == 0 )
293 ASSERT( posA == 0 && posB == 1 );
300 else if ( reversed ? slope().even() : slope().odd() )
302 Self prevP = previousPattern();
306 if ( posB > slope().u() * prevL )
312 subpattern =
Self( slope().father( nb ) );
314 startPos = prevP.
v() * k1;
319 Integer k2 = ( posB + prevL - 1 ) / prevL;
324 startPos = prevP.
v() * k1;
330 Self prevP = previousPattern();
332 Integer k1 = ( l - posB ) / prevL;
334 if ( ( l - posA ) > slope().u() * prevL )
344 subpattern =
Self( slope().father( nb ) );
352 Integer k2 = ( l - posA + prevL - 1 ) / prevL;
357 startPos = v() - prevP.
v() * k2;
365 template <
typename TFraction>
373 bool reversed )
const
375 bool null_pattern =
false;
377 ASSERT( ( 0 <= posA ) && ( posA < posB ) && ( posB <= l ) );
378 if ( slope().p() == 0 || slope().q() == 0 )
380 ASSERT( posA == 0 && posB == 1 );
385 null_pattern =
false;
387 else if ( reversed ? slope().even() : slope().odd() )
389 Self prevP = previousPattern();
391 Integer k1 = ( posA + prevL - 1 ) / prevL;
394 if ( posA > slope().u() * prevL )
405 subpattern =
Self( slope().father( nb ) );
407 startPos = prevP.
v() * k1;
408 null_pattern =
false;
416 if ( nb < 0 ) nb = 0;
417 subpattern = nb == 0 ?
Pattern() : prevP;
418 startPos = prevP.
v() * k1;
419 null_pattern = nb == 0;
424 Self prevP = previousPattern();
426 Integer k1 = ( l - posB + prevL - 1 ) / prevL;
430 if ( ( l - posB ) > slope().u() * prevL )
441 subpattern =
Self( slope().father( nb ) );
445 null_pattern =
false;
450 Integer k2 = ( l - posA ) / prevL;
453 if ( nb < 0 ) nb = 0;
454 subpattern = nb == 0 ?
Pattern() : prevP;
455 startPos = v() - prevP.
v() * k2;
456 null_pattern = nb == 0;
460 return ! null_pattern;
472 template <
typename TFraction>
477 out <<
"[Pattern] f=";
485 template <
typename TFraction>
498 template <
typename TFraction>
504 object.selfDisplay( out );