- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.netflix.spectator.impl.matcher.ZeroOrMoreMatcher.<init>()
方法的一些代码示例,展示了ZeroOrMoreMatcher.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroOrMoreMatcher.<init>()
方法的具体详情如下:
包路径:com.netflix.spectator.impl.matcher.ZeroOrMoreMatcher
类名称:ZeroOrMoreMatcher
方法名:<init>
[英]Create a new instance.
[中]创建一个新实例。
代码示例来源:origin: Netflix/spectator
@Override
public Matcher mergeNext(Matcher after) {
if (after instanceof TrueMatcher) {
return this;
}
Matcher m = (next instanceof TrueMatcher) ? after : SeqMatcher.create(next, after);
return new ZeroOrMoreMatcher(repeated, m);
}
代码示例来源:origin: Netflix/spectator
@Override
public Matcher rewriteEnd(Function<Matcher, Matcher> f) {
return f.apply(new ZeroOrMoreMatcher(repeated, next.rewriteEnd(f)));
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override
public Matcher mergeNext(Matcher after) {
if (after instanceof TrueMatcher) {
return this;
}
Matcher m = (next instanceof TrueMatcher) ? after : SeqMatcher.create(next, after);
return new ZeroOrMoreMatcher(repeated, m);
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override
public Matcher rewriteEnd(Function<Matcher, Matcher> f) {
return f.apply(new ZeroOrMoreMatcher(repeated, next.rewriteEnd(f)));
}
代码示例来源:origin: Netflix/spectator
@Override
public Matcher rewrite(Function<Matcher, Matcher> f) {
return f.apply(new ZeroOrMoreMatcher(repeated.rewrite(f), next.rewrite(f)));
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override
public Matcher rewrite(Function<Matcher, Matcher> f) {
return f.apply(new ZeroOrMoreMatcher(repeated.rewrite(f), next.rewrite(f)));
}
代码示例来源:origin: Netflix/spectator
@Test
public void removeSequentialMatchAny() {
Matcher input = new ZeroOrMoreMatcher(
AnyMatcher.INSTANCE,
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, AnyMatcher.INSTANCE)
);
Matcher expected = new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, AnyMatcher.INSTANCE);
Assertions.assertEquals(expected, Optimizer.removeSequentialMatchAny(input));
}
代码示例来源:origin: Netflix/spectator
/**
* Get the prefix matcher. This is similar to {@link #head(Matcher)} except that it can
* reach into character sequences as well as higher level sequences.
*/
static Matcher getPrefix(Matcher matcher) {
if (matcher instanceof SeqMatcher) {
List<Matcher> ms = matcher.<SeqMatcher>as().matchers();
return ms.get(0);
} else if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
return new ZeroOrMoreMatcher(zm.repeated(), TrueMatcher.INSTANCE);
} else if (matcher instanceof CharSeqMatcher) {
String pattern = matcher.<CharSeqMatcher>as().pattern();
return pattern.isEmpty() ? null : new CharSeqMatcher(pattern.charAt(0));
} else {
return matcher;
}
}
代码示例来源:origin: Netflix/spectator
@Test
public void convertRepeatedAnyCharSeqToIndexOf() {
Matcher input = new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, SeqMatcher.create(
new CharSeqMatcher("abc"),
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, SeqMatcher.create(
new CharSeqMatcher("def"),
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, TrueMatcher.INSTANCE)
))
));
Matcher expected = SeqMatcher.create(
new IndexOfMatcher(
"abc",
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, SeqMatcher.create(
new CharSeqMatcher("def"),
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, TrueMatcher.INSTANCE)
))
)
);
Assertions.assertEquals(expected, Optimizer.convertRepeatedAnyCharSeqToIndexOf(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void removeStartFollowedByMatchAny() {
Matcher input = SeqMatcher.create(
StartMatcher.INSTANCE,
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, AnyMatcher.INSTANCE)
);
Matcher expected = new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, AnyMatcher.INSTANCE);
Assertions.assertEquals(expected, Optimizer.removeStartFollowedByMatchAny(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void extractPrefixFromOr() {
Matcher a = new CharSeqMatcher("a");
Matcher b = new CharSeqMatcher("b");
Matcher input = OrMatcher.create(
new ZeroOrMoreMatcher(a, AnyMatcher.INSTANCE),
new ZeroOrMoreMatcher(a, a),
new ZeroOrMoreMatcher(a, b)
);
Matcher expected = SeqMatcher.create(
new ZeroOrMoreMatcher(a, TrueMatcher.INSTANCE),
OrMatcher.create(AnyMatcher.INSTANCE, a, b)
);
Assertions.assertEquals(expected, Optimizer.extractPrefixFromOr(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void inlineMatchAnyPrecedingOr() {
Matcher a = new CharSeqMatcher("a");
Matcher b = new CharSeqMatcher("b");
Matcher input = new ZeroOrMoreMatcher(
AnyMatcher.INSTANCE,
OrMatcher.create(a, b)
);
Matcher expected = OrMatcher.create(
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, a),
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, b)
);
Assertions.assertEquals(expected, Optimizer.inlineMatchAnyPrecedingOr(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void zeroOrMoreFalse_Next() {
Matcher input = new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, FalseMatcher.INSTANCE);
Matcher expected = FalseMatcher.INSTANCE;
Assertions.assertEquals(expected, Optimizer.zeroOrMoreFalse(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void zeroOrMoreFalse_Repeated() {
Matcher input = new ZeroOrMoreMatcher(FalseMatcher.INSTANCE, AnyMatcher.INSTANCE);
Matcher expected = AnyMatcher.INSTANCE;
Assertions.assertEquals(expected, Optimizer.zeroOrMoreFalse(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void removeTrailingMatchAny() {
Matcher input = new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, EndMatcher.INSTANCE);
Matcher expected = TrueMatcher.INSTANCE;
Assertions.assertEquals(expected, Optimizer.removeTrailingMatchAny(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void removeRepeatedStart() {
Matcher input = new ZeroOrMoreMatcher(StartMatcher.INSTANCE, AnyMatcher.INSTANCE);
Matcher expected = AnyMatcher.INSTANCE;
Assertions.assertEquals(expected, Optimizer.removeRepeatedStart(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void zeroOrMoreMergeNext() {
Matcher input = SeqMatcher.create(
AnyMatcher.INSTANCE,
new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, AnyMatcher.INSTANCE),
AnyMatcher.INSTANCE
);
Matcher expected = SeqMatcher.create(
AnyMatcher.INSTANCE,
new ZeroOrMoreMatcher(
AnyMatcher.INSTANCE,
SeqMatcher.create(AnyMatcher.INSTANCE, AnyMatcher.INSTANCE))
);
Assertions.assertEquals(expected, Optimizer.mergeNext(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void removeMatchAnyFollowedByStart() {
Matcher input = new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, SeqMatcher.create(
StartMatcher.INSTANCE,
AnyMatcher.INSTANCE
));
Matcher expected = SeqMatcher.create(StartMatcher.INSTANCE, AnyMatcher.INSTANCE);
Assertions.assertEquals(expected, Optimizer.removeMatchAnyFollowedByStart(input));
}
代码示例来源:origin: Netflix/spectator
@Test
public void optimizeOrIndexOf() {
PatternMatcher actual = PatternMatcher.compile("^.*abc.*|.*def.*|.*ghi*.");
PatternMatcher expected = OrMatcher.create(
new IndexOfMatcher("abc", TrueMatcher.INSTANCE),
new IndexOfMatcher("def", TrueMatcher.INSTANCE),
new IndexOfMatcher(
"gh",
new ZeroOrMoreMatcher(new CharSeqMatcher("i"), AnyMatcher.INSTANCE)
)
);
Assertions.assertEquals(expected, actual);
}
代码示例来源:origin: Netflix/spectator
@Test
public void removeMatchAnyFollowedByIndexOf() {
Matcher input = new ZeroOrMoreMatcher(
AnyMatcher.INSTANCE,
new IndexOfMatcher("foo", TrueMatcher.INSTANCE));
Matcher expected = new IndexOfMatcher("foo", TrueMatcher.INSTANCE);
Assertions.assertEquals(expected, Optimizer.removeMatchAnyFollowedByIndexOf(input));
}
尝试使用 spacy matcher 时出现错误: ~\Anaconda3\lib\site-packages\spacy\matcher\matcher.pyx in spacy.matcher.m
我想检查一个字符串是否包含另一个字符串,忽略大小写。基本上,我想这样做: assertThat(dialogTitle.getText(), containsString(equalToIgnorin
我想断言 ICollection 包含满足约束集合的项目。对于 Java Hamcrest,我会使用 Matchers.containsInAnyOrder(Matcher... matchers)。
如果我有一个 Matcher[A],如何创建一个只有当 Iterable 的每个元素都满足原始 Matcher 时才满足的 Matcher[Iterable[A]]。 class ExampleSpe
这将是一个简单的问题,但如果我的类路径中包含两个库,我找不到它们之间的区别以及使用哪一个? 最佳答案 Hamcrest 匹配器方法返回 Matcher和 Mockito 匹配器返回 T。因此,例如:o
给定一个序列 Seq[Matcher[A]]我要索取单Matcher[A]当序列中的所有匹配器都成功时,它就成功了。 编辑 我自己提供的答案似乎有点笨拙,此外,如果该序列的所有失败匹配器都产生结果,那
我看到了这个post 关于两者的区别: Matchers.hasItem(..) Assert.assertThat(items, Matchers.hasItem(Matchers.hasToStr
我对以下之间的区别有点困惑: Matcher m; m.group(); 和 Matcher m; m.pattern().pattern(); 它们都从列表中返回正确的匹配项,但我不明白两者之间的区
我正在使用 while(matcher.find()) 循环访问文件并从中检索内容。我想知道如果我知道我找到的内容的索引位于 matcher.start() 中,我将如何从这个循环中获取行号。 我很困
我试过这个例子,只是交换了两条线,它给出了不同的输出,为什么 String inputString = "username@gmail.com"; String pattern="([a-z]+@)(
以下代码在首次运行时给出异常。但是当我在匹配器行上设置断点并在 Netbeans Watcher 中评估一些命令时。有用。为什么?? String regex = "/I-TASSER/output/
是否有 Matcher.appendReplacement() 和 Matcher.appendTail() 的替代方案,它采用 StringBuilder 而不是 StringBuffer ? 是否
我需要在循环中“缩短”字符串,然后一次又一次地传递它以与 java.regex.Pattern 匹配。对于一些深入参与解析和文本处理的人来说,这可能是一个微不足道的情况。 我面临着必须使用的情况: s
为什么第一个 block 有效而第二个 block 不有效? int numberOfDigits = 2; Pattern p = Pattern.compile("[01]{"+numberOfD
我是 c# 的新手,正在尝试将以下代码转换为 c#,但在 c# 中找不到任何 api 来执行此操作。 请解释 matcher.start() 和 matcher.end() 的等价物。 c# 中 ma
我注意到调用 Matcher.lookingAt() 会影响 Matcher.find()。我在我的代码中运行了 lookingAt(),它返回了 true。然后,当我运行 find() 以便开始返回
我正在进行一些测试,以便重构一个旧的 C++ 项目。我正在尝试使用 gmock 匹配器 ElementsAreArray() 来匹配两个数组。 EXPECT_THAT(value_instance.v
我正在寻找一种方法来确定单个正则表达式是否匹配整个字符串、字符串的开头或 C# 中的一部分。 在 Java 中,您可以构造一个 Matcher 对象,并使用方法 matches() 来检查它是否与整个
给定一个 Collection 或 Iterable 项目,是否有任何 Matcher(或匹配器组合)可以断言每个项目都匹配一个匹配器? 例如,给定这个项目类型: public interface P
我看到有一些关于 Java Matcher 类的帖子,但我找不到关于特定方法 find() 和 group() 的帖子. 我有这段代码,其中 Lane 和 IllegalLaneException 已
我是一名优秀的程序员,十分优秀!