private static IEntity createPattern(IEntity child) { IEntity pattern = EntityUtils.clone(child); EntityDescriptor<?> ed = pattern.wGetEntityDescriptor(); for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) { if (!name.equals(fd)) pattern.wSet( fd, CommonsEntityAdapterFactory.createVariable(fd.getEntityDescriptor(), fd.getName())); } return pattern; }
@Override public void visit(HasType entity) { Name edName = entity.getDescriptorName(); if (isLearning() && EntityUtils.isResolver(edName)) { EntityDescriptor<?> ed = getBindings().wGet("evaluatedSubject").wGetEntityDescriptor(); Name learntEdName = TestsEntityFactory.instance.createName(ed.getName()); putLearntEntity(edName, learntEdName); setResultVisitor(GenericTraversalFactory.instance.identity()); } else super.visit(entity); }
protected boolean embedChildrenInComposite(EntityDescriptor<?> ed) { switch (ed.getEntityKind()) { case SIMPLE: for (FeatureDescriptor ced : ed.getEntityFeatureDescriptors()) if (!embedChildrenInSimple(ced.getEntityDescriptor())) return false; case DATA: return true; case COMPOSITE: default: return false; } }
public static IEntity cloneArtifact(IEntity artifact, IEntity appendChild) { IEntityFactory ef = GenericEntityFactory.instance(RegistryConfigurations.RESOLVER); EntityDescriptor<?> ed = artifact.wGetEntityDescriptor(); IEntity newArtifact = ef.create(ed); for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) { if (artifacts.equals(fd) || projects.equals(fd)) { IEntity composite = newArtifact.wGet(fd); if (appendChild != null) composite.wAdd(appendChild); else composite.wResolveWith(fd.getEntityDescriptor()); } else newArtifact.wSet(fd, EntityUtils.clone(artifact.wGet(fd))); } return newArtifact; }
public boolean embedChildren(EntityDescriptor<?> ed) { switch (ed.getEntityKind()) { case SIMPLE: for (FeatureDescriptor ced : ed.getEntityFeatureDescriptors()) if (!embedChildrenInSimple(ced.getEntityDescriptor())) return false; return true; case COMPOSITE: EntityDescriptor<?> ced = ed.getEntityDescriptor(0); return !ced.isPolymorphic() && embedChildrenInComposite(ced); case DATA: return true; default: return false; } }
@Override public void visit(IsAssignableTo entity) { Name edName = entity.getDescriptorName(); if (isLearning() && EntityUtils.isResolver(edName)) { IEntity subject = getBindings().wGet("evaluatedSubject"); EntityDescriptor<?> ed = EntityUtils.hasParent(subject) ? subject.wGetParent().wGetEntityDescriptor(subject) : subject.wGetEntityDescriptor(); Name learntEdName = TestsEntityFactory.instance.createName(ed.getName()); putLearntEntity(edName, learntEdName); setResultVisitor(GenericTraversalFactory.instance.identity()); } else super.visit(entity); }
protected boolean embedChildrenInSimple(EntityDescriptor<?> ed) { switch (ed.getEntityKind()) { case DATA: return true; case SIMPLE: case COMPOSITE: default: return false; } }
public CompositeEntityTreeFigure(EntityDescriptor<?> ed, boolean isRightToLeft) { initContentPanes(1); this.isRightToLeft = isRightToLeft; int leftShrink, rightShrink; if (isRightToLeft()) { leftShrink = 0; rightShrink = 5; } else { leftShrink = 5; rightShrink = 0; } setLayoutManager( new RowLayout() .withMinorAlignment(Alignment.CENTER) .withMajorAlignment(isRightToLeft() ? Alignment.TRAILING : Alignment.LEADING)); mainToggle = createFoldingToggle( new EntityToggle(WholeImages.ROUND_EXPAND, WholeImages.ROUND_COLLAPSE), 0); compositeFigure = new CompositeFigure(false); compositeFigure.setBorder(null); compositeFigure .getLayoutManager() .withMargin(DrawUtils.SPACING) .withSpacing(6) .withMinorAlignment(isRightToLeft() ? Alignment.TRAILING : Alignment.LEADING); if (isRightToLeft()) { add(createContentPane(0, compositeFigure)); add(mainToggle); } else { add(mainToggle); add(createContentPane(0, compositeFigure)); } setBorder( new RoundedTitleTabBorder( ed.getName(), new Insets(0, leftShrink, 0, rightShrink), Style.DASHED)); }
public boolean embedChild(EntityDescriptor<?> ed, int i) { return ed.getEntityDescriptor(i).getEntityKind().isData(); }