<commit_before>package org.jetbrains.plugins.scala.lang.psi.impl.toplevel.packaging

import api.base.ScStableCodeReferenceElement
import api.toplevel.typedef.ScTypeDefinition
import com.intellij.lang.ASTNode
import com.intellij.psi._
import com.intellij.psi.scope.PsiScopeProcessor
import com.intellij.psi.stubs.IStubElementType
import parser.ScalaElementTypes
import psi.ScalaPsiElementImpl
import api.toplevel.packaging._
import org.jetbrains.plugins.scala.lang.psi.stubs.elements.wrappers.ASTNodeWrapper
import org.jetbrains.plugins.scala.lang.psi.stubs.ScPackageContainerStub

/**
 * @author AlexanderPodkhalyuzin
* Date: 20.02.2008
 */

class ScPackagingImpl(node: ASTNode) extends ScalaPsiElementImpl(node) with ScPackaging {

  override def toString = "ScPackaging"

  private def reference = findChildByClass(classOf[ScStableCodeReferenceElement])

  // One more hack for correct inheritance
  override def getElementType: IStubElementType[Nothing, Nothing] =
    super.getElementType.asInstanceOf[IStubElementType[Nothing, Nothing]];

  def getPackageName = reference.qualName

  def fqn = {
    def _packageName(e: PsiElement): String = e.getParent match {
      case p: ScPackaging => {
        val _packName = _packageName(p)
        if (_packName.length > 0) _packName + "." + p.getPackageName else p.getPackageName
      }
      case f: ScalaFile => f.getPackageName
      case null => ""<commit_msg>NPE<commit_after>package org.jetbrains.plugins.scala.lang.psi.impl.toplevel.packaging

import api.base.ScStableCodeReferenceElement
import api.toplevel.typedef.ScTypeDefinition
import com.intellij.lang.ASTNode
import com.intellij.psi._
import com.intellij.psi.scope.PsiScopeProcessor
import com.intellij.psi.stubs.IStubElementType
import parser.ScalaElementTypes
import psi.ScalaPsiElementImpl
import api.toplevel.packaging._
import org.jetbrains.plugins.scala.lang.psi.stubs.elements.wrappers.ASTNodeWrapper
import org.jetbrains.plugins.scala.lang.psi.stubs.ScPackageContainerStub

/**
 * @author AlexanderPodkhalyuzin
* Date: 20.02.2008
 */

class ScPackagingImpl(node: ASTNode) extends ScalaPsiElementImpl(node) with ScPackaging {

  override def toString = "ScPackaging"

  private def reference = findChild(classOf[ScStableCodeReferenceElement])

  // One more hack for correct inheritance
  override def getElementType: IStubElementType[Nothing, Nothing] =
    super.getElementType.asInstanceOf[IStubElementType[Nothing, Nothing]];

  def getPackageName = reference match {
    case Some(r) => r.qualName
    case None => ""
  }

  def fqn = {
    def _packageName(e: PsiElement): String = e.getParent match {
      case p: ScPackaging => {
        val _packName = _packageName(p)
        if (_packName.length > 0) _packName + "." + p.getPackageName else p.getPackageName
      }
      case f: ScalaFile => f.getPackageName
      case null => ""
{'fraction_non_alphanumeric': 0.09354275741710297, 'fraction_numerical': 0.0062827225130890054, 'mean_word_length': 4.641732283464567, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6207923', 'n_tokens_mistral': 932, 'n_tokens_neox': 891, 'n_words': 178}