/*
- assumes id is already validated
516476
ReferenceableInstance createInstance(MemRepository repo, Id id) throws RepositoryException {
        Integer pos = idPosMap.get(id);
        String typeName = typeNameList.get(pos);
        if (!Objects.equals(typeName, hierarchicalType.getName())) {
            return repo.getClassStore(typeName).createInstance(repo, id);
        }

        ImmutableList<String> traitNames = traitNamesStore.get(pos);
        String[] tNs = traitNames.toArray(new String[]{});

        try {
            return (ReferenceableInstance) classType.createInstance(id, tNs);
        } catch (AtlasException me) {
            throw new RepositoryException(me);
        }
    }
1224624
function(id) {
        if (typeof id !== "string") {
            YAHOO.log("id is not a string, assuming it is an HTMLElement");
            id = Dom.generateId(id);
        }
        this.invalidHandleIds[id] = id;
    }
753377
def _ensure_object_id(cls, id):
        """"""
        if isinstance(id, ObjectId):
            return id

        if isinstance(id, basestring) and OBJECTIDEXPR.match(id):
            return ObjectId(id)

        return id
982692
public ValidationData findById(Long id) {
        List<ValidationData> datas = this.idIndex.get(ValidationIndexUtil.makeKey(String.valueOf(id)));
        if (datas.isEmpty()) {
            return null;
        }
        return datas.get(0);
    }
1373070
def validate_identifier(self, field):
        """"""
        if field.data:
            field.data = field.data.lower()
            if Community.get(field.data, with_deleted=True):
                raise validators.ValidationError(
                    _('The identifier already exists. '
                      'Please choose a different one.'))
50822
function checkOrGenerateId (data) {
        data = data || {};
        if (!data._id) {
          data._id = apos.utils.generateId();
        }
        return data;
      }
523252
public static void validateEntityID(final EntityID id) {
	int changes = 0;
	// Changed new UUID(m, l)
	if (id.mostSigBits() != EntityID.DEFAULT_MOST_SIG_BITS
		|| id.leastSigBits() != EntityID.DEFAULT_LEAST_SIG_BITS) {
	    changes++;
	}

	// Changed fromString(n)
	if (!EntityID.DEFAULT_NAME.equals(id.name())) {
	    changes++;
	}

	// Changed random
	if (id.random() != EntityID.DEFAULT_RANDOM) {
	    changes++;
	}

	// Check changed more than once
	if (changes > 1) {
	    throw new IllegalArgumentException(
		    String.format("%s annotation provides multiple ID source info", EntityID.class));
	}
    }
396283
function isString(value, message, id) {
    if (message === void 0) { message = ''; }
    if (id === void 0) { id = ''; }
    if (this.enabled && !(typeof value === 'string' || value instanceof String)) {
        throw TypeException.unexpectedType(assertionTypes.IS_STRING, value, '<string>', message, id);
    }
}
1236948
@Override
	public String isValidID(String id) {
		Data data;
		try {
			data = identities.find(id, identities.reuse());
		} catch (IOException e) {
			return getName() + " could not lookup " + id + ": " + e.getLocalizedMessage();
		}
		return data==null?id + "is not an Identity in " + getName():null;
	}
237341
function uniqueId() {
  var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'id_';
  var id = prefix + strRand();
  if (!store.uniqueId) store.uniqueId = {};
  var generatedIds = store.uniqueId;

  if (document.getElementById(id) || generatedIds[id]) {
    return uniqueId(prefix);
  } else {
    generatedIds[id] = true;
    return id;
  }
}
1211094
protected void checkIdRefs()
        throws XMLStreamException
    {
        /* 02-Oct-2004, TSa: Now we can also check that all id references
         *    pointed to ids that actually are defined
         */
        if (mIdMap != null) {
            ElementId ref = mIdMap.getFirstUndefined();
            if (ref != null) { // problem!
                reportValidationProblem("Undefined id '"+ref.getId()
                                        +"': referenced from element <"
                                        +ref.getElemName()+">, attribute '"
                                        +ref.getAttrName()+"'",
                                        ref.getLocation());
            }
        }
    }
894052
static Expression id(String id, Iterable<GoogRequire> requires) {
    CodeChunkUtils.checkId(id);
    return Leaf.create(id, /* isCheap= */ true, requires);
  }
1370734
function checkId(id) {
  id = id || "";
  id = id.toString();
  return _.isString(id) && id.length === 24;
}
8901
function validateUniqueName(value, respond) {
  // jshint validthis: true
  var self = this;

  // check for uniqueness of user name
  this.constructor.findOne({name: value}, function (err, user) {
    if (err) {
      throw err;
    }

    if (user) {
      // the searched name is my name or a duplicate
      return respond(self.id === user.id);
    }

    respond(true);
  });
}
765330
function checkPath(id)
{
  var i;

  for (i = 0; i < this.pathsKeys.length; i++)
  {
    if (id.indexOf(this.pathsKeys[i]) == 0)
    {
      if (this.paths[this.pathsKeys[i]] == 'empty:')
      {
        id = 'empty:';
      }
      else
      {
        id = id.replace(this.pathsKeys[i], this.paths[this.pathsKeys[i]]);
      }
      break;
    }
  }

  return id;
}
312399
public void ensureValidity(long oid) {
		if (oids == null) {
			return;
		}
		if (oid >= oids[oids.length-1]) {
			nextValidOidPos = -1;
			return;
		}
		while (oid >= oids[nextValidOidPos]) {
			nextValidOidPos++;
		}
	}
512133
public function validateId($id)
    {
        $id_string = $id->toString();
        $this->context[] = "id '$id_string'";
        if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
            // handled by InterchangeBuilder
            $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
        }
        // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)
        // we probably should check that it has at least one namespace
        $this->with($id, 'key')
            ->assertNotEmpty()
            ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder
        array_pop($this->context);
    }