Пример #1
0
 /// <summary>
 /// Returns the object associated with an ID.
 /// </summary>
 /// <param name="id">The ID number.</param>
 /// <returns>The object at that ID.</returns>
 /// <exception cref="UnregisteredObjectException">If no object is found
 /// at the given ID.
 /// </exception>
 /// <exception cref="UnregisteredPackageException">If the package specified
 /// by the ID is not registered.
 /// </exception>
 public static Identifiable Get(IdentityNumber id)
 {
     WriteLine("get id " + id.ToString());
     if (!map.Has(id))
     {
         throw GetNumError(id);
     }
     return(map[id]);
 }
Пример #2
0
 /// <summary>
 /// Releases an ID and removes its object from the Database.
 /// </summary>
 /// <param name="id">The ID to release.</param>
 /// <returns><code>True</code> if the ID was released successfully,
 /// <code>False</code> otherwise.
 /// </returns>
 /// <exception cref="UnregisteredPackageException">If the package specified
 /// by the ID is not registered.
 /// </exception>
 public static bool Release(IdentityNumber id)
 {
     WriteLine("release id " + id.ToString());
     if (!_registered[id.Package])
     {
         throw new UnregisteredPackageException(id.Package);
     }
     return(map.Release(id));
 }
Пример #3
0
 public UnregisteredObjectException(IdentityNumber key, Exception inner)
     : base("There is no object registered to " + key.ToString(), inner)
 {
     Reference = key;
 }