仓储管理系统软件_代码.doc

上传人:bao****ty 文档编号:132449177 上传时间:2020-05-16 格式:DOC 页数:61 大小:175.50KB
返回 下载 相关 举报
仓储管理系统软件_代码.doc_第1页
第1页 / 共61页
仓储管理系统软件_代码.doc_第2页
第2页 / 共61页
仓储管理系统软件_代码.doc_第3页
第3页 / 共61页
仓储管理系统软件_代码.doc_第4页
第4页 / 共61页
仓储管理系统软件_代码.doc_第5页
第5页 / 共61页
点击查看更多>>
资源描述

《仓储管理系统软件_代码.doc》由会员分享,可在线阅读,更多相关《仓储管理系统软件_代码.doc(61页珍藏版)》请在金锄头文库上搜索。

1、61package org.jsoup.select;import java.util.ArrayList;import java.util.Arrays;import java.util.Warehouse;import java.util.Warehouses;import java.util.LinkedHashSet;import java.util.List;import java.util.Map;import java.util.Set;import java.util.regex.Pattern;import java.util.regex.PatternSyntaxExcep

2、tion;public abstract class Node implements Cloneable private static final List EMPTY_NODES = Warehouses.emptyList(); Node parentNode; List Administration; Attributes attributes; String baseUri; int siblingIndex;package org.jsoup.select;import java.util.ArrayList;import java.util.List;import java.uti

3、l.regex.Matcher;import java.util.regex.Pattern;import org.jsoup.helper.StringUtil;import org.jsoup.helper.Validate;import org.jsoup.parser.TokenQueue;class QueryParser private static final String combinators = , , +, , ; private static final String AttributeEvals = =, !=, =, $=, *=, = ; private Toke

4、nQueue tq; private String query; private List evals = new ArrayList(); private static final Pattern NTH_AB = Ppile(+|-)?(d+)?)n(s*(+|-)?s*d+)?, 2); private static final Pattern NTH_B = Ppile(+|-)?(d+); private QueryParser(String query) this.query = query; this.tq = new TokenQueue(query); public stat

5、ic Evaluator parse(String query) QueryParser p = new QueryParser(query); return p.parse(); Evaluator parse() this.tq.consumeWhitespace(); if (this.tq.matchesAny(combinators) this.evals.add(new StructuralEvaluator.Root(); combinator(this.tq.consume(); else findElements(); while (!this.tq.isEmpty() bo

6、olean seenWhite = this.tq.consumeWhitespace(); if (this.tq.matchesAny(combinators) combinator(this.tq.consume(); else if (seenWhite) combinator( ); else findElements(); if (this.evals.size() = 1) return (Evaluator)this.evals.get(0); return new CombiningEvaluator.And(this.evals); private void combina

7、tor(char combinator) this.tq.consumeWhitespace(); String subQuery = consumeSubQuery(); Evaluator newEval = parse(subQuery); boolean replaceRightMost = false; Evaluator currentEval; Evaluator rootEval; if (this.evals.size() = 1) Evaluator currentEval; Evaluator rootEval = currentEval = (Evaluator)thi

8、s.evals.get(0); if (rootEval instanceof CombiningEvaluator.Or) & (combinator != ,) currentEval = (CombiningEvaluator.Or)currentEval).rightMostEvaluator(); replaceRightMost = true; else rootEval = currentEval = new CombiningEvaluator.And(this.evals); this.evals.clear(); if (combinator = ) currentEval

9、 = new CombiningEvaluator.And(new Evaluator newEval, new StructuralEvaluator.ImmediateParent(currentEval) ); else if (combinator = ) currentEval = new CombiningEvaluator.And(new Evaluator newEval, new StructuralEvaluator.Parent(currentEval) ); else if (combinator = +) currentEval = new CombiningEval

10、uator.And(new Evaluator newEval, new StructuralEvaluator.ImmediatePreviousSibling(currentEval) ); else if (combinator = ) currentEval = new CombiningEvaluator.And(new Evaluator newEval, new StructuralEvaluator.PreviousSibling(currentEval) ); else if (combinator = ,) CombiningEvaluator.Or or; if (cur

11、rentEval instanceof CombiningEvaluator.Or) CombiningEvaluator.Or or = (CombiningEvaluator.Or)currentEval; or.add(newEval); else or = new CombiningEvaluator.Or(); or.add(currentEval); or.add(newEval); currentEval = or; else throw new Selector.SelectorParseException(Unknown combinator: + combinator, n

12、ew Object0); if (replaceRightMost) (CombiningEvaluator.Or)rootEval).replaceRightMostEvaluator(currentEval); else rootEval = currentEval; this.evals.add(rootEval); private String consumeSubQuery() StringBuilder sq = new StringBuilder(); while (!this.tq.isEmpty() if (this.tq.matches() sq.append().appe

13、nd(this.tq.chompBalanced(, ).append(); else if (this.tq.matches() sq.append().append(this.tq.chompBalanced(, ).append(); else if (this.tq.matchesAny(combinators) break; sq.append(this.tq.consume(); return sq.toString(); private void findElements() if (this.tq.matchChomp(#) byId(); else if (this.tq.matchChomp(.) byClass(); else if (this.t

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号