aboutsummaryrefslogtreecommitdiff
path: root/src/Documentation/DocumentationModel.kt
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-11 20:54:26 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-11 20:54:26 +0400
commit197a6e486d16d2e3689e900b45c65ef8d598f3b7 (patch)
tree5b4443a4406dd0fff9a549e8fc51e61d8f2ef06a /src/Documentation/DocumentationModel.kt
parent6afd7af76563f373e971256f8c9a7dcf42183fd4 (diff)
downloaddokka-197a6e486d16d2e3689e900b45c65ef8d598f3b7.tar.gz
dokka-197a6e486d16d2e3689e900b45c65ef8d598f3b7.tar.bz2
dokka-197a6e486d16d2e3689e900b45c65ef8d598f3b7.zip
Rename Documentation folder to Model
Diffstat (limited to 'src/Documentation/DocumentationModel.kt')
-rw-r--r--src/Documentation/DocumentationModel.kt67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/Documentation/DocumentationModel.kt b/src/Documentation/DocumentationModel.kt
deleted file mode 100644
index 0113eb18..00000000
--- a/src/Documentation/DocumentationModel.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.jetbrains.dokka
-
-import org.jetbrains.jet.lang.resolve.BindingContext
-import org.jetbrains.jet.lang.psi.JetFile
-
-public enum class DocumentationNodeKind {
- Unknown
-
- Package
- Class
- Object
- Constructor
- Function
- Property
- Parameter
- TypeParameter
- Exception
-
- Page
- Model
-}
-
-public enum class DocumentationReferenceKind {
- Member
- Detail
- Owner
- Link
- Override
-}
-
-public open class DocumentationNode(val name: String, val doc: String, val kind: DocumentationNodeKind) {
- private val references = arrayListOf<DocumentationReference>()
-
- public val owner: DocumentationNode
- get() = references(DocumentationReferenceKind.Owner).single().to
- public val details: List<DocumentationNode>
- get() = references(DocumentationReferenceKind.Detail).map { it.to }
- public val members: List<DocumentationNode>
- get() = references(DocumentationReferenceKind.Member).map { it.to }
- public val links: List<DocumentationNode>
- get() = references(DocumentationReferenceKind.Link).map { it.to }
-
- // TODO: Should we allow node mutation? Model merge will copy by ref, so references are transparent, which could nice
- public fun addReferenceTo(to: DocumentationNode, kind: DocumentationReferenceKind) {
- references.add(DocumentationReference(this, to, kind))
- }
-
- public fun addAllReferencesFrom(other: DocumentationNode) {
- references.addAll(other.references)
- }
-
- public fun references(kind: DocumentationReferenceKind): List<DocumentationReference> = references.filter { it.kind == kind }
-}
-
-public class DocumentationModel : DocumentationNode("model", "", DocumentationNodeKind.Model) {
- fun merge(other: DocumentationModel): DocumentationModel {
- val model = DocumentationModel()
- model.addAllReferencesFrom(other)
- model.addAllReferencesFrom(this)
- return model
- }
-
- public val nodes: List<DocumentationNode>
- get() = members
-}
-
-public data class DocumentationReference(val from: DocumentationNode, val to: DocumentationNode, val kind: DocumentationReferenceKind)