1 /* 2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 package jdk.test.lib.jittester.classes; 25 26 import java.util.ArrayList; 27 import java.util.List; 28 import jdk.test.lib.jittester.IRNode; 29 import jdk.test.lib.jittester.types.TypeKlass; 30 import jdk.test.lib.jittester.visitors.Visitor; 31 32 33 public class Klass extends IRNode { 34 35 public TypeKlass getThisKlass() { 36 return thisKlass; 37 } 38 39 public List<TypeKlass> getInterfaces() { 40 return interfaces; 41 } 42 43 public TypeKlass getParentKlass() { 44 return parentKlass; 45 } 46 47 @Override 48 public String getName() { 49 return name; 50 } 51 52 public enum KlassPart { 53 DATA_MEMBERS, 54 CONSTRUCTORS, 55 REDEFINED_FUNCTIONS, 56 OVERRIDEN_FUNCTIONS, 57 MEMBER_FUNCTIONS, 58 MEMBER_FUNCTIONS_DECLARATIONS, 59 PRINT_VARIABLES, 60 } 61 62 protected final String name; 63 protected final TypeKlass thisKlass; 64 private final TypeKlass parentKlass; 65 private final ArrayList<TypeKlass> interfaces; 66 67 public Klass(TypeKlass thisKlass, TypeKlass parent, 68 ArrayList<TypeKlass> interfaces, String name, int level, 69 IRNode variableDeclarations, IRNode constructorDefinitions, 70 IRNode functionDefinitions, IRNode abstractFunctionRedefinitions, 71 IRNode overridenFunctionRedefitions, IRNode functionDeclarations, 72 IRNode printVariablesBlock) { 73 this.thisKlass = thisKlass; 74 klass = thisKlass; 75 this.parentKlass = parent; 76 this.interfaces = interfaces; 77 this.name = name; 78 this.level = level; 79 addChild(variableDeclarations); 80 addChild(constructorDefinitions); 81 addChild(abstractFunctionRedefinitions); 82 addChild(overridenFunctionRedefitions); 83 addChild(functionDefinitions); 84 addChild(functionDeclarations); 85 addChild(printVariablesBlock); 86 } 87 88 @Override 89 public long complexity() { 90 return 0; 91 } 92 93 @Override 94 public<T> T accept(Visitor<T> v) { 95 return v.visit(this); 96 } 97 }