ARPABETPhonemeAdapter.java from Texai at Krugle
Show ARPABETPhonemeAdapter.java syntax highlighted
/*
* ARPABETPhonemeAdapter.java
*
* Created on February 9, 2007, 1:38 PM
*
* Description: Provides an adapter to connect the arpabetPhoneme with its parent word construction, or
* word-sense simple construction.
*
* Copyright (C) 2007 Stephen L. Reed.
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation; either
* version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program;
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package org.texai.cmudict.domainEntity;
import javax.persistence.Id;
import org.texai.kb.Constants;
import org.texai.kb.persistence.DomainEntity;
import org.texai.kb.persistence.DomainProperty;
/**
*
* @author reed
*/
@DomainEntity(typeOf={Constants.TERM_NAME_LINGUISTIC_OBJECT_TYPE}, subClassOf={Constants.TERM_NAME_COMPUTER_DATA_STRUCTURE})
public class ARPABETPhonemeAdapter {
@Id
/** the term id */
private Long termId; // NOPMD
/**
* the adapted arpabet phoneme
*/
@DomainProperty(name="cxgPhoneme")
private ARPABETPhoneme arpabetPhoneme;
/**
* the phoneme position in an ordered list of phonemes
*/
@DomainProperty(name="cxgPhonenePosition", range=Constants.TERM_NAME_NON_NEGATIVE_INTEGER)
private int phonemePosition;
/**
* Creates a new instance of ARPABETPhonemeAdapter.
*/
public ARPABETPhonemeAdapter() {
super();
}
/**
* Creates a new instance of ARPABETPhonemeAdapter.
*
* @param arpabetPhoneme the adapted arpabet phoneme
* @param phonemePosition the parpabetPhonemeposition in an ordered list of phonemes
*/
public ARPABETPhonemeAdapter(final ARPABETPhoneme arpabetPhoneme, int phonemePosition) {
super();
//Preconditions
assert arpabetPhoneme != null : "arpabetPhoneme must not be null";
assert phonemePosition >= 0 : "phonemePosition must not be negative";
this.arpabetPhoneme = arpabetPhoneme;
this.phonemePosition = phonemePosition;
}
/**
* Sets the adapted arpabet phoneme.
*
* @param arpabetPhoneme the adapted parpabetPhoneme
*/
public void setPhoneme(final ARPABETPhoneme arpabetPhoneme) {
//Preconditions
assert arpabetPhoneme != null : "arpabetPhoneme must not be null";
this.arpabetPhoneme = arpabetPhoneme;
}
/**
* Gets the adapted arpabet phoneme.
*
* @return the adapted arpabet phoneme
*/
public ARPABETPhoneme getPhoneme() {
return arpabetPhoneme;
}
/**
* Sets the arpabet phoneme position in an ordered list of phonemes.
*
* @param phonemePosition the arpabet phoneme position in an ordered list of phonemes
*/
public void setPhonemePosition(final int phonemePosition) {
//Preconditions
assert phonemePosition >= 0 : "phonemePosition must not be negative";
this.phonemePosition = phonemePosition;
}
/**
* Gets the arpabet phoneme position in an ordered list of phonemes.
*
* @return the arpabet phoneme position in an ordered list of phonemes
*/
public int getPhonemePosition() {
return phonemePosition;
}
/** Returns a string representation of this object.
*
* @return a string representation of this object
*/
@Override
public String toString() {
return "[adapter for " + arpabetPhoneme + "]";
}
}
See more files for this project here