获取某个数据模型的 mock 数据
@param {Number} id - 数据模型的 id
@param {Array} ds - 数据模型的数据源, 包括所有数据模型
其他:
环的检测: 在深度遍历的时候, 如果遍历的路径上第二次出现自定义的数据类型, 则说明存在环
每次深度遍历完再进行广度遍历的时候(即遍历上一个结点的兄弟结点), 需要将上一次(同层级的)深度遍历时增加的结点去除
这里使用一个小技巧, 把数组的长度更改为上一次(同层级的)深度遍历时的值就可以
774591
function (id, ds) {
      this.ds = ds;
      this.errorData = [];
      var result = this._getMockOfDatatypeId(id);
      return {
        json: result,
        error: this.errorData
      };
    }
1078266
public void addObjectId( Object object, ObjectIdSerializer<?> id ) {
        if ( null == mapObjectId ) {
            if ( useEqualityForObjectId ) {
                mapObjectId = new HashMap<Object, ObjectIdSerializer<?>>();
            } else {
                mapObjectId = new IdentityHashMap<Object, ObjectIdSerializer<?>>();
            }
        }
        mapObjectId.put( object, id );
    }
98122
public static @CheckForNull <T extends Descriptor> T findById(Collection<? extends T> list, String id) {
        for (T d : list) {
            if(d.getId().equals(id))
                return d;
        }
        return null;
    }
598479
function (id) {
        var returnControl = null;
        for(var i=0, len=this.controls.length; i<len; i++) {
            var control = this.controls[i];
            if (control.id == id) {
                returnControl = control;
                break;
            }
        }
        return returnControl;
    }
1228216
function (id) {
      return typeof id === 'number' ?
        clear(id) :
        void(
          drop(qframe, id) ||
          drop(qidle, id) ||
          drop(qframex, id) ||
          drop(qidlex, id)
        );
    }
630755
public T setId(int id) {
    Preconditions.checkState(this.id == null);
    this.id = id;
    return (T) this;
  }
1370734
function checkId(id) {
  id = id || "";
  id = id.toString();
  return _.isString(id) && id.length === 24;
}
711388
function DepNode(id, options) {

	debug('new DepNode(%s)', id);

	if('string' != typeof id) {
		throw new Error('Invalid argument : id must be a string');
	}

	checkOptions(options);


	// Parent DepNode reference
	this.parent      = null;

	// Child nodes array
	this.children    = [];

	// This node uniq id
	this.id          = id;

	// List of the modules uniq id stored
	// owned by this node
	this.modules     = [];

	// Current nway options (stored for uid generation)
	this.options     = options

	// Used by debug to show optimization ratio
	this.fromSize = 0;
	this.toSize = 0;

}
355494
function(id) {
        var q = queues[id], sc;
        if (q.onTimeout) {
            sc = q.context || q;
            q.onTimeout.call(sc, _returnData(q));
        }

        _end(id, 'timeout', 'timeout');
    }
714275
public Map<String, Object> loadById(String id) {
        final String sid = sessionPrefix + ":" + id;
        try {
            return this.executor.execute(new RedisCallback<Map<String, Object>>() {
                public Map<String, Object> execute(Jedis jedis) {
                    String session = jedis.get(sid);
                    if (!Strings.isNullOrEmpty(session)) {
                        return serializer.deserialize(session);
                    }
                    return Collections.emptyMap();
                }
            });
        } catch (Exception e) {
            log.error("failed to load session(key={}), cause:{}", sid, Throwables.getStackTraceAsString(e));
            throw new SessionException("load session failed", e);
        }
    }
559591
function idOptions (id, options) {
  const _key = options._key == null
    ? '[' + id + ']'
    : options._key + '[' + id + ']'
  return Object.assign({}, options, { _key: _key })
}
725009
def propagate_ids(cls, obj, match_id, new_id, applied_keys, backend=None):
        
        applied = []
        def propagate(o):
            if o.id == match_id or (o.__class__.__name__ == 'DynamicMap'):
                setattr(o, 'id', new_id)
                applied.append(o)
        obj.traverse(propagate, specs=set(applied_keys) | {'DynamicMap'})

        # Clean up the custom tree if it was not applied
        if not new_id in Store.custom_options(backend=backend):
            raise AssertionError("New option id %d does not match any "
                                 "option trees in Store.custom_options."
                                 % new_id)
        return applied
458258
function generate_id (args, done) {
  var actnid
  var length = args.length || 6

  if (length < 65) {
    actnid = nids[length] || (nids[length] = Nid({length: length}))
  }
  else {
    actnid = Nid({length: length})
  }

  done(null, actnid())
}
170479
function getChainIndexById(id, sequence){
    return sequence.map(function(el){
      return el._id;
    }).indexOf(id);
  }
918702
private int getDatastreamPaneIndex(String id) {
        int index = -1;
        for (int i=0; i < m_datastreamPanes.length; i++)
        {
            if(m_datastreamPanes[i].getItemId().equals(id)){
                index = i;
                break;
            }
        }
        return index;
    }
865136
public void setId(Object id) {
	  if (lock == SET) {
		 throw new IllegalStateException("EntryInfo is locked");
	  }
	  /*if (idFlag == SET) {
		 if (tc.isDebugEnabled()) Tr.debug(tc, "Illegal State: tried to set id to "+id+
											   ", but id was already set to "+this.id  );
		  throw new IllegalStateException("id was already set");
	  } */
	  idFlag = SET;
	  this.id = id;
	  if (tc.isDebugEnabled())
		 Tr.debug(tc, "set id=" + id);
   }
740206
function assertNotContainRelativeId( requireId ) {
        var invalidIds = [];

        /**
         * 监测模块id是否relative id
         *
         * @ignore
         * @param {string} id 模块id
         */
        function monitor( id ) {
            if ( id.indexOf( '.' ) === 0 ) {
                invalidIds.push( id );
            }
        }

        if ( typeof requireId === 'string' ) {
            monitor( requireId );
        }
        else {
            each(
                requireId,
                function ( id ) {
                    monitor( id );
                }
            );
        }

        // 包含相对id时，直接抛出错误
        if ( invalidIds.length > 0 ) {
            throw new Error(
                '[REQUIRE_FATAL]Relative ID is not allowed in global require: '
                + invalidIds.join( ', ' )
            );
        }
    }