public boolean sendQMessages() throws PostServiceNotSetException{

        if (this.postservice == null){
            throw new PostServiceNotSetException();
        }

        boolean atLeastOneUpdated = false;

        switch (Athena.shuffleMessage){

            case 1:
                Object[] arrayx = this.getVariables().toArray();
                arrayx = Utils.shuffleArrayFY(arrayx);

                for (Object nodeVariable : arrayx) {
                    Object[] arrayf = this.getFunctionsOfVariable(((NodeVariable)nodeVariable)).toArray();
                    arrayf = Utils.shuffleArrayFY(arrayf);

                    // TODO: shuffling is DA WAY
                    
                    for (Object nodeFunction : arrayf) {
                        //atLeastOneUpdated |= this.op.updateQ(variable, function, this.postservice);
                        atLeastOneUpdated |= this.op.updateQ((NodeVariable)nodeVariable, (NodeFunction)nodeFunction, this.postservice);
                    }


                }
                break;

            case 0:
            default:
                //System.out.println("Sono appena entrato nella sendQ");
            //do not shuffle, use them as-is
                Iterator<NodeVariable> iteratorv = this.getVariables().iterator();
                NodeVariable variable; // = null;
                NodeFunction function = null;

                while (iteratorv.hasNext()){
                    variable = iteratorv.next();
                    //System.out.println("Sono la variabile "+variable.getId()+" dell'agente "+this.id());
                    // gotcha a variable, looking for its functions
                    //System.out.print("Le mie funzioni sono:");
                    //Iterator<NodeFunction> iteratorf = this.variableToFunctions.get(variable).iterator();
                    Iterator<NodeFunction> iteratorf = this.getFunctionsOfVariable(variable).iterator();
                    while (iteratorf.hasNext()){
                        function = iteratorf.next();
                        //System.out.print(" "+function.getId());
                        // got variable, function

                        if (debug>=1) {
                                String dmethod = Thread.currentThread().getStackTrace()[1].getMethodName();
                                String dclass = Thread.currentThread().getStackTrace()[1].getClassName();
                                System.out.println("---------------------------------------");
                                System.out.println("[class: "+dclass+" method: " + dmethod+ "] " + "agent "+this+" preparing Q from " + variable + " to " + function);
                                System.out.println("---------------------------------------");
                        }
                        atLeastOneUpdated |= this.op.updateQ(variable, function, this.postservice);
                        //System.out.println("Ho consegnato il messaggio alla funzione "+function.getId());
                        if (debug>=1) {
                                String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName();
                                String dclass = Thread.currentThread().getStackTrace()[2].getClassName();
                                System.out.println("---------------------------------------");
                                System.out.println("[class: "+dclass+" method: " + dmethod+ "] " + "messageQ updated:");
                                MessageQ mq = this.postservice.readQMessage(variable, function);
                                System.out.println("Sender "+ mq.getSender() + " Receiver " + mq.getReceiver() + " message "+ mq );
                                System.out.println("---------------------------------------");
                        }

                    }

                }
                break;
                //end of case 0



        }
        return atLeastOneUpdated;
    }