001/* 002 * Copyright (c) 2012-2018 Institut National des Sciences Appliquées de Lyon (INSA Lyon) and others 003 * 004 * This program and the accompanying materials are made available under the 005 * terms of the Eclipse Public License 2.0 which is available at 006 * http://www.eclipse.org/legal/epl-2.0. 007 * 008 * SPDX-License-Identifier: EPL-2.0 009 */ 010 011package org.eclipse.golo.compiler.parser; 012 013import java.util.List; 014 015public class ASTAugmentDeclaration extends GoloASTNode implements NamedNode { 016 017 private String target; 018 private List<String> augmentationNames; 019 020 public ASTAugmentDeclaration(int id) { 021 super(id); 022 } 023 024 public ASTAugmentDeclaration(GoloParser p, int id) { 025 super(p, id); 026 } 027 028 public String getTarget() { 029 return target; 030 } 031 032 public void setTarget(String target) { 033 this.target = target; 034 } 035 036 public List<String> getAugmentationNames() { 037 return augmentationNames; 038 } 039 040 public void setAugmentationNames(List<String> names) { 041 this.augmentationNames = names; 042 } 043 044 public boolean isNamedAugmentation() { 045 return (augmentationNames != null && !augmentationNames.isEmpty()); 046 } 047 048 @Override 049 public String toString() { 050 return "ASTAugmentDeclaration{" 051 + "target='" + target + '\'' 052 + (isNamedAugmentation() 053 ? ", augmentations=" + augmentationNames 054 : "") 055 + '}'; 056 } 057 058 @Override 059 public Object jjtAccept(GoloParserVisitor visitor, Object data) { 060 return visitor.visit(this, data); 061 } 062 063 @Override 064 public String getName() { 065 return getTarget(); 066 } 067 068 @Override 069 public void setName(String name) { 070 setTarget(name); 071 } 072}