本文整理汇总了Java中com.gs.collections.impl.set.mutable.primitive.IntHashSet类的典型用法代码示例。如果您正苦于以下问题:Java IntHashSet类的具体用法?Java IntHashSet怎么用?Java IntHashSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntHashSet类属于com.gs.collections.impl.set.mutable.primitive包,在下文中一共展示了IntHashSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCursorWithLargeInClauseAndEmptyTable
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testCursorWithLargeInClauseAndEmptyTable() throws Exception
{
IntHashSet set = new IntHashSet();
for (int i = 0; i < 1000000; i++)
{
set.add(i);
}
OrderFinder.findMany(OrderFinder.all()).deleteAll();
OrderFinder.findMany(OrderFinder.orderId().in(set)).forEachWithCursor(new DoWhileProcedure()
{
public boolean execute(Object o)
{
fail();
return true;
}
});
}
示例2: testDayOfMonthTimestampRetrieval
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testDayOfMonthTimestampRetrieval()
{
AllTypesList list = AllTypesFinder.findMany(AllTypesFinder.timestampValue().dayOfMonth().eq(1));
assertEquals(1, list.size());
IntHashSet intSet = new IntHashSet();
intSet.addAll(1, 2, 3, 4);
Operation eq2 = TimestampConversionFinder.timestampValueNone().dayOfMonth().in(intSet);
TimestampConversionList one2 = TimestampConversionFinder.findMany(eq2);
int size2 = one2.size();
assertEquals(4, size2);
IntHashSet intSet2 = new IntHashSet();
intSet2.addAll(1, 2, 3, 4);
Operation eq3 = TimestampConversionFinder.timestampValueUTC().dayOfMonth().in(intSet2);
TimestampConversionList one3 = TimestampConversionFinder.findMany(eq3);
int size3 = one3.size();
assertEquals(2, size3);
IntHashSet intSet3 = new IntHashSet();
intSet3.addAll(1, 2, 3, 4);
Operation eq4 = TimestampConversionFinder.timestampValueDB().dayOfMonth().in(intSet3);
TimestampConversionList one4 = TimestampConversionFinder.findMany(eq4);
int size4 = one4.size();
assertEquals(3, size4);
}
示例3: zInWithMax
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
@Override
public Operation zInWithMax(int maxInClause, List objects, Extractor extractor)
{
IntExtractor integerExtractor = (IntExtractor) extractor;
MutableIntSet set = new IntHashSet();
for (int i = 0; i < objects.size(); i++)
{
Object o = objects.get(i);
if (!integerExtractor.isAttributeNull(o))
{
set.add(integerExtractor.intValueOf(o));
if (set.size() > maxInClause)
{
return new None(this);
}
}
}
return this.in(set);
}
示例4: checkLargeInClause
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
private void checkLargeInClause(int initialId, int setSize)
{
IntHashSet idSet = new IntHashSet(setSize);
for(int i = 0; i < setSize; i++)
{
idSet.add(initialId+i);
}
AllTypesFinder.clearQueryCache();
Operation op = AllTypesFinder.id().in(idSet);
AllTypesList list = new AllTypesList(op);
final ArrayList resultsFromCursor = new ArrayList(setSize);
list.forEachWithCursor(new DoWhileProcedure()
{
public boolean execute(Object object)
{
resultsFromCursor.add(object);
return true;
}
});
assertEquals(list.size(), resultsFromCursor.size());
}
示例5: testDeleteAllPreCached
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testDeleteAllPreCached() throws SQLException
{
OrderList list = new OrderList(OrderFinder.userId().eq(1));
IntHashSet deletedIds = new IntHashSet();
for(int i=0;i<list.size();i++)
{
deletedIds.add(list.getOrderAt(i).getOrderId());
}
list.deleteAll();
IntIterator it = deletedIds.intIterator();
while(it.hasNext())
{
this.checkOrderDoesNotExist(it.next());
}
OrderList list2 = new OrderList(OrderFinder.userId().eq(1));
assertEquals(0, list2.size());
}
示例6: testLargeInClauseInParallel
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testLargeInClauseInParallel()
{
int initialId = 10000;
int setSize = 5200;
AllTypesList allTypesList = this.createNewAllTypesList(initialId, setSize);
allTypesList.insertAll();
IntHashSet idSet = new IntHashSet(setSize);
for(int i = 0; i < setSize; i++)
{
idSet.add(initialId+i);
}
AllTypesFinder.clearQueryCache();
final Operation op = AllTypesFinder.id().in(idSet);
final String sql = "select * from ALL_TYPES where ID >= "+initialId;
AllTypesList list = new AllTypesList(op);
list.setNumberOfParallelThreads(5);
validateMithraResult(list, sql, 1);
}
示例7: testAggregateListWithLargeIn
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testAggregateListWithLargeIn()
{
IntHashSet set = new IntHashSet();
for(int i=0;i<2000;i++)
{
set.add(i);
}
AggregateList list = new AggregateList(SalesLineItemFinder.itemId().in(set));
list.addGroupBy("manufacturer", SalesLineItemFinder.manufacturerId());
list.addAggregateAttribute("quantity", SalesLineItemFinder.quantity().sum());
assertEquals(2, list.size());
// AggregateData data = list.get(0);
// assertEquals(2, data.getAttributeAsInt("div"));
// boolean haveOne = data.getAttributeAsInt("manufacturer") == 1;
// boolean haveTwo = data.getAttributeAsInt("manufacturer") == 2;
//
// data = list.get(1);
// assertEquals(2, data.getAttributeAsInt("div"));
// haveOne = haveOne || data.getAttributeAsInt("manufacturer") == 1;
// haveTwo = haveTwo || data.getAttributeAsInt("manufacturer") == 2;
//
// assertTrue(haveOne);
// assertTrue(haveTwo);
}
示例8: testAggregateListOrderBy
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testAggregateListOrderBy()
{
IntHashSet set = new IntHashSet();
for(int i=0;i<2000;i++)
{
set.add(i);
}
AggregateList list = new AggregateList(SalesLineItemFinder.itemId().in(set));
list.addGroupBy("manufacturer", SalesLineItemFinder.manufacturerId());
list.addAggregateAttribute("quantity", SalesLineItemFinder.quantity().sum());
assertEquals(2, list.size());
list.addOrderBy("quantity", true);
assertEquals(89, list.get(0).getAttributeAsInteger("quantity"));
assertEquals(241, list.get(1).getAttributeAsInteger("quantity"));
}
示例9: testInTransactionCachedQuery
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testInTransactionCachedQuery() throws Exception
{
final Timestamp buzDate = new Timestamp(timestampFormat.parse("2008-01-01 00:00:00.000").getTime());
MithraManagerProvider.getMithraManager().executeTransactionalCommand(new TransactionalCommand<Object>()
{
@Override
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
Operation op = BitemporalOrderItemFinder.businessDate().eq(buzDate).and(BitemporalOrderItemFinder.state().eq("In-Progress")).
and(BitemporalOrderItemFinder.processingDate().eq(BitemporalOrderItemFinder.processingDate().getInfinityDate()));
BitemporalOrderItemList items = BitemporalOrderItemFinder.findMany(op);
assertEquals(4, items.size());
IntHashSet set = new IntHashSet();
set.add(2);
set.add(3);
BitemporalOrderItemList secondTry = BitemporalOrderItemFinder.findMany(op.and(BitemporalOrderItemFinder.order().description().eq("First order")));
assertEquals(1, secondTry.size());
return null;
}
});
}
示例10: checkLargeInClause
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
private void checkLargeInClause(int initialId, int setSize)
{
IntHashSet idSet = new IntHashSet(setSize);
for(int i = 0; i < setSize; i++)
{
idSet.add(initialId+i);
}
AllTypesIqFinder.clearQueryCache();
Operation op = AllTypesIqFinder.id().in(idSet);
AllTypesIqList list = new AllTypesIqList(op);
final ArrayList resultsFromCursor = new ArrayList(setSize);
list.forEachWithCursor(new DoWhileProcedure()
{
public boolean execute(Object object)
{
resultsFromCursor.add(object);
return true;
}
});
assertEquals(list.size(), resultsFromCursor.size());
}
示例11: fixmetestDeleteAllInBatchesWithIn
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void fixmetestDeleteAllInBatchesWithIn()
{
OrderList list = createOrderList(5000, 1000);
list.bulkInsertAll();
IntHashSet ids = new IntHashSet(5000);
for(int i = 1000; i < (6000);i++)
{
ids.add(i);
}
OrderList firstList = new OrderList(OrderFinder.orderId().in(ids));
firstList.deleteAllInBatches(500);
validateMithraResult(OrderFinder.userId().eq(999), "SELECT * FROM ORDERS WHERE USER_ID = 999", 0);
}
示例12: testParameterizedRelationships
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testParameterizedRelationships()
{
Operation stringParamOperation = ParentTypeFinder.nameEquals("value").exists();
assertEquals("ParentType.nameEquals(ParentType filters: none, ParentType filters: ParentType.name = \"value\") exists", stringParamOperation.toString());
Operation doubleParamOperation = OrderFinder.cheapItems(1.00).exists();
assertEquals("Order.cheapItems(OrderItem.originalPrice < 1.0) exists", doubleParamOperation.toString());
Operation intParamOperation = OrderFinder.itemForProduct(2).exists();
assertEquals("Order.itemForProduct(OrderItem.productId = 2) exists", intParamOperation.toString());
IntHashSet intSet = IntHashSet.newSetWith(3, 4);
Operation inParamOperation = OrderFinder.itemForProductSet(intSet).exists();
assertTrue("Order.itemForProductSet(OrderItem.productId in [3, 4]) exists".equals(inParamOperation.toString())
|| "Order.itemForProductSet(OrderItem.productId in [4, 3]) exists".equals(inParamOperation.toString()));
Operation timestampParamOperation = TradeFinder.tradesByTradeRef(Timestamp.valueOf("2010-12-31 23:59:00.0"), Timestamp.valueOf("2011-01-01 23:59:00.0")).exists();
assertEquals("Trade.tradesByTradeRef(Trade filters: none, Trade filters: Trade.processingDate = \"2011-01-01 23:59:00.0\" & Trade.businessDate = \"2010-12-31 23:59:00.0\") exists", timestampParamOperation.toString());
}
示例13: testTwoLargeInClause
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testTwoLargeInClause()
{
int initialId = 10000;
int setSize = 8000;
AllTypesList allTypesList = this.createNewAllTypesList(initialId, setSize);
allTypesList.insertAll();
IntHashSet idSet = new IntHashSet(setSize);
IntHashSet otherSet = new IntHashSet(setSize);
otherSet.add(2000000000);
for(int i = 0; i < setSize; i++)
{
idSet.add(initialId+i);
otherSet.add(i);
}
AllTypesFinder.clearQueryCache();
Operation op = AllTypesFinder.id().in(idSet).and(AllTypesFinder.intValue().in(otherSet));
String sql = "select * from ALL_TYPES where ID >= "+initialId;
validateMithraResult(op, sql);
}
示例14: testDeleteAllInBatchesWithIn
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testDeleteAllInBatchesWithIn()
{
OrderList list = createOrderList(5000, 1000);
list.bulkInsertAll();
IntHashSet ids = new IntHashSet(5000);
for(int i = 1000; i < (6000);i++)
{
ids.add(i);
}
OrderList firstList = new OrderList(OrderFinder.orderId().in(ids));
firstList.deleteAllInBatches(500);
validateMithraResult(OrderFinder.userId().eq(999), "SELECT * FROM ORDERS WHERE USER_ID = 999", 0);
}
示例15: testInClauseCausesFlush
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入依赖的package包/类
public void testInClauseCausesFlush()
{
MithraManagerProvider.getMithraManager().executeTransactionalCommand(
new TransactionalCommand()
{
public Object executeTransaction(MithraTransaction tran) throws Throwable
{
Order order = new Order();
order.setOrderId(1000);
order.setState("x");
order.setUserId(1);
order.setOrderDate(new Timestamp(System.currentTimeMillis()));
order.setDescription("t");
order.insert();
IntHashSet set = new IntHashSet();
set.add(1000);
set.add(1001);
assertEquals(1, OrderFinder.findMany(OrderFinder.orderId().in(set)).size());
return null;
}
});
}