/*
Flatten the message into a List of DataSlices for for transmission.

Javadoc description supplied by ControlMessage interface.
552693
public final List<DataSlice> encodeFast(Object conn) throws MessageEncodeFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "encodeFast");

    // ControlMessages are always single part small messages, so we encode them
    // to a single DataSlice.
    List<DataSlice> slices = new ArrayList<DataSlice>(1);
    slices.add(jmo.encodeSinglePartMessage(conn));

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "encodeFast");
    return slices;
  }
781905
protected static final SIMessageHandle[] getMessageHandles(
            final List messageList) {

        final String methodName = "getMessageIds";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(TRACE, methodName, messageList);
        }

        final SIMessageHandle[] msgHandles = new SIMessageHandle[messageList
                .size()];
        for (int i = 0; i < messageList.size(); i++) {
            SIBusMessage message = (SIBusMessage) messageList.get(i);
            msgHandles[i] = message.getMessageHandle();
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(TRACE, methodName, msgHandles);
        }
        return msgHandles;

    }
839251
def add_to_message(data, indent_level=0) -> list:
    """"""
    message = []

    if isinstance(data, str):
        message.append(indent(
            dedent(data.strip('\n')).strip(),
            indent_level * '  '
        ))
        return message

    for line in data:
        offset = 0 if isinstance(line, str) else 1
        message += add_to_message(line, indent_level + offset)
    return message
1084529
function flatten(list) {
    return list.reduce(function (acc, item) {
        if (Array.isArray(item)) {
            return acc.concat(flatten(item));
        }
        else {
            return acc.concat(item);
        }
    }, []);
}
785213
function normalize(msg, list) {
  var lower = map(function(s) {
    return s.toLowerCase();
  }, list);
  var opts = msg.options || {};
  var integrations = opts.integrations || {};
  var providers = opts.providers || {};
  var context = opts.context || {};
  var ret = {};
  debug('<-', msg);

  // integrations.
  each(function(value, key) {
    if (!integration(key)) return;
    if (!has.call(integrations, key)) integrations[key] = value;
    delete opts[key];
  }, opts);

  // providers.
  delete opts.providers;
  each(function(value, key) {
    if (!integration(key)) return;
    if (type(integrations[key]) === 'object') return;
    if (has.call(integrations, key) && typeof providers[key] === 'boolean')
      return;
    integrations[key] = value;
  }, providers);

  // move all toplevel options to msg
  // and the rest to context.
  each(function(value, key) {
    if (includes(key, toplevel)) {
      ret[key] = opts[key];
    } else {
      context[key] = opts[key];
    }
  }, opts);

  // generate and attach a messageId to msg
  msg.messageId = 'ajs-' + md5(json.stringify(msg) + uuid());

  // cleanup
  delete msg.options;
  ret.integrations = integrations;
  ret.context = context;
  ret = defaults(ret, msg);
  debug('->', ret);
  return ret;

  function integration(name) {
    return !!(
      includes(name, list) ||
      name.toLowerCase() === 'all' ||
      includes(name.toLowerCase(), lower)
    );
  }
}
158521
private List<DefNode> flatten(DefNode node) {
        final List<DefNode> result = new ArrayList<>();
        result.add(node);
        return flatten(result, node.getChildren());
    }
598707
function formatMsg(){

        return Array.prototype.slice.call( arguments ) .concat([ " (at ", linen, ":", linec, ")." ]) .join( "" );
    }
1123293
public void setupMessageDataDesc()
    {
        super.setupMessageDataDesc();
        
        for (String key: PROPERTIES)
        {
            this.addMessageFieldDesc(key, String.class, MessageFieldDesc.REQUIRED, null);
        }
    }
832617
public static String flatten(List lines, String sep) {
    return flatten(lines.toArray(new Object[lines.size()]), sep);
  }
81212
public List<MessageBuffer> toBufferList()
    {
        try {
            flush();
        }
        catch (IOException ex) {
            // IOException must not happen because underlying ArrayBufferOutput never throws IOException
            throw new RuntimeException(ex);
        }
        return getArrayBufferOut().toBufferList();
    }
333171
def flatten_sequence(list)
      foldl(list.compact) { |r, e|        # and then merge flat elements
        merge_fold(r, e)
      }
    end
561223
public void flattenToBuffer(ByteBuffer buf) {
        buf.put(INCOMPLETE_ENCODING_FROM_JAVA); // encoding version
        buf.put((byte)1); // owns_loops_
        buf.put((byte)(m_loops.size() > 1 ? 1 : 0)); // has_holes_
        buf.putInt(m_loops.size());
        int depth = 0;
        for (List<XYZPoint> loop : m_loops) {
            flattenLoopToBuffer(loop, depth, buf);
            depth = 1;
        }
        flattenEmptyBoundToBuffer(buf);
    }
707308
function flattenFields(fields) {
	const fieldsObj = {};
	fields.forEach(function(field) {
		if (!fields.hasOwnProperty(field.name)) {
			fieldsObj[field.name] = field.value;
		}
	});
	return fieldsObj;
}
247783
static SIMessageHandle[] getMessageHandles(final List messages) {

        final SIMessageHandle[] messageHandles = new SIMessageHandle[messages
                        .size()];
        for (int i = 0; i < messageHandles.length; i++) {
            final SIBusMessage message = (SIBusMessage) messages.get(i);
            messageHandles[i] = message.getMessageHandle();
        }
        return messageHandles;

    }
1051282
function(msgs){
  var res = '[', msg;
  for(var i=0, l=msgs.length; i<l; i++) {
    if(i > 0) {
      res += ',';
    }
    msg = msgs[i];
    if(typeof msg === 'string') {
      res += msg;
    } else {
      res += JSON.stringify(msg);
    }
  }
  res += ']';
  return res;
}
1063198
private List<DefNode> flatten(List<DefNode> result, List<DefNode> nodes) {
        nodes.stream().forEach(n -> {
            flatten(result, n.getChildren());
            result.add(n);
        });
        return result;
    }
538558
def split_message(message, max_length):
    """"""
    ms = []
    while len(message) > max_length:
        ms.append(message[:max_length])
        message = message[max_length:]
    ms.append(message)
    return ms