1 /* 2 * Copyright 2016 Google Inc. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.turbine.binder.bound; 18 19 import com.google.common.collect.ImmutableMap; 20 import com.google.turbine.binder.sym.ClassSymbol; 21 import com.google.turbine.model.TurbineTyKind; 22 import com.google.turbine.tree.Tree; 23 24 /** A {@link BoundClass} that corresponds to a source file being compiled. */ 25 public class SourceBoundClass implements BoundClass { 26 private final ClassSymbol sym; 27 private final ClassSymbol owner; 28 private final ImmutableMap<String, ClassSymbol> children; 29 private final int access; 30 private final Tree.TyDecl decl; 31 SourceBoundClass( ClassSymbol sym, ClassSymbol owner, ImmutableMap<String, ClassSymbol> children, int access, Tree.TyDecl decl)32 public SourceBoundClass( 33 ClassSymbol sym, 34 ClassSymbol owner, 35 ImmutableMap<String, ClassSymbol> children, 36 int access, 37 Tree.TyDecl decl) { 38 this.sym = sym; 39 this.owner = owner; 40 this.children = children; 41 this.access = access; 42 this.decl = decl; 43 } 44 decl()45 public Tree.TyDecl decl() { 46 return decl; 47 } 48 49 @Override kind()50 public TurbineTyKind kind() { 51 return decl().tykind(); 52 } 53 54 @Override owner()55 public ClassSymbol owner() { 56 return owner; 57 } 58 59 @Override access()60 public int access() { 61 return access; 62 } 63 64 @Override children()65 public ImmutableMap<String, ClassSymbol> children() { 66 return children; 67 } 68 sym()69 public ClassSymbol sym() { 70 return sym; 71 } 72 } 73