/* Send a code of the given tree. c and tree must not have side effects
497231
function SEND_CODE(c, tree) {
		send_bits(tree[c].fc, tree[c].dl);
	}
179364
protected void response( int code, String data )
    {    
        /*
         * send the json content type and the charset 
        */
        response.setContentType("application/json;charset="+config.getCharset());
        
        JSONWriter json = JSONWriter.create()
                    .put("code", code)
                        .put("data", data);
        
        /*IStringBuffer sb = new IStringBuffer();
        sb.append("{\n");
        sb.append("\"status\": ").append(status).append(",\n");
        sb.append("\"errcode\": ").append(errcode).append(",\n");
        sb.append("\"data\": ");
        if ( data.charAt(0) == '{' || data.charAt(0) == '[' ) {
            sb.append(data).append('\n');
        } else {
            sb.append('"').append(data).append("\"\n");
        }
        sb.append("}\n");*/
        
        output.println(json.toString());
        output.flush();
        
        //let the gc do its work
        json = null;
    }
228877
@Override
	public void sendCommand(final BitfinexCommand command) {
		try {
			if (command instanceof BitfinexStreamSymbolToChannelIdResolverAware) {
				final BitfinexStreamSymbolToChannelIdResolverAware aware = (BitfinexStreamSymbolToChannelIdResolverAware) command;
				aware.setResolver(symbol -> {
					final Integer channelId = getChannelForSymbol(symbol);
					if (channelId == null) {
						throw new IllegalArgumentException("Unknown symbol: " + symbol);
					}
					return channelId;
				});
			}
			final String json = command.getCommand(this);
            logger.debug("Sent: {}", command);
			websocketEndpoint.sendMessage(json);
		} catch (final BitfinexCommandException e) {
			logger.error("Got Exception while sending command", e);
		}
	}
1348031
function _addToTree(tree, branchToken, leafToken) {
  /* eslint-disable max-len, no-param-reassign */
  const leafValue = Utils.merge(tree[branchToken].fields[leafToken] || {}, _parseLeafToken(leafToken));
  tree[branchToken].fields[leafToken] = leafValue;
  /* eslint-enable max-len, no-param-reassign */

  return tree;
}
452934
function SendSchema() {
    /**
     * The recipient of value
     * @member
     * @type { Recipient }
     */
    this.recipient = Object.create(Recipient.prototype);
    /**
     * The messageId value
     * @member
     */
    this.messageId = null;
    /**
     * The conversionTarget of value
     * @member
     * @type { ConversionTarget }
     */
    this.conversionTarget = Object.create(ConversionTarget.prototype);

}
707107
private function writeCode($tree, $name)
    {
        $code     = $this->walk($tree);
        $sections = implode("\n", $this->sections);
        $blocks   = implode("\n", $this->blocks);
        $klass    = empty($this->sections) && empty($this->blocks) ? self::KLASS_NO_LAMBDAS : self::KLASS;

        $callable = $this->strictCallables ? $this->prepare(self::STRICT_CALLABLE) : '';

        return sprintf($this->prepare($klass, 0, false, true), $name, $callable, $code, $sections, $blocks);
    }
784061
public static void apply(Program program, TreeGP manager)
   {
      int iMaxProgramDepth = manager.getMaxProgramDepth();
      TGPMutationStrategy method = manager.getMutationStrategy();
      RandEngine randEngine = manager.getRandEngine();
      
      if (method == TGPMutationStrategy.MUTATION_SUBTREE || method == TGPMutationStrategy.MUTATION_SUBTREE_KINNEAR)
      {
         TreeNode node = program.anyNode(randEngine)._1();
         int depth = program.calcDepth();

         TreeNode root = program.getRoot();

         if (method == TGPMutationStrategy.MUTATION_SUBTREE)
         {
            int node_depth = root.depth2Node(node);
            node.getChildren().clear();

            node.setPrimitive(program.anyPrimitive(randEngine));

            if (!node.getPrimitive().isTerminal())
            {
               int max_depth = iMaxProgramDepth - node_depth;
               TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine);
            }
         }
         else
         {
            int subtree_depth = root.depth2Node(node);
            int current_depth = depth - subtree_depth;
            int max_depth = (int)(depth * 1.15) - current_depth;

            node.getChildren().clear();
            node.setPrimitive(program.anyPrimitive(randEngine));

            if (!node.getPrimitive().isTerminal())
            {
               TreeGenerator.createWithDepth(program, node, max_depth, TGPInitializationStrategy.INITIALIZATION_METHOD_GROW, randEngine);
            }
         }
      }
      else if (method == TGPMutationStrategy.MUTATION_HOIST)
      {
         TreeNode node = program.anyNode(randEngine)._1();

         if (node != program.getRoot())
         {
            program.setRoot(node);
         }
      }
      else if (method == TGPMutationStrategy.MUTATION_SHRINK)
      {
         TreeNode node = program.anyNode(randEngine)._1();
         node.getChildren().clear();
         node.setPrimitive(program.anyTerminal(randEngine));
      }

      program.calcDepth();
      program.calcLength();
   }
1302344
def request(self, tree, **kwargs):
        

        apirequest = lxml.etree.tostring(
            E.openXML(
                E.credentials(
                    E.username(self.username),
                    OE('password', self.password),
                    OE('hash', self.password_hash),
                ),
                tree
            ),

            method='c14n'
        )

        try:
            apiresponse = self.session.post(self.url, data=apirequest)
            apiresponse.raise_for_status()
        except requests.RequestException as e:
            raise ServiceUnavailable(str(e))

        tree = lxml.objectify.fromstring(apiresponse.content)

        if tree.reply.code == 0:
            return Response(tree)
        else:
            klass = from_code(tree.reply.code)
            desc = tree.reply.desc
            code = tree.reply.code
            data = getattr(tree.reply, 'data', '')
            raise klass(u"{0} ({1}) {2}".format(desc, code, data), code)
904699
void send(AbstractMessage aMessage, int priority)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "send", new Object[] {this,
                                            aMessage,
                                            new Integer(priority),
                                            "verboseMsg OUT : " + aMessage.toVerboseString()});
    if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      MPIOMsgDebug.debug(tc, aMessage, priority);
    
    // comms accepting messages, write the message
    // immediately.
    try
    {
      //send the encoded message
      connection.send(aMessage, priority);          

      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message accepted by Comms");
    } 
    catch (SIConnectionDroppedException e)
    {
      // No FFDC code needed
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Connection Dropped");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }       
    catch (SIConnectionUnavailableException e)
    {
      // No FFDC code needed
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Connection Unavailable");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    } 
    catch (SIConnectionLostException e)
    {
      // No FFDC code needed
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Connection Lost");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(MessageEncodeFailedException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Msg Encode Failed");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(MessageCopyFailedException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Msg Copy Failed");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(UnsupportedEncodingException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Msg Encoding Failed");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
    catch(IncorrectMessageTypeException e)
    {
      // No FFDC code needed
      //this should never happen, but comms declare the exception, so
      //we have to deal with it
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        SibTr.debug(tc, "send", "Message refused by Comms: Incorrect Message Type");
      
      // Pass this exception up to our parent.  Note that we'll assume
      // we're still alive, and let our parent (in coordination with TRM
      // decide whether or not to nuke us).
      mpio.error(connection, e);
    }
      
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "send");
  }
525508
function send_tree(tree, max_code) {
		var n; // iterates over all tree elements
		var prevlen = -1; // last emitted length
		var curlen; // length of current code
		var nextlen = tree[0].dl; // length of next code
		var count = 0; // repeat count of the current code
		var max_count = 7; // max repeat count
		var min_count = 4; // min repeat count

		// tree[max_code+1].dl = -1; */  /* guard already set */
		if (nextlen === 0) {
			max_count = 138;
			min_count = 3;
		}

		for (n = 0; n <= max_code; n++) {
			curlen = nextlen;
			nextlen = tree[n + 1].dl;
			if (++count < max_count && curlen === nextlen) {
				continue;
			} else if (count < min_count) {
				do {
					SEND_CODE(curlen, bl_tree);
				} while (--count !== 0);
			} else if (curlen !== 0) {
				if (curlen !== prevlen) {
					SEND_CODE(curlen, bl_tree);
					count--;
				}
			// Assert(count >= 3 && count <= 6, " 3_6?");
				SEND_CODE(REP_3_6, bl_tree);
				send_bits(count - 3, 2);
			} else if (count <= 10) {
				SEND_CODE(REPZ_3_10, bl_tree);
				send_bits(count - 3, 3);
			} else {
				SEND_CODE(REPZ_11_138, bl_tree);
				send_bits(count - 11, 7);
			}
			count = 0;
			prevlen = curlen;
			if (nextlen === 0) {
				max_count = 138;
				min_count = 3;
			} else if (curlen === nextlen) {
				max_count = 6;
				min_count = 3;
			} else {
				max_count = 7;
				min_count = 4;
			}
		}
	}
1063963
public static Tree CCtransform(Tree t) {
    boolean notDone = true;
    while (notDone) {
      Tree cc = findCCparent(t, t);
      if (cc != null) {
        t = cc;
      } else {
        notDone = false;
      }
    }
    return t;
  }
1102186
protected void fireTreeStructureChanged(Object source, Object[] path, int[] childIndices, Object[] children) {
        // Guaranteed to return a non-null array
        Object[] listeners = listenerList.getListenerList();
        TreeModelEvent e = null;
        // Process the listeners last to first, notifying
        // those that are interested in this event
        for (int i = listeners.length - 2; i >= 0; i -= 2) {
            if (listeners[i] == TreeModelListener.class) {
                // Lazily create the event:
                if (e == null) {
                    e = new TreeModelEvent(source, path, childIndices, children);
                }
                ((TreeModelListener) listeners[i + 1]).treeStructureChanged(e);
            }
        }
    }
1337076
public static void processTreeRequest(String treeId, TreeElement treeRoot, HttpServletRequest request, HttpServletResponse response)
    {
        assert(treeId != null) : "parameter treeId must not be null.";
        assert(treeRoot != null) : "parameter treeRoot must not be null.";
        assert(request != null) : "paramater request must not be null.";

        // check the root node to see if it is a TreeRootElement.  if it is, then we
        // use it to change the selected node.  Otherwise we will do a recursive search
        // of the tree to select the node.
        String selectNode = request.getParameter(TreeElement.SELECTED_NODE);
        if (selectNode != null) {
            if (treeRoot instanceof ITreeRootElement) {
                ITreeRootElement root = (ITreeRootElement) treeRoot;
                root.changeSelected(selectNode, request);
            }
            else {
                setSelected(treeRoot, selectNode, request);
            }
        }

        // handle auto expand.
        String expandNode = null;

        // our we auto expanding this node?
        expandNode = request.getParameter(TreeElement.EXPAND_NODE);

        // if we are auto expanding flip the expand of this node if it was expanded
        if (expandNode != null) {
            TreeElement n = treeRoot.findNode(expandNode);
            if (n != null) {
                n.onExpand(request, response);
                n.setExpanded(!n.isExpanded());
            }
        }
    }
339725
public void sendRequestPacket(String nodeID, Context ctx) {
		FastBuildTree msg = new FastBuildTree(11);

		// Add basic properties (version, sender's nodeID, etc.)
		msg.putUnsafe("ver", PROTOCOL_VERSION);
		msg.putUnsafe("sender", this.nodeID);
		msg.putUnsafe("id", ctx.id);
		msg.putUnsafe("action", ctx.name);

		// Add params and meta
		if (ctx.params != null) {
			msg.putUnsafe("params", ctx.params.asObject());
			Tree meta = ctx.params.getMeta(false);
			if (meta != null && !meta.isEmpty()) {
				msg.putUnsafe("meta", meta.asObject());
			}
		}

		// Timeout
		if (ctx.opts != null && ctx.opts.timeout > 0) {
			msg.putUnsafe("timeout", ctx.opts.timeout);
		}

		// Call level
		msg.putUnsafe("level", ctx.level);

		// Parent ID
		if (ctx.parentID != null) {
			msg.putUnsafe("parentID", ctx.parentID);
		}

		// Request ID
		msg.putUnsafe("requestID", ctx.requestID);

		// Stream packet counter (default is "0" = packet isn't streamed)
		if (ctx.stream != null) {

			// Streaming in progress
			msg.putUnsafe("stream", true);

			// First sequence
			msg.putUnsafe("seq", 0);
		}

		// Send message
		publish(Transporter.PACKET_REQUEST, nodeID, msg);
	}
642029
function treeSetMutable (address, tree, value) {
  if (address.length === 0) {
    return value
  } else {
    const [ rest, last ] = tail(address)
    const parent = treeGet(rest, tree)
    if (checkType(NODE, parent)) {
      parent.children[last] = value
    } else {
      parent[last] = value
    }
    return tree
  }
}
235258
public static int send(SocketBase s, String str, int flags)
    {
        byte[] data = str.getBytes(CHARSET);
        return send(s, data, data.length, flags);
    }
1164056
function _composeTree() {
    var this$1 = this;

    this._updateChildNodes(this.host, this._composeNode(this.host));
    var p$ = this._insertionPoints || [];
    for (var i=0, l=p$.length, p, parent; (i<l) && (p=p$[i]); i++) {
      parent = tree.Logical.getParentNode(p);
      if ((parent !== this$1.host) && (parent !== this$1)) {
        this$1._updateChildNodes(parent, this$1._composeNode(parent));
      }
    }
  }