Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Utils/NetronClipboard.cs

    r2768 r4068  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Text;
    42using System.Collections;
    5 using System.Diagnostics;
    63using System.IO;
    74
    8 namespace Netron.Diagramming.Core
    9 {
    10     // ----------------------------------------------------------------------
     5namespace Netron.Diagramming.Core {
     6  // ----------------------------------------------------------------------
     7  /// <summary>
     8  /// Our custom "clipboard" for copying diagram elements (or anything else
     9  /// for that matter) to.
     10  /// </summary>
     11  // ----------------------------------------------------------------------
     12  public static class NetronClipboard {
     13    // ------------------------------------------------------------------
    1114    /// <summary>
    12     /// Our custom "clipboard" for copying diagram elements (or anything else
    13     /// for that matter) to.
     15    /// The items on the clipboard.
    1416    /// </summary>
    15     // ----------------------------------------------------------------------
    16     public static class NetronClipboard
    17     {
    18         // ------------------------------------------------------------------
    19         /// <summary>
    20         /// The items on the clipboard.
    21         /// </summary>
    22         // ------------------------------------------------------------------
    23         static ArrayList items = new ArrayList();
     17    // ------------------------------------------------------------------
     18    static ArrayList items = new ArrayList();
    2419
    25         // ------------------------------------------------------------------
    26         /// <summary>
    27         /// Gets the collection of all items.
    28         /// </summary>
    29         // ------------------------------------------------------------------
    30         public static ArrayList Items
    31         {
    32             get
    33             {
    34                 return items;
    35             }
     20    // ------------------------------------------------------------------
     21    /// <summary>
     22    /// Gets the collection of all items.
     23    /// </summary>
     24    // ------------------------------------------------------------------
     25    public static ArrayList Items {
     26      get {
     27        return items;
     28      }
     29    }
     30
     31    // ------------------------------------------------------------------
     32    /// <summary>
     33    /// Adds the item to the collection.
     34    /// </summary>
     35    /// <param name="item">object</param>
     36    /// <returns>int</returns>
     37    // ------------------------------------------------------------------
     38    public static int Add(object item) {
     39      return items.Add(item);
     40    }
     41
     42    public static int AddStream(MemoryStream stream) {
     43      return items.Add(stream);
     44    }
     45
     46    // ------------------------------------------------------------------
     47    /// <summary>
     48    /// Clears the collection.
     49    /// </summary>
     50    // ------------------------------------------------------------------
     51    public static void Clear() {
     52      items.Clear();
     53    }
     54
     55    // ------------------------------------------------------------------
     56    /// <summary>
     57    /// Returns if we have any items of the type specified.
     58    /// </summary>
     59    /// <param name="type">Type</param>
     60    /// <returns>bool</returns>
     61    // ------------------------------------------------------------------
     62    public static bool ContainsData(Type type) {
     63      foreach (Object obj in items) {
     64        if (obj.GetType() == type) {
     65          return true;
    3666        }
     67      }
     68      return false;
     69    }
    3770
    38         // ------------------------------------------------------------------
    39         /// <summary>
    40         /// Adds the item to the collection.
    41         /// </summary>
    42         /// <param name="item">object</param>
    43         /// <returns>int</returns>
    44         // ------------------------------------------------------------------
    45         public static int Add(object item)
    46         {
    47             return items.Add(item);
     71    // ------------------------------------------------------------------
     72    /// <summary>
     73    /// Gets all items of the type specified.
     74    /// </summary>
     75    /// <param name="type"></param>
     76    /// <returns></returns>
     77    // ------------------------------------------------------------------
     78    public static ArrayList GetAll(Type type) {
     79      ArrayList subitems = new ArrayList();
     80      foreach (Object obj in items) {
     81        if (obj.GetType() == type) {
     82          subitems.Add(obj);
    4883        }
     84      }
     85      return subitems;
     86    }
    4987
    50         public static int AddStream(MemoryStream stream)
    51         {
    52             return items.Add(stream);
     88    // ------------------------------------------------------------------
     89    /// <summary>
     90    /// Returns the FIRST item found that has the type specified.
     91    /// </summary>
     92    /// <param name="type">Type</param>
     93    /// <returns>object</returns>
     94    // ------------------------------------------------------------------
     95    public static object Get(Type type) {
     96      foreach (Object obj in items) {
     97        if (obj.GetType() == type) {
     98          return obj;
    5399        }
     100      }
     101      return null;
     102    }
    54103
    55         // ------------------------------------------------------------------
    56         /// <summary>
    57         /// Clears the collection.
    58         /// </summary>
    59         // ------------------------------------------------------------------
    60         public static void Clear()
    61         {
    62             items.Clear();
     104    public static MemoryStream GetMemoryStream() {
     105      foreach (object obj in items) {
     106        if (obj is MemoryStream) {
     107          return obj as MemoryStream;
    63108        }
     109      }
    64110
    65         // ------------------------------------------------------------------
    66         /// <summary>
    67         /// Returns if we have any items of the type specified.
    68         /// </summary>
    69         /// <param name="type">Type</param>
    70         /// <returns>bool</returns>
    71         // ------------------------------------------------------------------
    72         public static bool ContainsData(Type type)
    73         {
    74             foreach (Object obj in items)
    75             {
    76                 if (obj.GetType() == type)
    77                 {
    78                     return true;
    79                 }
    80             }
    81             return false;
    82         }
    83 
    84         // ------------------------------------------------------------------
    85         /// <summary>
    86         /// Gets all items of the type specified.
    87         /// </summary>
    88         /// <param name="type"></param>
    89         /// <returns></returns>
    90         // ------------------------------------------------------------------
    91         public static ArrayList GetAll(Type type)
    92         {
    93             ArrayList subitems = new ArrayList();
    94             foreach (Object obj in items)
    95             {
    96                 if (obj.GetType() == type)
    97                 {
    98                     subitems.Add(obj);
    99                 }
    100             }
    101             return subitems;
    102         }
    103 
    104         // ------------------------------------------------------------------
    105         /// <summary>
    106         /// Returns the FIRST item found that has the type specified.
    107         /// </summary>
    108         /// <param name="type">Type</param>
    109         /// <returns>object</returns>
    110         // ------------------------------------------------------------------
    111         public static object Get(Type type)
    112         {
    113             foreach (Object obj in items)
    114             {
    115                 if (obj.GetType() == type)
    116                 {
    117                     return obj;
    118                 }
    119             }
    120             return null;
    121         }
    122 
    123         public static MemoryStream GetMemoryStream()
    124         {
    125             foreach (object obj in items)
    126             {
    127                 if (obj is MemoryStream)
    128                 {
    129                     return obj as MemoryStream;
    130                 }
    131             }
    132 
    133             return null;
    134         }
     111      return null;
    135112    }
     113  }
    136114}
Note: See TracChangeset for help on using the changeset viewer.