Changeset 2674 for trunk/gsdl/src


Ignore:
Timestamp:
2001-07-27T11:29:15+12:00 (23 years ago)
Author:
paynter
Message:

Changes for the new version of suffix: Added
Phrase::shortenByOneAtSuffix and corresponding Prefix version; made a
couple of private member functions public.

Location:
trunk/gsdl/src/phind/generate
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/phind/generate/phrase.cpp

    r2487 r2674  
    4444#include "phrase.h"
    4545
     46
    4647// Phrase constructor functions
     48
    4749
    4850Phrase::Phrase(symbol *words, cellcount size, int direction) {
     
    5961}
    6062
     63
    6164Phrase::Phrase() {
    6265  empty();
     
    119122  return 0;
    120123}
     124
     125// Shorten a phrase by one symbol
     126int Phrase::shortenByOneAtSuffix() {
     127  --length;
     128  --back;
     129  clearSuffix();
     130  clearPrefix();
     131  return 0;
     132}
     133
     134int Phrase::shortenByOneAtPrefix() {
     135  --length;
     136  ++forward;
     137  clearSuffix();
     138  clearPrefix();
     139  return 0;
     140}
     141
    121142
    122143
     
    705726int Phrase::expandWhileUniqueSuffixExtension() {
    706727  assert(forward);
    707   assert(suffixFound);
     728  ensureSuffixFound();
    708729
    709730  // if the phrase occurs only once, do nothing
     
    745766
    746767int Phrase::expandWhileUniquePrefixExtension() {
    747   assert(prefixFound);
     768  assert(forward);
     769  ensurePrefixFound();
    748770
    749771  // if the phrase occurs only once, do nothing
  • trunk/gsdl/src/phind/generate/phrase.h

    r2498 r2674  
    7575  cellcount prefixFrequency;
    7676
    77   // Constructor function
     77  // Constructor functions
    7878  // First argument is an array of words, second is the length of
    7979  // the phrase, third is the direction (SUFFIX of PREFIX) in
     
    100100  int expandUniquePrefixExtensionByOne();
    101101  int expandUniqueSuffixExtensionByOne();
     102
     103  // Extend a phrase until it no longer has a unique extanesion
     104  int expandWhileUniqueSuffixExtension();
     105  int expandWhileUniquePrefixExtension();
     106
     107  // Shorten a phrase by one symbol
     108  int shortenByOneAtSuffix();
     109  int shortenByOneAtPrefix();
    102110
    103111  // Find the phrase in the suffix/prefix array
     
    137145  Phrase Phrase::newPhraseShortestPrefixExpansion(cellindex i);
    138146
    139   // Extend a phrase until it no longer has a unique extanesion
    140   int expandWhileUniqueSuffixExtension();
    141   int expandWhileUniquePrefixExtension();
    142147};
    143148
Note: See TracChangeset for help on using the changeset viewer.