/*
 * Copyright (C) 2014 peiwang
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package nars.operator.mental;

import java.util.ArrayList;
import nars.entity.*;
import nars.language.*;
import nars.operator.Operation;
import nars.operator.Operator;
import nars.core.Memory;

/**
 * Register a new operator when the system is running
 */
public class Register extends Operator {

    public Register() {
        super("^register");
    }

    /**
     * To register a new operator
     * @param args Arguments, a Statement followed by an optional tense
     * @param memory The memory in which the operation is executed
     * @return Immediate results as Tasks
     */
    @Override
    protected ArrayList<Task> execute(Operation operation, Term[] args, Memory memory) {
        Term operator = args[0];
        memory.addOperator((Operator) operator);  // add error checking
        return null;
    }
    
}

@@ -759,16 +759,42 @@
 yList;%0D%0A
+import nars.core.Memory;%0D%0A
 import n
@@ -829,24 +829,60 @@
 anguage.*;%0D%0A
+import nars.operator.NullOperator;%0D%0A
 import nars.
@@ -937,34 +937,8 @@
 or;%0D
-%0Aimport nars.core.Memory;%0D
 %0A%0D%0A/
@@ -1462,31 +1462,56 @@
     
-Term o
+Operator op=new NullO
 perator
- = 
+(
 args%5B0%5D
+.toString())
 ;%0D%0A 
@@ -1540,27 +1540,10 @@
 tor(
-(Operator) operator
+op
 );  

fix Register operator.