当前位置: 首页>>代码示例>>Java>>正文


Java SequenceNode.setFlowStyle方法代码示例

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


在下文中一共展示了SequenceNode.setFlowStyle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: representSequence

import org.yaml.snakeyaml.nodes.SequenceNode; //导入方法依赖的package包/类
@Override
    public Node representSequence(Tag tag, Iterable<?> sequence, @Nullable Boolean flowStyle)
    {
        int size = 10;// default for ArrayList
        if (sequence instanceof Collection<?>)
        {
            size = ((Collection<?>) sequence).size();
        }
        List<Node> value = new ArrayList<>(size);
        SequenceNode node = new SequenceNode(tag, value, flowStyle);
        this.representedObjects.put(this.objectToRepresent, node);
        boolean bestStyle = true;
        long width = 0;
        for (Object item : sequence)
        {
            Node nodeItem = this.representData(item);
            if (bestStyle)
            {
                if ((nodeItem instanceof ScalarNode) && (((ScalarNode) nodeItem).getStyle() == null))
                {
                    String val = ((ScalarNode) nodeItem).getValue();
                    width += (val == null) ? 0 : val.length();
                    width += 2; // comma and space.
                    if (width > MAX_WIDTH)
                    {
                        bestStyle = false;
                    }
                }
                else
                {
                    bestStyle = false;
                }
            }
            value.add(nodeItem);
        }
        if (flowStyle == null)
        {
            // we ignore this for diorite representer, configs should look nice.
//            if (this.defaultFlowStyle != FlowStyle.AUTO)
//            {
//                node.setFlowStyle(this.defaultFlowStyle.getStyleBoolean());
//            }
//            else
//            {
            node.setFlowStyle(bestStyle);
//            }
        }
        return node;
    }
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:50,代码来源:Representer.java


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