Search in sources :

Example 1 with ActiveQuestionTask

use of nars.task.ActiveQuestionTask in project narchy by automenta.

the class InterNAR method receive.

void receive(UDPeer.UDProfile from, UDPeer.Msg m, Task x) {
    if (x.isQuestOrQuestion()) {
        // reconstruct a question task with an onAnswered handler to reply with answers to the sender
        x = new ActiveQuestionTask(x, 8, nar, (q, a) -> accept(nar, q, a));
        x.meta("UDPeer", m);
    }
    x.budget(nar);
    // System.out.println(me + " RECV " + x + " " + Arrays.toString(x.stamp()) + " from " + m.origin());
    logger.debug("recv {} from {}", x, from);
    recv.input(x);
}
Also used : TaskLeak(nars.bag.leak.TaskLeak) Logger(org.slf4j.Logger) TriConsumer(jcog.util.TriConsumer) TELL(jcog.net.UDPeer.Command.TELL) LoggerFactory(org.slf4j.LoggerFactory) IOException(java.io.IOException) InetSocketAddress(java.net.InetSocketAddress) UnknownHostException(java.net.UnknownHostException) Util(jcog.Util) ITask(nars.task.ITask) ActiveQuestionTask(nars.task.ActiveQuestionTask) Nullable(org.jetbrains.annotations.Nullable) SocketException(java.net.SocketException) TaskService(nars.control.TaskService) UDPeer(jcog.net.UDPeer) CauseChannel(nars.control.CauseChannel) ActiveQuestionTask(nars.task.ActiveQuestionTask)

Aggregations

IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 SocketException (java.net.SocketException)1 UnknownHostException (java.net.UnknownHostException)1 Util (jcog.Util)1 UDPeer (jcog.net.UDPeer)1 TELL (jcog.net.UDPeer.Command.TELL)1 TriConsumer (jcog.util.TriConsumer)1 TaskLeak (nars.bag.leak.TaskLeak)1 CauseChannel (nars.control.CauseChannel)1 TaskService (nars.control.TaskService)1 ActiveQuestionTask (nars.task.ActiveQuestionTask)1 ITask (nars.task.ITask)1 Nullable (org.jetbrains.annotations.Nullable)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1