本文整理汇总了Java中org.yaml.snakeyaml.events.MappingEndEvent类的典型用法代码示例。如果您正苦于以下问题:Java MappingEndEvent类的具体用法?Java MappingEndEvent怎么用?Java MappingEndEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MappingEndEvent类属于org.yaml.snakeyaml.events包,在下文中一共展示了MappingEndEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expect
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
public void expect() throws IOException {
if (event instanceof MappingEndEvent) {
indent = indents.pop();
flowLevel--;
writeIndicator("}", false, false, false);
state = states.pop();
} else {
if (canonical || (column > bestWidth && splitLines) || prettyFlow) {
writeIndent();
}
if (!canonical && checkSimpleKey()) {
states.push(new ExpectFlowMappingSimpleValue());
expectNode(false, true, true);
} else {
writeIndicator("?", true, false, false);
states.push(new ExpectFlowMappingValue());
expectNode(false, true, false);
}
}
}
示例2: expect
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
static void expect(Emitter emitter, boolean first) throws IOException
{
if (! first && (emitter.event instanceof MappingEndEvent))
{
emitter.indent = emitter.indents.pop();
emitter.state = emitter.states.pop();
}
else
{
if (emitter.checkSimpleKey())
{
emitter.writeIndent();
emitter.states.push(new ExpectBlockMappingSimpleValue());
emitter.expectNode(false, true, true, emitter.indent);
}
else
{
emitter.writeIndent();
emitter.writeIndicator("?", true, false, true);
emitter.states.push(new ExpectBlockMappingValue());
emitter.expectNode(false, true, false);
}
}
}
示例3: testGetEvent
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的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);
}
示例4: testGetEvent2
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的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);
}
示例5: expect
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
static void expect(Emitter emitter, boolean first) throws IOException
{
if (! first && (emitter.event instanceof MappingEndEvent))
{
emitter.indent = emitter.indents.pop();
emitter.state = emitter.states.pop();
}
else
{
if (emitter.checkSimpleKey())
{
// emitter.writeComment("This is test comment!"); TODO
emitter.writeIndent();
emitter.states.push(new ExpectBlockMappingSimpleValue());
emitter.expectNode(false, true, true, emitter.indent);
}
else
{
emitter.writeIndent();
emitter.writeIndicator("?", true, false, true);
emitter.states.push(new ExpectBlockMappingValue());
emitter.expectNode(false, true, false);
}
}
}
示例6: testGetEvent
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的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));
}
示例7: expect
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
public void expect() throws IOException {
if (event instanceof MappingEndEvent) {
indent = indents.pop();
flowLevel--;
writeIndicator("}", false, false, false);
state = states.pop();
} else {
if (canonical || column > bestWidth || prettyFlow) {
writeIndent();
}
if (!canonical && checkSimpleKey()) {
states.push(new ExpectFlowMappingSimpleValue());
expectNode(false, true, true);
} else {
writeIndicator("?", true, false, false);
states.push(new ExpectFlowMappingValue());
expectNode(false, true, false);
}
}
}
示例8: expect
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
@Override
public void expect(Emitter emitter) throws IOException
{
if (emitter.event instanceof MappingEndEvent)
{
emitter.indent = emitter.indents.pop();
emitter.flowLevel--;
if (emitter.canonical)
{
emitter.writeIndicator(",", false, false, false);
emitter.writeIndent();
}
if (emitter.prettyFlow)
{
emitter.writeIndent();
}
emitter.writeIndicator("}", false, false, false);
emitter.state = emitter.states.pop();
}
else
{
emitter.writeIndicator(",", false, false, false);
if (emitter.canonical || ((emitter.column > emitter.bestWidth) && emitter.splitLines) || emitter.prettyFlow)
{
emitter.writeIndent();
}
if (! emitter.canonical && emitter.checkSimpleKey())
{
emitter.states.push(new ExpectFlowMappingSimpleValue());
emitter.expectNode(false, true, true);
}
else
{
emitter.writeIndicator("?", true, false, false);
emitter.states.push(new ExpectFlowMappingValue());
emitter.expectNode(false, true, false);
}
}
}
示例9: expect
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
@Override
public void expect(Emitter emitter) throws IOException
{
if (emitter.event instanceof MappingEndEvent)
{
emitter.indent = emitter.indents.pop();
emitter.flowLevel--;
emitter.writeIndicator("}", false, false, false);
emitter.state = emitter.states.pop();
}
else
{
if (emitter.canonical || ((emitter.column > emitter.bestWidth) && emitter.splitLines) || emitter.prettyFlow)
{
emitter.writeIndent();
}
if (! emitter.canonical && emitter.checkSimpleKey())
{
emitter.states.push(new ExpectFlowMappingSimpleValue());
emitter.expectNode(false, true, true);
}
else
{
emitter.writeIndicator("?", true, false, false);
emitter.states.push(new ExpectFlowMappingValue());
emitter.expectNode(false, true, false);
}
}
}
示例10: parseMapping
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
private void parseMapping() {
scanner.getToken(Token.ID.FlowMappingStart);
if (!scanner.checkToken(Token.ID.FlowMappingEnd)) {
parseMapEntry();
while (!scanner.checkToken(Token.ID.FlowMappingEnd)) {
scanner.getToken(Token.ID.FlowEntry);
if (!scanner.checkToken(Token.ID.FlowMappingEnd)) {
parseMapEntry();
}
}
}
scanner.getToken(Token.ID.FlowMappingEnd);
events.add(new MappingEndEvent(null, null));
}
示例11: testGetEvent2
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的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));
}
示例12: produce
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
public Event produce() {
state = new ParseFlowSequenceEntry(false);
Token token = scanner.peekToken();
return new MappingEndEvent(token.getStartMark(), token.getEndMark());
}
示例13: serializeNode
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的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));
}
}
}
示例14: checkEmptyMapping
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
private boolean checkEmptyMapping() {
return event instanceof MappingStartEvent && !events.isEmpty() && events.peek() instanceof MappingEndEvent;
}
示例15: checkEmptyMapping
import org.yaml.snakeyaml.events.MappingEndEvent; //导入依赖的package包/类
private boolean checkEmptyMapping()
{
return (this.event instanceof MappingStartEvent) && ! this.events.isEmpty() && (this.events.peek() instanceof MappingEndEvent);
}