/** * Converts XSD regex to Java-compatible regex. * * @param xsdRegex XSD regex pattern as it is defined in a YANG source * @return Java-compatible regex */ public static String getJavaRegexFromXSD(final String xsdRegex) { // Note: we are using a non-capturing group to deal with internal structure issues, like branches and similar. return "^(?:" + fixUnicodeScriptPattern(escapeChars(xsdRegex)) + ")$"; }
/** * Create a new instance from specified modules. Note that no module validation is done and hence the consistency * of the resulting SchemaContext is completely in hands of the caller. */ public static SimpleSchemaContext forModules(final Set<Module> modules) { return new SimpleSchemaContext(modules); }
private static <T extends SchemaNode> T getOriginalSchema(final T choice) { @SuppressWarnings("unchecked") final T original = (T) SchemaNodeUtils.getRootOriginalIfPossible(choice); if (original != null) { return original; } return choice; }
/** * Topological sort of module dependency graph. * * @param modules YANG modules * @return Sorted list of Modules. Modules can be further processed in returned order. * @throws IllegalArgumentException when provided modules are not consistent. */ public static List<Module> sort(final Collection<Module> modules) { final List<Node> sorted = sortInternal(modules); // Cast to Module from Node and return return Lists.transform(sorted, input -> input == null ? null : ((ModuleNodeImpl) input).getReference()); }
/** * Topological sort of module dependency graph. * * @param modules YANG modules * @return Sorted list of Modules. Modules can be further processed in returned order. * @throws IllegalArgumentException when provided modules are not consistent. */ public static List<Module> sort(final Module... modules) { return sort(Arrays.asList(modules)); }
public static SchemaNode getRootOriginalIfPossible(final SchemaNode data) { Optional<SchemaNode> previous = Optional.empty(); Optional<SchemaNode> next = getOriginalIfPossible(data); while (next.isPresent()) { previous = next; next = getOriginalIfPossible(next.get()); } return previous.orElse(null); }
private static Table<String, Optional<Revision>, ModuleNodeImpl> createModuleGraph( final Collection<Module> builders) { final Table<String, Optional<Revision>, ModuleNodeImpl> moduleGraph = HashBasedTable.create(); processModules(moduleGraph, builders); processDependencies(moduleGraph, builders); return moduleGraph; }
AugmentationNormalization(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { super(DataSchemaContextNode.augmentationIdentifierFrom(augmentation), EffectiveAugmentationSchema.create(augmentation, schema)); }
@Override public String toString() { return "Module [name=" + name + ", revision=" + formatRevDate(getRevision()) + "]"; }
public DataNodeIterator(final DataNodeContainer container) { if (container == null) { throw new IllegalArgumentException("Data Node Container MUST be specified and cannot be NULL!"); } this.container = container; traverse(this.container); }
private static <T extends SchemaNode> T getOriginalSchema(final T choice) { @SuppressWarnings("unchecked") final T original = (T) SchemaNodeUtils.getRootOriginalIfPossible(choice); if (original != null) { return original; } return choice; }
/** * Converts XSD regex to Java-compatible regex. * * @param xsdRegex XSD regex pattern as it is defined in a YANG source * @return Java-compatible regex */ public static String getJavaRegexFromXSD(final String xsdRegex) { // Note: we are using a non-capturing group to deal with internal structure issues, like branches and similar. return "^(?:" + fixUnicodeScriptPattern(escapeChars(xsdRegex)) + ")$"; }
/** * Topological sort of module dependency graph. * * @param modules YANG modules * @return Sorted list of Modules. Modules can be further processed in returned order. * @throws IllegalArgumentException when provided modules are not consistent. */ public static List<Module> sort(final Collection<Module> modules) { final List<Node> sorted = sortInternal(modules); // Cast to Module from Node and return return Lists.transform(sorted, input -> input == null ? null : ((ModuleNodeImpl) input).getReference()); }
/** * Topological sort of module dependency graph. * * @param modules YANG modules * @return Sorted list of Modules. Modules can be further processed in returned order. * @throws IllegalArgumentException when provided modules are not consistent. */ public static List<Module> sort(final Module... modules) { return sort(Arrays.asList(modules)); }
public static SchemaNode getRootOriginalIfPossible(final SchemaNode data) { Optional<SchemaNode> previous = Optional.empty(); Optional<SchemaNode> next = getOriginalIfPossible(data); while (next.isPresent()) { previous = next; next = getOriginalIfPossible(next.get()); } return previous.orElse(null); }
private static Table<String, Optional<Revision>, ModuleNodeImpl> createModuleGraph( final Collection<Module> builders) { final Table<String, Optional<Revision>, ModuleNodeImpl> moduleGraph = HashBasedTable.create(); processModules(moduleGraph, builders); processDependencies(moduleGraph, builders); return moduleGraph; }
/** * Create a new instance from specified modules. Note that no module validation is done and hence the consistency * of the resulting SchemaContext is completely in hands of the caller. */ public static SimpleSchemaContext forModules(final Set<Module> modules) { return new SimpleSchemaContext(modules); }
@Override public String toString() { return "Module [name=" + name + ", revision=" + formatRevDate(getRevision()) + "]"; }
public DataNodeIterator(final DataNodeContainer container) { if (container == null) { throw new IllegalArgumentException("Data Node Container MUST be specified and cannot be NULL!"); } this.container = container; traverse(this.container); }
private static final <T extends SchemaNode> T getOriginalSchema(final T choice) { @SuppressWarnings("unchecked") final T original = (T) SchemaNodeUtils.getRootOriginalIfPossible(choice); if (original != null) { return original; } return choice; }