<commit_before>/*
 * Copyright 2000-2007 JetBrains s.r.o.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.plugins.groovy.lang.psi.impl.statements;

import com.intellij.lang.ASTNode;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.util.IncorrectOperationException;
import com.intellij.pom.java.PomField;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariableDeclarations;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinitionBody;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;

/**
 * @author: Dmitry.Krasilschikov
 * @date: 11.04.2007
 */
public class GrVariableImpl extends GroovyPsiElementImpl implements GrField {
  public GrVariableImpl(@NotNull ASTNode node) {
    super(node);
  }

  public String toString() {
    return "Variable";
  }

  @NotNull
  public PsiType getType() {
    GrTypeElement typeElement = ((GrVariableDeclarations) getParent()).getTypeElementGroovy();
    return typeElement == null ?
        getManager().getElementFactory().createTypeByFQClassName("java.lang.Object", getResolveScope()) :
        typeElement.getType();
  }

  @Nullable
  public PsiTypeElement getTypeElement() {
    return null;
  }

  @Nullable
  public PsiExpression getInitializer() {
    return null;
  }

  public boolean hasInitializer() {
    return false;
  }

  public void normalizeDeclaration() throws IncorrectOperationException {
  }

  @Nullable
  public Object computeConstantValue() {
    return null;
  }

  public String getName() {
    return getNameIdentifierGroovy().getText();
  }

  @NotNull
  public PsiElement getNameIdentifierGroovy() {
    return findChildByType(GroovyTokenTypes.mIDENT);
  }

  public int getTextOffset() {
    return getNameIdentifierGroovy().getTextRange().getStartOffset();
  }

  public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
    throw new IncorrectOperationException("NIY");
  }

  public PomField getPom() {
    return null;
  }

  public void setInitializer(@Nullable PsiExpression psiExpression) throws IncorrectOperationException {
  }

  @NotNull
  public PsiIdentifier getNameIdentifier() {
    PsiElement nameId = getNameIdentifierGroovy();
    return new JavaIdentifier(getManager(), getContainingFile(), nameId.getTextRange());
  }

  public PsiClass getContainingClass() {
    PsiElement parent = getParent().getParent();
    if (parent instanceof GrTypeDefinitionBody) {
      return (PsiClass) parent.getParent();
    }
    return null;
  }

  @Nullable
  public PsiModifierList getModifierList() {
    PsiElement parent = getParent();
    if (parent instanceof GrVariableDeclarations) {
      return ((GrVariableDeclarations) parent).getModifierList();
    }
    return null;
  }

  public boolean hasModifierProperty(@NonNls @NotNull String property) {
    PsiModifierList modifierList = getModifierList();
    if (modifierList != null) return modifierList.hasModifierProperty(property);
    return false;
  }

  @Nullable
  public PsiDocComment getDocComment() {
    return null;
  }

  public boolean isDeprecated() {
    return false;
  }
}
<commit_msg>cleanup<commit_after>/*
 * Copyright 2000-2007 JetBrains s.r.o.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.plugins.groovy.lang.psi.impl.statements;

import com.intellij.lang.ASTNode;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.util.IncorrectOperationException;
import com.intellij.pom.java.PomField;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariableDeclarations;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinitionBody;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;

/**
 * @author: Dmitry.Krasilschikov
 * @date: 11.04.2007
 */
public class GrVariableImpl extends GroovyPsiElementImpl implements GrField {
  public GrVariableImpl(@NotNull ASTNode node) {
    super(node);
  }

  public String toString() {
    return "Variable";
  }

  @NotNull
  public PsiType getType() {
    PsiElement parent = getParent();
    GrTypeElement typeElement = parent instanceof GrParameter ? ((GrParameter) parent).getTypeElementGroovy() : ((GrVariableDeclarations) parent).getTypeElementGroovy();
    return typeElement == null ?
        getManager().getElementFactory().createTypeByFQClassName("java.lang.Object", getResolveScope()) :
        typeElement.getType();
  }

  @Nullable
  public PsiTypeElement getTypeElement() {
    return null;
  }

  @Nullable
  public PsiExpression getInitializer() {
    return null;
  }

  public boolean hasInitializer() {
    return false;
  }

  public void normalizeDeclaration() throws IncorrectOperationException {
  }

  @Nullable
  public Object computeConstantValue() {
    return null;
  }

  public String getName() {
    return getNameIdentifierGroovy().getText();
  }

  @NotNull
  public PsiElement getNameIdentifierGroovy() {
    return findChildByType(GroovyTokenTypes.mIDENT);
  }

  public int getTextOffset() {
    return getNameIdentifierGroovy().getTextRange().getStartOffset();
  }

  public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
    throw new IncorrectOperationException("NIY");
  }

  public PomField getPom() {
    return null;
  }

  public void setInitializer(@Nullable PsiExpression psiExpression) throws IncorrectOperationException {
  }

  @NotNull
  public PsiIdentifier getNameIdentifier() {
    PsiElement nameId = getNameIdentifierGroovy();
    return new JavaIdentifier(getManager(), getContainingFile(), nameId.getTextRange());
  }

  public PsiClass getContainingClass() {
    PsiElement parent = getParent().getParent();
    if (parent instanceof GrTypeDefinitionBody) {
      return (PsiClass) parent.getParent();
    }
    return null;
  }

  @Nullable
  public PsiModifierList getModifierList() {
    PsiElement parent = getParent();
    if (parent instanceof GrVariableDeclarations) {
      return ((GrVariableDeclarations) parent).getModifierList();
    }
    return null;
  }

  public boolean hasModifierProperty(@NonNls @NotNull String property) {
    PsiModifierList modifierList = getModifierList();
    if (modifierList != null) return modifierList.hasModifierProperty(property);
    return false;
  }

  @Nullable
  public PsiDocComment getDocComment() {
    return null;
  }

  public boolean isDeprecated() {
    return false;
  }
}

{'fraction_non_alphanumeric': 0.09608411892675853, 'fraction_numerical': 0.0048344210780759, 'mean_word_length': 4.429790026246719, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5940761', 'n_tokens_mistral': 2499, 'n_tokens_neox': 2355, 'n_words': 580}