My environment: groovy -v
Groovy Version: 3.0.4 JVM: 1.8.0_242 Vendor: Azul Systems, Inc. OS: Linux
I write two files: AStar.groovy and digit.groovy.
file AStar.groovy like:
class State{
int deep = 0;
def pre;
double f = 0;
}
abstract class AStar {
State begin;
State end;
def astar() {
// some astar code
}
abstract def judge(def state);
}
and file digit.groovy like:
class DigitState extends State {
// some fields and methods
}
class Digit extends AStar {
// some fields and methods;
def judge(def state) {
// some codes.
}
}
def digit = new Digit();
def path = digit.astar();
path.each {
println(it);
}
now I want to run digit as: groovy digit.groovy
But it tell me "unable to resolve class State"
I see this url: Including a groovy script in another groovy
But I can not run my script by that way, and I do not know what is my wrong.
How can I include the file without compile please?