Exemple #1
0
     public override void Read(final DataInput indexIn, final bool absolute)
 {
     if (absolute)
     {
         upto = indexIn.readVInt();
         fp = indexIn.readVLong();
     }
     else
     {
         final
         int uptoDelta = indexIn.readVInt();
         if ((uptoDelta & 1) == 1)
         {
             // same block
             upto += uptoDelta >> > 1;
         }
         else
         {
             // new block
             upto = uptoDelta >> > 1;
             fp += indexIn.readVLong();
         }
     }
     Debug.Assert(
     upto < blockSize;
 }
Exemple #2
0
    private static boolean repOK_ordered(final BinomialHeapNode node)
    {
        if (node.child != null)
        {
            if (node.child.key < node.key)
            {
                return(false);
            }
            if (!repOK_ordered(node.child))
            {
                return(false);
            }
            for (BinomialHeapNode ns = node.child.sibling; ns != null; ns = ns.sibling)
            {
                if (ns.key < node.key)
                {
                    return(false);
                }
                if (!repOK_ordered(ns))
                {
                    return(false);
                }
            }
            return(true);
        }

        return(true);
    }
Exemple #3
0
    private BinTreeNode treeSuccessor(final BinTreeNode x_param)
    {
        BinTreeNode x = x_param;
        BinTreeNode result;

        if (x.right != null)
        {
            { /*$goal 11 reachable*/ }
            result = treeMinimum(x.right);
        }
        else
        {
            { /*$goal 12 unreachable*/ }
            BinTreeNode y = x.parent;
            while (y != null && x == y.right)
            {
                { /*$goal 13 unreachable*/ }
                x = y;
                y = y.parent;
            }

            result = y;
        }
        { /*$goal 14 reachable*/ }
        return(result);
    }
Exemple #4
0
    private AvlNode find(final int x, final AvlNode arg)
    {
        AvlNode t = arg;

        while (t != null)
        {
            { /*$goal 0 reachable*/ }
            if (x < t.element)
            {
                { /*$goal 1 reachable*/ }
                t = t.left;
            }
            else if (x > t.element)
            {
                { /*$goal 2 reachable*/ }
                t = t.right;
            }
            else
            {
                { /*$goal 3 reachable*/ }
                return(t);                // Match
            }
        }

        { /*$goal 4 reachable*/ }
        return(null);        // No match
    }
Exemple #5
0
        /**
         * Specifies the network resource referenced by this <code>KMLNetworkLink</code>, or <code>null</code> if this link
         * has no resource. If the specified <code>kmlRoot</code> is not <code>null</code, this link draws the
         * <code>kmlRoot</code> during preRendering and rendering, and forwards property change events from the
         * <code>kmlRoot</code> to this link's property change listeners.
         *
         * @param kmlRoot the network resource referenced by this <code>KMLNetworkLink</code>. May be <code>null</code>.
         *
         * @see #getNetworkResource()
         */
        public void setNetworkResource(final KMLRoot kmlRoot)
        {
            // Remove any property change listeners previously set on the KMLRoot. This eliminates dangling references from
            // the KMLNetworkLink to its previous KMLRoot.
            KMLRoot resource = this.getNetworkResource();

            if (resource != null)
            {
                resource.removePropertyChangeListener(this);
            }

            this.networkResource.set(kmlRoot);
            this.networkResourceRetrievalTime.set(System.currentTimeMillis());
            if (this.firstRetrievalTime == null)
            {
                this.firstRetrievalTime = new AtomicLong(this.networkResourceRetrievalTime.get());
            }

            // Set up to listen for property change events on the KMLRoot. KMLNetworkLink must forward REPAINT and REFRESH
            // property change events from its internal KMLRoot to its parent KMLRoot to support BrowserBalloon repaint
            // events and recursive KMLNetworkLink elements.
            if (kmlRoot != null)
            {
                kmlRoot.addPropertyChangeListener(this);

                // Apply any updates contained in the new root's optional network link control.
                SwingUtilities.invokeLater(new Runnable()
                {
Exemple #6
0
        public ActionResult BudgetCalculator()
        {
            final          fc          = new final();
            List <product> productList = fc.products.ToList();

            ViewBag.productList = productList;
            return(View());
        }
Exemple #7
0
    private BinTreeNode treeMinimum(final BinTreeNode x_param)
    {
        BinTreeNode x = x_param;

        while (x.left != null)
        {
            { /*$goal 15 reachable*/ }
            x = x.left;
        }
        { /*$goal 16 reachable*/ }
        return(x);
    }
Exemple #8
0
 public BackupOutcome DoFullBackup(final string sourceHostNameOrIp, final int sourcePort, DatabaseLayout targetLayout, ConsistencyCheck consistencyCheck, Config tuningConfiguration, final long timeout, final bool forensics)
 {
     try
     {
         using (FileSystemAbstraction fileSystem = _fileSystemSupplier.get())
         {
             return(FullBackup(fileSystem, sourceHostNameOrIp, sourcePort, targetLayout, consistencyCheck, tuningConfiguration, timeout, forensics));
         }
     }
     catch (IOException e)
     {
         throw new Exception(e);
     }
 }
Exemple #9
0
        public ActionResult FindRecipe()
        {
            /*
             * List<recipe> models = db1.recipes.ToList();
             * List<string> nameList = new List<string>();
             * List<string> ingredientList = new List<string>();
             * List<string> directionList = new List<string>();
             * List<int> servingList = new List<int>();
             * List<double> costList = new List<double>();
             * List<string> urlList = new List<string>();
             * List<string> categoryList = new List<string>();
             * List<int> totalTimeList = new List<int>();
             * List<string> timeList = new List<string>();
             * foreach (recipe item in models)
             * {
             * nameList.Add(item.recipe_name);
             * ingredientList.Add(item.ingredients);
             * directionList.Add(item.directions);
             * servingList.Add((int)item.servings);
             * costList.Add((double)item.cost);
             * urlList.Add(item.img_url);
             * categoryList.Add(item.category);
             * totalTimeList.Add((int)item.total_time_min);
             * timeList.Add(item.total_time_str);
             * }
             *
             * ViewBag.nameList = JsonConvert.SerializeObject(nameList);
             * ViewBag.ingredientList = JsonConvert.SerializeObject(ingredientList);
             * ViewBag.directionList = JsonConvert.SerializeObject(directionList);
             * ViewBag.servingList = JsonConvert.SerializeObject(servingList);
             * ViewBag.costList = JsonConvert.SerializeObject(costList);
             * ViewBag.urlList = JsonConvert.SerializeObject(urlList);
             * ViewBag.categoryList = JsonConvert.SerializeObject(categoryList);
             * ViewBag.totalTimeList = JsonConvert.SerializeObject(totalTimeList);
             * ViewBag.timeList = JsonConvert.SerializeObject(timeList);
             * ViewBag.models = JsonConvert.SerializeObject(models);
             * db1.recipes.ToList()
             *
             */
            final          db             = new final();
            List <product> meatList       = db.products.Where(p => p.category == "Meat").ToList();
            List <product> vegetablesList = db.products.Where(p => p.category == "Vegetables").ToList();
            List <product> othersList     = db.products.Where(p => p.category == "Others").ToList();

            ViewBag.MeatList       = meatList;
            ViewBag.VegetablesList = vegetablesList;
            ViewBag.OthersList     = othersList;

            return(View());
        }
Exemple #10
0
        static void Main(string[] args)
        {
            A obj = new A {
                a = 10
            };
            final f = new final(obj);

            f.Calarea();
            B obj2 = new B {
                a = 20
            };
            final f1 = new final(obj2);

            f1.Calarea();
        }
Exemple #11
0
    void Start()
    {
        ismovingA        = false;
        ismovingD        = false;
        ismovingS        = false;
        ismovingW        = false;
        terminocenter    = true;
        var              = true;
        disabilita       = true;
        f                = this;
        deploymentHeight = 45f;
        velocity         = 30f;


        _ID = "" + GetComponent <NetworkIdentity>().netId;
        Debug.Log(_ID);
    }
Exemple #12
0
    private AvlNode findMax(final AvlNode arg)
    {
        AvlNode t = arg;

        if (t == null)
        {
            { /*$goal 0 reachable*/ }
            return(t);
        }

        while (t.right != null)
        {
            { /*$goal 1 reachable*/ }
            t = t.right;
        }

        { /*$goal 2 reachable*/ }
        return(t);
    }
Exemple #13
0
    public static String pak(final String s)
    {
        String[] arr   = s.split(" ");
        String   recon = "";

        if (arr.length <= 1)
        {
            return(recon);
        }
        else
        {
            int limit = arr.length - 1;
            for (int i = 0; i < limit; i++)
            {
                recon += arr[i] + " pak ";
            }
            recon += arr[limit];
            return(recon.trim());
        }
    }
Exemple #14
0
        public JsonResult GetFoodaryData(string category, List <string> keys, string sort)
        {
            final db = new final();

            Expression <Func <recipe, bool> > catWhere = r => 1 == 1;
            Expression <Func <recipe, bool> > exWhere  = r => 1 == 1;

            if (category != "all")
            {
                catWhere = r => r.category == category;
            }

            if (keys != null && keys.Count > 0)
            {
                exWhere = r => keys.Any(k => r.directions.Contains(k));
            }


            List <recipe> list = new List <recipe>();

            switch (sort)
            {
            case "cost":
                list = db.recipes.Where(catWhere).Where(exWhere).OrderBy(r => r.cost).ToList();
                break;

            case "preparationTime":
                list = db.recipes.Where(catWhere).Where(exWhere).OrderBy(r => r.total_time_min).ToList();
                break;

            case "servingSize":
                list = db.recipes.Where(catWhere).Where(exWhere).OrderBy(r => r.servings).ToList();
                break;
            }

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
	private static void assertValid(final boolean exp, final String name) {
		assertEquals("\"" + name + "\"", exp, Repository.isValidRefName(name));
	}
Exemple #16
0
        /**
         * Internal helper method for natural logarithm function.
         * @param x original argument of the natural logarithm function
         * @param hiPrec extra bits of precision on output (To Be Confirmed)
         * @return log(x)
         */
        private static double log(final double x, final double[] hiPrec)
        {
            if (x==0) { // Handle special case of +0/-0
            return Double.NEGATIVE_INFINITY;
            }
            long bits = Double.doubleToLongBits(x);

            /* Handle special cases of negative input, and NaN */
            if ((bits & 0x8000000000000000L) != 0 || x != x) {
            if (x != 0.0) {
                if (hiPrec != null) {
                    hiPrec[0] = Double.NaN;
                }

                return Double.NaN;
            }
            }

            /* Handle special cases of Positive infinity. */
            if (x == Double.POSITIVE_INFINITY) {
            if (hiPrec != null) {
                hiPrec[0] = Double.POSITIVE_INFINITY;
            }

            return Double.POSITIVE_INFINITY;
            }

            /* Extract the exponent */
            int exp = (int)(bits >> 52)-1023;

            if ((bits & 0x7ff0000000000000L) == 0) {
            // Subnormal!
            if (x == 0) {
                // Zero
                if (hiPrec != null) {
                    hiPrec[0] = Double.NEGATIVE_INFINITY;
                }

                return Double.NEGATIVE_INFINITY;
            }

            /* Normalize the subnormal number. */
            bits <<= 1;
            while ( (bits & 0x0010000000000000L) == 0) {
                --exp;
                bits <<= 1;
            }
            }

            if (exp == -1 || exp == 0) {
            if (x < 1.01 && x > 0.99 && hiPrec == null) {
                /* The normal method doesn't work well in the range [0.99, 1.01], so call do a straight
               polynomial expansion in higer precision. */

               /* Compute x - 1.0 and split it */
                double xa = x - 1.0;
                double xb = xa - x + 1.0;
                double tmp = xa * HEX_40000000;
                double aa = xa + tmp - tmp;
                double ab = xa - aa;
                xa = aa;
                xb = ab;

                final double[] lnCoef_last = LN_QUICK_COEF[LN_QUICK_COEF.length - 1];
                double ya = lnCoef_last[0];
                double yb = lnCoef_last[1];

                for (int i = LN_QUICK_COEF.length - 2; i >= 0; i--) {
                    /* Multiply a = y * x */
                    aa = ya * xa;
                    ab = ya * xb + yb * xa + yb * xb;
                    /* split, so now y = a */
                    tmp = aa * HEX_40000000;
                    ya = aa + tmp - tmp;
                    yb = aa - ya + ab;

                    /* Add  a = y + lnQuickCoef */
                    final double[] lnCoef_i = LN_QUICK_COEF[i];
                    aa = ya + lnCoef_i[0];
                    ab = yb + lnCoef_i[1];
                    /* Split y = a */
                    tmp = aa * HEX_40000000;
                    ya = aa + tmp - tmp;
                    yb = aa - ya + ab;
                }

                /* Multiply a = y * x */
                aa = ya * xa;
                ab = ya * xb + yb * xa + yb * xb;
                /* split, so now y = a */
                tmp = aa * HEX_40000000;
                ya = aa + tmp - tmp;
                yb = aa - ya + ab;

                return ya + yb;
            }
            }

            // lnm is a log of a number in the range of 1.0 - 2.0, so 0 <= lnm < ln(2)
            final double[] lnm = lnMant.LN_MANT[(int)((bits & 0x000ffc0000000000L) >> 42)];

            /*
            double epsilon = x / Double.longBitsToDouble(bits & 0xfffffc0000000000L);

            epsilon -= 1.0;
             */

            // y is the most significant 10 bits of the mantissa
            //double y = Double.longBitsToDouble(bits & 0xfffffc0000000000L);
            //double epsilon = (x - y) / y;
            final double epsilon = (bits & 0x3ffffffffffL) / (TWO_POWER_52 + (bits & 0x000ffc0000000000L));

            double lnza = 0.0;
            double lnzb = 0.0;

            if (hiPrec != null) {
            /* split epsilon -> x */
            double tmp = epsilon * HEX_40000000;
            double aa = epsilon + tmp - tmp;
            double ab = epsilon - aa;
            double xa = aa;
            double xb = ab;

            /* Need a more accurate epsilon, so adjust the division. */
            final double numer = bits & 0x3ffffffffffL;
            final double denom = TWO_POWER_52 + (bits & 0x000ffc0000000000L);
            aa = numer - xa*denom - xb * denom;
            xb += aa / denom;

            /* Remez polynomial evaluation */
            final double[] lnCoef_last = LN_HI_PREC_COEF[LN_HI_PREC_COEF.length-1];
            double ya = lnCoef_last[0];
            double yb = lnCoef_last[1];

            for (int i = LN_HI_PREC_COEF.length - 2; i >= 0; i--) {
                /* Multiply a = y * x */
                aa = ya * xa;
                ab = ya * xb + yb * xa + yb * xb;
                /* split, so now y = a */
                tmp = aa * HEX_40000000;
                ya = aa + tmp - tmp;
                yb = aa - ya + ab;

                /* Add  a = y + lnHiPrecCoef */
                final double[] lnCoef_i = LN_HI_PREC_COEF[i];
                aa = ya + lnCoef_i[0];
                ab = yb + lnCoef_i[1];
                /* Split y = a */
                tmp = aa * HEX_40000000;
                ya = aa + tmp - tmp;
                yb = aa - ya + ab;
            }

            /* Multiply a = y * x */
            aa = ya * xa;
            ab = ya * xb + yb * xa + yb * xb;

            /* split, so now lnz = a */
            /*
              tmp = aa * 1073741824.0;
              lnza = aa + tmp - tmp;
              lnzb = aa - lnza + ab;
             */
            lnza = aa + ab;
            lnzb = -(lnza - aa - ab);
            } else {
            /* High precision not required.  Eval Remez polynomial
             using standard double precision */
            lnza = -0.16624882440418567;
            lnza = lnza * epsilon + 0.19999954120254515;
            lnza = lnza * epsilon + -0.2499999997677497;
            lnza = lnza * epsilon + 0.3333333333332802;
            lnza = lnza * epsilon + -0.5;
            lnza = lnza * epsilon + 1.0;
            lnza = lnza * epsilon;
            }

            /* Relative sizes:
             * lnzb     [0, 2.33E-10]
             * lnm[1]   [0, 1.17E-7]
             * ln2B*exp [0, 1.12E-4]
             * lnza      [0, 9.7E-4]
             * lnm[0]   [0, 0.692]
             * ln2A*exp [0, 709]
             */

            /* Compute the following sum:
             * lnzb + lnm[1] + ln2B*exp + lnza + lnm[0] + ln2A*exp;
             */

            //return lnzb + lnm[1] + ln2B*exp + lnza + lnm[0] + ln2A*exp;
            double a = LN_2_A*exp;
            double b = 0.0;
            double c = a+lnm[0];
            double d = -(c-a-lnm[0]);
            a = c;
            b = b + d;

            c = a + lnza;
            d = -(c - a - lnza);
            a = c;
            b = b + d;

            c = a + LN_2_B*exp;
            d = -(c - a - LN_2_B*exp);
            a = c;
            b = b + d;

            c = a + lnm[1];
            d = -(c - a - lnm[1]);
            a = c;
            b = b + d;

            c = a + lnzb;
            d = -(c - a - lnzb);
            a = c;
            b = b + d;

            if (hiPrec != null) {
            hiPrec[0] = a;
            hiPrec[1] = b;
            }

            return a + b;
        }
 public void start(final int delay)
 {
     Task.Delay(delay).ContinueWith(_ =>
                                    backgroundThread = new Thread(_ =>
                                                                  IsBackground = true;
                                                                  sendEvent(reactContext, "backgroundTimer");
Exemple #18
0
    private static boolean repOK_ordered(final BinomialHeapNode node)
    {
        if (node.child != null) {
              if (node.child.key < node.key) {
                return false;
              }
              if (!repOK_ordered(node.child)) {
                return false;
              }
              for (BinomialHeapNode ns = node.child.sibling; ns != null; ns = ns.sibling) {
                if (ns.key < node.key) {
                  return false;
                }
                if (!repOK_ordered(ns)) {
                  return false;
                }
              }
              return true;
            }

            return true;
    }
Exemple #19
0
    private AvlNode find(final int x, final AvlNode arg)
    {
        AvlNode t = arg;
        while (t != null) {

            { /*$goal 0 reachable*/}
            if (x < t.element) {

                { /*$goal 1 reachable*/}
                t = t.left;
            } else if (x > t.element) {

                { /*$goal 2 reachable*/}
                t = t.right;
            } else {

                { /*$goal 3 reachable*/}
                return t; // Match
            }
        }

        { /*$goal 4 reachable*/}
        return null; // No match
    }
 /** Compute the inverse hyperbolic cosine of a number.
  * @param a number on which evaluation is done
  * @return inverse hyperbolic cosine of a
  */
 public static double acosh(final double a)
 {
     return FastMath.log(a + FastMath.sqrt(a * a - 1));
 }
Exemple #21
0
    static void Main(string[] args)
    {
        Console.Write("Enter First name : ");
        string n1   = Console.ReadLine();
        string name = n1.ToUpper(new CultureInfo("en-US", false));

        Console.Write("Enter surname : ");
        string n2     = Console.ReadLine();
        string sname  = n2.ToUpper(new CultureInfo("en-US", false));
        int    valgen = 0;
        string gen;

        do    //GENDER VALIDATION
        {
            Console.Write("Enter Gender M/F : ");
            gen = Console.ReadLine();
            if (gen == "M" | gen == "F")
            {
                valgen = 1;
            }
        }while(valgen == 0);

        string dob;
        bool   res;

        do
        {
            Console.Write("Enter DOB dd/mm/yyyy : ");
            dob = Console.ReadLine();
            final m = new final();
            res = m.DateVal(dob);
        } while (res == false);
        string[,] A = { { name, sname }, { gen, dob } };
        final  s       = new final();
        int    res2    = s.Ccount(sname);
        string sfiscal = "";
        string nfiscal = "";
        var    watch   = new System.Diagnostics.Stopwatch();

        watch.Start();
        if (res2 >= 3)//surname fiscal start
        {
            string res3 = s.sur1cal(sname);
            sfiscal = res3;
        }
        else if (res2 < 3)
        {
            string res3 = s.sur2cal(sname);
            sfiscal = res3;
        }
        else if (sname.Length < 3)
        {
            sfiscal = (sname + "X");
        }     //surname fiscal end

        //name fiscal start
        int res4 = s.Ccount(name);

        if (res4 == 3)
        {
            string res5 = s.sur1cal(name);
            nfiscal = res5;
        }
        else if (res4 > 3)
        {
            string res5 = s.n1cal(name);
            nfiscal = res5;
        }
        else if (res4 < 3)
        {
            string res5 = s.sur2cal(name);
            nfiscal = res5;
        }
        else if (name.Length < 3)
        {
            nfiscal = (name + "X");
        }
        //NAME FISCAL END

        //DOB AND GENDER FISCAL START
        string yearfiscal = dob.Substring(8, 2);
        string month      = dob.Substring(3, 2);
        string mfiscal    = s.getLetter(month);
        string gfiscal    = "";
        int    gffiscal   = 0;

        if (gen == "M")
        {
            gfiscal = dob.Substring(0, 2);
        }
        else if (gen == "F")
        {
            gffiscal = int.Parse(dob.Substring(0, 2));
            gffiscal = gffiscal + 40;
            gfiscal  = gffiscal.ToString();
        }
        //DOB AND GENDER FISCAL END
        Console.WriteLine("Fiscal Code is " + sfiscal + nfiscal + yearfiscal + mfiscal + gfiscal);
        watch.Stop();
        Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms");
        Console.ReadLine();
    }
Exemple #22
0
 /**
  * Natural logarithm.
  *
  * @param x   a double
  * @return log(x)
  */
 public static double log(final double x)
 {
     return(log(x, null));
 }
Exemple #23
0
    /** From CLR **/
    private void fixAfterDeletion(final TreeSetEntry entry)
    {
        TreeSetEntry x = entry;

        while (x != root && colorOf(x) == BLACK) {

            {/*$goal 17 reachable*/}

            if (x == leftOf(parentOf(x))) {

                {/*$goal 18 reachable*/}
                TreeSetEntry sib = rightOf(parentOf(x));

                if (colorOf(sib) == RED) {

                    {/*$goal 19 reachable*/}
                    setColor(sib, BLACK);
                    setColor(parentOf(x), RED);
                    rotateLeft(parentOf(x));
                    sib = rightOf(parentOf(x));
                }

                if (colorOf(leftOf(sib)) == BLACK
                        && colorOf(rightOf(sib)) == BLACK) {

                    {/*$goal 20 reachable*/}

                    setColor(sib, RED);
                    x = parentOf(x);
                } else {
                    if (colorOf(rightOf(sib)) == BLACK) {

                        {/*$goal 21 reachable*/}
                        setColor(leftOf(sib), BLACK);
                        setColor(sib, RED);
                        rotateRight(sib);
                        sib = rightOf(parentOf(x));
                    }
                    setColor(sib, colorOf(parentOf(x)));
                    setColor(parentOf(x), BLACK);
                    setColor(rightOf(sib), BLACK);
                    rotateLeft(parentOf(x));
                    x = root;
                }
            } else { // symmetric
                TreeSetEntry sib = leftOf(parentOf(x));

                if (colorOf(sib) == RED) {

                    {/*$goal 22 reachable*/}
                    setColor(sib, BLACK);
                    setColor(parentOf(x), RED);
                    rotateRight(parentOf(x));
                    sib = leftOf(parentOf(x));
                }

                if (colorOf(rightOf(sib)) == BLACK
                        && colorOf(leftOf(sib)) == BLACK) {

                    {/*$goal 23 reachable*/}
                    setColor(sib, RED);
                    x = parentOf(x);
                } else {
                    if (colorOf(leftOf(sib)) == BLACK) {

                        {/*$goal 24 reachable*/}
                        setColor(rightOf(sib), BLACK);
                        setColor(sib, RED);
                        rotateLeft(sib);
                        sib = leftOf(parentOf(x));
                    }
                    setColor(sib, colorOf(parentOf(x)));
                    setColor(parentOf(x), BLACK);
                    setColor(leftOf(sib), BLACK);
                    rotateRight(parentOf(x));
                    x = root;
                }
            }
        }

        {/*$goal 25 reachable*/}
        setColor(x, BLACK);
    }
Exemple #24
0
    /** From CLR **/
    private void fixAfterInsertion(final TreeSetEntry entry)
    {
        TreeSetEntry x = entry;

        x.color = RED;

        while (x != null && x != root && x.parent.color == RED)
        {
            { /*$goal 10 reachable*/ }

            if (parentOf(x) == leftOf(parentOf(parentOf(x))))
            {
                { /*$goal 11 reachable*/ }
                TreeSetEntry y = rightOf(parentOf(parentOf(x)));
                if (colorOf(y) == RED)
                {
                    { /*$goal 12 reachable*/ }
                    setColor(parentOf(x), BLACK);
                    setColor(y, BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    x = parentOf(parentOf(x));
                }
                else
                {
                    { /*$goal 13 reachable*/ }
                    if (x == rightOf(parentOf(x)))
                    {
                        { /*$goal 14 reachable*/ }
                        x = parentOf(x);
                        rotateLeft(x);
                    }
                    else
                    {
                        { /*$goal 15 reachable*/ }
                    }
                    setColor(parentOf(x), BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    if (parentOf(parentOf(x)) != null)
                    {
                        { /*$goal 16 reachable*/ }
                        rotateRight(parentOf(parentOf(x)));
                    }
                    else
                    {
                        { /*$goal 17 unreachable*/ }                       //source: CLR
                    }
                }
            }
            else
            {
                { /*$goal 18 reachable*/ }
                TreeSetEntry y = leftOf(parentOf(parentOf(x)));
                if (colorOf(y) == RED)
                {
                    { /*$goal 19 reachable*/ }
                    setColor(parentOf(x), BLACK);
                    setColor(y, BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    x = parentOf(parentOf(x));
                }
                else
                {
                    { /*$goal 20 reachable*/ }
                    if (x == leftOf(parentOf(x)))
                    {
                        { /*$goal 21 reachable*/ }
                        x = parentOf(x);
                        rotateRight(x);
                    }
                    else
                    {
                        { /*$goal 22 reachable*/ }
                    }
                    setColor(parentOf(x), BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    if (parentOf(parentOf(x)) != null)
                    {
                        { /*$goal 23 reachable*/ }
                        rotateLeft(parentOf(parentOf(x)));
                    }
                    else
                    {
                        { /*$goal 24 unreachable*/ }                       //source: CLR
                    }
                }
            }
        }
        { /*$goal 25 reachable*/ }
        root.color = BLACK;
    }
Exemple #25
0
 /**
  * {@inheritDoc}
  */
 public override Text createTextNode(final String data) {
     return new DomText(this, data);
 }
Exemple #26
0
    private AvlNode findMin(final AvlNode arg)
    {
        AvlNode t = arg;
        if (t == null) {
            { /*$goal 0 reachable*/}
            return t;
        }

        while (t.left != null) {
            { /*$goal 1 reachable*/}
            t = t.left;
        }

        { /*$goal 2 reachable*/}
        return t;
    }
Exemple #27
0
 /*@ nullable @*/
 publicAvlNode findNode(final int x)
 {
     return find(x, this.root);
 }
Exemple #28
0
    public BinTreeNode remove(final BinTreeNode z)
    {
        BinTreeNode y = null;

        if (z.left == null || z.right == null)
        {
            { /*$goal 0 reachable*/ }
            y = z;
        }
        else
        {
            { /*$goal 1 reachable*/ }
            y = treeSuccessor(z);
        }

        BinTreeNode x = null;

        if (y.left != null)
        {
            { /*$goal 2 reachable*/ }
            x = y.left;
        }
        else
        {
            { /*$goal 3 reachable*/ }
            x = y.right;
        }

        if (x != null)
        {
            { /*$goal 4 reachable*/ }
            x.parent = y.parent;
        }

        if (y.parent == null)
        {
            { /*$goal 5 reachable*/ }
            this.root = x;
        }
        else
        {
            { /*$goal 6 reachable*/ }
            if (y == y.parent.left)
            {
                { /*$goal 7 reachable*/ }
                y.parent.left = x;
            }
            else
            {
                { /*$goal 8 reachable*/ }
                y.parent.right = x;
            }
        }

        if (y != z)
        {
            { /*$goal 9 reachable*/ }
            z.key = y.key;
        }

        { /*$goal 10 reachable*/ }
        return(y);
    }
Exemple #29
0
    public BinTreeNode remove(final BinTreeNode z)
    {
        BinTreeNode y = null;
        if (z.left == null || z.right == null) {
            {/*$goal 0 reachable*/}
            y = z;
        } else {
            {/*$goal 1 reachable*/}
            y = treeSuccessor(z);
        }

        BinTreeNode x = null;
        if (y.left != null) {
            {/*$goal 2 reachable*/}
            x = y.left;
        } else {
            {/*$goal 3 reachable*/}
            x = y.right;
        }

        if (x != null) {
            {/*$goal 4 reachable*/}
            x.parent = y.parent;
        }

        if (y.parent == null) {
            {/*$goal 5 reachable*/}
            this.root = x;
        } else {
            {/*$goal 6 reachable*/}
            if (y == y.parent.left){
                {/*$goal 7 reachable*/}
                y.parent.left = x;
            }else{
                {/*$goal 8 reachable*/}
                y.parent.right = x;
            }
        }

        if (y != z) {
            {/*$goal 9 reachable*/}
            z.key = y.key;
        }

        {/*$goal 10 reachable*/}
        return y;
    }
 // Composite - use to send logging to several destinations
 public LogOutput makeComposite(final LogOutput...loggers)
Exemple #31
0
    private BinTreeNode treeSuccessor(final BinTreeNode x_param)
    {
        BinTreeNode x = x_param;
        BinTreeNode result;
        if (x.right != null) {
            {/*$goal 11 reachable*/}
            result = treeMinimum(x.right);
        } else {
            {/*$goal 12 unreachable*/}
            BinTreeNode y = x.parent;
            while (y != null && x == y.right) {
                {/*$goal 13 unreachable*/}
                x = y;
                y = y.parent;
            }

            result = y;
        }
        {/*$goal 14 reachable*/}
        return result;
    }
Exemple #32
0
 public Comment createComment(final String data) {
     return new DomComment(this, data);
 }
		CGitLsTreeRecord(final String line) {
			final int tab = line.indexOf('\t');
			final int sp1 = line.indexOf(' ');
			final int sp2 = line.indexOf(' ', sp1 + 1);
			mode = Integer.parseInt(line.substring(0, sp1), 8);
			id = ObjectId.fromString(line.substring(sp2 + 1, tab));
			path = line.substring(tab + 1);
		}
Exemple #34
0
    /** From CLR **/
    private void fixAfterDeletion(final TreeSetEntry entry)
    {
        TreeSetEntry x = entry;

        while (x != root && colorOf(x) == BLACK)
        {
            { /*$goal 17 reachable*/ }

            if (x == leftOf(parentOf(x)))
            {
                { /*$goal 18 reachable*/ }
                TreeSetEntry sib = rightOf(parentOf(x));

                if (colorOf(sib) == RED)
                {
                    { /*$goal 19 reachable*/ }
                    setColor(sib, BLACK);
                    setColor(parentOf(x), RED);
                    rotateLeft(parentOf(x));
                    sib = rightOf(parentOf(x));
                }

                if (colorOf(leftOf(sib)) == BLACK &&
                    colorOf(rightOf(sib)) == BLACK)
                {
                    { /*$goal 20 reachable*/ }

                    setColor(sib, RED);
                    x = parentOf(x);
                }
                else
                {
                    if (colorOf(rightOf(sib)) == BLACK)
                    {
                        { /*$goal 21 reachable*/ }
                        setColor(leftOf(sib), BLACK);
                        setColor(sib, RED);
                        rotateRight(sib);
                        sib = rightOf(parentOf(x));
                    }
                    setColor(sib, colorOf(parentOf(x)));
                    setColor(parentOf(x), BLACK);
                    setColor(rightOf(sib), BLACK);
                    rotateLeft(parentOf(x));
                    x = root;
                }
            }
            else                 // symmetric
            {
                TreeSetEntry sib = leftOf(parentOf(x));

                if (colorOf(sib) == RED)
                {
                    { /*$goal 22 reachable*/ }
                    setColor(sib, BLACK);
                    setColor(parentOf(x), RED);
                    rotateRight(parentOf(x));
                    sib = leftOf(parentOf(x));
                }

                if (colorOf(rightOf(sib)) == BLACK &&
                    colorOf(leftOf(sib)) == BLACK)
                {
                    { /*$goal 23 reachable*/ }
                    setColor(sib, RED);
                    x = parentOf(x);
                }
                else
                {
                    if (colorOf(leftOf(sib)) == BLACK)
                    {
                        { /*$goal 24 reachable*/ }
                        setColor(rightOf(sib), BLACK);
                        setColor(sib, RED);
                        rotateLeft(sib);
                        sib = leftOf(parentOf(x));
                    }
                    setColor(sib, colorOf(parentOf(x)));
                    setColor(parentOf(x), BLACK);
                    setColor(leftOf(sib), BLACK);
                    rotateRight(parentOf(x));
                    x = root;
                }
            }
        }

        { /*$goal 25 reachable*/ }
        setColor(x, BLACK);
    }
Exemple #35
0
 public ClusterTestScriptDSL Message(int time, final string msg)
 {
     return(addAction(new ClusterActionAnonymousInnerClass7(this)
                      , time));
 }
Exemple #36
0
    /** From CLR **/
    private void fixAfterInsertion(final TreeSetEntry entry)
    {
        TreeSetEntry x = entry;
        x.color = RED;

        while (x != null && x != root && x.parent.color == RED) {

            {/*$goal 10 reachable*/}

            if (parentOf(x) == leftOf(parentOf(parentOf(x)))) {

                {/*$goal 11 reachable*/}
                TreeSetEntry y = rightOf(parentOf(parentOf(x)));
                if (colorOf(y) == RED) {

                    {/*$goal 12 reachable*/}
                    setColor(parentOf(x), BLACK);
                    setColor(y, BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    x = parentOf(parentOf(x));
                } else {

                    {/*$goal 13 reachable*/}
                    if (x == rightOf(parentOf(x))) {

                        {/*$goal 14 reachable*/}
                        x = parentOf(x);
                        rotateLeft(x);
                    } else {
                        {/*$goal 15 reachable*/}
                    }
                    setColor(parentOf(x), BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    if (parentOf(parentOf(x)) != null) {
                        {/*$goal 16 reachable*/}
                        rotateRight(parentOf(parentOf(x)));
                    } else {
                        {/*$goal 17 unreachable*/} //source: CLR
                    }
                }
            } else {

                {/*$goal 18 reachable*/}
                TreeSetEntry y = leftOf(parentOf(parentOf(x)));
                if (colorOf(y) == RED) {

                    {/*$goal 19 reachable*/}
                    setColor(parentOf(x), BLACK);
                    setColor(y, BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    x = parentOf(parentOf(x));
                } else {

                    {/*$goal 20 reachable*/}
                    if (x == leftOf(parentOf(x))) {

                        {/*$goal 21 reachable*/}
                        x = parentOf(x);
                        rotateRight(x);
                    } else {
                        {/*$goal 22 reachable*/}
                    }
                    setColor(parentOf(x), BLACK);
                    setColor(parentOf(parentOf(x)), RED);
                    if (parentOf(parentOf(x)) != null) {
                        {/*$goal 23 reachable*/}
                        rotateLeft(parentOf(parentOf(x)));
                    } else {
                        {/*$goal 24 unreachable*/} //source: CLR
                    }

                }
            }
        }
        {/*$goal 25 reachable*/}
        root.color = BLACK;
    }
Exemple #37
0
 public ClusterTestScriptDSL VerifyConfigurations(final string description, long time)
 {
     return(addAction(new ClusterActionAnonymousInnerClass8(this)
                      , time));
 }
Exemple #38
0
 /**
  * Internal helper method for natural logarithm function.
  * @param x original argument of the natural logarithm function
  * @param hiPrec extra bits of precision on output (To Be Confirmed)
  * @return log(x)
  */
 private static double log(final double x, final double[] hiPrec)
Exemple #39
0
 public ClusterTestScriptDSL GetRoles(final IDictionary <string, InstanceId> roles)
Exemple #40
0
 private BinTreeNode treeMinimum(final BinTreeNode x_param)
 {
     BinTreeNode x = x_param;
     while (x.left != null) {
         {/*$goal 15 reachable*/}
         x = x.left;
     }
     {/*$goal 16 reachable*/}
     return x;
 }
Exemple #41
0
 public override void Read(final DataInput indexIn, final bool absolute)
	protected void filter(final String path) {
		rw.setTreeFilter(AndTreeFilter.create(PathFilterGroup
				.createFromStrings(Collections.singleton(path)),
				TreeFilter.ANY_DIFF));
	}
Exemple #43
0
	private RefUpdate updateRef(final String name) throws IOException {
Exemple #44
0
 public setPhone(final IPhone phone)
 {
     this.phone = phone;
 }
Exemple #45
0
 /**
  * Natural logarithm.
  *
  * @param x   a double
  * @return log(x)
  */
 public static double log(final double x)
 {
     return log(x, null);
 }
Exemple #46
0
 public override void Seek(final IntIndexInput .Reader other)
Exemple #47
0
 /**
  * Returns an iterator over this buffer's logical vectors, as double[] coordinate arrays. The array returned from a
  * call to Iterator.next() will be newly allocated, and will have length equal to coordsPerVec or minCoordsPerVec,
  * whichever is larger. If minCoordsPerVec is larger than coordsPerVec, then the elements in the returned array will
  * after index "coordsPerVec - 1" will be undefined.
  *
  * @param minCoordsPerVec the minimum number of coordinates returned in each double[] array.
  *
  * @return iterator over this buffer's vectors, as double[] arrays.
  */
 public Iterable <double[]> getCoords(final int minCoordsPerVec)
 {
     return(new Iterable <double[]>()
     {
 public V get(final StringValue key, int hash)
Exemple #49
0
 String                  SituacaoParcelaGet
 (
     final String as_conteudo_arquivo,
Exemple #50
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentUser.type == 2)
            {
                int id;
                //appid
                id = int.Parse(this.GRIDREAL.SelectedItem.ToString().Split(' ', ',', '=')[4]);
                var getuser =
                    from a in app
                    where a.idapplicant == id
                    select a;
                if (getuser.First().hired == false)
                {
                    var DelFromR =
                        from rr in RRTAB
                        where rr.Idapplicant == id
                        select rr;
                    var DelFromR2 =
                        from rr in rAO
                        where rr.Idapplicant == id
                        select rr;
                    int vacid;
                    //get idvac from R
                    foreach (var r in DelFromR)
                    {
                        try
                        {
                            r.vacancies.dateclose = DateTime.Now;
                        }
                        catch (Exception ex)
                        {
                            //MessageBox.Show(ex.Message);
                        }
                    }

                    AddNew           = new final();
                    AddNew.dateclose = DateTime.Now;
                    AddNew.dateopen  = (from v in RRTAB where v.applicant.idapplicant == id select v.vacancies.dateopen).First();

                    try { AddNew.id = (from i in finalTable select i.id).Max() + 1; }
                    catch (Exception) { AddNew.id = 1; }
                    string ab = (from a in getuser select a.FIO).First();
                    AddNew.FIO = ab;
                    if (AddNew.id == null)
                    {
                        AddNew.id = 1;
                    }
                    if (AddNew.FIO.Length >= 20)
                    {
                        AddNew.FIO = AddNew.FIO.Substring(0, 19);
                    }
                    AddNew.Info = (from a in getuser select a.Info).First();
                    if (AddNew.Info == "")
                    {
                        AddNew.Info = "Информация не предоставлена";
                    }
                    if (AddNew.Info.Length >= 100)
                    {
                        AddNew.Info = AddNew.Info.Substring(0, 99);
                    }
                    AddNew.orgname  = CurrentUser.name;
                    AddNew.position = (from a in getuser select a.position).First();
                    if (AddNew.position.Length >= 30)
                    {
                        AddNew.position.Substring(0, 29);
                    }
                    AddNew.salary   = (from a in getuser select a.salary).Max();
                    AddNew.accepted = "Не подтверждено";
                    MessageBox.Show("Вакансия №" + AddNew.id + "\n" + AddNew.dateopen.ToString() + "\n" + AddNew.dateclose.ToString() + "\n" + "\nИнформация о кандидате:\n" + AddNew.Info + "\n\n" + AddNew.orgname + "\nПозиция - " + AddNew.position + "\nОклад - " + AddNew.salary + " рублей\n");
                    foreach (var rr in DelFromR)
                    {
                        RRTAB.DeleteOnSubmit(rr);
                    }

                    /*foreach (var rr in DelFromR2)
                     * {
                     *  rAO.DeleteOnSubmit(rr);
                     * }*/
                    foreach (var h in getuser)
                    {
                        h.hired = true;
                    }
                    finalTable.InsertOnSubmit(AddNew);

                    try
                    {
                        db.SubmitChanges();
                        MessageBox.Show("Кандидат выбран. Он будет уведомлен специальным сообщением.");
                        Update();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Кандидат уже приглашен!");
                }
            }
            else
            {
                MessageBox.Show("Только компании могут приглашать кандидатов.");
            }
        }
Exemple #51
0
        /**
         * Computes log(1 + x).
         *
         * @param x Number.
         * @return {@code log(1 + x)}.
         */
        public static double log1p(final double x)
        {
            if (x == -1) {
            return Double.NEGATIVE_INFINITY;
            }

            if (x == Double.POSITIVE_INFINITY) {
            return Double.POSITIVE_INFINITY;
            }

            if (x > 1e-6 ||
            x < -1e-6) {
            final double xpa = 1 + x;
            final double xpb = -(xpa - 1 - x);

            final double[] hiPrec = new double[2];
            final double lores = log(xpa, hiPrec);
            if (Double.isInfinite(lores)) { // Don't allow this to be converted to NaN
                return lores;
            }

            // Do a taylor series expansion around xpa:
            //   f(x+y) = f(x) + f'(x) y + f''(x)/2 y^2
            final double fx1 = xpb / xpa;
            final double epsilon = 0.5 * fx1 + 1;
            return epsilon * fx1 + hiPrec[1] + hiPrec[0];
            } else {
            // Value is small |x| < 1e6, do a Taylor series centered on 1.
            final double y = (x * F_1_3 - F_1_2) * x + 1;
            return y * x;
            }
        }