<commit_before>/*   Copyright (c) 2015 Magnet Systems, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.magnet.mmx.protocol;

import java.io.Serializable;
import java.util.Map;

import com.google.gson.annotations.SerializedName;
import com.magnet.mmx.util.GsonData;

/**
 * This class represents an identifier for an MMX user or MMX end-point.  The
 * MMX identifier for end-point targets to a specific user device.  The MMX
 * identifier for user targets to the user regardless of devices.  An MMX
 * user identifier can be derived from an MMX end-point identifier by:
 * <pre>
 * MMXid endpointXID;
 * ...
 * MMXid userXID = new MMXid(endpointXID.getUserId());
 * </pre>
 */
public class MMXid implements Serializable {
  private static final long serialVersionUID = -4167064339466261739L;
  @SerializedName("userId")
  private String mUserId;
  @SerializedName("devId")
  private String mDeviceId;
  @SerializedName("displayName")
  private String mDisplayName;

//  /**
//   * Construct an identifier for a user without a display name.  The
//   * <code>userId</code> must be in the un-escaped format and it will be
//   * converted to lower case.
//   * @param userId A non-null user ID.
//   */
//  public MMXid(String userId) {
//    this(userId, null, null);
//  }

  /**
   * Construct an identifier for a user.  The <code>userId</code> must be
   * in the un-escaped format and it will be converted to lower case.
   * @param userId A non-null user ID.
   * @param displayName A display name or null.
   */
  public MMXid(String userId, String displayName) {
    this(userId, null, displayName);
  }

  /**
   * Construct an identifier for an end-point with an optional display name.
   * The <code>userId</code> must be be in the un-escaped format and it will be
   * converted to lower case.
   * @param userId A non-null user ID.
   * @param deviceId A device ID.
   * @param displayName A display name or null.
   */
  public MMXid(String userId, String deviceId, String displayName) {
    if (userId == null) {
      throw new IllegalArgumentException("User ID cannot be null");
    }
    mUserId = userId.toLowerCase();
    mDeviceId = deviceId;
    mDisplayName = displayName;
  }

  /**
   * Get the user ID.  When comparing the user ID, make sure that it is case
   * insensitive.
   * @return The user ID in lower case.
   */
  public String getUserId() {
    return mUserId;
  }

  /**
   * Get the device ID.  A null value may be returned if this identifier is for
   * user.  The device ID is case sensitive.
   * @return The device ID, or null.
   */
  public String getDeviceId() {
    return mDeviceId;
  }

  /**
   * Get a user display name.  This property is optional.<commit_msg>Remove the confusing constructor.<commit_after>/*   Copyright (c) 2015 Magnet Systems, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.magnet.mmx.protocol;

import java.io.Serializable;
import java.util.Map;

import com.google.gson.annotations.SerializedName;
import com.magnet.mmx.util.GsonData;

/**
 * This class represents an identifier for an MMX user or MMX end-point.  The
 * MMX identifier for end-point targets to a specific user device.  The MMX
 * identifier for user targets to the user regardless of devices.  An MMX
 * user identifier can be derived from an MMX end-point identifier by:
 * <pre>
 * MMXid endpointXID;
 * ...
 * MMXid userXID = new MMXid(endpointXID.getUserId());
 * </pre>
 */
public class MMXid implements Serializable {
  private static final long serialVersionUID = -4167064339466261739L;
  @SerializedName("userId")
  private String mUserId;
  @SerializedName("devId")
  private String mDeviceId;
  @SerializedName("displayName")
  private String mDisplayName;

//  /**
//   * Construct an identifier for a user without a display name.  The
//   * <code>userId</code> must be in the un-escaped format and it will be
//   * converted to lower case.
//   * @param userId A non-null user ID.
//   */
//  public MMXid(String userId) {
//    this(userId, null, null);
//  }

  /**
   * Construct an identifier for a user or end-point with an optional display
   * name.  The <code>userId</code> must be be in the un-escaped format and it
   * will be converted to lower case.
   * @param userId A non-null user ID.
   * @param deviceId A device ID or null.
   * @param displayName A display name or null.
   */
  public MMXid(String userId, String deviceId, String displayName) {
    if (userId == null) {
      throw new IllegalArgumentException("User ID cannot be null");
    }
    mUserId = userId.toLowerCase();
    mDeviceId = deviceId;
    mDisplayName = displayName;
  }

  /**
   * Get the user ID.  When comparing the user ID, make sure that it is case
   * insensitive.
   * @return The user ID in lower case.
   */
  public String getUserId() {
    return mUserId;
  }

  /**
   * Get the device ID.  A null value may be returned if this identifier is for
   * user.  The device ID is case sensitive.
   * @return The device ID, or null.
   */
  public String getDeviceId() {
    return mDeviceId;
  }

  /**
   * Get a user display name.  This property is optional.
{'fraction_non_alphanumeric': 0.09214135872196225, 'fraction_numerical': 0.008713893819590124, 'mean_word_length': 3.08569545154911, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3514147', 'n_tokens_mistral': 1851, 'n_tokens_neox': 1848, 'n_words': 753}