com.regnosys.rosetta.translate.synonymmap.SynonymExistsTest Maven / Gradle / Ivy
package com.regnosys.rosetta.translate.synonymmap;
import java.util.Collections;
import java.util.List;
import com.regnosys.rosetta.rosetta.RosettaMapPathValue;
import com.regnosys.rosetta.rosetta.RosettaMapTestExistsExpression;
public class SynonymExistsTest implements SynonymTest {
private final SynonymValue path;
public SynonymExistsTest(RosettaMapTestExistsExpression exp) {
path = new SynonymValue(Element.toElementList(((RosettaMapPathValue)exp.getArgument()).getPath()), 1, false);
}
@Override
public List getPaths() {
return Collections.singletonList(path);
}
public SynonymValue getPath() {
return path;
}
@Override
public String toString() {
return path.toPathString() + " exists";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((path == null) ? 0 : path.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SynonymExistsTest other = (SynonymExistsTest) obj;
if (path == null) {
if (other.path != null)
return false;
} else if (!path.equals(other.path))
return false;
return true;
}
}