de.citec.tcs.alignment.sequence.StringValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sequences Show documentation
Show all versions of sequences Show documentation
This module contains the sequence datastructure of the
TCS Alignment Toolbox. It defines the possible value sets in the
ValueType enum as well as the different KeywordSpecification classes, namely:
1.) StringKeywordSpecification for string type values.
2.) SymbolicKeywordSpecification for values from a discrete alphabet (also refer to the Alphabet class)
3.) VectorialKeywordSpecification for vectors of some length (or for scalars)
A NodeSpecification is a vector of such KeywordSpecifications and defines
the order of value sets. A node, then, is defined as a vector of values
from these value sets (also refer to the Value interface as well as the
StringValue, SymbolicValue and VectorialValue classes). Finally a
sequence is defined as a list of such nodes.
/*
* TCS Alignment Toolbox Version 3
*
* Copyright (C) 2016
* Benjamin Paaßen
* AG Theoretical Computer Science
* Centre of Excellence Cognitive Interaction Technology (CITEC)
* University of Bielefeld
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package de.citec.tcs.alignment.sequence;
import lombok.NonNull;
/**
* This value is supposed to represent strings that are not restricted to a
* certain alphabet. If you want to limit the number of possible values, please
* refer to the SymbolValue class.
*
* @author Benjamin Paassen - [email protected]
*/
public class StringValue extends AbstractValue {
private String string;
public StringValue() {
super(ValueType.STRING);
}
public StringValue(@NonNull String string) {
super(ValueType.STRING);
this.string = string;
}
/**
* Returns the actual string.
*
* @return the actual string.
*/
public String getString() {
return string;
}
/**
*
* @param string the actual string.
*/
public void setString(@NonNull String string) {
this.string = string;
}
@Override
public String toString() {
return string;
}
@Override
public int hashCode() {
int hash = 7;
hash = 47 * hash + (this.string != null ? this.string.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final StringValue other = (StringValue) obj;
if ((this.string == null) ? (other.string != null) : !this.string.equals(other.string)) {
return false;
}
return true;
}
}