All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.regnosys.rosetta.translate.SynonymAttributePath Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.regnosys.rosetta.translate;

import java.util.Comparator;

class SynonymAttributePath implements Comparable {

	private final Comparator comparator =
			Comparator.comparing(SynonymAttributePath::getSynonymPath)
					.thenComparing(SynonymAttributePath::getAttributePath)
					.thenComparing(SynonymAttributePath::getIndex);

	private final String synonymPath;
	private final String attributePath;
	private final int index;

	public SynonymAttributePath(String synonymPath, String attributePath, int index) {
		this.synonymPath = synonymPath;
		this.attributePath = attributePath;
		this.index = index;
	}

	public String getSynonymPath() {
		return synonymPath;
	}

	public String getAttributePath() {
		return attributePath;
	}

	public int getIndex() {
		return index;
	}

	@Override
	public int compareTo(SynonymAttributePath other) {
		return comparator.compare(this, other);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((attributePath == null) ? 0 : attributePath.hashCode());
		result = prime * result + ((synonymPath == null) ? 0 : synonymPath.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;
		SynonymAttributePath other = (SynonymAttributePath) obj;
		if (attributePath == null) {
			if (other.attributePath != null)
				return false;
		} else if (!attributePath.equals(other.attributePath))
			return false;
		if (synonymPath == null) {
			if (other.synonymPath != null)
				return false;
		} else if (!synonymPath.equals(other.synonymPath))
			return false;
		return true;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy