diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-12 17:39:53 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-12 17:39:53 +0100 |
commit | 1a9b7e81919e4bd52cbb2db2e9e91a244734ab2c (patch) | |
tree | 26bf8beec6ac62e5418f0d4831c5e43c1969a464 /src/core/model/Domain.hpp | |
parent | ebac41111fa33790acce7be45e599f8de37e7f43 (diff) |
restructured pathTo. Also fixed some issues with that method and made it more general.
Diffstat (limited to 'src/core/model/Domain.hpp')
-rw-r--r-- | src/core/model/Domain.hpp | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index 57e5602..ae5ba1d 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -404,9 +404,6 @@ private: Owned<StructType> attributesDescriptor; NodeVector<FieldDescriptor> fieldDescriptors; - bool continuePath(Handle<StructuredClass> target, NodeVector<Node> &path, - bool start) const; - void addAndSortFieldDescriptor(Handle<FieldDescriptor> fd, Logger &logger); protected: @@ -581,6 +578,9 @@ public: * a path between book and section (via chapter), but chapter is not * transparent. Therefore that path is not allowed. * + * Implicitly this does a breadth-first search on the graph of + * StructuredClasses that are transparent. It also takes care of cycles. + * * @param childDescriptor is a supposedly valid child Descriptor of this * Descriptor. * @return either a path of FieldDescriptors and @@ -589,7 +589,38 @@ public: * no such path can be constructed. * */ - NodeVector<Node> pathTo(Handle<StructuredClass> childDescriptor) const; + NodeVector<Node> pathTo(Handle<StructuredClass> childDescriptor, + Logger &logger) const; + /** + * This tries to construct the shortest possible path of this Descriptor + * to the given FieldDescriptor. + * + * Implicitly this does a breadth-first search on the graph of + * StructuredClasses that are transparent. It also takes care of cycles. + * + * @param field is a FieldDescriptor that may be allowed as child of this + * Descriptor. + * @return either a path of FieldDescriptors and StructuredClasses + * between this Descriptor and the input FieldDescriptor or an + * empty vector if no such path can be constructed. + */ + NodeVector<Node> pathTo(Handle<FieldDescriptor> field, + Logger &logger) const; + /** + * This tries to construct the shortest possible path of this Descriptor + * to the given FieldDescriptor. + * + * Implicitly this does a breadth-first search on the graph of + * StructuredClasses that are transparent. It also takes care of cycles. + * + * @param fieldName is the name of a FieldDescriptor that may be allowed as + * child of this Descriptor. + * @return either a path of FieldDescriptors and StructuredClasses + * between this Descriptor and a FieldDescriptor with the + * given name or an empty vector if no such path can be + * constructed. + */ + NodeVector<Node> pathTo(const std::string &fieldName, Logger &logger) const; }; /* * TODO: We should discuss Cardinalities one more time. Is it smart to define |