| 1 | /*
|
| 2 | * JavaTypeArgumentBoundLocalVariableModel.java
|
| 3 | *
|
| 4 | *
|
| 5 | * Copyright (c) 2006 GradSoft Ukraine
|
| 6 | * All Rights Reserved
|
| 7 | */
|
| 8 |
|
| 9 |
|
| 10 | package ua.gradsoft.javachecker.models;
|
| 11 |
|
| 12 | import java.util.Map;
|
| 13 | import ua.gradsoft.javachecker.EntityNotFoundException;
|
| 14 | import ua.gradsoft.javachecker.attributes.AttributedEntity;
|
| 15 | import ua.gradsoft.termware.Term;
|
| 16 | import ua.gradsoft.termware.TermWareException;
|
| 17 |
|
| 18 | /**
|
| 19 | *Local variable with type substitutions.
|
| 20 | * @author Ruslan Shevchenko
|
| 21 | */
|
| 22 | public class JavaTypeArgumentBoundLocalVariableModel implements JavaLocalVariableModel
|
| 23 | {
|
| 24 |
|
| 25 | public JavaTypeArgumentBoundLocalVariableModel(JavaLocalVariableModel origin,
|
| 26 | JavaTypeArgumentBoundStatementModel statement
|
| 27 | )
|
| 28 | {
|
| 29 | origin_=origin;
|
| 30 | statement_=statement;
|
| 31 | }
|
| 32 |
|
| 33 | public String getName()
|
| 34 | {
|
| 35 | return origin_.getName();
|
| 36 | }
|
| 37 |
|
| 38 | public JavaVariableKind getKind()
|
| 39 | {
|
| 40 | return origin_.getKind();
|
| 41 | }
|
| 42 |
|
| 43 | public JavaTypeModel getType() throws TermWareException, EntityNotFoundException
|
| 44 | {
|
| 45 | return statement_.getArgumentBoundTopLevelBlockModel().getSubstitution().substitute(origin_.getType());
|
| 46 | }
|
| 47 |
|
| 48 | public JavaTypeModel getOwnerType()
|
| 49 | { return origin_.getOwnerType(); }
|
| 50 |
|
| 51 | public JavaTopLevelBlockOwnerModel getTopLevelBlockOwner()
|
| 52 | { return origin_.getTopLevelBlockOwner(); }
|
| 53 |
|
| 54 | public JavaStatementModel getStatement()
|
| 55 | { return statement_; }
|
| 56 |
|
| 57 | public JavaExpressionModel getInitExpressionModel()
|
| 58 | {
|
| 59 | JavaExpressionModel e = origin_.getInitExpressionModel();
|
| 60 | return (e==null) ? null : new JavaTypeArgumentBoundExpressionModel(e,statement_);
|
| 61 | }
|
| 62 |
|
| 63 | public Map<String,JavaAnnotationInstanceModel> getAnnotationsMap() throws TermWareException
|
| 64 | {
|
| 65 | return origin_.getAnnotationsMap();
|
| 66 | }
|
| 67 |
|
| 68 |
|
| 69 | public JavaModifiersModel getModifiers()
|
| 70 | { return origin_.getModifiers(); }
|
| 71 |
|
| 72 | /**
|
| 73 | * TypeArgumentBoundLocalVariable(origin,substitution)
|
| 74 | */
|
| 75 | public Term getModelTerm() throws TermWareException, EntityNotFoundException
|
| 76 | {
|
| 77 | Term x = origin_.getModelTerm();
|
| 78 | Term y = TermUtils.createJTerm(statement_.getArgumentBoundTopLevelBlockModel().getSubstitution());
|
| 79 | Term retval = TermUtils.createTerm("TypeArgumentBoundLocalVariableModel",x,y);
|
| 80 | return retval;
|
| 81 | }
|
| 82 |
|
| 83 | public boolean isConstant() throws TermWareException, EntityNotFoundException
|
| 84 | {
|
| 85 | return origin_.isConstant();
|
| 86 | }
|
| 87 |
|
| 88 |
|
| 89 | public boolean isForHead()
|
| 90 | { return origin_.isForHead(); }
|
| 91 |
|
| 92 | public Term getAttribute(String name) throws TermWareException {
|
| 93 | return origin_.getAttribute(name);
|
| 94 | }
|
| 95 |
|
| 96 | public void setAttribute(String name, Term value) throws TermWareException {
|
| 97 | origin_.setAttribute(name,value);
|
| 98 | }
|
| 99 |
|
| 100 | public AttributedEntity getChildAttributes(String childName)
|
| 101 | {
|
| 102 | return null;
|
| 103 | }
|
| 104 |
|
| 105 | private JavaLocalVariableModel origin_;
|
| 106 | private JavaTypeArgumentBoundStatementModel statement_;
|
| 107 |
|
| 108 | }
|