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

fr.boreal.model.logicalElements.impl.LiteralImpl Maven / Gradle / Ivy

The newest version!
package fr.boreal.model.logicalElements.impl;

import fr.boreal.model.logicalElements.api.Literal;

/**
 * Default implementation of Literal
 *
 * @param  the native type of the Literal
 * @author Florent Tornil
 */
public record LiteralImpl(T value) implements Literal {

	/////////////////////////////////////////////////
	// Constructors
	/////////////////////////////////////////////////

	/**
	 * Constructor from a single value
	 *
	 * @param value the value
	 */
	public LiteralImpl {
	}

	/////////////////////////////////////////////////
	// Public methods
	/////////////////////////////////////////////////

	/////////////////////////////////////////////////
	// Getters
	/////////////////////////////////////////////////


	@Override
	public String label() {
		return this.value.toString();
	}

	/////////////////////////////////////////////////
	// Object methods
	/////////////////////////////////////////////////

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		} else if (o == null) {
			return false;
		} else if (o instanceof Literal other) {
            return this.value().equals(other.value());
		} else {
			return false;
		}
	}

	@Override
	public String toString() {
		return this.value.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy