當前位置: 首頁>>代碼示例>>Java>>正文


Java BigInt類代碼示例

本文整理匯總了Java中scala.math.BigInt的典型用法代碼示例。如果您正苦於以下問題:Java BigInt類的具體用法?Java BigInt怎麽用?Java BigInt使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BigInt類屬於scala.math包,在下文中一共展示了BigInt類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convert

import scala.math.BigInt; //導入依賴的package包/類
@Override
public EnumValue convert(Object val, Multiplicity m) throws AtlasException {
    if (val != null) {
        EnumValue e = null;
        if (val instanceof EnumValue) {
            e = valueMap.get(((EnumValue) val).value);
        } else if (val instanceof Integer || val instanceof BigInt) {
            e = ordinalMap.get(val);
        } else if (val instanceof String) {
            e = valueMap.get(val);
        } else if (val instanceof Number) {
            e = ordinalMap.get(((Number) val).intValue());
        }

        if (e == null) {
            throw new ValueConversionException(this, val);
        }
        return e;
    }
    return convertNull(m);
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:22,代碼來源:EnumType.java

示例2: testGroupByGenericType

import scala.math.BigInt; //導入依賴的package包/類
@Test
public void testGroupByGenericType() throws Exception {
	/*
	 * Group by generic type
	 */
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	env.setParallelism(1);

	DataSet<CollectionDataSets.PojoWithCollection> ds = CollectionDataSets.getPojoWithCollection(env);

	// f0.f0 is first integer
	DataSet<String> reduceDs = ds.groupBy("bigInt")
			.reduceGroup(new GroupReducer8());
	List<String> result = reduceDs.collect();
	ExecutionConfig ec = env.getConfig();

	// check if automatic type registration with Kryo worked
	Assert.assertTrue(ec.getRegisteredKryoTypes().contains(BigInt.class));
	Assert.assertFalse(ec.getRegisteredKryoTypes().contains(java.sql.Date.class));

	String expected = null;

	String localExpected = "[call\n" +
			"For key 92233720368547758070 we got:\n" +
			"PojoWithCollection{pojos.size()=2, key=0, sqlDate=2033-05-18, bigInt=92233720368547758070, bigDecimalKeepItNull=null, scalaBigInt=10, mixed=[{someKey=1}, /this/is/wrong, uhlala]}\n" +
			"For key 92233720368547758070 we got:\n" +
			"PojoWithCollection{pojos.size()=2, key=0, sqlDate=1976-05-03, bigInt=92233720368547758070, bigDecimalKeepItNull=null, scalaBigInt=31104000, mixed=null}]";

	Assert.assertEquals(localExpected, result.toString());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:31,代碼來源:GroupReduceITCase.java

示例3: getPojoWithCollection

import scala.math.BigInt; //導入依賴的package包/類
public static DataSet<PojoWithCollection> getPojoWithCollection(ExecutionEnvironment env) {
	List<PojoWithCollection> data = new ArrayList<>();

	List<Pojo1> pojosList1 = new ArrayList<>();
	pojosList1.add(new Pojo1("a", "aa"));
	pojosList1.add(new Pojo1("b", "bb"));

	List<Pojo1> pojosList2 = new ArrayList<>();
	pojosList2.add(new Pojo1("a2", "aa2"));
	pojosList2.add(new Pojo1("b2", "bb2"));

	PojoWithCollection pwc1 = new PojoWithCollection();
	pwc1.pojos = pojosList1;
	pwc1.key = new IntValue(0);
	pwc1.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc1.scalaBigInt = BigInt.int2bigInt(10);
	pwc1.bigDecimalKeepItNull = null;
	
	// use calendar to make it stable across time zones
	GregorianCalendar gcl1 = new GregorianCalendar(2033, 04, 18);
	pwc1.sqlDate = new java.sql.Date(gcl1.getTimeInMillis());
	pwc1.mixed = new ArrayList<Object>();
	Map<StringValue, IntValue> map = new HashMap<>();
	map.put(new StringValue("someKey"), new IntValue(1));
	pwc1.mixed.add(map);
	pwc1.mixed.add(new File("/this/is/wrong"));
	pwc1.mixed.add("uhlala");

	PojoWithCollection pwc2 = new PojoWithCollection();
	pwc2.pojos = pojosList2;
	pwc2.key = new IntValue(0);
	pwc2.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc2.scalaBigInt = BigInt.int2bigInt(31104000);
	pwc2.bigDecimalKeepItNull = null;
	
	GregorianCalendar gcl2 = new GregorianCalendar(1976, 4, 3);
	pwc2.sqlDate = new java.sql.Date(gcl2.getTimeInMillis()); // 1976

	data.add(pwc1);
	data.add(pwc2);

	return env.fromCollection(data);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:44,代碼來源:ValueCollectionDataSets.java

示例4: getPojoWithCollection

import scala.math.BigInt; //導入依賴的package包/類
public static DataSet<PojoWithCollection> getPojoWithCollection(ExecutionEnvironment env) {
	List<PojoWithCollection> data = new ArrayList<>();

	List<Pojo1> pojosList1 = new ArrayList<>();
	pojosList1.add(new Pojo1("a", "aa"));
	pojosList1.add(new Pojo1("b", "bb"));

	List<Pojo1> pojosList2 = new ArrayList<>();
	pojosList2.add(new Pojo1("a2", "aa2"));
	pojosList2.add(new Pojo1("b2", "bb2"));

	PojoWithCollection pwc1 = new PojoWithCollection();
	pwc1.pojos = pojosList1;
	pwc1.key = 0;
	pwc1.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc1.scalaBigInt = BigInt.int2bigInt(10);
	pwc1.bigDecimalKeepItNull = null;
	
	// use calendar to make it stable across time zones
	GregorianCalendar gcl1 = new GregorianCalendar(2033, 4, 18);
	pwc1.sqlDate = new java.sql.Date(gcl1.getTimeInMillis());
	pwc1.mixed = new ArrayList<>();
	Map<String, Integer> map = new HashMap<>();
	map.put("someKey", 1); // map.put("anotherKey", 2); map.put("third", 3);
	pwc1.mixed.add(map);
	pwc1.mixed.add(new File("/this/is/wrong"));
	pwc1.mixed.add("uhlala");

	PojoWithCollection pwc2 = new PojoWithCollection();
	pwc2.pojos = pojosList2;
	pwc2.key = 0;
	pwc2.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc2.scalaBigInt = BigInt.int2bigInt(31104000);
	pwc2.bigDecimalKeepItNull = null;
	
	GregorianCalendar gcl2 = new GregorianCalendar(1976, 4, 3);
	pwc2.sqlDate = new java.sql.Date(gcl2.getTimeInMillis()); // 1976


	data.add(pwc1);
	data.add(pwc2);

	return env.fromCollection(data);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:45,代碼來源:CollectionDataSets.java

示例5: getPojoWithCollection

import scala.math.BigInt; //導入依賴的package包/類
public static DataSet<PojoWithCollection> getPojoWithCollection(ExecutionEnvironment env) {
	List<PojoWithCollection> data = new ArrayList<>();

	List<Pojo1> pojosList1 = new ArrayList<>();
	pojosList1.add(new Pojo1("a", "aa"));
	pojosList1.add(new Pojo1("b", "bb"));

	List<Pojo1> pojosList2 = new ArrayList<>();
	pojosList2.add(new Pojo1("a2", "aa2"));
	pojosList2.add(new Pojo1("b2", "bb2"));

	PojoWithCollection pwc1 = new PojoWithCollection();
	pwc1.pojos = pojosList1;
	pwc1.key = new IntValue(0);
	pwc1.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc1.scalaBigInt = BigInt.int2bigInt(10);
	pwc1.bigDecimalKeepItNull = null;

	// use calendar to make it stable across time zones
	GregorianCalendar gcl1 = new GregorianCalendar(2033, 04, 18);
	pwc1.sqlDate = new java.sql.Date(gcl1.getTimeInMillis());
	pwc1.mixed = new ArrayList<Object>();
	Map<StringValue, IntValue> map = new HashMap<>();
	map.put(new StringValue("someKey"), new IntValue(1));
	pwc1.mixed.add(map);
	pwc1.mixed.add(new File("/this/is/wrong"));
	pwc1.mixed.add("uhlala");

	PojoWithCollection pwc2 = new PojoWithCollection();
	pwc2.pojos = pojosList2;
	pwc2.key = new IntValue(0);
	pwc2.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc2.scalaBigInt = BigInt.int2bigInt(31104000);
	pwc2.bigDecimalKeepItNull = null;

	GregorianCalendar gcl2 = new GregorianCalendar(1976, 4, 3);
	pwc2.sqlDate = new java.sql.Date(gcl2.getTimeInMillis()); // 1976

	data.add(pwc1);
	data.add(pwc2);

	return env.fromCollection(data);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:44,代碼來源:ValueCollectionDataSets.java

示例6: getPojoWithCollection

import scala.math.BigInt; //導入依賴的package包/類
public static DataSet<PojoWithCollection> getPojoWithCollection(ExecutionEnvironment env) {
	List<PojoWithCollection> data = new ArrayList<>();

	List<Pojo1> pojosList1 = new ArrayList<>();
	pojosList1.add(new Pojo1("a", "aa"));
	pojosList1.add(new Pojo1("b", "bb"));

	List<Pojo1> pojosList2 = new ArrayList<>();
	pojosList2.add(new Pojo1("a2", "aa2"));
	pojosList2.add(new Pojo1("b2", "bb2"));

	PojoWithCollection pwc1 = new PojoWithCollection();
	pwc1.pojos = pojosList1;
	pwc1.key = 0;
	pwc1.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc1.scalaBigInt = BigInt.int2bigInt(10);
	pwc1.bigDecimalKeepItNull = null;

	// use calendar to make it stable across time zones
	GregorianCalendar gcl1 = new GregorianCalendar(2033, 4, 18);
	pwc1.sqlDate = new java.sql.Date(gcl1.getTimeInMillis());
	pwc1.mixed = new ArrayList<>();
	Map<String, Integer> map = new HashMap<>();
	map.put("someKey", 1); // map.put("anotherKey", 2); map.put("third", 3);
	pwc1.mixed.add(map);
	pwc1.mixed.add(new File("/this/is/wrong"));
	pwc1.mixed.add("uhlala");

	PojoWithCollection pwc2 = new PojoWithCollection();
	pwc2.pojos = pojosList2;
	pwc2.key = 0;
	pwc2.bigInt = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN);
	pwc2.scalaBigInt = BigInt.int2bigInt(31104000);
	pwc2.bigDecimalKeepItNull = null;

	GregorianCalendar gcl2 = new GregorianCalendar(1976, 4, 3);
	pwc2.sqlDate = new java.sql.Date(gcl2.getTimeInMillis()); // 1976

	data.add(pwc1);
	data.add(pwc2);

	return env.fromCollection(data);
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:44,代碼來源:CollectionDataSets.java


注:本文中的scala.math.BigInt類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。