/*******************************************************************************
* Copyright (c) 2009-2015 CWI
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI
* * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl
* * Paul Klint - Paul.Klint@cwi.nl - CWI
* * Mark Hills - Mark.Hills@cwi.nl (CWI)
* * Arnold Lankamp - Arnold.Lankamp@cwi.nl
* * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI
*******************************************************************************/
package org.rascalmpl.ast;
import org.rascalmpl.value.IConstructor;
import org.rascalmpl.value.ISourceLocation;
public abstract class KeywordFormals extends AbstractAST {
public KeywordFormals(ISourceLocation src, IConstructor node) {
super(src /* we forget node on purpose */);
}
public boolean hasKeywordFormalList() {
return false;
}
public java.util.List<org.rascalmpl.ast.KeywordFormal> getKeywordFormalList() {
throw new UnsupportedOperationException();
}
public boolean hasOptionalComma() {
return false;
}
public org.rascalmpl.ast.OptionalComma getOptionalComma() {
throw new UnsupportedOperationException();
}
public boolean isDefault() {
return false;
}
static public class Default extends KeywordFormals {
// Production: sig("Default",[arg("org.rascalmpl.ast.OptionalComma","optionalComma"),arg("java.util.List\<org.rascalmpl.ast.KeywordFormal\>","keywordFormalList")],breakable=false)
private final org.rascalmpl.ast.OptionalComma optionalComma;
private final java.util.List<org.rascalmpl.ast.KeywordFormal> keywordFormalList;
public Default(ISourceLocation src, IConstructor node , org.rascalmpl.ast.OptionalComma optionalComma, java.util.List<org.rascalmpl.ast.KeywordFormal> keywordFormalList) {
super(src, node);
this.optionalComma = optionalComma;
this.keywordFormalList = keywordFormalList;
}
@Override
public boolean isDefault() {
return true;
}
@Override
public <T> T accept(IASTVisitor<T> visitor) {
return visitor.visitKeywordFormalsDefault(this);
}
@Override
protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) {
if (getLocation().getBeginLine() == $line) {
$result.add(this);
}
ISourceLocation $l;
$l = optionalComma.getLocation();
if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
optionalComma.addForLineNumber($line, $result);
}
if ($l.getBeginLine() > $line) {
return;
}
for (AbstractAST $elem : keywordFormalList) {
$l = $elem.getLocation();
if ($l.hasLineColumn() && $l.getBeginLine() <= $line && $l.getEndLine() >= $line) {
$elem.addForLineNumber($line, $result);
}
if ($l.getBeginLine() > $line) {
return;
}
}
}
@Override
public boolean equals(Object o) {
if (!(o instanceof Default)) {
return false;
}
Default tmp = (Default) o;
return true && tmp.optionalComma.equals(this.optionalComma) && tmp.keywordFormalList.equals(this.keywordFormalList) ;
}
@Override
public int hashCode() {
return 941 + 307 * optionalComma.hashCode() + 941 * keywordFormalList.hashCode() ;
}
@Override
public org.rascalmpl.ast.OptionalComma getOptionalComma() {
return this.optionalComma;
}
@Override
public boolean hasOptionalComma() {
return true;
}
@Override
public java.util.List<org.rascalmpl.ast.KeywordFormal> getKeywordFormalList() {
return this.keywordFormalList;
}
@Override
public boolean hasKeywordFormalList() {
return true;
}
@Override
public Object clone() {
return newInstance(getClass(), src, (IConstructor) null , clone(optionalComma), clone(keywordFormalList));
}
}
public boolean isNone() {
return false;
}
static public class None extends KeywordFormals {
// Production: sig("None",[],breakable=false)
public None(ISourceLocation src, IConstructor node ) {
super(src, node);
}
@Override
public boolean isNone() {
return true;
}
@Override
public <T> T accept(IASTVisitor<T> visitor) {
return visitor.visitKeywordFormalsNone(this);
}
@Override
protected void addForLineNumber(int $line, java.util.List<AbstractAST> $result) {
if (getLocation().getBeginLine() == $line) {
$result.add(this);
}
ISourceLocation $l;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof None)) {
return false;
}
None tmp = (None) o;
return true ;
}
@Override
public int hashCode() {
return 631 ;
}
@Override
public Object clone() {
return newInstance(getClass(), src, (IConstructor) null );
}
}
}