예제 #1
0
 public static <C extends AmVisitContext> void walkTerminology(
     AmVisitor<AmObject, C> visitor, ArchetypeTerminology terminology, C context) {
   ArchetypeWalker<C> walker = new ArchetypeWalker<>(visitor, context);
   Action<?> action = walker.walk(terminology);
   if (action.act != Action.Act.next) {
     throw new AssertionError("Cannot remove or replace root ontology object");
   }
 }
예제 #2
0
  @SuppressWarnings("unchecked")
  public static <T extends AmObject, C extends AmConstraintContext> void walkConstraints(
      AmVisitor<T, C> visitor, Archetype archetype, C context) {
    if (!(visitor instanceof ConstraintAmVisitor<?>)) {
      visitor = new ConstraintAmVisitor<>().add(AmObject.class, (AmVisitor) visitor);
    }

    ArchetypeWalker<C> walker = new ArchetypeWalker<>((AmVisitor<AmObject, C>) visitor, context);
    Action<?> action = walker.walk(archetype.getDefinition());
    if (action.act != Action.Act.next) {
      throw new AssertionError("Cannot remove or replace root constraint");
    }
  }