Package java.math

Examples of java.math.BigInteger.longValue()


    BigInteger x = BigInteger.valueOf(n);
    BigInteger y = x.multiply(x.add(BigInteger.ONE));
    y = y.multiply(x.shiftLeft(1).add(BigInteger.ONE));
    y = y.divide(SIX_BI);
    y = y.mod(MODULUS_BI);
    return y.longValue();
  }
 
}
View Full Code Here


          else
            primaryAgencyId = agencyIdMap.get(gtfsAgency.getId());
         
        }
       
        Agency primaryAgency = Agency.findById(primaryAgencyId.longValue());
       
        agencyTask.completeTask("Imported " + agencyCount + " agencies.", GtfsSnapshotMergeTaskStatus.SUCCESS);
       
        Logger.info("Agencies loaded: " + agencyCount.toString());
        Logger.info("GtfsImporter: importing routes...");
View Full Code Here

        assertEquals("The toIdString() method did not return the correct id", expectedResult, result);

        expectedResult = "fedcba9876543210";
        BigInteger interrum = new BigInteger(expectedResult, 16);
        interrum.subtract(new BigInteger("10000000000000000", 16));
        result = (String)callPrivateMethod(instance, "toIdString", new Class[] {Long.TYPE}, new Object[] {new Long(interrum.longValue())});
        assertEquals("The toIdString() method did not return the correct id", expectedResult, result);

        expectedResult = "0123456789abcdef";
        result = (String)callPrivateMethod(instance, "toIdString", new Class[] {Long.TYPE}, new Object[] {Long.parseLong(expectedResult, 16)});
        assertEquals("The toIdString() method did not return the correct id", expectedResult, result);
View Full Code Here

        } else {
            if (number.bitLength() > 63 && !number.equals(MAX_LONG)) {
                throw new NumberFormatException(literal);
            }
        }
        return number.longValue();
    }


    /**
     * 指定のリテラルが表現する{@link String}型の値を返す。
View Full Code Here

        AstLiteral stripeSize = take(environment, attribute, elements, ELEMENT_STRIPE_SIZE, LiteralKind.INTEGER);
        if (stripeSize != null) {
            String label = label(ELEMENT_STRIPE_SIZE);
            BigInteger value = stripeSize.toIntegerValue();
            if (AttributeUtil.checkRange(environment, stripeSize, label, value, MINIMUM_STRIPE_SIZE, Long.MAX_VALUE)) {
                result.configuration().withStripeSize(value.longValue());
            }
        }
    }

    private AstLiteral take(
View Full Code Here

            // find another pair q, r such that a = q b + r
            BigInteger bigK = BigInteger.valueOf(k);
            BigInteger q = q0.subtract(bigK);
            BigInteger r = r0.add(bigK.multiply(bigB));
            if (r.abs().compareTo(bigB.abs()) < 0 &&
                (r.longValue() == 0l || ((r.longValue() ^ b) & 0x8000000000000000l) == 0)) {
                if (fd.compareTo(q) < 0) {
                    fd = q;
                }
            }
        }
View Full Code Here

            // find another pair q, r such that a = q b + r
            BigInteger bigK = BigInteger.valueOf(k);
            BigInteger q = q0.subtract(bigK);
            BigInteger r = r0.add(bigK.multiply(bigB));
            if (r.abs().compareTo(bigB.abs()) < 0 &&
                (r.longValue() == 0l || ((r.longValue() ^ b) & 0x8000000000000000l) == 0)) {
                if (fd.compareTo(q) < 0) {
                    fd = q;
                }
            }
        }
View Full Code Here

    public static TripShape createFromEncoded(String encoded) {
     
       
      BigInteger tripShapeId = TripShape.nativeInsert(TripShape.em(), "", generateLinestring(encoded), 0.0);

        return TripShape.findById(tripShapeId.longValue());
    }

    public static TripShape createFromPattern(TripPattern tp) {
     
      List<String> points = new ArrayList<String>();
View Full Code Here

          String linestring = "LINESTRING(" + StringUtils.join(points, ", ") + ")";
         
         
          BigInteger tripShapeId = TripShape.nativeInsert(TripShape.em(), "", linestring, 0.0);

            return TripShape.findById(tripShapeId.longValue());
        }
        else
          return null;
       
    }
View Full Code Here

        "  VALUES(?, ?, ?, ?, ?);");
    else
      q = em.createNativeQuery("INSERT INTO trippattern (id, name, route_id, headsign)" +
            "  VALUES(?, ?, ?, ?);");

        q.setParameter(1,  tripPatternId.longValue())
        .setParameter(2,  trip.route.routeShortName + "(" + trip.tripHeadsign + ")")
        .setParameter(3,  trip.route.id)
        .setParameter(4,  trip.tripHeadsign);

        if(trip.shape != null)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.