devel:design:model_conversion
Generic approach to model conversion
Notation: src
– source; dst
– destination.
- Convert math model of
src
to math model ofdst
.- Use node creation methods that can generate necessary hierarchy in
dst
model based onsrc
node reference.
- Provide a method for generation of visual
dst
model for mathdst
and use the information from visualsrc
model.
interface MathModelConverter<TSrcModel extends MathModel, TDstModel extends MathModel> { TSrcModel getSrcModel(); TDstModel getDstModel(); Map<Class<? extends MathNode>, Class<? extends MathNode>> getNodeClassMap(); String convertNodeName(String srcName, Container container); Container getRefToDstPage(String ref); MathNode getSrcToDstNode(MathNode srcNode); void preprocessing(); void postprocessing(); PageNode convertPage(PageNode srcPage); MathNode convertNode(MathNode srcNode); Connection convertConnection(Connection srcConnection); }
public interface VisualModelConverter<TSrcModel extends VisualModel, TDstModel extends VisualModel> { TSrcModel getSrcModel(); TDstModel getDstModel(); Map<Class<? extends MathNode>, Class<? extends MathNode>> getComponentClassMap(); Map<Class<? extends VisualReplica>, Class<? extends VisualReplica>> getReplicaClassMap(); String convertNodeName(String srcName, Container container); Container getRefToDstPage(String ref); VisualNode getSrcToDstNode(VisualNode srcNode); void preprocessing(); void postprocessing(); VisualPage convertPage(VisualPage srcPage); VisualComponent convertComponent(VisualComponent srcComponent); VisualReplica convertReplica(VisualReplica srcReplica); VisualGroup convertGroup(VisualGroup srcGroup); VisualConnection convertConnection(VisualConnection srcConnection); }
Copyright © 2014-2024 workcraft.org