次の3つのcannot find symbol
エラーが発生しましたが、理由がわかりません。
GrammerQueue.java:9: cannot find symbol
symbol : constructor GrammerStructure()
location: class GrammerStructure
public class GrammerQueue extends GrammerStructure implements StringQueue{
^
GrammerQueue.java:45: cannot find symbol
symbol : variable stack
location: class GrammerQueue
this.stack += tmpAr[i];
^
GrammerQueue.java:47: cannot find symbol
symbol : variable count
location: class GrammerQueue
this.count--;
^
3 errors
別のスクリプトでこのエラーが発生し、クラスが作成したオブジェクトを直接呼び出すのではなく、そのタイプの新しいオブジェクトを呼び出すことで解決しました。しかし、私はまだオブジェクトを作成しようとはしていません!私に何ができる?
コードは次のとおりです。
import java.lang.*;
public class GrammerQueue extends GrammerStructure implements StringQueue {
private String queue = "";
private String structName;
// @override
public boolean offer(String item) {
if (item.length() == 0) // We don't accept empty Strings!
return false;
else if (this.queue.length() == 0) // If new queue, just add - no null.
queue = item;
else
// Append null and item for seperation.
queue += "\0" + item;
return true; // done.
}
// @override
public String[] asArray() {
// Splits the string at each null character and returns it as an array.
String[] array = this.queue.split("\0");
return array;
}
// @override
public void GrammerStructure(String structureName) {
this.structName = structureName;
}
// @override
public String take() throws EmptyException {
// If empty, throw errors.
if (this.queue.length() == 0)
throw new EmptyException(structName);
String[] tmpAr = this.asArray();
// Empties the stac now that we have it in a temp array.
this.queue = "";
// FIFO, so exclude first element in reconstruction.
for (int i = 1; i < tmpAr.length; i++)
this.stack += tmpAr[i];
// We made it this far without error, so reduce count.
this.count--;
// Return the first item.
return tmpAr[0];
}
// @override
public String peek() {
// Empty string check.
if (this.queue.length() == 0)
return null;
String[] tmpAr = this.asArray();
// Return the first item.
return tmpAr[0];
}
// @override
public int size() {
if (this.queue.length() == 0)
return 0;
String[] tmpAr = this.asArray();
return tmpAr.length;
}
// @override
public void clear() throws EmptyException {
// If empty, throw errors.
if (this.queue.length() == 0)
throw new EmptyException(structName);
else
this.queue = ""; // Empty now.
}
public void main(String args[]) {}
}