本文整理汇总了Java中org.yaml.snakeyaml.events.MappingStartEvent类的典型用法代码示例。如果您正苦于以下问题:Java MappingStartEvent类的具体用法?Java MappingStartEvent怎么用?Java MappingStartEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MappingStartEvent类属于org.yaml.snakeyaml.events包,在下文中一共展示了MappingStartEvent类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: needMoreEvents
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private boolean needMoreEvents()
{
if (this.events.isEmpty())
{
return true;
}
Event event = this.events.peek();
if (event instanceof DocumentStartEvent)
{
return this.needEvents(1);
}
else if (event instanceof SequenceStartEvent)
{
return this.needEvents(2);
}
else if (event instanceof MappingStartEvent)
{
return this.needEvents(3);
}
else
{
return false;
}
}
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:25,代码来源:Emitter.java
示例2: composeMappingNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
protected Node composeMappingNode(String anchor) {
MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent();
String tag = startEvent.getTag();
Tag nodeTag;
boolean resolved = false;
if (tag == null || tag.equals("!")) {
nodeTag = resolver.resolve(NodeId.mapping, null, startEvent.getImplicit());
resolved = true;
} else {
nodeTag = new Tag(tag);
}
final List<NodeTuple> children = new ArrayList<NodeTuple>();
MappingNode node = new MappingNode(nodeTag, resolved, children, startEvent.getStartMark(),
null, startEvent.getFlowStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
while (!parser.checkEvent(Event.ID.MappingEnd)) {
composeMappingChildren(children, node);
}
Event endEvent = parser.getEvent();
node.setEndMark(endEvent.getEndMark());
return node;
}
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:26,代码来源:Composer.java
示例3: testGetEvent
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
public void testGetEvent() {
String data = "string: abcd";
StreamReader reader = new StreamReader(data);
Parser parser = new ParserImpl(reader);
Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
LinkedList<Event> etalonEvents = new LinkedList<Event>();
etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
etalonEvents.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark,
Boolean.FALSE));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "string",
dummyMark, dummyMark, (char) 0));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "abcd",
dummyMark, dummyMark, (char) 0));
etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
check(etalonEvents, parser);
}
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:20,代码来源:ParserImplTest.java
示例4: testGetEvent2
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
public void testGetEvent2() {
String data = "american:\n - Boston Red Sox";
StreamReader reader = new StreamReader(data);
Parser parser = new ParserImpl(reader);
Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
LinkedList<Event> etalonEvents = new LinkedList<Event>();
etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
etalonEvents
.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark, Boolean.TRUE));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "american",
dummyMark, dummyMark, (char) 0));
etalonEvents.add(new SequenceStartEvent(null, null, true, dummyMark, dummyMark,
Boolean.FALSE));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false),
"Boston Red Sox", dummyMark, dummyMark, (char) 0));
etalonEvents.add(new SequenceEndEvent(dummyMark, dummyMark));
etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
check(etalonEvents, parser);
}
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:23,代码来源:ParserImplTest.java
示例5: testGetEvent
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
public void testGetEvent() {
String data = "string: abcd";
StreamReader reader = new StreamReader(data);
Parser parser = new ParserImpl(reader);
Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
LinkedList<Event> etalonEvents = new LinkedList<Event>();
etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
etalonEvents.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark,
Boolean.FALSE));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "string",
dummyMark, dummyMark, (char) 0));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "abcd",
dummyMark, dummyMark, (char) 0));
etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
while (parser.checkEvent(null)) {
Event event = parser.getEvent();
if (etalonEvents.isEmpty()) {
fail("unexpected event: " + event);
}
assertEquals(etalonEvents.removeFirst(), event);
}
assertFalse("Must contain no more events: " + parser.getEvent(), parser.checkEvent(null));
}
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:27,代码来源:ParserImplTest.java
示例6: needMoreEvents
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private boolean needMoreEvents() {
if (events.isEmpty()) {
return true;
}
Event event = events.peek();
if (event instanceof DocumentStartEvent) {
return needEvents(1);
} else if (event instanceof SequenceStartEvent) {
return needEvents(2);
} else if (event instanceof MappingStartEvent) {
return needEvents(3);
} else {
return false;
}
}
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:16,代码来源:Emitter.java
示例7: expectNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private void expectNode(boolean root, boolean mapping, boolean simpleKey) throws IOException {
rootContext = root;
mappingContext = mapping;
simpleKeyContext = simpleKey;
if (event instanceof AliasEvent) {
expectAlias();
} else if (event instanceof ScalarEvent || event instanceof CollectionStartEvent) {
processAnchor("&");
processTag();
if (event instanceof ScalarEvent) {
expectScalar();
} else if (event instanceof SequenceStartEvent) {
if (flowLevel != 0 || canonical || ((SequenceStartEvent) event).getFlowStyle()
|| checkEmptySequence()) {
expectFlowSequence();
} else {
expectBlockSequence();
}
} else {// MappingStartEvent
if (flowLevel != 0 || canonical || ((MappingStartEvent) event).getFlowStyle()
|| checkEmptyMapping()) {
expectFlowMapping();
} else {
expectBlockMapping();
}
}
} else {
throw new EmitterException("需要 NodeEvent 事件, 但却得到了 " + event);
}
}
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:31,代码来源:Emitter.java
示例8: expectNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private void expectNode(boolean root, boolean mapping, boolean simpleKey) throws IOException {
rootContext = root;
mappingContext = mapping;
simpleKeyContext = simpleKey;
if (event instanceof AliasEvent) {
expectAlias();
} else if (event instanceof ScalarEvent || event instanceof CollectionStartEvent) {
processAnchor("&");
processTag();
if (event instanceof ScalarEvent) {
expectScalar();
} else if (event instanceof SequenceStartEvent) {
if (flowLevel != 0 || canonical || ((SequenceStartEvent) event).getFlowStyle()
|| checkEmptySequence()) {
expectFlowSequence();
} else {
expectBlockSequence();
}
} else {// MappingStartEvent
if (flowLevel != 0 || canonical || ((MappingStartEvent) event).getFlowStyle()
|| checkEmptyMapping()) {
expectFlowMapping();
} else {
expectBlockMapping();
}
}
} else {
throw new EmitterException("expected NodeEvent, but got " + event);
}
}
开发者ID:RoccoDev,项目名称:5zig-TIMV-Plugin,代码行数:31,代码来源:Emitter.java
示例9: composeMappingNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private Node composeMappingNode(String anchor) {
MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent();
String tag = startEvent.getTag();
Tag nodeTag;
boolean resolved = false;
if (tag == null || tag.equals("!")) {
nodeTag = resolver.resolve(NodeId.mapping, null, startEvent.getImplicit());
resolved = true;
} else {
nodeTag = new Tag(tag);
}
final List<NodeTuple> children = new ArrayList<NodeTuple>();
MappingNode node = new MappingNode(nodeTag, resolved, children, startEvent.getStartMark(),
null, startEvent.getFlowStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
while (!parser.checkEvent(Event.ID.MappingEnd)) {
Node itemKey = composeNode(node);
if (itemKey.getTag().equals(Tag.MERGE)) {
node.setMerged(true);
}
Node itemValue = composeNode(node);
children.add(new NodeTuple(itemKey, itemValue));
}
Event endEvent = parser.getEvent();
node.setEndMark(endEvent.getEndMark());
return node;
}
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:31,代码来源:Composer.java
示例10: testGetEvent2
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
public void testGetEvent2() {
String data = "american:\n - Boston Red Sox";
StreamReader reader = new StreamReader(data);
Parser parser = new ParserImpl(reader);
Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
LinkedList<Event> etalonEvents = new LinkedList<Event>();
etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
etalonEvents
.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark, Boolean.TRUE));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "american",
dummyMark, dummyMark, (char) 0));
etalonEvents.add(new SequenceStartEvent(null, null, true, dummyMark, dummyMark,
Boolean.FALSE));
etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false),
"Boston Red Sox", dummyMark, dummyMark, (char) 0));
etalonEvents.add(new SequenceEndEvent(dummyMark, dummyMark));
etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
while (parser.checkEvent(null)) {
Event event = parser.getEvent();
if (etalonEvents.isEmpty()) {
fail("unexpected event: " + event);
}
assertEquals(etalonEvents.removeFirst(), event);
}
assertFalse("Must contain no more events: " + parser.getEvent(), parser.checkEvent(null));
}
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:30,代码来源:ParserImplTest.java
示例11: composeMappingNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private Node composeMappingNode(String anchor) {
MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent();
String tag = startEvent.getTag();
Tag nodeTag;
boolean resolved = false;
if (tag == null || tag.equals("!")) {
nodeTag = resolver.resolve(NodeId.mapping, null, startEvent.getImplicit());
resolved = true;
} else {
nodeTag = new Tag(tag);
}
final List<NodeTuple> children = new ArrayList<NodeTuple>();
MappingNode node = new MappingNode(nodeTag, resolved, children, startEvent.getStartMark(),
null, startEvent.getFlowStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
while (!parser.checkEvent(Event.ID.MappingEnd)) {
Node itemKey = composeNode(node);
if (itemKey.getTag().equals(Tag.MERGE)) {
node.setMerged(true);
} else if (itemKey.getTag().equals(Tag.VALUE)) {
itemKey.setTag(Tag.STR);
}
Node itemValue = composeNode(node);
children.add(new NodeTuple(itemKey, itemValue));
}
Event endEvent = parser.getEvent();
node.setEndMark(endEvent.getEndMark());
return node;
}
开发者ID:timvisee,项目名称:TestTheTeacher,代码行数:33,代码来源:Composer.java
示例12: composeMappingNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private Node composeMappingNode(final String anchor) {
MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent();
String tag = startEvent.getTag();
Tag nodeTag;
boolean resolved = false;
if (tag == null || tag.equals("!")) {
nodeTag = resolver.resolve(NodeId.mapping, null, startEvent.getImplicit());
resolved = true;
} else {
nodeTag = new Tag(tag);
}
final List<NodeTuple> children = new ArrayList<NodeTuple>();
MappingNode node = new MappingNode(nodeTag, resolved, children, startEvent.getStartMark(), null, startEvent.getFlowStyle());
if (anchor != null) {
anchors.put(anchor, node);
}
while (!parser.checkEvent(Event.ID.MappingEnd)) {
Node itemKey = composeNode(node);
if (itemKey.getTag().equals(Tag.MERGE)) {
node.setMerged(true);
} else if (itemKey.getTag().equals(Tag.VALUE)) {
itemKey.setTag(Tag.STR);
}
Node itemValue = composeNode(node);
children.add(new NodeTuple(itemKey, itemValue));
}
Event endEvent = parser.getEvent();
node.setEndMark(endEvent.getEndMark());
return node;
}
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:32,代码来源:Composer.java
示例13: serializeNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private void serializeNode(Node node, Node parent) throws IOException {
if (node.getNodeId() == NodeId.anchor) {
node = ((AnchorNode) node).getRealNode();
}
String tAlias = this.anchors.get(node);
if (this.serializedNodes.contains(node)) {
this.emitter.emit(new AliasEvent(tAlias, null, null));
} else {
this.serializedNodes.add(node);
switch (node.getNodeId()) {
case scalar:
ScalarNode scalarNode = (ScalarNode) node;
Tag detectedTag = this.resolver.resolve(NodeId.scalar, scalarNode.getValue(), true);
Tag defaultTag = this.resolver.resolve(NodeId.scalar, scalarNode.getValue(), false);
ImplicitTuple tuple = new ImplicitTuple(node.getTag().equals(detectedTag), node
.getTag().equals(defaultTag));
ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple,
scalarNode.getValue(), null, null, scalarNode.getStyle());
this.emitter.emit(event);
break;
case sequence:
SequenceNode seqNode = (SequenceNode) node;
boolean implicitS = node.getTag().equals(this.resolver.resolve(NodeId.sequence,
null, true));
this.emitter.emit(new SequenceStartEvent(tAlias, node.getTag().getValue(),
implicitS, null, null, seqNode.getFlowStyle()));
List<Node> list = seqNode.getValue();
for (Node item : list) {
serializeNode(item, node);
}
this.emitter.emit(new SequenceEndEvent(null, null));
break;
default:// instance of MappingNode
Tag implicitTag = this.resolver.resolve(NodeId.mapping, null, true);
boolean implicitM = node.getTag().equals(implicitTag);
this.emitter.emit(new MappingStartEvent(tAlias, node.getTag().getValue(),
implicitM, null, null, ((CollectionNode) node).getFlowStyle()));
MappingNode mnode = (MappingNode) node;
List<NodeTuple> map = mnode.getValue();
for (NodeTuple row : map) {
Node key = row.getKeyNode();
Node value = row.getValueNode();
serializeNode(key, mnode);
serializeNode(value, mnode);
}
this.emitter.emit(new MappingEndEvent(null, null));
}
}
}
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:50,代码来源:Serializer.java
示例14: checkEmptyMapping
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private boolean checkEmptyMapping() {
return event instanceof MappingStartEvent && !events.isEmpty() && events.peek() instanceof MappingEndEvent;
}
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:4,代码来源:Emitter.java
示例15: expectNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
void expectNode(boolean root, boolean mapping, boolean simpleKey, @Nullable Integer lastIndent) throws IOException
{
this.rootContext = root;
this.mappingContext = mapping;
this.simpleKeyContext = simpleKey;
if (this.event instanceof AliasEvent)
{
this.expectAlias();
}
else if ((this.event instanceof ScalarEvent) || (this.event instanceof CollectionStartEvent))
{
this.processAnchor("&");
this.processTag();
if (this.event instanceof ScalarEvent)
{
this.expectScalar(lastIndent);
}
else if (this.event instanceof SequenceStartEvent)
{
if ((this.flowLevel != 0) || this.canonical || ((SequenceStartEvent) this.event).getFlowStyle()
|| this.checkEmptySequence())
{
this.expectFlowSequence();
}
else
{
this.expectBlockSequence();
}
}
else
{// MappingStartEvent
if ((this.flowLevel != 0) || this.canonical || ((MappingStartEvent) this.event).getFlowStyle() || this.checkEmptyMapping())
{
this.expectFlowMapping();
}
else
{
this.expectBlockMapping();
}
}
}
else
{
throw new EmitterException("expected NodeEvent, but got " + this.event);
}
}
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:47,代码来源:Emitter.java
示例16: checkEmptyMapping
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private boolean checkEmptyMapping()
{
return (this.event instanceof MappingStartEvent) && ! this.events.isEmpty() && (this.events.peek() instanceof MappingEndEvent);
}
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:5,代码来源:Emitter.java
示例17: serializeNode
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
private void serializeNode(Node node, @Nullable Node parent, LinkedList<String> commentPath, boolean mappingScalar) throws IOException
{
if (node.getNodeId() == NodeId.anchor)
{
node = ((AnchorNode) node).getRealNode();
}
String tAlias = this.anchors.get(node);
if (this.serializedNodes.contains(node))
{
this.emitter.emit(new AliasEvent(tAlias, null, null));
}
else
{
this.serializedNodes.add(node);
switch (node.getNodeId())
{
case scalar:
ScalarNode scalarNode = (ScalarNode) node;
Tag detectedTag = this.resolver.resolve(NodeId.scalar, scalarNode.getValue(), true);
Tag defaultTag = this.resolver.resolve(NodeId.scalar, scalarNode.getValue(), false);
String[] pathNodes = commentPath.toArray(new String[commentPath.size()]);
String comment;
if (this.checkCommentsSet(pathNodes))
{
comment = this.comments.getComment(pathNodes);
}
else
{
comment = null;
}
ImplicitTuple tuple = new ImplicitTupleExtension(node.getTag().equals(detectedTag), node.getTag().equals(defaultTag), comment);
ScalarEvent event = new ScalarEvent(tAlias, node.getTag().getValue(), tuple, scalarNode.getValue(), null, null, scalarNode.getStyle());
this.emitter.emit(event);
break;
case sequence:
SequenceNode seqNode = (SequenceNode) node;
boolean implicitS = node.getTag().equals(this.resolver.resolve(NodeId.sequence, null, true));
this.emitter.emit(new SequenceStartEvent(tAlias, node.getTag().getValue(), implicitS, null, null, seqNode.getFlowStyle()));
List<Node> list = seqNode.getValue();
for (Node item : list)
{
this.serializeNode(item, node, commentPath, false);
}
this.emitter.emit(new SequenceEndEvent(null, null));
break;
default:// instance of MappingNode
Tag implicitTag = this.resolver.resolve(NodeId.mapping, null, true);
boolean implicitM = node.getTag().equals(implicitTag);
this.emitter.emit(new MappingStartEvent(tAlias, node.getTag().getValue(), implicitM, null, null, ((CollectionNode) node).getFlowStyle()));
MappingNode mnode = (MappingNode) node;
List<NodeTuple> map = mnode.getValue();
for (NodeTuple row : map)
{
Node key = row.getKeyNode();
Node value = row.getValueNode();
if (key instanceof ScalarNode)
{
commentPath.add(((ScalarNode) key).getValue());
}
this.serializeNode(key, mnode, commentPath, true);
this.serializeNode(value, mnode, commentPath, false);
if (key instanceof ScalarNode)
{
commentPath.removeLast();
}
}
this.emitter.emit(new MappingEndEvent(null, null));
}
}
}
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:71,代码来源:Serializer.java
示例18: expectMappingStart
import org.yaml.snakeyaml.events.MappingStartEvent; //导入依赖的package包/类
public MappingStartEvent expectMappingStart() {
return (MappingStartEvent) expect(Event.ID.MappingStart);
}
开发者ID:petercipov,项目名称:mobi,代码行数:4,代码来源:YamlConfigParser.java
注:本文中的org.yaml.snakeyaml.events.MappingStartEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论