| 1 |
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
package com.eprosima.idl.parser.tree; |
| 16 |
|
| 17 |
import com.eprosima.idl.context.Context; |
| 18 |
import com.eprosima.idl.parser.typecode.Member; |
| 19 |
|
| 20 |
import java.util.ArrayList; |
| 21 |
import java.util.List; |
| 22 |
import org.antlr.v4.runtime.Token; |
| 23 |
|
| 24 |
public class Exception extends TreeNode implements Export, Definition |
| 25 |
{ |
| 26 |
public Exception(String scopeFile, boolean isInScope, String scope, String name, Token token) |
| 27 |
{ |
| 28 |
super(scopeFile, isInScope, scope, name, token); |
| 29 |
|
| 30 |
m_members = new ArrayList<Member>(); |
| 31 |
} |
| 32 |
|
| 33 |
@Override |
| 34 |
public boolean isIsModule() |
| 35 |
{ |
| 36 |
return false; |
| 37 |
} |
| 38 |
|
| 39 |
@Override |
| 40 |
public boolean isIsInterface() |
| 41 |
{ |
| 42 |
return false; |
| 43 |
} |
| 44 |
|
| 45 |
@Override |
| 46 |
public boolean isIsTypeDeclaration() |
| 47 |
{ |
| 48 |
return false; |
| 49 |
} |
| 50 |
|
| 51 |
@Override |
| 52 |
public boolean isIsConstDeclaration() |
| 53 |
{ |
| 54 |
return false; |
| 55 |
} |
| 56 |
|
| 57 |
public void setParent(Object obj) |
| 58 |
{ |
| 59 |
m_parent = obj; |
| 60 |
} |
| 61 |
|
| 62 |
public Object getParent() |
| 63 |
{ |
| 64 |
return m_parent; |
| 65 |
} |
| 66 |
|
| 67 |
@Override |
| 68 |
public boolean isIsOperation() |
| 69 |
{ |
| 70 |
return false; |
| 71 |
} |
| 72 |
|
| 73 |
@Override |
| 74 |
public boolean isIsException() |
| 75 |
{ |
| 76 |
return true; |
| 77 |
} |
| 78 |
|
| 79 |
@Override |
| 80 |
public boolean isIsAnnotation() |
| 81 |
{ |
| 82 |
return false; |
| 83 |
} |
| 84 |
|
| 85 |
public List<Member> getMembers() |
| 86 |
{ |
| 87 |
return m_members; |
| 88 |
} |
| 89 |
|
| 90 |
public int addMember(Member member) |
| 91 |
{ |
| 92 |
m_members.add(member); |
| 93 |
member.set_index(m_members.size() - 1); |
| 94 |
return m_members.size() - 1; |
| 95 |
} |
| 96 |
|
| 97 |
@Override |
| 98 |
public boolean resolve(Context ctx) |
| 99 |
{ |
| 100 |
return true; |
| 101 |
} |
| 102 |
|
| 103 |
@Override |
| 104 |
protected boolean isDeclaredInsideInterface() |
| 105 |
{ |
| 106 |
return m_parent instanceof Interface; |
| 107 |
} |
| 108 |
|
| 109 |
private Object m_parent = null; |
| 110 |
private List<Member> m_members = null; |
| 111 |
} |