Класс LexError
package
myLaba;
public
class
LexError
extends
Exception {
public
LexError() {
}
public
LexError(String message) {
super(message);
}
public
LexError(String message, Throwable cause) {
super(message,
cause);
}
public
LexError(Throwable cause) {
super(cause);
}
}
Класс Tape
package
myLaba;
public
class
Tape {
private
String text;
private
int
position
= 0;
public
Tape(String text) throws
LexError {
if
(text == null
|| text.equals("")){
throw
new
LexError("Не
задан текст для преобразования");
}
this.text
= text;
}
public
int
getNext(){
if
(position
>= text.length()){
return
-1;
}
return
text.charAt(position++);
}
}