Ejemplo n.º 1
0
 private static void ParseMMFFCHARGE(Stream ins, Dictionary <BondKey, decimal> map)
 {
     using (var br = new StreamReader(ins, System.Text.Encoding.UTF8))
     {
         string line;
         while ((line = br.ReadLine()) != null)
         {
             if (line.Length == 0 || line[0] == '*')
             {
                 continue;
             }
             var cols = Strings.Tokenize(line);
             if (cols.Count != 5)
             {
                 throw new IOException("Malformed MMFFBOND.PAR file.");
             }
             var key = new BondKey(int.Parse(cols[0], NumberFormatInfo.InvariantInfo),
                                   int.Parse(cols[1], NumberFormatInfo.InvariantInfo),
                                   int.Parse(cols[2], NumberFormatInfo.InvariantInfo));
             decimal bci = decimal.Parse(cols[3], NumberFormatInfo.InvariantInfo);
             map[key]       = bci;
             map[key.Inv()] = -bci;
         }
     }
 }
Ejemplo n.º 2
0
            public override bool Equals(object o)
            {
                if (this == o)
                {
                    return(true);
                }
                if (o == null || GetType() != o.GetType())
                {
                    return(false);
                }

                BondKey bondKey = (BondKey)o;

                if (cls != bondKey.cls)
                {
                    return(false);
                }
                if (type1 != bondKey.type1)
                {
                    return(false);
                }
                return(type2 == bondKey.type2);
            }