/* * (non-Javadoc) * @see com.lexst.db.view.View#getChunkIds() */ @Override public Set<Long> getChunkIds() { Set<Long> all = new TreeSet<Long>(); for (IdentitySet set : mapSet.values()) { all.addAll(set.keySet()); } return all; }
/** * get all worksite * * @return */ public WorkSite[] batch() { WorkSite[] sites = null; super.lockMulti(); try { int size = mapSite.size(); if (size > 0) { sites = new WorkSite[size]; mapSite.values().toArray(sites); } } catch (Throwable exp) { Logger.fatal(exp); } finally { super.unlockMulti(); } return sites; }
/* * (non-Javadoc) * @see com.lexst.db.view.View#find(com.lexst.db.statement.Condition) */ @Override public Set<Long> find(Condition condi) { IndexColumn num = condi.getValue(); if (num == null || num.getClass() != ShortIndex.class) { throw new IllegalArgumentException("null pointer or invalid index!"); } short value = ((ShortIndex) num).getValue(); // 找到范围分片截止点 HashSet<Long> all = new HashSet<Long>(1024); // 列名在左,参数值在右(固定!, 检查可以的范围) switch (condi.getCompare()) { case Condition.EQUAL: for (ShortRange range : mapSet.keySet()) { if (range.inside(value)) { IdentitySet set = mapSet.get(range); all.addAll(set.keySet()); } } break; case Condition.NOT_EQUAL: for (ShortRange range : mapSet.keySet()) { if (range.getBegin() != value || range.getEnd() != value) { IdentitySet set = mapSet.get(range); all.addAll(set.keySet()); } } break; case Condition.LESS: for (ShortRange range : mapSet.keySet()) { if (range.getBegin() < value || range.getEnd() < value) { IdentitySet set = mapSet.get(range); all.addAll(set.keySet()); } } break; case Condition.LESS_EQUAL: for (ShortRange range : mapSet.keySet()) { if (range.getBegin() <= value || range.getEnd() <= value) { IdentitySet set = mapSet.get(range); all.addAll(set.keySet()); } } break; case Condition.GREATER: for (ShortRange range : mapSet.keySet()) { if (range.getBegin() > value || range.getEnd() > value) { IdentitySet set = mapSet.get(range); all.addAll(set.keySet()); } } break; case Condition.GREATER_EQUAL: for (ShortRange range : mapSet.keySet()) { if (range.getBegin() >= value || range.getEnd() >= value) { IdentitySet set = mapSet.get(range); all.addAll(set.keySet()); } } break; case Condition.LIKE: for (IdentitySet set : mapSet.values()) { all.addAll(set.keySet()); } break; } return all; }