Java Code Examples for com.gs.fw.common.mithra.finder.Operation#equals()
The following examples show how to use
com.gs.fw.common.mithra.finder.Operation#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DelegatingList.java From reladomo with Apache License 2.0 | 5 votes |
protected void zSetOperation(Operation op) { if (op.equals(this.operation)) { this.operation = op; } else { throw new RuntimeException("cannot change operation"); } }
Example 2
Source File: TestMappedOperation.java From reladomo with Apache License 2.0 | 5 votes |
public void testEqualityAfterMapping() { Operation throughRel = OrderFinder.items().state().eq("x"); Operation mapped = new MappedOperation(OrderFinder.zGetOrderItemsReverseMapper(), OrderItemFinder.state().eq("x")); assertEquals(throughRel, mapped); throughRel = OrderFinder.items().discountPrice().absoluteValue().greaterThan(6); mapped = new MappedOperation(OrderFinder.zGetOrderItemsReverseMapper(), OrderItemFinder.discountPrice().absoluteValue().greaterThan(6)); assertEquals(throughRel, mapped); throughRel = OrderFinder.items().state().eq("x").and(OrderFinder.items().discountPrice().absoluteValue().greaterThan(6)); mapped = new MappedOperation(OrderFinder.zGetOrderItemsReverseMapper(), OrderItemFinder.state().eq("x").and(OrderItemFinder.discountPrice().absoluteValue().greaterThan(6))); assertEquals(throughRel, mapped); throughRel = UserFinder.groups().locations().city().eq("NY"); mapped = new MappedOperation(UserFinder.zGetUserGroupsReverseMapper(), new MappedOperation(GroupFinder.zGetGroupLocationsReverseMapper(), LocationFinder.city().eq("NY"))); assertEquals(throughRel, mapped); throughRel = UserFinder.groups().locations().city().eq("NY").and(UserFinder.groups().manager().id().eq(1)); mapped = new MappedOperation(UserFinder.zGetUserGroupsReverseMapper(), new MappedOperation(GroupFinder.zGetGroupLocationsReverseMapper(), LocationFinder.city().eq("NY"))); mapped = mapped.and(new MappedOperation(UserFinder.zGetUserGroupsReverseMapper(), new MappedOperation(GroupFinder.zGetGroupManagerReverseMapper(), UserFinder.id().eq(1)))); throughRel.equals(mapped); assertEquals(throughRel, mapped); new UserList(throughRel.and(UserFinder.sourceId().eq(0))).forceResolve(); }
Example 3
Source File: LruQueryIndex.java From reladomo with Apache License 2.0 | 4 votes |
public synchronized CachedQuery get(Operation op, boolean forRelationship) { int hash = op.hashCode(); int i = indexFor(hash, table.length); Entry prev = table[i]; Entry e = prev; long live = timeToLive; if (forRelationship) live = relationshipTimeToLive; while (true) { if (e == null) return null; CachedQuery candidate = e.getCachedQuery(); if (candidate != null && e.hash == hash && op.equals(candidate.getOperation())) { if (candidate.isExpired()) { unlink(e); size--; if (prev == e) table[i] = e.next; else prev.next = e.next; candidate = null; } else if (live == 0 || ((TimedEntry)e).isValid(live)) { relink(e); } else { candidate = null; } return candidate; } prev = e; e = e.next; } }