private ITypeAssetProvider GetTypeAssetProviderForType(NIType type)
 {
     if (type.IsRebarReferenceType())
     {
         NIType             innerType = type.GetReferentType();
         ITypeAssetProvider innerTypeAssetProvider = GetTypeAssetProviderForType(innerType)
                                                     ?? StockResources.GetTypeAssets((Element)null, innerType);
         int innerTypeDimensionality = StockDiagramUIResources.TypeToArraySize(innerType);
         ITypeAssetProvider outerTypeAssetProvider = type.IsMutableReferenceType()
             ? (ITypeAssetProvider) new MutableReferenceTypeAssetProvider(innerTypeAssetProvider, innerTypeDimensionality)
             : new ImmutableReferenceTypeAssetProvider(innerTypeAssetProvider, innerTypeDimensionality);
         return(outerTypeAssetProvider);
     }
     if (type.IsLockingCellType())
     {
         return(new GenericReferenceTypeAssetProvider("Locking Cell"));
     }
     if (type.IsSharedType())
     {
         return(new GenericReferenceTypeAssetProvider("Shared"));
     }
     if (type.IsIteratorType())
     {
         return(new GenericReferenceTypeAssetProvider("Iterator"));
     }
     if (type.IsVectorType())
     {
         return(new GenericReferenceTypeAssetProvider("Vector"));
     }
     if (type.IsUnion())
     {
         return(new VariantTypeAssetProvider(type.GetName()));
     }
     return(null);
 }
 public QueryResult <T> QueryService <T>(NIType type) where T : class
 {
     if (typeof(T) == typeof(ITypeAssetProvider))
     {
         if (type.IsRebarReferenceType())
         {
             NIType             innerType = type.GetReferentType();
             ITypeAssetProvider innerTypeAssetProvider = StockResources.GetTypeAssets(null, innerType);
             int innerTypeDimensionality = StockDiagramUIResources.TypeToArraySize(innerType);
             ITypeAssetProvider outerTypeAssetProvider = type.IsMutableReferenceType()
                 ? (ITypeAssetProvider) new MutableReferenceTypeAssetProvider(innerTypeAssetProvider, innerTypeDimensionality)
                 : new ImmutableReferenceTypeAssetProvider(innerTypeAssetProvider, innerTypeDimensionality);
             return(new QueryResult <T>(outerTypeAssetProvider as T));
         }
         if (type.IsLockingCellType())
         {
             return(new QueryResult <T>(new GenericReferenceTypeAssetProvider("Locking Cell") as T));
         }
         if (type.IsNonLockingCellType())
         {
             return(new QueryResult <T>(new GenericReferenceTypeAssetProvider("Nonlocking Cell") as T));
         }
         if (type.IsIteratorType())
         {
             return(new QueryResult <T>(new GenericReferenceTypeAssetProvider("Iterator") as T));
         }
         if (type.IsVectorType())
         {
             return(new QueryResult <T>(new GenericReferenceTypeAssetProvider("Vector") as T));
         }
     }
     return(new QueryResult <T>());
 }
 public ImmutableValueTypeAssetProvider(ITypeAssetProvider innerTypeAssets, int innerTypeDimensionality)
     : base(
         innerTypeAssets,
         innerTypeDimensionality,
         "Resources/ImmutableValue",
         "Immutable Value")
 {
 }
 public MutableReferenceTypeAssetProvider(ITypeAssetProvider innerTypeAssets, int innerTypeDimensionality)
     : base(
         innerTypeAssets,
         innerTypeDimensionality,
         "Resources/MutableReference",
         "Mutable Reference")
 {
 }
 protected TypeAssetProvider(ITypeAssetProvider innerTypeAssetProvider, int innerTypeDimensionality, string resourceKey, string displayName)
     : base(
         typeof(TypeAssetProvider),
         resourceKey,
         innerTypeAssetProvider.SolidColorAsColor,
         displayName)
 {
     _innerTypeAssets         = innerTypeAssetProvider;
     _innerTypeDimensionality = innerTypeDimensionality;
 }
 public QueryResult <T> QueryService <T>(NIType type) where T : class
 {
     if (typeof(T) == typeof(ITypeAssetProvider))
     {
         ITypeAssetProvider typeAssetProvider = GetTypeAssetProviderForType(type);
         if (typeAssetProvider != null)
         {
             return(new QueryResult <T>(typeAssetProvider as T));
         }
         if (type.IsSlice())
         {
             return(new QueryResult <T>(new GenericReferenceTypeAssetProvider("Slice") as T));
         }
         if (type.IsSliceIteratorType())
         {
             return(new QueryResult <T>(new GenericReferenceTypeAssetProvider("Slice Iterator") as T));
         }
         if (type.IsSliceMutableIteratorType())
         {
             return(new QueryResult <T>(new GenericReferenceTypeAssetProvider("Slice Mutable Iterator") as T));
         }
     }
     return(new QueryResult <T>());
 }