name() public méthode

public name ( ) : string
Résultat string
Exemple #1
0
        public Unit findDiv(Unit a, Unit b)
        {
            // compute dim/scale of a / b
            Dimension dim   = a.m_dim.subtract(b.m_dim).intern();
            double    scale = a.m_scale / b.m_scale;

            // find all the matches
            Unit[] matches = match(dim, scale);
            if (matches.Length == 1)
            {
                return(matches[0]);
            }

            // right how our technique for resolving multiple matches is lame
            string expectedName = a.name() + "_per_" + b.name();

            for (int i = 0; i < matches.Length; ++i)
            {
                if (matches[i].name().Contains(expectedName))
                {
                    return(matches[i]);
                }
            }

            // for now just give up
            throw Err.make("Cannot match to db: " + a + " / " + b).val;
        }
Exemple #2
0
        private static Unit findMult(Unit a, Unit b)
        {
            // compute dim/scale of a * b
            Dimension dim   = a.m_dim.add(b.m_dim).intern();
            double    scale = a.m_scale * b.m_scale;

            // find all the matches
            Unit[] matches = match(dim, scale);
            if (matches.Length == 1)
            {
                return(matches[0]);
            }

            // right how our technique for resolving multiple matches is lame
            string expectedName = a.name() + "_" + b.name();

            for (int i = 0; i < matches.Length; ++i)
            {
                if (matches[i].name() == expectedName)
                {
                    return(matches[i]);
                }
            }

            // for now just give up
            throw Err.make("Cannot match to db: " + a + " * " + b).val;
        }
Exemple #3
0
        private static Unit findMult(Unit a, Unit b)
        {
            // compute dim/scale of a * b
              Dimension dim = a.m_dim.add(b.m_dim).intern();
              double scale = a.m_scale * b.m_scale;

              // find all the matches
              Unit[] matches = match(dim, scale);
              if (matches.Length == 1) return matches[0];

              // right how our technique for resolving multiple matches is lame
              string expectedName = a.name() + "_" + b.name();
              for (int i=0; i<matches.Length; ++i)
            if (matches[i].name() == expectedName)
              return matches[i];

              // for now just give up
              throw Err.make("Cannot match to db: " + a + " * " + b).val;
        }
Exemple #4
0
        public Unit findDiv(Unit a, Unit b)
        {
            // compute dim/scale of a / b
              Dimension dim = a.m_dim.subtract(b.m_dim).intern();
              double scale = a.m_scale / b.m_scale;

              // find all the matches
              Unit[] matches = match(dim, scale);
              if (matches.Length == 1) return matches[0];

              // right how our technique for resolving multiple matches is lame
              string expectedName = a.name() + "_per_" + b.name();
              for (int i=0; i<matches.Length; ++i)
            if (matches[i].name().Contains(expectedName))
              return matches[i];

              // for now just give up
              throw Err.make("Cannot match to db: " + a + " / " + b).val;
        }