/*
* Copyright (c) 2015 Institut National de l'Audiovisuel, INA
*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Redistributions of source code and compiled versions
* must retain the above copyright notice, this list of conditions and
* the following disclaimer.
*
* Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this file. If not, see <http://www.gnu.org/licenses/>
*
* This file 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 Lesser General Public License for more details.
*/
package fr.ina.research.amalia.model;
import java.math.BigDecimal;
import fr.ina.research.amalia.AmaliaException;
import fr.ina.research.amalia.model.jaxb.Data;
import fr.ina.research.amalia.model.jaxb.Localisation;
import fr.ina.research.amalia.model.jaxb.Shape;
import fr.ina.research.amalia.model.jaxb.Sublocalisations;
/**
* Wraps the localisation class automatically generated by Jaxb.
*
* @author Nicolas HERVE - nherve@ina.fr
*/
public class LocalisationBlock extends Block {
private Localisation internal;
LocalisationBlock() {
this(new Localisation());
}
LocalisationBlock(Localisation l) {
super();
internal = l;
}
@Override
public LocalisationBlock addLocalisationBlock(LocalisationBlock l) {
if (internal.getSublocalisations() == null) {
internal.setSublocalisations(new Sublocalisations());
}
l.setTclevel(getTcLevel() + 1);
internal.getSublocalisations().getLocalisation().add(l.getInternal());
return l;
}
@Override
public DataBlock getDataBlock() throws AmaliaException {
if (internal.getData() == null) {
internal.setData(new Data());
}
return new DataBlock(internal.getData());
}
public Localisation getInternal() {
return internal;
}
@Override
public int getTcLevel() {
return internal.getTclevel();
}
public void setId(String value) {
internal.setId(value);
}
public LocalisationBlock setLabel(String value) {
internal.setLabel(value);
return this;
}
public LocalisationBlock setScore(BigDecimal value) {
internal.setScore(value);
return this;
}
public LocalisationBlock setShape(Shape value) {
internal.setShape(value);
return this;
}
public LocalisationBlock setSynchronizedText(String value) {
if (internal.getData() == null) {
internal.setData(new Data());
} else {
internal.getData().getText().clear();
}
internal.getData().getText().add(value);
return this;
}
public LocalisationBlock setTc(String value) {
internal.setTc(value);
return this;
}
public LocalisationBlock setTcin(String value) {
internal.setTcin(value);
return this;
}
public LocalisationBlock setTclevel(Integer value) {
internal.setTclevel(value);
return this;
}
public LocalisationBlock setTcout(String value) {
internal.setTcout(value);
return this;
}
public LocalisationBlock setThumb(String value) {
internal.setThumb(value);
return this;
}
public LocalisationBlock setType(String value) {
internal.setType(value);
return this;
}
}