本文整理了Java中org.onosproject.yang.compiler.datamodel.YangFeature
类的一些代码示例,展示了YangFeature
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangFeature
类的具体详情如下:
包路径:org.onosproject.yang.compiler.datamodel.YangFeature
类名称:YangFeature
[英]Represents data model node to maintain information defined in YANG feature.
[中]表示数据模型节点,以维护要素中定义的信息。
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
@Override
public void addIfFeatureList(YangIfFeature ifFeature) {
if (getIfFeatureList() == null) {
setIfFeatureList(new LinkedList<>());
}
getIfFeatureList().add(ifFeature);
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-parser
/**
* Performs validation and updates the data model tree.It is called when parser receives
* an input matching the grammar rule (feature).
*
* @param listener listener's object
* @param ctx context object of the grammar rule
*/
public static void processFeatureEntry(TreeWalkListener listener,
FeatureStatementContext ctx) {
// Check for stack to be non empty.
checkStackIsNotEmpty(listener, MISSING_HOLDER, FEATURE_DATA, ctx.string().getText(), ENTRY);
String identifier = getValidIdentifier(ctx.string().getText(), FEATURE_DATA, ctx);
// Obtain the node of the stack.
Parsable tmpNode = listener.getParsedDataStack().peek();
if (tmpNode instanceof YangFeatureHolder) {
YangFeatureHolder featureHolder = (YangFeatureHolder) tmpNode;
YangFeature feature = new YangFeature();
feature.setName(identifier);
feature.setLineNumber(ctx.getStart().getLine());
feature.setCharPosition(ctx.getStart().getCharPositionInLine());
feature.setFileName(listener.getFileName());
featureHolder.addFeatureList(feature);
listener.getParsedDataStack().push(feature);
} else {
throw new ParserException(constructListenerErrorMessage(INVALID_HOLDER, FEATURE_DATA,
ctx.string().getText(), ENTRY));
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Returns if there is any unresolved if-feature in feature.
*
* @param node module/submodule node
*/
private void addUnResolvedIfFeatureToStack(YangNode node) {
YangFeature refFeature = ((YangIfFeature) getCurEntityToResolveFromStack())
.getReferredFeature();
List<YangIfFeature> ifFeatureList = refFeature.getIfFeatureList();
if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
while (ifFeatureIterator.hasNext()) {
addEntityToStack((T) ifFeatureIterator.next(), node);
}
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
private boolean isFeatureDefinedInNode(YangNode node) {
T entity = getCurEntityToResolveFromStack();
YangNodeIdentifier ifFeature = ((YangIfFeature) entity).getName();
List<YangFeature> featureList = ((YangFeatureHolder) node)
.getFeatureList();
if (featureList != null && !featureList.isEmpty()) {
Iterator<YangFeature> iterator = featureList.iterator();
while (iterator.hasNext()) {
YangFeature feature = iterator.next();
if (ifFeature.getName().equals(feature.getName())) {
((YangIfFeature) entity).setReferredFeature(feature);
((YangIfFeature) entity).setReferredFeatureHolder(node);
return true;
}
}
}
return false;
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-datamodel
@Override
public Object resolve() throws DataModelException {
YangFeature feature = getReferredFeature();
// check whether feature has if-feature
List<YangIfFeature> ifFeatureList = feature.getIfFeatureList();
if (ifFeatureList != null && !ifFeatureList.isEmpty()) {
Iterator<YangIfFeature> ifFeatureIterator = ifFeatureList.iterator();
while (ifFeatureIterator.hasNext()) {
YangIfFeature ifFeature = ifFeatureIterator.next();
if (ifFeature.getResolvableStatus() != ResolvableStatus.RESOLVED) {
setResolvableStatus(ResolvableStatus.INTRA_FILE_RESOLVED);
return null;
}
}
}
return null;
}
}
代码示例来源:origin: org.onosproject/onos-yang-compiler-linker
/**
* Finds the referred feature node at the root level of imported/included node.
*
* @param refNode module/sub-module node
* @return referred feature
*/
private YangNode findRefFeature(YangNode refNode) {
T entity = getCurEntityToResolveFromStack();
YangNodeIdentifier ifFeature = ((YangIfFeature) entity).getName();
List<YangFeature> featureList = ((YangFeatureHolder) refNode)
.getFeatureList();
if (featureList != null && !featureList.isEmpty()) {
for (YangFeature feature : featureList) {
if (ifFeature.getName().equals(feature.getName())) {
((YangIfFeature) entity).setReferredFeature(feature);
return refNode;
}
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!