Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/magnus/back_end/SessionManager/include/SMWord.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: SMWord.h,v 1.7 2000/03/03 01:35:21 bormotov Exp $
00003  */
00004 
00005 // Copyright (C) 1995 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 
00008 // Contents: Declaration of class SMWord
00009 //
00010 // Principal Author: Roger Needham
00011 //
00012 // Status: in progress
00013 //
00014 // Revision History:
00015 //
00016 
00017 #ifndef _SMWORD_H_
00018 #define _SMWORD_H_
00019 
00020 #include "AlgebraicObject.h"
00021 #include "SMFPGroup.h"
00022 #include "Word.h"
00023 
00024 #include "InformationCenter.h"
00025 #include "BaseProperties.h"
00026 
00027 //
00028 // New properties of Word's Information Center (WIC)
00029 // 
00030 
00031 class IsTrivialProperty : public NoDataProperty {
00032 public:
00033   IsTrivialProperty(const Chars& descr) : NoDataProperty(descr) {}
00034   PropertyType actualType()   const { return type(); }
00035   static PropertyType type() { return theTypeID; }
00036   Chars propertyName() const { return "IsTrivial"; }
00037 protected:
00038   GenericProperty* clone() const { return new IsTrivialProperty(*this); }
00039 private:
00040   static const PropertyType theTypeID;
00041 };
00042 
00043 class WordOrderProperty : public IntegerProperty {
00044 public:
00045   WordOrderProperty(const Integer& data) : IntegerProperty(data) {}
00046   PropertyType actualType  () const { return type(); }
00047   static PropertyType type() { return theTypeID; }
00048   Chars propertyName() const { return "WordOrder";   }
00049 protected:
00050   GenericProperty* clone() const { return new WordOrderProperty(*this); }
00051 private:
00052   static const PropertyType theTypeID;
00053 };
00054 
00055 class MaximalRootProperty : public WordProperty {
00056 public:
00057   MaximalRootProperty(const Word& data) : WordProperty(data) {}
00058   PropertyType actualType()   const { return type(); }
00059   static PropertyType type() { return theTypeID; }
00060   Chars propertyName() const { return "MaximalRoot"; }
00061 protected:
00062   GenericProperty* clone() const { return new MaximalRootProperty(*this); }
00063 private:
00064   static const PropertyType theTypeID;
00065 };
00066 
00067 class MaximalPowerProperty : public IntegerProperty {
00068 public:
00069   MaximalPowerProperty(const Integer& data) : IntegerProperty(data) {}
00070   PropertyType actualType()   const { return type(); }
00071   static PropertyType type() { return theTypeID; }
00072   Chars propertyName() const { return "MaximalPower"; }
00073 protected:
00074   GenericProperty* clone() const { return new MaximalPowerProperty(*this); }
00075 private:
00076   static const PropertyType theTypeID;
00077 };
00078 
00079 class CollectedFormProperty : public PolyWordProperty {
00080 public:
00081   CollectedFormProperty(const PolyWord& data) : PolyWordProperty(data) {}
00082   PropertyType actualType()   const { return type(); }
00083   static PropertyType type() { return theTypeID; }
00084   Chars propertyName() const { return "CollectedForm"; }
00085 protected:
00086   GenericProperty* clone() const { return new CollectedFormProperty(*this); }
00087 private:
00088   static const PropertyType theTypeID;
00089 };
00090 
00091 
00092 // ------------------------------- WIC ------------------------------------- //
00093 
00094 
00095 class WIC : public InformationCenter, protected FEData 
00096 {  
00097 public:
00098   
00099   /////////////////////////////////////////////////////////////////////////
00100   //                                                                     //
00101   // Constructors:                                                       //
00102   //                                                                     //
00103   /////////////////////////////////////////////////////////////////////////
00104   
00105   WIC( OID word_oid );
00106   ~WIC( );
00107 
00108   /*
00109    *   Adapter for the IsTrivial property:
00110    */
00111 
00112   Trichotomy isTrivial() const;
00113   Trichotomy isTrivial(Chars& expl);
00114   // Yes if word is trivial, no if it is not.
00115 
00116   void putIsTrivial(bool istrivial, const Chars& expl);
00117   // Yes if word is trivial, no if it is not.
00118 
00119   /*
00120    *   Adapter for the CollectedForm property:
00121    */
00122 
00123   bool haveCollectedForm() const;
00124   // True if have cannonical decomposition in nilpotent
00125 
00126   void putHaveCollectedForm( const PolyWord& p );
00127 
00128   const PolyWord& getCollectedForm() const;
00129 
00130   /*
00131    *   Adapter for the WordOrder property:
00132    */
00133 
00134   bool haveOrder( ) const;
00135   void putHaveOrder (const Integer& o);
00136   Integer getOrder( ) const;
00137 
00138   /*
00139    *   Adapter for the MaximalRoot property:
00140    */
00141 
00142   bool haveMaximalRoot() const;
00143   // True if word has the maximal root
00144 
00145   void putHaveMaximalRoot(const Word& ,const Integer&);
00146   // Puts the solution of maximal root problem
00147 
00148   void getMaximalRoot(Word& , Integer& ) const;
00149 
00150   Trichotomy isPower() const;
00151   // True if maximal root problem, was solved
00152 
00153   Integer getMaximalExponent() const;
00154 
00155   /////////////////////////////////////////////////////////////////////////
00156   //                                                                     //
00157   // Data Members:                                                       //
00158   //                                                                     //
00159   /////////////////////////////////////////////////////////////////////////
00160 
00161   OID wordOID;
00162   // Need this for composing messages about what has been found.
00163 };
00164 
00165 // ------------------------------- WCM ------------------------------------- //
00166 
00167 
00168 class WCM : public Supervisor
00169 {
00170 public:
00171 
00172   /////////////////////////////////////////////////////////////////////////
00173   //                                                                     //
00174   // Constructors:                                                       //
00175   //                                                                     //
00176   /////////////////////////////////////////////////////////////////////////
00177 
00178   WCM( class SMWord& W );
00179 
00180   /////////////////////////////////////////////////////////////////////////
00181   //                                                                     //
00182   // Accessors:                                                          //
00183   //                                                                     //
00184   /////////////////////////////////////////////////////////////////////////
00185 
00186   SMWord& getWord( )  { return theWord; }
00187 
00188 
00189   /////////////////////////////////////////////////////////////////////////
00190   //                                                                     //
00191   // Front End Interfacing:                                              //
00192   //                                                                     //
00193   /////////////////////////////////////////////////////////////////////////
00194 
00195   void viewStructure(ostream& ostr) const { }
00196 
00197 
00198   /////////////////////////////////////////////////////////////////////////
00199   //                                                                     //
00200   // Subordinate Computation Managers:                                   //
00201   //                                                                     //
00202   /////////////////////////////////////////////////////////////////////////
00203 
00204   Subordinate<WCM,NGdecomposeWord> ngDecomposeWord;
00205 
00206   /////////////////////////////////////////////////////////////////////////
00207   //                                                                     //
00208   // Control:                                                            //
00209   //                                                                     //
00210   /////////////////////////////////////////////////////////////////////////
00211 
00212   void takeControl( );        // overrides ComputationManager
00213 
00214 
00215   /////////////////////////////////////////////////////////////////////////
00216   //                                                                     //
00217   // State Transitions:                                                  //
00218   //                                                                     //
00219   /////////////////////////////////////////////////////////////////////////
00220 
00221   void start( ) { }           // overrides ComputationManager
00222 
00223   void terminate( ) { }       // overrides ComputationManager
00224 
00225 
00226 private:
00227 
00228   /////////////////////////////////////////////////////////////////////////
00229   //                                                                     //
00230   // Data Members:                                                       //
00231   //                                                                     //
00232   /////////////////////////////////////////////////////////////////////////
00233 
00234   class SMWord& theWord;
00235 
00236   bool didFastChecks;
00237   // The takeControl method does some sneaky checks of obvious properties
00238   // (this should be formalized, since they are not always that fast).
00239   // This records the first call, so that they are not done over and over.
00240 
00241 };
00242 
00243 //---------------------------------------------------------------------------//
00244 //---------------------------- SMWord ---------------------------------------//
00245 //---------------------------------------------------------------------------//
00246 
00247 class SMWord : public AlgebraicObject
00248 {
00249 public:
00250 
00251   /////////////////////////////////////////////////////////////////////////
00252   //                                                                     //
00253   // Constructors:                                                       //
00254   //                                                                     //
00255   /////////////////////////////////////////////////////////////////////////
00256 
00257   SMWord(SMFPGroup& G, const Word w, const Chars heritage);
00258 
00259   SMWord(SMFPGroup& G) : AlgebraicObject(""), theGroup(G), 
00260     wic( oid() ),theWCM ( 0 )
00261     { }
00262   //@rn Bogus ctor; see `But no' comment in Menu.h.
00263 
00264   /////////////////////////////////////////////////////////////////////////
00265   //                                                                     //
00266   // Accessors:                                                          //
00267   //                                                                     //
00268   /////////////////////////////////////////////////////////////////////////
00269 
00270   Word getWord( ) const { return theWord; }
00271 
00272   SMFPGroup& getParent( ) const { return theGroup; }
00273 
00274   WCM& wcm() const { return *theWCM; }
00275 
00276         InformationCenter* infoCenter()       { return &wic; }
00277   const InformationCenter* infoCenter() const { return &wic; }
00278 
00279   /////////////////////////////////////////////////////////////////////////
00280   //                                                                     //
00281   // Front End Interfacing:                                              //
00282   //                                                                     //
00283   /////////////////////////////////////////////////////////////////////////
00284 
00285   static const char* type( ) { return "SMWord"; }
00286 
00287   const char* typeID( ) const { return type(); }        // overrides SMObject
00288 
00289   const IconID iconID( ) const { return IconID::elt; }  // overrides SMObject
00290 
00291   void viewStructure(ostream& ostr) const;              // overrides SMObject
00292 
00293   void printProperties(ostream& ostr) const;            // overrides SMObject
00294 
00295   void printDefinition(ostream& ostr) const;            // overrides SMObject
00296 
00297   WIC wic;
00298 
00299 protected:
00300 
00301   /////////////////////////////////////////////////////////////////////////
00302   //                                                                     //
00303   // Restricted Access:                                                  //
00304   //                                                                     //
00305   /////////////////////////////////////////////////////////////////////////
00306 
00307   void readMessage(istream&) { }                        // overrides SMObject
00308 
00309 
00310 private:
00311 
00312   /////////////////////////////////////////////////////////////////////////
00313   //                                                                     //
00314   // Data Members:                                                       //
00315   //                                                                     //
00316   /////////////////////////////////////////////////////////////////////////
00317 
00318   SMFPGroup& theGroup;
00319 
00320   const Word theWord;
00321  
00322   WCM* theWCM;
00323 };
00324 
00325 #endif

Generated at Tue Jun 19 09:49:39 2001 for Magnus Classes by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001