public static void MakeReady(Fuzzifier fuzzifier) { fuzzifier.m_MembershipFunctions.Clear(); string line; char[] separator = { ' ', '\t', '\n' }; string[] tokens; string[] s = MemberFunctionGrapper.GetFunctions(); for (int i = 0; i < s.Length; i++) { line = s[i].Trim(); if (line.Length > 0 && line[0] != ';') { tokens = line.Split(separator); MfInterface memberFunc = new MembershipFunction(tokens[0], tokens[1], double.Parse(tokens[2]), double.Parse(tokens[3]), double.Parse(tokens[4])); if (tokens.Length > 5 && tokens[5].Equals("*")) { memberFunc.Lock(true); } fuzzifier.AddMembershipFunction(memberFunc); } } }
public static void LoadMemberFunctions(Fuzzifier fuzzifier, string file) { try { if (File.Exists(file)) { 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 memberFunc = new MembershipFunction(tokens[0], tokens[1], double.Parse(tokens[2]), double.Parse(tokens[3]), double.Parse(tokens[4])); if (tokens.Length > 5 && tokens[5].Equals("*")) { memberFunc.Lock(true); } fuzzifier.AddMembershipFunction(memberFunc); } } reader.Close(); } } catch (Exception e) { LogWriter.Write(e.ToString()); } }
public static void MakeReady( Fuzzifier fuzzifier ) { fuzzifier.m_MembershipFunctions.Clear(); string line; char[] separator = {' ', '\t', '\n'}; string[] tokens; string[] s = MemberFunctionGrapper.GetFunctions(); for ( int i = 0; i < s.Length; i++ ) { line = s[i].Trim(); if ( line.Length > 0 && line[0] != ';' ) { tokens = line.Split( separator ); MfInterface memberFunc = new MembershipFunction( tokens[0], tokens[1], double.Parse( tokens[2] ), double.Parse( tokens[3]), double.Parse( tokens[4] ) ); if ( tokens.Length > 5 && tokens[5].Equals("*") ) memberFunc.Lock( true ); fuzzifier.AddMembershipFunction( memberFunc ); } } }
public static void LoadMemberFunctions( Fuzzifier fuzzifier, string file ) { try { if ( File.Exists( file ) ) { 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 memberFunc = new MembershipFunction( tokens[0], tokens[1], double.Parse( tokens[2] ), double.Parse( tokens[3]), double.Parse( tokens[4] ) ); if ( tokens.Length > 5 && tokens[5].Equals("*") ) memberFunc.Lock( true ); fuzzifier.AddMembershipFunction( memberFunc ); } } reader.Close(); } } catch ( Exception e ) { LogWriter.Write( e.ToString() ); } }