/*
 * Sample.java
 *
 * Copyright (C) 2008  Pei Wang
 *
 * This file is part of Open-NARS.
 *
 * Open-NARS 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 2 of the License, or
 * (at your option) any later version.
 *
 * Open-NARS 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 Open-NARS.  If not, see <http://www.gnu.org/licenses/>.
 */
package nars.operator.io;

import com.google.common.collect.Lists;
import nars.core.Memory;
import nars.logic.entity.Task;
import nars.logic.entity.Term;
import nars.logic.nal8.Operation;
import nars.logic.nal8.Operator;

import java.util.List;

/**
 */
public class Say extends Operator {

//    boolean rejectEmpty = true;
//    boolean rejectHasVariables = true;    
    
    public Say() {
        super("^say");
    }

    @Override
    protected List<Task> execute(Operation operation, Term[] args, Memory memory) {

//        if (rejectEmpty && args.length == 1) {
//            //SELF argument by itself is not worth speaking
//            throw NegativeFeedback.ignore("Said nothing");
//        }
//                
//        if (rejectEmpty && Terms.containsVariables(args)) {
//            throw NegativeFeedback.ignore("Said variables");
//        }
                
        List<Term> spoken = Lists.newArrayList(args).subList(0, args.length-1);
        memory.emit(Say.class, spoken);
        
        return null;
    }

}

@@ -806,24 +806,114 @@
 ort 
-nars.core.Memory
+java.util.ArrayList;%0Aimport java.util.List;%0Aimport nars.core.Memory;%0Aimport nars.logic.entity.CompoundTerm
 ;%0Aim
@@ -968,24 +968,56 @@
 ntity.Term;%0A
+import nars.logic.nal4.Product;%0A
 import nars.
@@ -1076,32 +1076,8 @@
 r;%0A%0A
-import java.util.List;%0A%0A
 /**%0A
@@ -1786,16 +1786,563 @@
 gth-1);%0A
+        List%3CTerm%3E spoke2=new ArrayList%3CTerm%3E();%0A        for(Term t: spoken) %7B%0A            if(t instanceof Product) %7B%0A                CompoundTerm cn=(CompoundTerm) t;%0A                for(Term k : cn) %7B%0A                    String s=k.toString();%0A                    if(s.startsWith(%22word-%22)) %7B%0A                        spoke2.add(new Term(s.replace(%22word-%22, %22%22)));%0A                    %7D else %7B%0A                        spoke2.add(k);%0A                    %7D%0A                %7D%0A%0A            %7D else %7B%0A                return null;%0A            %7D%0A        %7D%0A
         
@@ -2369,17 +2369,17 @@
 s, spoke
-n
+2
 );%0A     

Update Say Operator to 1.6.1 state (commit 96d3c58454698fc33f14f87e9d4d11c79a3e7cee)