• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SequenceNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.yaml.snakeyaml.nodes.SequenceNode的典型用法代码示例。如果您正苦于以下问题:Java SequenceNode类的具体用法?Java SequenceNode怎么用?Java SequenceNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SequenceNode类属于org.yaml.snakeyaml.nodes包,在下文中一共展示了SequenceNode类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: representSequence

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
protected Node representSequence(Tag tag, Iterable<?> sequence, Boolean flowStyle) {
    int size = 10;// default for ArrayList
    if (sequence instanceof List<?>) {
        size = ((List<?>) sequence).size();
    }
    List<Node> value = new ArrayList<Node>(size);
    SequenceNode node = new SequenceNode(tag, value, flowStyle);
    representedObjects.put(objectToRepresent, node);
    boolean bestStyle = true;
    for (Object item : sequence) {
        Node nodeItem = representData(item);
        if (!(nodeItem instanceof ScalarNode && ((ScalarNode) nodeItem).getStyle() == null)) {
            bestStyle = false;
        }
        value.add(nodeItem);
    }
    if (flowStyle == null) {
        if (defaultFlowStyle != FlowStyle.AUTO) {
            node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
        } else {
            node.setFlowStyle(bestStyle);
        }
    }
    return node;
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:26,代码来源:BaseRepresenter.java


示例2: construct2ndStep

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@Override
public void construct2ndStep(Node node, Object object) {
    // Compact Object Notation may contain only one entry
    MappingNode mnode = (MappingNode) node;
    NodeTuple nodeTuple = mnode.getValue().iterator().next();

    Node valueNode = nodeTuple.getValueNode();

    if (valueNode instanceof MappingNode) {
        valueNode.setType(object.getClass());
        constructJavaBean2ndStep((MappingNode) valueNode, object);
    } else {
        // value is a list
        applySequence(object, constructSequence((SequenceNode) valueNode));
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:17,代码来源:CompactConstructor.java


示例3: constructSequence

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected List<? extends Object> constructSequence(SequenceNode node) {
    List<Object> result;
    if (List.class.isAssignableFrom(node.getType()) && !node.getType().isInterface()) {
        // the root class may be defined (Vector for instance)
        try {
            result = (List<Object>) node.getType().newInstance();
        } catch (Exception e) {
            throw new YAMLException(e);
        }
    } else {
        result = createDefaultList(node.getValue().size());
    }
    constructSequenceStep2(node, result);
    return result;

}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:18,代码来源:BaseConstructor.java


示例4: constructSet

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected Set<? extends Object> constructSet(SequenceNode node) {
    Set<Object> result;
    if (!node.getType().isInterface()) {
        // the root class may be defined
        try {
            result = (Set<Object>) node.getType().newInstance();
        } catch (Exception e) {
            throw new YAMLException(e);
        }
    } else {
        result = createDefaultSet(node.getValue().size());
    }
    constructSequenceStep2(node, result);
    return result;

}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:18,代码来源:BaseConstructor.java


示例5: construct2ndStep

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void construct2ndStep(Node node, Object object)
{
    SequenceNode snode = (SequenceNode) node;
    if (List.class.isAssignableFrom(node.getType()))
    {
        List<Object> list = (List<Object>) object;
        this.yamlConstructor.constructSequenceStep2(snode, list);
    }
    else if (node.getType().isArray())
    {
        this.yamlConstructor.constructArrayStep2(snode, object);
    }
    else
    {
        throw new YAMLException("Immutable objects cannot be recursive.");
    }
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:20,代码来源:YamlConstructSequence.java


示例6: containsKey

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@Override
public boolean containsKey(String key)
{
    if (this.node instanceof MappingNode)
    {
        return this.getNode((MappingNode) this.node, key) != null;
    }
    if (this.node instanceof SequenceNode)
    {
        int i = DioriteMathUtils.asInt(key, - 1);
        if (i == - 1)
        {
            return false;
        }
        return i < ((SequenceNode) this.node).getValue().size();
    }
    return false;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:19,代码来源:YamlDeserializationData.java


示例7: getNode

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@Nullable
private Node getNode(Node node, String key)
{
    if (key.isEmpty())
    {
        return node;
    }
    if (node instanceof SequenceNode)
    {
        SequenceNode sequenceNode = (SequenceNode) node;
        List<Node> sequenceNodeValue = sequenceNode.getValue();
        int i = DioriteMathUtils.asInt(key, - 1);
        if ((i == - 1) || (i < sequenceNodeValue.size()))
        {
            return null;
        }
        return sequenceNodeValue.get(i);
    }
    if (node instanceof MappingNode)
    {
        return this.getNode((MappingNode) node, key);
    }
    return null;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:25,代码来源:YamlDeserializationData.java


示例8: composeSequenceNode

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
protected Node composeSequenceNode(String anchor) {
    SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    final ArrayList<Node> children = new ArrayList<Node>();
    SequenceNode node = new SequenceNode(nodeTag, resolved, children,
            startEvent.getStartMark(), null, startEvent.getFlowStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.SequenceEnd)) {
        children.add(composeNode(node));
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:25,代码来源:Composer.java


示例9: construct

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Car construct(Node node) {
    Car car = new Car();
    MappingNode mapping = (MappingNode) node;
    List<NodeTuple> list = mapping.getValue();
    for (NodeTuple tuple : list) {
        String field = toScalarString(tuple.getKeyNode());
        if ("plate".equals(field)) {
            car.setPlate(toScalarString(tuple.getValueNode()));
        }
        if ("wheels".equals(field)) {
            SequenceNode snode = (SequenceNode) tuple.getValueNode();
            List<Wheel> wheels = (List<Wheel>) constructSequence(snode);
            car.setWheels(wheels);
        }
    }
    return car;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:19,代码来源:YamlLoadAsIssueTest.java


示例10: loadYamlLookupSets

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
private void loadYamlLookupSets(MappingNode entry, String filename) {
//        LOG.info("Loading lookupSet.({}:{})", filename, entry.getStartMark().getLine());
        String name = null;
        Set<String> lookupSet = new HashSet<>();

        for (NodeTuple tuple : entry.getValue()) {
            switch (getKeyAsString(tuple, filename)) {
                case "name":
                    name = getValueAsString(tuple, filename);
                    break;
                case "values":
                    SequenceNode node = getValueAsSequenceNode(tuple, filename);
                    List<String> values = getStringValues(node, filename);
                    for (String value: values) {
                        lookupSet.add(value.toLowerCase(Locale.ENGLISH));
                    }
                    break;
                default:
                    break;
            }
        }

        lookupSets.put(name, lookupSet);
    }
 
开发者ID:nielsbasjes,项目名称:yauaa,代码行数:25,代码来源:UserAgentAnalyzerDirect.java


示例11: composeSequenceNode

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
protected Node composeSequenceNode(String anchor) {
    SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    final ArrayList<Node> children = new ArrayList<Node>();
    SequenceNode node = new SequenceNode(nodeTag, resolved, children, startEvent.getStartMark(),
            null, startEvent.getFlowStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.SequenceEnd)) {
        children.add(composeNode(node));
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
}
 
开发者ID:ME1312,项目名称:SubServers-2,代码行数:25,代码来源:Composer.java


示例12: composeSequenceNode

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
private Node composeSequenceNode(String anchor) {
    SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
    String tag = startEvent.getTag();
    Tag nodeTag;
    boolean resolved = false;
    if (tag == null || tag.equals("!")) {
        nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
        resolved = true;
    } else {
        nodeTag = new Tag(tag);
    }
    final ArrayList<Node> children = new ArrayList<Node>();
    SequenceNode node = new SequenceNode(nodeTag, resolved, children,
            startEvent.getStartMark(), null, startEvent.getFlowStyle());
    if (anchor != null) {
        anchors.put(anchor, node);
    }
    while (!parser.checkEvent(Event.ID.SequenceEnd)) {
        children.add(composeNode(node));
    }
    Event endEvent = parser.getEvent();
    node.setEndMark(endEvent.getEndMark());
    return node;
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:25,代码来源:Composer.java


示例13: representSequence

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
protected Node representSequence(Tag tag, Iterable<? extends Object> sequence, Boolean flowStyle) {
    int size = 10;// default for ArrayList
    if (sequence instanceof List<?>) {
        size = ((List<?>) sequence).size();
    }
    List<Node> value = new ArrayList<Node>(size);
    SequenceNode node = new SequenceNode(tag, value, flowStyle);
    representedObjects.put(objectToRepresent, node);
    boolean bestStyle = true;
    for (Object item : sequence) {
        Node nodeItem = representData(item);
        if (!((nodeItem instanceof ScalarNode && ((ScalarNode) nodeItem).getStyle() == null))) {
            bestStyle = false;
        }
        value.add(nodeItem);
    }
    if (flowStyle == null) {
        if (defaultFlowStyle != FlowStyle.AUTO) {
            node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
        } else {
            node.setFlowStyle(bestStyle);
        }
    }
    return node;
}
 
开发者ID:timvisee,项目名称:TestTheTeacher,代码行数:26,代码来源:BaseRepresenter.java


示例14: typeCheck

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@Override
public void typeCheck(Node node) throws ConfigTypeErrorException {
    if (YamlUtils.isNull(node)) {
        return;
    }
    if (!(node instanceof SequenceNode)) {
        throw new ConfigTypeErrorException(node, format("Expected a %s, found %s", this.toString(), node.getTag()));
    } else {
        SequenceNode listNode = (SequenceNode)node;
        Set<Object> results = new HashSet<>();
        for (Node innerNode : listNode.getValue()) {
            innerType.typeCheck(innerNode);
            Object obj = innerType.coerce(innerNode);
            if (results.contains(obj)) {
                throw new ConfigTypeErrorException(innerNode, "Duplicate entry in set");
            }
            results.add(obj);
        }
    }
}
 
开发者ID:wtetzner,项目名称:kurgan,代码行数:21,代码来源:ConfigSet.java


示例15: representSequence

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
protected Node representSequence(final Tag tag, final Iterable<?> sequence, final Boolean flowStyle) {
	int size = 10;// default for ArrayList
	if (sequence instanceof List<?>) {
		size = ((List<?>) sequence).size();
	}
	List<Node> value = new ArrayList<Node>(size);
	SequenceNode node = new SequenceNode(tag, value, flowStyle);
	representedObjects.put(objectToRepresent, node);
	boolean bestStyle = true;
	for (Object item : sequence) {
		Node nodeItem = representData(item);
		if (!((nodeItem instanceof ScalarNode && ((ScalarNode) nodeItem).getStyle() == null))) {
			bestStyle = false;
		}
		value.add(nodeItem);
	}
	if (flowStyle == null) {
		if (defaultFlowStyle != FlowStyle.AUTO) {
			node.setFlowStyle(defaultFlowStyle.getStyleBoolean());
		} else {
			node.setFlowStyle(bestStyle);
		}
	}
	return node;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:26,代码来源:BaseRepresenter.java


示例16: composeSequenceNode

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
private Node composeSequenceNode(final String anchor) {
	SequenceStartEvent startEvent = (SequenceStartEvent) parser.getEvent();
	String tag = startEvent.getTag();
	Tag nodeTag;
	boolean resolved = false;
	if (tag == null || tag.equals("!")) {
		nodeTag = resolver.resolve(NodeId.sequence, null, startEvent.getImplicit());
		resolved = true;
	} else {
		nodeTag = new Tag(tag);
	}
	final ArrayList<Node> children = new ArrayList<Node>();
	SequenceNode node = new SequenceNode(nodeTag, resolved, children, startEvent.getStartMark(), null, startEvent.getFlowStyle());
	if (anchor != null) {
		anchors.put(anchor, node);
	}
	int index = 0;
	while (!parser.checkEvent(Event.ID.SequenceEnd)) {
		children.add(composeNode(node));
		index++;
	}
	Event endEvent = parser.getEvent();
	node.setEndMark(endEvent.getEndMark());
	return node;
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:26,代码来源:Composer.java


示例17: construct2ndStep

import org.yaml.snakeyaml.nodes.SequenceNode; //导入依赖的package包/类
@Override
public void construct2ndStep(final Node node, final Object object) {
	// Compact Object Notation may contain only one entry
	MappingNode mnode = (MappingNode) node;
	NodeTuple nodeTuple = mnode.getValue().iterator().next();

	Node valueNode = nodeTuple.getValueNode();

	if (valueNode instanceof MappingNode) {
		valueNode.setType(object.getClass());
		constructJavaBean2ndStep((MappingNode) valueNode, object);
	} else {
		// value is a list
		applySequence(object, constructSequence((SequenceNode) valueNode));
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:17,代码来源:CompactConstructor.java



注:本文中的org.yaml.snakeyaml.nodes.SequenceNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultGlobalScopeProvider类代码示例发布时间:2022-05-21
下一篇:
Java MouseEventDetails类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap