Example #1
0
 public double BaseLeft()
 {
     return(m_WrappedMf.BaseLeft());
 }
Example #2
0
/*
 *              public static void LoadRedefinedMemberFunctions( Fuzzifier fuzzifier, string file )
 *              {
 *                      try
 *                      {
 * //				fuzzifier.m_MembershipFunctions.Clear();
 *
 *                              StreamReader reader = new StreamReader( file );
 *                              string line;
 *                              char[] separator = {' ', '\t', '\n'};
 *                              string[] tokens;
 *                              while ( ( line = reader.ReadLine() ) != null )
 *                              {
 *                                      line = line.Trim();
 *                                      if ( line.Length > 0 && line[0] != ';' )
 *                                      {
 *                                              tokens = line.Split( separator );
 *                                              MfInterface[] memberFuncToWrap = fuzzifier.GetMembershipFunctions( tokens[1] );
 *
 *                                              for ( int i = 0; i < memberFuncToWrap.Length; i++ )
 *                                              {
 *                                                      MfInterface wrapperMf = new RedefinedMemberFunction( tokens[0], memberFuncToWrap[i] );
 *                                                      fuzzifier.AddMembershipFunction( wrapperMf );
 *                                              }
 *                                      }
 *                              }
 *                              reader.Close();
 *                      }
 *                      catch ( Exception e )
 *                      {
 *                              LogWriter.Write( e.ToString() );
 *                      }
 *              }
 */

        public static void SaveMemberFunctions(Fuzzifier fuzzifier, string file)
        {
            try
            {
                StreamWriter writer = new StreamWriter(file, false);

                IDictionaryEnumerator htEnumerator = fuzzifier.m_MembershipFunctions.GetEnumerator();
                while (htEnumerator.MoveNext())
                {
                    ArrayList currentFunctions = ( ArrayList )htEnumerator.Value;
                    for (int i = 0; i < currentFunctions.Count; i++)
                    {
                        string      locked           = "";
                        MfInterface memberFuncToSave = ( MfInterface )currentFunctions[i];

                        if (memberFuncToSave.IsLocked())
                        {
                            locked = " *";
                        }

                        if (memberFuncToSave.SaveAble())
                        {
                            writer.WriteLine(memberFuncToSave.VariableName() + " " + memberFuncToSave.TermName() + " " + memberFuncToSave.BaseLeft() + " " + memberFuncToSave.CenterMax() + " " + memberFuncToSave.BaseRight() + locked);
                        }
                    }
                }
                writer.Close();
            }
            catch (Exception)
            {}
        }