![JAR search and dependency download from the Maven repository](/logo.png)
io.github.kiryu1223.expressionTree.expressions.CaseExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ExpressionTree Show documentation
Show all versions of ExpressionTree Show documentation
java static expressionTree
package io.github.kiryu1223.expressionTree.expressions;
import java.util.List;
public class CaseExpression extends Expression
{
private final Expression part;
private final List stats;
public CaseExpression(Expression part, List stats)
{
this.part = part;
this.stats = stats;
}
public Expression getPart()
{
return part;
}
public List getStats()
{
return stats;
}
@Override
public Kind getKind()
{
return Kind.Case;
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder("case " + part + ":");
for (Expression stat : stats)
{
sb.append("\n ").append(stat);
switch (stat.getKind())
{
case Block:
case Lambda:
case If:
case Foreach:
case For:
case While:
case Switch:
case Catch:
case Try:
break;
default:
sb.append(";");
break;
}
}
return sb.toString();
}
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
CaseExpression that = (CaseExpression) obj;
return part.equals(that.part) && stats.equals(that.stats);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy