我正尝试在我的域特定语言中包含以下代码段:
val Layer1WTAconnection: ConnectionRef = layer1.connectTo( layer1, new FullConnection( () => new InhibitorySynapse ) )
通过使用相同的样式导入所有库,并且一切正常,我在DSL中编写了以下代码行:
val a: N2S3ConnectionReferences = new N2S3ConnectionReferences
val b: ConnectionRef = a.ConnectionRef_Generator("group_1","group_1")
上面的行引发错误。
ConnectionRef
文件包含以下代码段:
class ConnectionRef(from: NeuronGroupRef, to: NeuronGroupRef, connectionType: ConnectionPolicy) {
var deployed = false
def isDeployed: Boolean = this.deployed
var connections : ConnectionSet = _
def ensureDeployed(n2s3: N2S3): Unit = {
if (!this.isDeployed){
deployed = true
this.deploy(n2s3)
}
}
def deploy(n2s3: N2S3): Unit = {
println("Create connections from "+from.getIdentifier+" to "+to.getIdentifier)
connections = connectionType.create(from, to)
}
def disconnect() : Unit = {
assert(connections != null, "connection already disconnected")
connections.disconnect()
connections = null
}
def connects(aNeuron: NeuronRef, anotherNeuron: NeuronRef): Boolean = {
(aNeuron.group == from) & (anotherNeuron.group == to) & connectionType.connects(aNeuron, anotherNeuron)
}
}
但是它总是抛出错误。谁能帮忙。如果您想了解更多详细信息,请发表评论。 我为DSL定义的是:
class N2S3ConnectionReferences {
def ConnectionRef_Generator (id1: String, id2: String)(implicit network: N2S3SimulationDSL): ConnectionRef = {
network.getNeuronGroupRef( id1 ).connectTo( network.getNeuronGroupRef( id2 ), new FullConnection( () => new InhibitorySynapse ) )
}
}