本文整理汇总了Java中org.codehaus.jparsec.functors.Map类的典型用法代码示例。如果您正苦于以下问题:Java Map类的具体用法?Java Map怎么用?Java Map使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Map类属于org.codehaus.jparsec.functors包,在下文中一共展示了Map类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mapFromString
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
Map<String, Fragment<Stripping>> mapFromString ()
{
return new Map<String, Fragment<Stripping>>() {
@Override
public Fragment<Stripping> map (String from)
{
if (from.equals("-"))
return new Fragment<>(Stripping.ALL, StripTag.this);
else if (from.equals("+"))
return new Fragment<>(Stripping.NONE, StripTag.this);
else if (from.equals("!"))
return new Fragment<>(Stripping.LINE, StripTag.this);
throw new IllegalArgumentException(from);
}
@Override
public String toString ()
{
return String.valueOf(this);
}
};
}
开发者ID:impl,项目名称:yashiro,代码行数:24,代码来源:Tag.java
示例2: map
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
Map<T, Fragment<T>> map ()
{
return new Map<T, Fragment<T>>()
{
@Override
public Fragment<T> map (T from)
{
return new Fragment<>(from, Tag.this);
}
@Override
public String toString ()
{
return Tag.this.toString();
}
};
}
开发者ID:impl,项目名称:yashiro,代码行数:18,代码来源:Tag.java
示例3: mapWith
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
public <T extends StmtNode> StatementParser mapWith (final Map<ContentMatchMap, T> map)
{
checkNotNull(map);
return new StatementParser()
{
@Override
public String getPackage()
{
return callables.getPackageName();
}
@Override
public String getName ()
{
return callables.getName();
}
@Override
public Parser<T> parser (Cont cont)
{
ContentParserBuilder content = contents.getContent();
return cont.name().next(content.parser().map(map));
}
};
}
开发者ID:impl,项目名称:yashiro,代码行数:27,代码来源:StatementWithoutBodyParserBuilder.java
示例4: forUnitParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
private static Parser<TypeContext> forUnitParser() {
return token("for_unit").next(Parsers.or(matrixTermBang(), TYPEIDENTIFIER).sepBy(token(","))).map(
new Map<List<TypeNode>, TypeContext>() {
public TypeContext map(List<TypeNode> nodes) {
TypeContext context = new TypeContext();
for (TypeNode node : nodes) {
if (node instanceof TypeIdentifierNode) {
context.addUnitVar(((TypeIdentifierNode) node).getName());
} else {
context.addUnitVar(((BangTypeNode) node).toText());
}
}
return context;
}
});
}
开发者ID:pgriffel,项目名称:pacioli,代码行数:17,代码来源:Reader.java
示例5: statementSequenceParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
private static Parser<ExpressionNode> statementSequenceParser(
Parser<ExpressionNode> statementParser,
Parser<ExpressionNode> expParser) {
return Parsers
.or(assignmentStatementParser(expParser),
tupleAssignmentParser(expParser),
ifStatementParser(statementParser, expParser),
whileStatementParser(statementParser, expParser),
returnStatementParser(expParser),
applicationParser(expParser).followedBy(token(";"))).many1()
.map(new Map<List<ExpressionNode>, ExpressionNode>() {
public ExpressionNode map(List<ExpressionNode> body) {
assert (0 < body.size());
Location loc = body.get(0).getLocation()
.join(body.get(body.size() - 1).getLocation());
return new SequenceNode(loc, body);
}
});
}
开发者ID:pgriffel,项目名称:pacioli,代码行数:20,代码来源:Reader.java
示例6: elseRestIflessParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
private static Parser<List<Pair<ExpressionNode, ExpressionNode>>> elseRestIflessParser(
Parser<ExpressionNode> statementParser,
Parser<ExpressionNode> expParser,
Parser<List<Pair<ExpressionNode, ExpressionNode>>> restParser) {
return statementParser
.followedBy(token("end"))
.map(new Map<ExpressionNode, List<Pair<ExpressionNode, ExpressionNode>>>() {
public List<Pair<ExpressionNode, ExpressionNode>> map(
ExpressionNode body) {
return Arrays
.asList(new Pair<ExpressionNode, ExpressionNode>(
new ConstNode("true", body
.getLocation()), body));
}
});
}
开发者ID:pgriffel,项目名称:pacioli,代码行数:17,代码来源:Reader.java
示例7: assignmentParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
private static Parser<Map<ExpressionNode, ExpressionNode>> assignmentParser(
Parser<ExpressionNode> expParser, String accu) {
return Parsers
.sequence(
EXPIDENTIFIER,
token(":=").next(expParser),
new Map2<IdentifierNode, ExpressionNode, Map<ExpressionNode, ExpressionNode>>() {
public Map<ExpressionNode, ExpressionNode> map(
final IdentifierNode var,
final ExpressionNode value) {
return new Map<ExpressionNode, ExpressionNode>() {
public ExpressionNode map(
ExpressionNode rest) {
Location loc = var.getLocation().join(
value.getLocation());
return new ApplicationNode(
new LambdaNode(
freshUnderscores(Arrays.asList(var
.getName())),
rest, loc), Arrays
.asList(value), loc);
}
};
}
});
}
开发者ID:pgriffel,项目名称:pacioli,代码行数:27,代码来源:Reader.java
示例8: filterParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
private static Parser<Map<ExpressionNode, ExpressionNode>> filterParser(
Parser<ExpressionNode> expParser, String list, final String accu) {
return expParser
.map(new Map<ExpressionNode, Map<ExpressionNode, ExpressionNode>>() {
public Map<ExpressionNode, ExpressionNode> map(
final ExpressionNode cond) {
return new Map<ExpressionNode, ExpressionNode>() {
public ExpressionNode map(ExpressionNode rest) {
return new BranchNode(cond, rest,
new IdentifierNode(accu, cond
.getLocation()), cond
.getLocation());
}
};
}
});
}
开发者ID:pgriffel,项目名称:pacioli,代码行数:18,代码来源:Reader.java
示例9: qlSelectParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
protected <OperatorT extends QlConstraintOperator> Parser<QlSelectStatement> qlSelectParser(
ConstraintOperatorSupport<OperatorT> opSupport) {
return paddedRegex("SELECT", true, false)
.next(Parsers.tuple(fieldsParser().followedBy(paddedRegex("FROM", true, false)),
alphaNumeric(),
padWithWhitespace(whereClauseParser(opSupport).optional(), true),
padWithWhitespace(orderByParser().optional(), false),
padWithWhitespace(pageConstraintParser().optional(), false))
.map(new Map<Tuple5<List<QlField>, String, QlBooleanConstraintNode, List<QlSortClause>, QlPageConstraints>,
QlSelectStatement>() {
@Override
public QlSelectStatement map(Tuple5<List<QlField>, String, QlBooleanConstraintNode,
List<QlSortClause>, QlPageConstraints> arg0) {
return QlSelectStatement.builder()
.setFields(arg0.a)
.setCollection(arg0.b)
.setConstraints(arg0.c)
.setSortConstraints(arg0.d)
.setPageConstraints(arg0.e)
.build();
}
}));
}
开发者ID:lithiumtech,项目名称:starql,代码行数:24,代码来源:JparsecQueryMarkupManager.java
示例10: fieldOrFunctionParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
protected Parser<QlField> fieldOrFunctionParser() {
Parser.Reference<QlField> fieldOrFuncParserRef = Parser.newReference();
Parser<Tuple3<String, QlField, Boolean>> simpleParser = simpleFieldParser();
Parser<Tuple3<String, QlField, Boolean>> fieldParser = fieldParser(fieldOrFuncParserRef);
Parser<QlField> fieldOrFuncParser =
Parsers.or(functionParser(fieldOrFuncParserRef), fieldParser,
simpleParser).map(
new Map<Tuple3<String, QlField, Boolean>, QlField>() {
@Override
public QlField map(Tuple3<String, QlField, Boolean> fieldInfo) {
return QlField.create(null, fieldInfo.a, fieldInfo.b,
fieldInfo.c);
}
});
fieldOrFuncParserRef.lazySet(fieldOrFuncParser);
return fieldOrFuncParser;
}
开发者ID:lithiumtech,项目名称:starql,代码行数:18,代码来源:JparsecQueryMarkupManager.java
示例11: fieldOrFunctionParserOB
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
protected Parser<Pair<QlField, QlSortOrderType>> fieldOrFunctionParserOB() {
Parser.Reference<Pair<QlField, QlSortOrderType>> fieldOrFuncParserRef = Parser.newReference();
Parser<Tuple3<String, Pair<QlField, QlSortOrderType>, Boolean>> simpleParser = simpleFieldParserOB();
Parser<Tuple3<String, Pair<QlField, QlSortOrderType>, Boolean>> fieldParser = fieldParserOB(fieldOrFuncParserRef);
Parser<Pair<QlField, QlSortOrderType>> fieldOrFuncParser =
Parsers.or(functionParserOB(fieldOrFuncParserRef), fieldParser,
simpleParser).map(
new Map<Tuple3<String, Pair<QlField, QlSortOrderType>, Boolean>, Pair<QlField, QlSortOrderType>>() {
@Override
public Pair<QlField, QlSortOrderType> map(Tuple3<String, Pair<QlField, QlSortOrderType>, Boolean> fieldInfo) {
return new Pair<QlField, QlSortOrderType>(QlField.create(null, fieldInfo.a, fieldInfo.b.a,
fieldInfo.c), QlSortOrderType.DEFAULT);
}
});
fieldOrFuncParserRef.lazySet(fieldOrFuncParser);
return fieldOrFuncParser;
}
开发者ID:lithiumtech,项目名称:starql,代码行数:18,代码来源:JparsecQueryMarkupManager.java
示例12: qualifiedFieldOrFunctionParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
protected Parser<QlField> qualifiedFieldOrFunctionParser() {
Parser.Reference<QlField> fieldOrFuncParserRef = Parser.newReference();
Parser<Tuple3<String, QlField, Boolean>> simpleParser = simpleFieldParser();
Parser<Tuple3<String, QlField, Boolean>> fieldParser = fieldParser(fieldOrFuncParserRef);
Parser<String> qualifierParser = regex("[a-zA-Z]+\\s+", false)
.followedBy(regex("from", false).not().peek()).atomic().optional(null);
Parser<QlField> fieldOrFuncParser = Parsers.pair(qualifierParser,
Parsers.or(functionParser(fieldOrFuncParserRef), fieldParser,
simpleParser)).map(
new Map<Pair<String, Tuple3<String, QlField, Boolean>>, QlField>() {
@Override
public QlField map(
Pair<String, Tuple3<String, QlField, Boolean>> fieldInfo) {
String qualifier = fieldInfo.a == null ? null : fieldInfo.a.trim();
return QlField.create(qualifier, fieldInfo.b.a, fieldInfo.b.b,
fieldInfo.b.c);
}
});
fieldOrFuncParserRef.lazySet(fieldOrFuncParser);
return fieldOrFuncParser;
}
开发者ID:lithiumtech,项目名称:starql,代码行数:22,代码来源:JparsecQueryMarkupManager.java
示例13: collectionValueParser
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
/**
* A collection is a constraint value consisting of a pair of parentheses around a comma-separated
* list of constraint values, as defined above excluding collections, so it is not recursive.
*
* @return ConstraintValueCollection containing ConstraintValues *MAY BE OF DIFFERENT TYPES*
*/
protected Parser<QlConstraintValueCollection<? extends QlConstraintValue>> collectionValueParser() {
return padWithWhitespace(
Parsers.or(executableValueParser(), stringValueParser(),
numericalValueParser(), booleanValueParser()), false)
.sepBy(padWithWhitespace(regex(",", true), false))
.between(padWithWhitespace(regex("\\(", true), false),
padWithWhitespace(regex("\\)", true), false))
.map(new Map<List<QlConstraintValue>, QlConstraintValueCollection<? extends QlConstraintValue>>() {
@Override
public QlConstraintValueCollection<? extends QlConstraintValue> map(
List<QlConstraintValue> arg0) {
return new QlConstraintValueCollection<QlConstraintValue>(
arg0);
}
});
}
开发者ID:lithiumtech,项目名称:starql,代码行数:24,代码来源:JparsecQueryMarkupManager.java
示例14: parseGroupByClause
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
static GroupByClause parseGroupByClause(String text, java.util.Map<String, String> aliases) {
if(Strings.isNullOrEmpty(text)) {
return null;
}
text = Preprocessor.applyAliases(text, aliases);
Parser<Expression> expr = ExpressionParser.groupByExpression();
Parser<GroupByClause> groupByParser = Mapper.curry(GroupByClause.class).sequence(expr.sepBy1(term(",")));
return TerminalParser.parse(groupByParser, text);
}
开发者ID:indeedeng,项目名称:iql,代码行数:11,代码来源:StatementParser.java
示例15: parseWhereClause
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
public static WhereClause parseWhereClause(String text, java.util.Map<String, String> aliases) {
if(Strings.isNullOrEmpty(text)) {
return null;
}
text = Preprocessor.applyAliases(text, aliases);
final Expression whereExpression = ExpressionParser.parseWhereExpression(text);
return new WhereClause(whereExpression);
}
开发者ID:indeedeng,项目名称:iql,代码行数:10,代码来源:StatementParser.java
示例16: parseSelectClause
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
public static SelectClause parseSelectClause(String text, java.util.Map<String, String> aliases) {
if(Strings.isNullOrEmpty(text)) {
return defaultSelect();
}
text = Preprocessor.applyAliases(text, aliases);
Parser<Expression> expr = ExpressionParser.expression();
Parser<List<Expression>> selectParser = expr.sepBy1(term(","));
List<Expression> result = TerminalParser.parse(selectParser, text);
if(result == null || result.size() == 0) {
return defaultSelect();
}
return new SelectClause(result);
}
开发者ID:indeedeng,项目名称:iql,代码行数:15,代码来源:StatementParser.java
示例17: statement
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
Parser<StmtNode> statement (final Parser<BodyListNode> lazy)
{
return NAME_PARSER.peek().next(
new Map<List<String>, Parser<? extends StmtNode>>()
{
@Override
public Parser<? extends StmtNode> map (List<String> names)
{
String name = Joiner.on('.').join(names);
boolean useShortNames = names.size() == 1;
List<Parser<? extends StmtNode>> parsers = Lists.newLinkedList();
ListMultimap<String, StatementParser> candidateMap = useShortNames
? statementParsersWithShortNames
: statementParsers;
List<StatementParser> candidates = candidateMap.get(name);
if (candidates != null) {
for (StatementParser candidate : candidates) {
ContImpl cont = new ContImpl(candidate, lazy, useShortNames);
parsers.add(Marker.mark(candidate.parser(cont)));
}
}
if (parsers.isEmpty())
throw new RuntimeException("statement '" + name + "' is not registered");
return Parsers.longest(parsers);
}
});
}
开发者ID:impl,项目名称:yashiro,代码行数:33,代码来源:BodyParser.java
示例18: ContentParserBuilder
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
ContentParserBuilder()
{
out.add(Parsers.always().map(new Map<Object, ListMultimap<String, ExprNode>>() {
@Override
public ListMultimap<String, ExprNode> map (Object o)
{
return result();
}
}));
}
开发者ID:impl,项目名称:yashiro,代码行数:11,代码来源:ContentParserBuilder.java
示例19: wordWithGroup
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
public ContentParserBuilder wordWithGroup (final String group, String... name)
{
for (int i = 0; i < out.size(); i++) {
out.set(i, out.get(i).followedBy(name(name)).map(new Map<ListMultimap<String, ExprNode>, ListMultimap<String, ExprNode>>() {
@Override
public ListMultimap<String, ExprNode> map (ListMultimap<String, ExprNode> from)
{
from.put(group, null);
return from;
}
}));
}
return this;
}
开发者ID:impl,项目名称:yashiro,代码行数:16,代码来源:ContentParserBuilder.java
示例20: flatten
import org.codehaus.jparsec.functors.Map; //导入依赖的package包/类
public static <T> Parser<List<T>> flatten (Parser<List<List<T>>> parser)
{
return parser.map(new Map<List<List<T>>, List<T>>() {
@Override
public List<T> map (List<List<T>> from)
{
return Lists.newArrayList(Iterables.concat(Iterables.filter(from, Predicates.notNull())));
}
});
}
开发者ID:impl,项目名称:yashiro,代码行数:11,代码来源:Parsers2.java
注:本文中的org.codehaus.jparsec.functors.Map类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论