本文整理汇总了Java中org.apache.commons.collections15.set.ListOrderedSet类的典型用法代码示例。如果您正苦于以下问题:Java ListOrderedSet类的具体用法?Java ListOrderedSet怎么用?Java ListOrderedSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListOrderedSet类属于org.apache.commons.collections15.set包,在下文中一共展示了ListOrderedSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOutputColumnsForPlanNode
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Get the set of columns
*
* @param catalog_db
* @param node
* @return
*/
public static Collection<Column> getOutputColumnsForPlanNode(final Database catalog_db, AbstractPlanNode node) {
final PlannerContext pcontext = PlannerContext.singleton();
final Collection<Integer> planColumnIds = getOutputColumnIdsForPlanNode(node);
final Set<Column> columns = new ListOrderedSet<Column>();
for (Integer column_guid : planColumnIds) {
PlanColumn planColumn = pcontext.get(column_guid);
assert (planColumn != null);
AbstractExpression exp = planColumn.getExpression();
assert (exp != null);
Collection<Column> exp_cols = ExpressionUtil.getReferencedColumns(catalog_db, exp);
if (debug.val)
LOG.debug(planColumn.toString() + " => " + exp_cols);
columns.addAll(exp_cols);
} // FOR
return (columns);
}
示例2: getOutputExpressionsForPlanNode
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Get the set of columns
*
* @param catalogContext
* @param node
* @return
*/
public static Collection<AbstractExpression> getOutputExpressionsForPlanNode(AbstractPlanNode node) {
final PlannerContext pcontext = PlannerContext.singleton();
final Collection<Integer> planColumnIds = getOutputColumnIdsForPlanNode(node);
final Collection<AbstractExpression> exps = new ListOrderedSet<AbstractExpression>();
for (Integer column_guid : planColumnIds) {
PlanColumn planColumn = pcontext.get(column_guid);
assert (planColumn != null);
AbstractExpression exp = planColumn.getExpression();
assert (exp != null);
exps.add(exp);
} // FOR
return (exps);
}
示例3: getLocalPartitions
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* For a given base partition id, return the list of partitions that are on
* same node as the base partition
*
* @param catalog_db
* @param base_partition
* @return
*/
public static Collection<Partition> getLocalPartitions(Database catalog_db, int base_partition) {
Set<Partition> partitions = new ListOrderedSet<Partition>();
// First figure out what partition we are in the catalog
Cluster catalog_clus = CatalogUtil.getCluster(catalog_db);
assert (catalog_clus != null);
Partition catalog_part = CatalogUtil.getPartitionById(catalog_clus, base_partition);
assert (catalog_part != null);
Site catalog_site = catalog_part.getParent();
assert (catalog_site != null);
Host catalog_host = catalog_site.getHost();
assert (catalog_host != null);
// Now look at what other partitions are on the same host that we are
for (Site other_site : catalog_clus.getSites()) {
if (other_site.getHost().equals(catalog_host) == false)
continue;
LOG.trace(catalog_host + " => " + CatalogUtil.debug(other_site.getPartitions()));
CollectionUtil.addAll(partitions, other_site.getPartitions());
} // FOR
return (partitions);
}
示例4: findAll
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* @param <T>
* @param <U>
* @param items
* @param field
* @param value
* @return
*/
public static <T extends CatalogType, U> Set<T> findAll(Iterable<T> items, String field, U value) {
Set<T> found = new ListOrderedSet<T>();
for (T catalog_item : items) {
assert (catalog_item != null);
try {
Object field_value = catalog_item.getField(field);
if (field_value.equals(value))
found.add(catalog_item);
} catch (NullPointerException ex) {
LOG.fatal(catalog_item + ": " + catalog_item.getFields());
LOG.fatal(catalog_item + " does not have a field '" + field + "'");
throw ex;
}
} // FOR
return (found);
}
示例5: get
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Return the ith element of a set. Super lame
*
* @param <T>
* @param items
* @param idx
* @return
*/
public static <T> T get(Iterable<T> items, int idx) {
if (items == null) {
return (null);
}
else if (items instanceof List<?>) {
return ((List<T>) items).get(idx);
}
else if (items instanceof ListOrderedSet<?>) {
return ((ListOrderedSet<T>) items).get(idx);
}
else if (items instanceof SortedSet<?> && idx == 0) {
SortedSet<T> set = (SortedSet<T>)items;
return (set.isEmpty() ? null : set.first());
}
int ctr = 0;
for (T t : items) {
if (ctr++ == idx) return (t);
}
return (null);
}
示例6: getRoots
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Get the lists of roots for this graph.
* This probably won't work if the graph is undirected
* @return
*/
public synchronized Set<V> getRoots() {
boolean recompute = false;
// First time
if (this.roots == null) {
this.roots = new ListOrderedSet<V>();
recompute = true;
// Check whether it's been marked as dirty. If it hasn't, then
// we know that our cache is still valid
} else if (this.isDirty(DirtyIndex.ROOTS)) {
recompute = true;
}
if (recompute) {
this.roots.clear();
for (V v : this.graph.getVertices()) {
if (this.graph.getPredecessorCount(v) == 0) {
this.roots.add(v);
}
} // FOR
// Probably a race condition
this.resetDirty(DirtyIndex.ROOTS);
}
return (Collections.unmodifiableSet(this.roots));
}
示例7: testExtractInsertColumnSet
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* testExtractInsertColumnSet
*/
public void testExtractInsertColumnSet() throws Exception {
Table catalog_tbl = this.getTable("HISTORY");
Procedure catalog_proc = this.getProcedure(paymentByCustomerId.class);
Statement catalog_stmt = this.getStatement(catalog_proc, "insertHistory");
assertNotNull(catalog_stmt);
PredicatePairs cset = CatalogUtil.extractStatementPredicates(catalog_stmt, false, catalog_tbl);
// System.out.println(cset.debug());
// Column -> StmtParameter Index
Set<Pair<Column, Integer>> expected_columns = new ListOrderedSet<Pair<Column, Integer>>();
for (Column catalog_col : CatalogUtil.getSortedCatalogItems(catalog_tbl.getColumns(), "index")) {
assertNotNull(catalog_col);
expected_columns.add(Pair.of(catalog_col, catalog_col.getIndex()));
} // FOR
System.err.println(StringUtil.columns("EXPECTED:\n" + StringUtil.join("\n", expected_columns), "ACTUAL:\n" + StringUtil.join("\n", cset)));
this.checkColumnSet(cset, expected_columns);
}
示例8: getOutputColumnIdsForPlanNode
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* @param node
* @return
*/
public static Collection<Integer> getOutputColumnIdsForPlanNode(AbstractPlanNode node) {
final Collection<Integer> planColumnIds = new ListOrderedSet<Integer>();
// 2011-07-20: Using the AbstractExpressions is the more accurate way of
// getting the
// Columns referenced in the output
// If this is Scan that has an inline Projection, grab those too
if ((node instanceof AbstractScanPlanNode) && node.getInlinePlanNode(PlanNodeType.PROJECTION) != null) {
ProjectionPlanNode prj_node = node.getInlinePlanNode(PlanNodeType.PROJECTION);
planColumnIds.addAll(prj_node.getOutputColumnGUIDs());
if (debug.val)
LOG.debug(prj_node.getPlanNodeType() + ": " + planColumnIds);
} else {
planColumnIds.addAll(node.getOutputColumnGUIDs());
if (debug.val)
LOG.debug(node.getPlanNodeType() + ": " + planColumnIds);
}
// If this is an AggregatePlanNode, then we also need to include columns
// computed in the aggregates
if (node instanceof AggregatePlanNode) {
AggregatePlanNode agg_node = (AggregatePlanNode) node;
planColumnIds.addAll(agg_node.getAggregateColumnGuids());
if (debug.val)
LOG.debug(node.getPlanNodeType() + ": " + agg_node.getAggregateColumnGuids());
}
return (planColumnIds);
}
示例9: getPartitionIds
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
public Collection<Integer> getPartitionIds(String host, int site) {
Set<Integer> ids = new ListOrderedSet<Integer>();
for (PartitionConfiguration pc : this.getPartitions(host, site)) {
ids.add(pc.partition);
} // FOR
return (ids);
}
示例10: getForeignKeyDependents
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Returns all the columns for this table that have a foreign key dependency
* on another table
*
* @param catalog_tbl
* @return
*/
public static Collection<Column> getForeignKeyDependents(Table catalog_tbl) {
Set<Column> found = new ListOrderedSet<Column>();
for (Column catalog_col : catalog_tbl.getColumns()) {
assert (catalog_col != null);
if (!catalog_col.getConstraints().isEmpty()) {
// System.out.println(catalog_col + ": " +
// CatalogUtil.getConstraints(catalog_col.getConstraints()));
if (!CatalogUtil.findAll(CatalogUtil.getConstraints(catalog_col.getConstraints()), "type", ConstraintType.FOREIGN_KEY.getValue()).isEmpty()) {
found.add(catalog_col);
}
}
} // FOR
return (found);
}
示例11: getReferencedTables
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Returns all the tables access/modified in all the Statements for this
* Procedure
*
* @param catalog_proc
* @return
* @throws Exception
*/
public static Collection<Table> getReferencedTables(Procedure catalog_proc) throws Exception {
final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_proc);
Set<Table> ret = cache.PROCEDURE_TABLES.get(catalog_proc);
if (ret == null) {
Set<Table> tables = new ListOrderedSet<Table>();
for (Statement catalog_stmt : catalog_proc.getStatements()) {
tables.addAll(CatalogUtil.getReferencedTables(catalog_stmt));
} // FOR
ret = Collections.unmodifiableSet(tables);
cache.PROCEDURE_TABLES.put(catalog_proc, ret);
}
return (ret);
}
示例12: getReferencedColumns
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Returns all the columns access/modified in all the Statements for this
* Procedure
*
* @param catalog_proc
* @return
* @throws Exception
*/
public static Collection<Column> getReferencedColumns(Procedure catalog_proc) throws Exception {
final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_proc);
Set<Column> ret = cache.PROCEDURE_COLUMNS.get(catalog_proc);
if (ret == null) {
Set<Column> columns = new ListOrderedSet<Column>();
for (Statement catalog_stmt : catalog_proc.getStatements()) {
columns.addAll(CatalogUtil.getReferencedColumns(catalog_stmt));
} // FOR
ret = Collections.unmodifiableSet(columns);
cache.PROCEDURE_COLUMNS.put(catalog_proc, ret);
}
return (ret);
}
示例13: getReferencingProcedures
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Returns all of the procedures that access/modify the given table
*
* @param catalog_tbl
* @return
* @throws Exception
*/
public static Collection<Procedure> getReferencingProcedures(Table catalog_tbl) throws Exception {
Set<Procedure> ret = new ListOrderedSet<Procedure>();
Database catalog_db = CatalogUtil.getDatabase(catalog_tbl);
for (Procedure catalog_proc : catalog_db.getProcedures()) {
if (catalog_proc.getSystemproc())
continue;
if (CatalogUtil.getReferencedTables(catalog_proc).contains(catalog_tbl)) {
ret.add(catalog_proc);
}
} // FOR
return (ret);
}
示例14: getOrderByColumns
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Return all the Columns used in ORDER BY clauses for the given Statement
*
* @param catalog_stmt
* @return
*/
public static Collection<Column> getOrderByColumns(Statement catalog_stmt) {
if (debug.val)
LOG.debug("Extracting order-by columns from statement " + CatalogUtil.getDisplayName(catalog_stmt));
final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_stmt);
Set<Column> ret = cache.STATEMENT_ORDERBY_COLUMNS.get(catalog_stmt);
if (ret == null) {
Database catalog_db = CatalogUtil.getDatabase(catalog_stmt);
ret = new ListOrderedSet<Column>();
try {
AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, true);
assert (root != null);
PlannerContext context = PlannerContext.singleton();
for (OrderByPlanNode node : PlanNodeUtil.getPlanNodes(root, OrderByPlanNode.class)) {
for (Integer guid : node.getSortColumnGuids()) {
PlanColumn pcol = context.get(guid);
assert (pcol != null);
ret.addAll(ExpressionUtil.getReferencedColumns(catalog_db, pcol.getExpression()));
} // FOR
} // FOR
} catch (Throwable ex) {
throw new RuntimeException("Failed to retrieve ORDER BY columns for " + catalog_stmt.fullName());
}
cache.STATEMENT_ORDERBY_COLUMNS.put(catalog_stmt, ret);
}
return (ret);
}
示例15: getReferencedTablesForPlanNode
import org.apache.commons.collections15.set.ListOrderedSet; //导入依赖的package包/类
/**
* Return all of the tables referenced in the given AbstractPlanNode
* Non-recursive.
*
* @param catalog_db
* @param node
* @return
* @throws Exception
*/
public static Collection<Table> getReferencedTablesForPlanNode(final Database catalog_db,
final AbstractPlanNode node) {
final Set<Table> ret = new ListOrderedSet<Table>();
try {
CatalogUtil.getReferencedTablesForPlanNode(catalog_db, node, ret);
} catch (Exception ex) {
throw new RuntimeException("Failed to get referenced tables for " + node, ex);
}
return (ret);
}