generated from jetbrains-academy/kotlin-course-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ouw own realization of functions
- Loading branch information
Valerii
committed
Jan 16, 2024
1 parent
c35a2fe
commit 6715358
Showing
10 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
common/sampleProject/src/main/kotlin/AccessingPsiElements/FunctionCounter/ComplexMethods.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class ComplexMethods { | ||
|
||
fun calculate(value: Int): Int { | ||
fun innerFunction(x: Int): Int { | ||
return x * x | ||
} | ||
return innerFunction(value) | ||
} | ||
|
||
companion object { | ||
fun staticMethod() { | ||
println("Static method in companion object") | ||
} | ||
} | ||
} | ||
|
||
fun anotherTopLevelFunction() { | ||
println("Another top-level function") | ||
} |
8 changes: 8 additions & 0 deletions
8
...k/src/main/kotlin/org/jetbrains/academy/plugin/course/dev/access/AuthorElementsCounter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.jetbrains.academy.plugin.course.dev.access | ||
|
||
import com.intellij.psi.PsiFile | ||
import com.intellij.psi.util.PsiTreeUtil | ||
import org.jetbrains.kotlin.psi.KtClass | ||
|
||
fun authorCountKtClasses(psiFile: PsiFile) = | ||
PsiTreeUtil.findChildrenOfType(psiFile, KtClass::class.java).toList().size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...k/src/main/kotlin/org/jetbrains/academy/plugin/course/dev/access/AuthorElementsCounter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.jetbrains.academy.plugin.course.dev.access | ||
|
||
import com.intellij.psi.PsiFile | ||
import com.intellij.psi.util.PsiTreeUtil | ||
import org.jetbrains.kotlin.psi.KtNamedFunction | ||
|
||
fun authorCountKtFunctions(psiFile: PsiFile) = | ||
PsiTreeUtil.findChildrenOfType(psiFile, KtNamedFunction::class.java).toList().size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters