text:
import { vtkObject } from "../../../interfaces";
import vtkActor from "../Actor";
import vtkActor2D from "../Actor2D";
import vtkTexture from "../Texture";
import vtkVolume from "../Volume";
import { CoordinateSystem } from "./Constants";

export interface IPropInitialValues {
    visibility?: boolean;
    pickable?: boolean;
    dragable?: boolean;
    useBounds?: boolean;
    allocatedRenderTime?: number;
    estimatedRenderTime?: number;
    savedEstimatedRenderTime?: number;
    renderTimeMultiplier?: number;
    textures?: vtkTexture[];
}

export interface vtkProp extends vtkObject {

    /**
     *
     * @param estimatedRenderTime
     */
    addEstimatedRenderTime(estimatedRenderTime: number): void;

    /**
     * To be reimplemented by subclasses.
     * For some exporters and other other operations we must be able
     * to collect all the actors or volumes.
     */
    getActors(): vtkActor[];

    /**
     * Not implemented yet
     */
    getActors2D(): vtkActor2D[];

	/**
	 * Get the coordinate system this prop is defined in.
	 */
    getCoordinateSystem(): CoordinateSystem;

    /**
     * Get the value of the dragable instance variable.
     * @see getNestedDragable
     * @see getPickable
     */
    getDragable(): boolean;

    /**
     * Combine dragabe property with optional ancestor props dragable properties.
     * It is used to decide whether the prop can be mouse dragged.
     * @see getDragable
     * @see getParentProp
     */
    getNestedDragable(): boolean;

    /**
     * Get visibility of this vtkProp.
     * @see getNestedVisibility
     * @see getPickable
     */
    getVisibility(): boolean;

    /**
     * Combine visibility property with optional ancestor props visibility properties.
     * It is used to decide whether the prop should be rendered.
     * @see getVisibility
     * @see getParentProp
     */
    getNestedVisibility(): boolean;

    /**
     * Get the pickable instance variable.
     * @see getNestedPickable
     * @see getDragable
     */
    getPickable(): boolean;

    /**
     * Combine pickable property with optional ancestor props pickable properties.
     * It is used to decide whether the prop should be rendered during a selection rendering.
     * @see getPickable
     * @see getParentProp
     */
    getNestedPickable(): boolean;

    /**
     * Return the mtime of anything that would cause the rendered image to appear differently.
     * Usually this involves checking the mtime of the prop plus anything else it depends on such as properties,
     * textures etc.
     */
    getRedrawMTime(): number

    /**
     *
     */
    getRendertimemultiplier(): number;

    /**
     * The value is returned in seconds. For simple geometry the accuracy may not be great
     * due to buffering. For ray casting, which is already multi-resolution,
     * the current resolution of the image is factored into the time. We need the viewport
     * for viewing parameters that affect timing. The no-arguments version simply returns the value of the variable with no estimation.
     */
    getEstimatedRenderTime(): number;

    /**
     *
     */
    getAllocatedRenderTime(): number;

    /**
     *
     */
    getNestedProps(): any;

    /**
     * Return parent prop set by setParentProp
     * @see setParentProp
     */
    getParentProp(): vtkProp;

    /**
     *
     * Not implemented yet
     */
    getVolumes(): vtkVolume[];

    /**
     *
     */
    getUseBounds(): boolean;

    /**
     *
     */
    getSupportsSelection(): boolean;

    /**
     *
     */
    getTextures(): vtkTexture[];

    /**
     *
     * @param {vtkTexture} texture The vtkTexture instance.
     *
     */
    hasTexture(texture: vtkTexture): boolean;

    /**
     *
     * @param {vtkTexture} texture The vtkTexture instance.
     */
    addTexture(texture: vtkTexture): void;

    /**
     *
     * @param {vtkTexture} texture The vtkTexture instance.
     */
    removeTexture(texture: vtkTexture): void;

    /**
     *
     */
    removeAllTextures(): void;

    /**
     * This method is used to restore that old value should the render be aborted.
     */
    restoreEstimatedRenderTime(): void;

    /**
     *
     * @param allocatedRenderTime
     */
    setAllocatedRenderTime(allocatedRenderTime: number): void;

	/**
     * Set the coordinate system that this prop's data should be in.
     * Once the prop has applied any modifiers such as position, orientation
     * userMatrix the resulting values will be treated as in the specified
     * coordinate system.
     * Not all mappers support all coordinate systems.
	 * @param {CoordinateSystem} coordinateSystem
	 */
    setCoordinateSystem(coordinateSystem: CoordinateSystem): void;

    /**
     * Indicate that this prop's data should be in world coordinates.
     * Once the prop has applied any modifiers such as position, orientation
     * userMatrix the resulting values will be treated as in world coordinates.
     * Not all mappers support all coordinate systems.
     */
    setCoordinateSystemToWorld(): void;

    /**
     * Indicate that this prop's data should be in display coordinates.
     * Once the prop has applied any modifiers such as position, orientation
     * userMatrix the resulting values will be treated as in pixel coordinates.
     * That is pixel coordinate with 0,0 in the lower left of the viewport
     * and a z range of -1 at the near plane and 1 at the far.
     * Not all mappers support all coordinate systems.
     */
    setCoordinateSystemToDisplay(): void;

    /**
     * Set whether prop is dragable.
     * Even if true, prop may not be dragable if an ancestor prop is not dragable.
     * @param dragable
     * @default true
     * @see getDragable
     * @see combineDragable
     */
    setDragable(dragable: boolean): boolean;

    /**
     *
     * @param estimatedRenderTime
     */
    setEstimatedRenderTime(estimatedRenderTime: number): void;

    /**
     * Set parent prop used by combineVisibility(), combinePickable(), combineDragable()
     * @param parentProp
     * @see combineVisibility
     * @see combinePickable
     * @see combineDragable
     * @default null
     */
    setParentProp(parentProp: vtkProp): void;

    /**
     * Set whether prop is pickable.
     * Even if true, prop may not be pickable if an ancestor prop is not pickable.
     * @param pickable
     * @default true
     * @see getPickable
     * @see combinePickable
     */
    setPickable(pickable: boolean): boolean;

    /**
     * Set whether prop is visible.
     * Even if true, prop may not be visible if an ancestor prop is not visible.
     * @param visibility
     * @default true
     * @see getVisibility
     * @see combineVisibility
     */
    setVisibility(visibility: boolean): boolean;

    /**
     * In case the Visibility flag is true, tell if the bounds of this prop should be taken into
     * account or ignored during the computation of other bounding boxes, like in vtkRenderer::ResetCamera().
     * @param useBounds
     * @default true
     */
    setUseBounds(useBounds: boolean): boolean;

    /**
     * This is used for culling and is a number between 0 and 1. It is used to create the allocated render time value.
     * @param {Number} renderTimeMultiplier
     */
    setRenderTimeMultiplier(renderTimeMultiplier: number): boolean;

    /**
     * Not Implemented yet
     * Method fires PickEvent if the prop is picked.
     */
    pick(): any;

    /**
     * Not Implemented yet
     */
    hasKey(): any;
}

/**
 * Method use to decorate a given object (publicAPI+model) with vtkProp characteristics.
 *
 * @param publicAPI object on which methods will be bounds (public)
 * @param model object on which data structure will be bounds (protected)
 * @param {IPropInitialValues} [initialValues] (default: {})
 */
export function extend(publicAPI: object, model: object, initialValues?: IPropInitialValues): void;

/**
 * Method use to create a new instance of vtkProp
 * @param {IPropInitialValues} [initialValues] for pre-setting some of its content
 */
export function newInstance(initialValues?: IPropInitialValues): vtkProp;

/**
 * vtkProp is an abstract superclass for any objects that can exist in a
 * rendered scene (either 2D or 3D). Instances of vtkProp may respond to
 * various render methods (e.g., RenderOpaqueGeometry()). vtkProp also
 * defines the API for picking, LOD manipulation, and common instance
 * variables that control visibility, picking, and dragging.
 */
export declare const vtkProp: {
    newInstance: typeof newInstance,
    extend: typeof extend,
};
export default vtkProp;


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BLTools.Data;
using System.Reflection;
using System.Globalization;
using System.Security.Permissions;
using System.Security;

namespace BLTools.Data.Csv {
  /// <summary>
  /// Describes a CSV datafile
  /// </summary>
  /// <typeparam name="T">The type of TCsvRecord of this data file</typeparam>
  public class TCsvDataFile<T> : List<T>, IDisposable where T : TCsvRecordX, new() {

    private const char DEFAULT_SEPARATOR = ';';

    #region Public properties
    /// <summary>
    /// The name of the file
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// The type of the record contained in the file
    /// </summary>
    public Type RecordType { get; set; }
    /// <summary>
    /// Does the file has headers in the first line
    /// </summary>
    public bool HasHeaders {
      get {
        return _HasHeaders;
      }
      set {
        _HasHeaders = value;
        if (_HasHeaders) {
          HeaderColumns.Clear();
          int i = 0;
          foreach (PropertyInfo PropertyItem in CsvProperties) {
            i++;
            string VarName = PropertyItem.Name;
            TCsvDataFieldAttribute CsvAttribute = ((TCsvDataFieldAttribute)Attribute.GetCustomAttribute(PropertyItem, typeof(TCsvDataFieldAttribute)));
            string FieldName = CsvAttribute.FieldName;
            int FieldPosition = CsvAttribute.FieldPosition;
            HeaderColumns.Add(string.IsNullOrWhiteSpace(FieldName) ? VarName: FieldName, FieldPosition == -1 ? i : FieldPosition);
          }
        }
      }
    }
    private bool _HasHeaders;
    /// <summary>
    /// The encoding of the file
    /// </summary>
    public Encoding DataEncoding { get; set; }
    /// <summary>
    /// Are the empty dates left blank or filled with a specific value
    /// </summary>
    public bool EmptyDatesValueBlank { get; set; }
    /// <summary>
    /// The character used as separator between fields
    /// </summary>
    public char Separator {
      get {
        if (_Separator == '\0') {
          return DEFAULT_SEPARATOR;
        }
        return _Separator;
      }
      set {
        _Separator = value;
      }
    }
    private char _Separator = '\0';
    /// <summary>
    /// Are the strings in the file surrounded with a quote sign
    /// </summary>
    public bool SurroundString { get; set; }
    #endregion Public properties

    #region Private variables
    //private FileStream _Stream;
    //private BufferedStream _BufferedStream;
    private TextReader _StreamReader;
    private TextWriter _StreamWriter;
    private bool _IsOpened;
    private EOpenMode _FileOpenMode;
    private readonly Dictionary<string, int> HeaderColumns;
    /// <summary>
    /// The list of CSV fields properties for the associated TCsvRecord
    /// </summary>
    protected List<PropertyInfo> CsvProperties {
      get {
        return typeof(T).GetProperties().Where(x => x.HasAttribute(typeof(TCsvDataFieldAttribute))).ToList();
      }
    }
    #endregion Private variables

    #region Constructor(s)
    /// <summary>
    /// Blank constructor, all values to default
    /// </summary>
    public TCsvDataFile()
      : base() {
      HeaderColumns = new Dictionary<string, int>();
      Name = "";
      RecordType = typeof(T);
      HasHeaders = true;
      DataEncoding = Encoding.Default;
      EmptyDatesValueBlank = true;
      SurroundString = true;
    }

    /// <summary>
    /// Builds the object with the name of the file
    /// </summary>
    /// <param name="name">The name of the file</param>
    public TCsvDataFile(string name)
      : this() {
      Name = name;
    }

    /// <summary>
    /// Builds the object with name of the file and a specific encoding
    /// </summary>
    /// <param name="name">The name of the file</param>
    /// <param name="encoding">The encoding used to read/write the file</param>
    public TCsvDataFile(string name, Encoding encoding)
      : this(name) {
      DataEncoding = encoding;
    }

    /// <summary>
    /// Builds the object from another TCsvDataFile
    /// </summary>
    /// <param name="csvDataFile">Another TCsvDataFile<T></param>
    public TCsvDataFile(TCsvDataFile<T> csvDataFile) : this() {
      Name = csvDataFile.Name;
      HeaderColumns = new Dictionary<string, int>();
      RecordType = csvDataFile.RecordType;
      HasHeaders = csvDataFile.HasHeaders;
      DataEncoding = csvDataFile.DataEncoding;
      EmptyDatesValueBlank = csvDataFile.EmptyDatesValueBlank;
      SurroundString = csvDataFile.SurroundString;
    }

    /// <summary>
    /// Cleanup
    /// </summary>
    public void Dispose() {
      HeaderColumns.Clear();
      if (_IsOpened) {
        Close();
      }
    }
    #endregion Constructor(s)

    #region I/O operations
    /// <summary>
    /// Initialize the file (delete it if it exists)
    /// </summary>
    public void Init() {
      if (string.IsNullOrWhiteSpace(Name)) {
        return;
      }
      if (File.Exists(Name)) {
        try {
          File.Delete(Name);
        } catch (Exception ex) {
          Trace.WriteLine(string.Format("Unable to delete file \"{0}\" : {1}", Name, ex.Message));
        }
      }
    }

    /// <summary>
    /// Open the file
    /// </summary>
    /// <param name="mode">Specifiy whether the file is to be opened R/O or R/W</param>
    public void Open(EOpenMode mode) {
      if (_IsOpened) {
        return;
      }
      try {
        switch (mode) {
          case EOpenMode.Read:
            //_Stream = new FileStream(Name, FileMode.Open, FileAccess.Read, FileShare.Read);
            //_BufferedStream = new BufferedStream(_Stream);
            //_StreamReader = new StreamReader(_Stream, DataEncoding);
            _StreamReader = new StreamReader(Name, DataEncoding);
            _FileOpenMode = EOpenMode.Read;
            break;
          case EOpenMode.Create:
            //_Stream = new FileStream(Name, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
            //_BufferedStream = new BufferedStream(_Stream);
            //_StreamWriter = new StreamWriter(_Stream, DataEncoding);
            _StreamWriter = new StreamWriter(Name, false, DataEncoding);
            _FileOpenMode = EOpenMode.Create;
            break;
          case EOpenMode.Append:
            FileIOPermission AppendPermission = new FileIOPermission(FileIOPermissionAccess.Append, Path.GetFullPath(Name));
            try {
              AppendPermission.Demand();
              //_Stream = new FileStream(Name, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
              //_BufferedStream = new BufferedStream(_Stream);
              //_StreamWriter = new StreamWriter((_Stream, DataEncoding);
              _StreamWriter = new StreamWriter(Name, true, DataEncoding);
              _FileOpenMode = EOpenMode.Append;
            } catch (SecurityException ex) {
              Trace.WriteLine(string.Format("Append Access right not granted for file {0} : {1}", Name, ex.Message));
              _IsOpened = false;
              return;
            }
            break;
        }
        _IsOpened = true;
      } catch (Exception ex) {
        Trace.WriteLine(string.Format("Error opening file : {0}", ex.Message));
        _IsOpened = false;
      }
    }

    /// <summary>
    /// Close the file
    /// </summary>
    public void Close() {
      if (!_IsOpened) {
        return;
      }
      if (_IsOpened) {
        switch (_FileOpenMode) {
          case EOpenMode.Read:
            if (_StreamReader != null) {
              _StreamReader.Close();
            }

            break;
          case EOpenMode.Create:
          case EOpenMode.Append:
            if (_StreamWriter != null) {
              _StreamWriter.Flush();
              _StreamWriter.Close();
            }
            break;
        }
        //if (_BufferedStream != null) {
        //  _BufferedStream.Close();
        //}
        //if (_Stream != null) {
        //  _Stream.Close();
        //}
        _IsOpened = false;
      }
    }
    #endregion I/O operations

    #region Reading data
    /// <summary>
    /// Read the headers of the columns from the TCsvDataFile
    /// </summary>
    protected virtual void ReadHeaderColumns() {
      #region Validate parameters
      if (string.IsNullOrWhiteSpace(Name)) {
        Trace.WriteLine("Unable to read file : filename is missing", Severity.Error);
        return;
      }
      if (!File.Exists(Name)) {
        Trace.WriteLine("Error : Unable to read file : the file is missing or access is denied");
        return;
      }
      #endregion Validate parameters

      bool LocalOpen = false;

      try {
        if (!_IsOpened) {
          Open(EOpenMode.Read);
          LocalOpen = true;
        }
        if (HasHeaders) {
          string HeaderLine = _StreamReader.ReadLine();
          int i = 0;
          HeaderColumns.Clear();
          foreach (string HeaderItem in HeaderLine.Split(Separator)) {
            HeaderColumns.Add(HeaderItem.Trim('"').Trim().ToLower(), i++);
          }
        }
      } catch (Exception ex) {
        Trace.WriteLine(string.Format("Unable to read header columns from file {0} : {1}", Name, ex.Message));
      } finally {
        if (LocalOpen) {
          Close();
        }
      }
    }

    /// <summary>
    /// Read the content of a TCsvDataFile
    /// </summary>
    public virtual void Read() {
      #region Validate parameters
      if (string.IsNullOrWhiteSpace(Name)) {
        Trace.WriteLine("Unable to read file : filename is missing", Severity.Error);
        return;
      }
      if (!File.Exists(Name)) {
        Trace.WriteLine("Error : Unable to read file : the file is missing or access is denied");
        return;
      }
      #endregion Validate parameters

      string CsvRow = "";
      try {
        Open(EOpenMode.Read);

        if (HasHeaders) {
          ReadHeaderColumns();
        }

        while ((CsvRow = _StreamReader.ReadLine()) != null) {
          Add(ParseCsv(CsvRow));
        }
      } catch (Exception ex) {
        Trace.WriteLine(string.Format("Error while reading data from file {0} : {1} : {2}", Name, ex.Message, CsvRow));
      } finally {
        Close();
      }

    }

    /// <summary>
    /// Convert a row from its string representation to the field values in a TCsvRecord
    /// </summary>
    /// <param name="CsvRow">The row as a string</param>
    /// <returns>The correctly typed TCsvRecord filled with values</returns>
    protected T ParseCsv(string CsvRow) {
      #region Validate parameters
      if (string.IsNullOrWhiteSpace(CsvRow)) {
        return default(T);
      }
      #endregion Validate parameters

      //TODO: check for inner ; or "
      string[] Items = CsvRow.Split(Separator);

      T RetVal = new T();

      foreach (PropertyInfo PropertyInfoItem in CsvProperties) {

        TCsvDataFieldAttribute CurrentFieldAttribute = (TCsvDataFieldAttribute)Attribute.GetCustomAttribute(PropertyInfoItem, typeof(TCsvDataFieldAttribute));

        #region Check if column exists
        int ColumnLocation = -1;

        if (HasHeaders) {
          if (HeaderColumns.Keys.Contains(PropertyInfoItem.Name.Trim().ToLower())) {
            ColumnLocation = HeaderColumns[PropertyInfoItem.Name.Trim().ToLower()];
          } else {
            if (HeaderColumns.Keys.Contains(CurrentFieldAttribute.FieldName.Trim().ToLower())) {
              ColumnLocation = HeaderColumns[CurrentFieldAttribute.FieldName.Trim().ToLower()];
            }
          }
        } else {
          ColumnLocation = CurrentFieldAttribute.FieldPosition;
        }

        if (ColumnLocation == -1) {
          continue;
        }
        #endregion Check if column exists

        Type FieldType = PropertyInfoItem.PropertyType;
        string RawFieldContent = Items[ColumnLocation];

        try {
          PropertyInfoItem.SetValue(RetVal, ConvertValueFromString(RawFieldContent, FieldType, CurrentFieldAttribute), null);
        } catch (Exception ex) {
          Trace.WriteLine(string.Format("Conversion error : {0}", ex.Message));
        }

      }

      return RetVal;
    }

    /// <summary>
    /// Convert a value from its string representation to its real value, based on type and attribute parameters
    /// </summary>
    /// <param name="sourceValue">The source string</param>
    /// <param name="newType">The requested type</param>
    /// <param name="attribute">The attribute of the field</param>
    /// <returns>The converted value</returns>
    protected object ConvertValueFromString(string sourceValue, Type newType, TCsvDataFieldAttribute attribute) {

      try {

        #region String
        if (newType == typeof(string)) {
          return sourceValue;
        }
        #endregion String

        #region Int
        if (newType == typeof(int)) {
          try {
            return int.Parse(sourceValue.Trim());
          } catch {
            return 0;
          }
        }
        #endregion Int

        #region Long
        if (newType == typeof(long)) {
          try {
            return long.Parse(sourceValue.Trim());
          } catch {
            return 0;
          }
        }
        #endregion Long

        #region Float
        if (newType == typeof(float)) {
          if (sourceValue.Trim() == "") {
            return 0f;
          } else {
            try {
              return float.Parse(sourceValue.Trim());
            } catch {
              return 0f;
            }
          }
        }
        #endregion Float

        #region Double
        if (newType == typeof(double)) {
          if (sourceValue.Trim() == "") {
            return 0d;
          } else {
            try {
              return double.Parse(sourceValue.Trim());
            } catch {
              return 0d;
            }
          }
        }
        #endregion Double

        #region Decimal
        if (newType == typeof(decimal)) {
          if (sourceValue.Trim() == "") {
            return 0m;
          } else {
            try {
              return decimal.Parse(sourceValue.Trim());
            } catch {
              return 0m;
            }
          }
        }
        #endregion Decimal

        #region Bool
        if (newType == typeof(bool)) {
          switch (attribute.BoolFormat) {
            case EBoolFormat.OneOrZero:
            case EBoolFormat.TOrF:
            case EBoolFormat.TrueOrFalse:
            case EBoolFormat.YesOrNo:
            case EBoolFormat.YOrN:
              return sourceValue.ToBool();
            case EBoolFormat.Custom:
              return sourceValue.ToBool(attribute.TrueValue, attribute.FalseValue);
            default:
              Trace.WriteLine(string.Format("Error : Attempt to convert unknown value to boolean : {0}", sourceValue), Severity.Warning);
              return false;
          }
        }
        #endregion Bool

        #region DateTime
        if (newType == typeof(DateTime)) {

          int Year;
          int Month;
          int Day;
          int Hour;
          int Minute;
          int Second;

          switch (attribute.DateTimeFormat) {
            case EDateTimeFormat.DateOnly:
              if (sourceValue.Trim() == "") {
                if (EmptyDatesValueBlank) {
                  return DateTime.MinValue;
                } else {
                  Trace.WriteLine(string.Format("Error : Attempt to read a empty DateTime while this is not allowed for this record"));
                  return DateTime.MinValue;
                }
              }
              Year = Int32.Parse(sourceValue.Left(4));
              Month = Int32.Parse(sourceValue.Substring(4, 2));
              Day = Int32.Parse(sourceValue.Right(2));
              return new DateTime(Year, Month, Day);
            case EDateTimeFormat.TimeOnly:
              Hour = Int32.Parse(sourceValue.Left(2));
              Minute = Int32.Parse(sourceValue.Substring(2, 2));
              Second = Int32.Parse(sourceValue.Substring(4, 2));
              return new DateTime(1, 1, 1, Hour, Minute, Second);
            case EDateTimeFormat.Custom:
              throw new ApplicationException("Custom Datetime format are not supported for reading");
            case EDateTimeFormat.DateAndTime:
            default:
              Year = Int32.Parse(sourceValue.Left(4));
              Month = Int32.Parse(sourceValue.Substring(4, 2));
              Day = Int32.Parse(sourceValue.Substring(6, 2));
              Hour = Int32.Parse(sourceValue.Substring(8, 2));
              Minute = Int32.Parse(sourceValue.Substring(10, 2));
              Second = Int32.Parse(sourceValue.Substring(12, 2));
              return new DateTime(Year, Month, Day, Hour, Minute, Second);
          }
        }
        #endregion DateTime

        return sourceValue;

      } catch (Exception ex) {
        Trace.WriteLine(string.Format("Conversion error : {0} => {1} : {2}", sourceValue, newType.Name, ex.Message));
        return newType.GetConstructor(System.Type.EmptyTypes).Invoke(null);
      }
    }

    #endregion Reading data

    #region Saving data
    /// <summary>
    /// Write the headers of the columns to the file
    /// </summary>
    protected virtual void WriteHeaderColumns() {
      #region Validate parameters
      if (string.IsNullOrWhiteSpace(Name)) {
        Trace.WriteLine("Unable to write file : filename is missing", Severity.Error);
        return;
      }
      #endregion Validate parameters

      bool LocalOpen = false;

      try {
        if (!_IsOpened) {
          Open(EOpenMode.Create);
          LocalOpen = true;
        }
        if (HasHeaders) {
          StringBuilder HeaderLine = new StringBuilder();
          foreach (string HeaderItem in HeaderColumns.OrderBy(x => x.Value).Select(x => x.Key)) {
            HeaderLine.AppendFormat("\"{0}\"{1}", HeaderItem, Separator);
          }
          _StreamWriter.WriteLine(HeaderLine.Truncate(1).ToString());
        }
      } catch (Exception ex) {
        Trace.WriteLine(string.Format("Unable to write header columns to file {0} : {1}", Name, ex.Message));
      } finally {
        if (LocalOpen) {
          Close();
        }
      }
    }

    /// <summary>
    /// Save the content of the list to a file
    /// </summary>
    public void Save(bool append = false) {
      #region Validate parameters
      if (string.IsNullOrWhiteSpace(Name)) {
        Trace.WriteLine("Unable to save file : filename is missing", Severity.Error);
        return;
      }
      #endregion Validate parameters

      try {
        if (append) {
          bool IsFileEmpty = true;
          if (File.Exists(Name) && (new FileInfo(Name)).Length > 0) {
            IsFileEmpty = false;
          }
          Open(EOpenMode.Append);
          if (HasHeaders && IsFileEmpty) {
            WriteHeaderColumns();
          }
        } else {
          Open(EOpenMode.Create);
          if (HasHeaders) {
            WriteHeaderColumns();
          }
        }

        foreach (T CsvRowItem in this) {
          Trace.WriteLine(BuildCsv(CsvRowItem));
          _StreamWriter.WriteLine(BuildCsv(CsvRowItem));
          _StreamWriter.Flush();
        }

      } catch (Exception ex) {
        Trace.WriteLine(string.Format("Error while saving data to file {0} : {1}", Name, ex.Message));
      } finally {
        Close();
      }
    }

    /// <summary>
    /// Convert a TCsvRecord to a string
    /// </summary>
    /// <param name="CsvRow">Any TCsvRecord</param>
    /// <returns>The string to write to the file</returns>
    protected string BuildCsv(T CsvRow) {
      #region Validate parameters
      if (CsvRow == null) {
        return null;
      }
      #endregion Validate parameters

      Dictionary<int, string> OutputColumns = new Dictionary<int, string>();

      foreach (PropertyInfo PropertyInfoItem in CsvProperties) {
        TCsvDataFieldAttribute CurrentFieldAttribute = (TCsvDataFieldAttribute)Attribute.GetCustomAttribute(PropertyInfoItem, typeof(TCsvDataFieldAttribute));
        #region Check if column exists
        int ColumnLocation = -1;

        if (HasHeaders) {
          if (HeaderColumns.Keys.Contains(PropertyInfoItem.Name.Trim(), StringComparer.InvariantCultureIgnoreCase)) {
            ColumnLocation = HeaderColumns[PropertyInfoItem.Name.Trim()];
          } else {
            if (HeaderColumns.Keys.Contains(CurrentFieldAttribute.FieldName.Trim(), StringComparer.InvariantCultureIgnoreCase)) {
              ColumnLocation = HeaderColumns[CurrentFieldAttribute.FieldName.Trim()];
            }
          }
        } else {
          ColumnLocation = CurrentFieldAttribute.FieldPosition;
        }

        if (ColumnLocation == -1) {
          continue;
        }
        #endregion Check if column exists
        OutputColumns.Add(ColumnLocation, ConvertValueToString(PropertyInfoItem.GetValue(CsvRow, null), PropertyInfoItem.PropertyType, CurrentFieldAttribute));
      }

      StringBuilder RetVal = new StringBuilder();
      foreach(KeyValuePair<int, string> ColumnItem in OutputColumns.OrderBy(x=>x.Key)) {
        RetVal.Append(ColumnItem.Value);
        RetVal.Append(Separator);
      }

      return RetVal.Truncate(1).ToString();
    }

    /// <summary>
    /// Convert a value of a certain type to its string representation, based on rules of the data file (surround string with quotes, ...)
    /// </summary>
    /// <param name="sourceValue">The source value</param>
    /// <param name="actualType">The type of the source</param>
    /// <param name="attribute">The attribute of the current field</param>
    /// <returns>The value converted to string</returns>
    protected string ConvertValueToString(object sourceValue, Type actualType, TCsvDataFieldAttribute attribute) {

      #region String
      if (actualType == typeof(string)) {
        if (SurroundString) {
          return string.Format("\"{0}\"", (string)sourceValue);
        } else {
          return (string)sourceValue;
        }
      }
      #endregion String

      #region Int and long
      if (actualType == typeof(int) || actualType == typeof(long)) {
        return sourceValue.ToString();
      }
      #endregion Int and long

      #region Float
      if (actualType == typeof(float)) {
        string FormatNumber;
        if (attribute.DecimalDigits > 0) {
          FormatNumber = "#." + new string('#', attribute.DecimalDigits);
        } else {
          FormatNumber = "#";
        }
        return ((float)sourceValue).ToString(FormatNumber);
      }
      #endregion Float

      #region Double
      if (actualType == typeof(double)) {
        string FormatNumber;
        if (attribute.DecimalDigits > 0) {
          FormatNumber = "#." + new string('#', attribute.DecimalDigits);
        } else {
          FormatNumber = "#";
        }
        return ((double)sourceValue).ToString(FormatNumber);
      }
      #endregion Double

      #region Decimal
      if (actualType == typeof(decimal)) {
        string FormatNumber;
        if (attribute.DecimalDigits > 0) {
          FormatNumber = "#." + new string('#', attribute.DecimalDigits);
        } else {
          FormatNumber = "#";
        }
        return ((decimal)sourceValue).ToString(FormatNumber);
      }
      #endregion Decimal

      #region Bool
      if (actualType == typeof(bool)) {
        switch (attribute.BoolFormat) {
          case EBoolFormat.OneOrZero:
            return ((bool)sourceValue ? "1" : "0");
          case EBoolFormat.TOrF:
            return ((bool)sourceValue ? "T" : "F");
          case EBoolFormat.TrueOrFalse:
            return ((bool)sourceValue ? "True" : "False");
          case EBoolFormat.YesOrNo:
            return ((bool)sourceValue ? "Yes" : "No");
          case EBoolFormat.YOrN:
            return ((bool)sourceValue ? "Y" : "N");
          case EBoolFormat.Custom:
            return ((bool)sourceValue ? attribute.TrueValue : attribute.FalseValue);
        }
      }
      #endregion Bool

      #region DateTime
      if (actualType == typeof(DateTime)) {

        DateTime CurrentValue = (DateTime)sourceValue;

        switch (attribute.DateTimeFormat) {
          case EDateTimeFormat.DateOnly:
            return CurrentValue.ToDMY();
          case EDateTimeFormat.TimeOnly:
            return CurrentValue.ToHMS();
          case EDateTimeFormat.Custom:
            return CurrentValue.ToString(attribute.DateTimeFormatCustom);
          case EDateTimeFormat.DateAndTime:
          default:
            return CurrentValue.ToDMYHMS();
        }
      }
      #endregion DateTime

      Trace.WriteLine(string.Format("Unable to convert value {0} from {1} to {2}", sourceValue.ToString(), sourceValue.GetType().Name, actualType.Name));
      return "";

    }
    #endregion Saving data

  }

}

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 * This file is part of the Hephaistos project management API.
 *
 * As each files provides by the CSCFA, this file is licensed
 * under the MIT license.
 *
 * PHP version 5.6
 *
 * @category Interface
 * @package  Hephaistos
 * @author   matthieu vallance <matthieu.vallance@cscfa.fr>
 * @license  MIT <https://opensource.org/licenses/MIT>
 * @link     http://cscfa.fr
 */
namespace CSDT\CollectionsBundle\CollectionHelper\HelperInterface;

use CSDT\CollectionsBundle\CollectionInterfaces\CollectionInterface;

/**
 * Collection helper interface
 *
 * This interface define the methods
 * of the collection helper.
 *
 * @category Interface
 * @package  Hephaistos
 * @author   matthieu vallance <matthieu.vallance@cscfa.fr>
 * @license  MIT <https://opensource.org/licenses/MIT>
 * @link     http://cscfa.fr
 */
interface CollectionHelperInterface
{

    /**
     * Set caster manager
     *
     * This method store a ArrayCasterManager
     * instance to allow the processing of the
     * array.
     *
     * @param ArrayCasterManagerInterface $manager The manager to store
     *
     * @return CollectionHelperInterface
     */
    public function setCasterManager(ArrayCasterManagerInterface $manager);

    /**
     * Array to collection
     *
     * This method inject an array into specific collection type.
     *
     * @param array  $source          The array source to inject
     * @param string $collectionClass The collection class name
     *
     * @return CollectionInterface
     */
    public function arrayToCollection(array $source, $collectionClass);

    /**
     * Merge collection
     *
     * Return a collection of the same type as
     * $collection1 with all the content of the
     * second collection. Note a data lost is
     * possible by example if you merge a
     * ValueCollection as $collection1 and a
     * MapCollection as $collection2.
     *
     * @param CollectionInterface $collection1 The first collection
     * @param CollectionInterface $collection2 The second collection
     *
     * @return CollectionInterface
     */
    public function mergeCollections(
        CollectionInterface $collection1,
        CollectionInterface $collection2
    );

    /**
     * Merge array
     *
     * Return a collectino of the same type as
     * $collection with the content of the
     * array. Note a data lost is possible by
     * example if you merge a ValueCollection
     * as $collection and an associative array
     * as $array.
     *
     * @param CollectionInterface $collection The collection
     * @param array               $array      The array to merge
     *
     * @return CollectionInterface
     */
    public function mergeArray(
        CollectionInterface $collection,
        array $array
    );

    /**
     * Sub collection
     *
     * Return a Collection that contain a part
     * of the $collection starting at an integer
     * index and for the given length. Th content
     * will be truncated if the length is superior
     * of the real collection length. Note you are
     * able to use it with a map collection.
     *
     * @param CollectionInterface $collection The collection where find the content
     * @param number              $start      The start index
     * @param integer             $length     The length of the result collection
     *                                        content
     *
     * @return CollectionInterface
     */
    public function subCollection(
        CollectionInterface $collection,
        $start = 0,
        $length = null
    );

    /**
     * Sub map
     *
     * Return a Collection that contain a part
     * of the $collection corresponding to the
     * to the given $keys. Note you are able to
     * use it with any collection.
     *
     * @param CollectionInterface $collection The collection where
     *                                        find the content
     * @param array               $keys       The keys to return
     *
     * @return CollectionInterface
     */
    public function subMap(
        CollectionInterface $collection,
        array $keys
    );

    /**
     * Walk collection
     *
     * Apply a closure foreach elements of a collection.
     * It send to the closure the value as first argument
     * and the index as second one.
     *
     * @param CollectionInterface $collection The collection to walk
     * @param \Closure            $closure    The closure to apply
     * @param array               $args       [optional] The array of argument to
     *                                        send as third argument
     *
     * @return void
     */
    public function walkCollection(
        CollectionInterface $collection,
        \Closure $closure,
        array $args = null
    );

}


text:
using System.Collections.Generic;

namespace MiniTrello.Domain.Entities
{
    public class Organization: IEntity
    {
        public virtual long Id { get; set; }
        public virtual bool IsArchived { get; set; }
        public virtual string Title { get; set; }
        private readonly IList<Board> _boards = new List<Board>();
        public virtual IEnumerable<Board> Boards{get { return _boards; }}
        public virtual void AddBoard(Board board)
        {
            if (!_boards.Contains(board))
            {
                _boards.Add(board);
            }
        }

        public virtual Board GetBoardById(long ID)
        {
            foreach (var board in _boards)
            {
                if (board.Id == ID)
                    return board;

            }
            return null;
        }

        public virtual Board GetBoardByTitle(string title)
        {
            foreach (var board in _boards)
            {
                if (board.Title.Equals(title))
                    return board;
            }
            return null;
        }
    }
}


text:
<!DOCTYPE html>

	<meta name="generator" content="Hugo 0.48" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/css/style.css">

<meta property="fb:pages" content="267523766781017" />
<title>All American Muslim</title>
<link rel="canonical" href="https://www.allamericanmuslim.com/">
<meta property="og:locale" content="en-us">
<meta property="og:title" content="All American Muslim">
<meta property="og:site_name" content="All American Muslim">
<meta property="og:description" content="">
<meta property="og:url" content="https://www.allamericanmuslim.com/">

<meta property="og:type" content="article">

<meta property="fb:app_id" content="347123062352978">
<meta http-equiv="cleartype" content="on">
<meta name="description" content="">

All American Muslim

Home

DMCA

European Country Issues Coin Depicting Drowned Syrian Child Aylan

Journalist Sarah Price Explains Why She converted to Islam

My parents don't Like My Islam and Are Full of Prejudices

French Genealogist Claims Presidential Candidate Marine Le Pen is Descendant of Prophet Muhammad

Muslim American Girl Accepted into 7 US Ivy League Colleges

Retired Russian Colonel: We Have Nuclear Missiles Planted Off the Coasts of America

Tabitha Shares How It Feels Being a New Muslim in Middle America

When Singing in Arabic Draws the Attention of the New York Joint Terrorism Task Force

Hi I'm Muslim: Fighting Islamophobia with Flowers and Outreach

This Man Escaped the Nuclear Bomb at Hiroshima But the Bomb Followed him to Nagasaki

The Music Professor who Tried to Prove Quran Evil, But Ended up Accepting Islam

Austrian President Asks Women to Wear Hijab in Solidarity with Muslim Women

« First

‹ Prev

...

22

23

24

25

26

...

Next ›

Last »


text:
require 'spec_helper'

describe "ResourceFinder" do

	before(:each) do
		TestResource.reload_resource_definition
	end

	it "should load normally without includes using connection.get" do
		TestResource.connection.expects(:get).with("/test_resources.json")

		ApiResource::Finders::ResourceFinder.new(
			TestResource,
			mock(:to_hash => {})
		).load
	end

	it "should pass conditions into the connection get method" do
		TestResource.connection.expects(:get).with("/test_resources.json?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3")

		ApiResource::Finders::ResourceFinder.new(
			TestResource,
			mock(:to_hash => {:ids => [1,2,3]})
		).load
	end

	it "should try to load includes if it finds an object" do
		obj_mock = {:id => 1}

		TestResource.connection.expects(:get).with("/test_resources.json").returns([obj_mock])

		obj = ApiResource::Finders::ResourceFinder.new(
			TestResource,
			stub(:to_hash => {}, :eager_load? => false, :included_objects => [])
		).load

	#	obj.first.id.should eql(1)
	end

	it "should load and distribute includes among the returned objects" do
		inc_mock = {:id => 1}
		inc_mock2 = {:id => 2}

		TestResource.connection.expects(:get)
				.with("/test_resources.json")
				.returns([{:id => 1, :has_many_object_ids => [1,2]}])

		HasManyObject.connection.expects(:get)
				.with("/has_many_objects.json?ids%5B%5D=1&ids%5B%5D=2")
				.returns([inc_mock, inc_mock2])

		obj = ApiResource::Finders::ResourceFinder.new(
			TestResource,
			stub(:to_hash => {}, :eager_load? => true, :included_objects => [:has_many_objects])
		).load
		obj.first.has_many_objects.collect(&:id).should eql([1,2])
	end

	it "should work with loading for multiple objects" do
		TestResource.connection.expects(:get).with("/test_resources.json").returns([
			{:id => 1, :has_many_object_ids => [1]},
			{:id => 2, :has_many_object_ids => [2]}
		])
		HasManyObject.connection.expects(:get)
								 .with("/has_many_objects.json?ids%5B%5D=1&ids%5B%5D=2")
								 .returns([{:id => 1}, {:id => 2}])

		obj = ApiResource::Finders::ResourceFinder.new(
			TestResource,
			stub(:to_hash => {}, :eager_load? => true, :included_objects => [:has_many_objects])
		).load

		obj.first.has_many_objects.collect(&:id).should eql([1])
		obj.second.has_many_objects.collect(&:id).should eql([2])
	end

	context 'Headers returned from the server' do

		context '#total_entries' do

			it 'stores the ApiResource-Total-Entries as total_entries' do

				finder = ApiResource::Finders::ResourceFinder.new(
					TestResource,
					ApiResource::Conditions::PaginationCondition.new(
						TestResource,
						{ page: 2, per_page: 10 }
					)
				)

				finder.load

				expect(finder.total_entries).to be 100

			end

		end

	end

end


text:
<?php

namespace Oro\Bundle\QueryDesignerBundle\Grid\Extension;

use Doctrine\ORM\QueryBuilder;

use Oro\Bundle\DataGridBundle\Datagrid\Builder;
use Oro\Bundle\DataGridBundle\Extension\AbstractExtension;
use Oro\Bundle\DataGridBundle\Datasource\Orm\OrmDatasource;
use Oro\Bundle\DataGridBundle\Datasource\DatasourceInterface;
use Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration;
use Oro\Bundle\QueryDesignerBundle\QueryDesigner\RestrictionBuilderInterface;

class OrmDatasourceExtension extends AbstractExtension
{
    /** @var RestrictionBuilderInterface */
    protected $restrictionBuilder;

    /**
     * @param RestrictionBuilderInterface $restrictionBuilder
     */
    public function __construct(RestrictionBuilderInterface $restrictionBuilder)
    {
        $this->restrictionBuilder = $restrictionBuilder;
    }

    /**
     * {@inheritDoc}
     */
    public function isApplicable(DatagridConfiguration $config)
    {
        return $config->offsetGetByPath(Builder::DATASOURCE_TYPE_PATH) == OrmDatasource::TYPE
            && $config->offsetGetByPath('[source][query_config][filters]');
    }

    /**
     * {@inheritdoc}
     */
    public function visitDatasource(DatagridConfiguration $config, DatasourceInterface $datasource)
    {
        /** @var QueryBuilder $qb */
        $qb      = $datasource->getQueryBuilder();
        $ds      = new GroupingOrmFilterDatasourceAdapter($qb);
        $filters = $config->offsetGetByPath('[source][query_config][filters]');
        $this->restrictionBuilder->buildRestrictions($filters, $ds);
    }
}


text:
title:  Eyüp'ün Karakteri
date:   17/12/2016
---

### Eyüp'ün Karakteri

### KONUYLA İLGİLİ METİNLER
Eyü. 1:1, 8; Eyü. 29:8–17; Eyü. 31:1–23; Çık. 20:17; Mat. 7:22–27; Mat. 5:16; Ef. 3:10.

>
HATIRLAMA METNİ:

> "Görüyorsun, onun imanı eylemleriyle birlikte etkindi; imanı eylemleriyle tamamlandı." (Yakup 2:22).

Eyüp kitapçığında değindiğimiz tüm önemli konuların arasında, diğer bir önemli konuyu gözden kaybetmemeliyiz: Eyüp'ün kendisini. Rabb'in, sadakati ve doğruluğu üzerine şeytanla iddiaya girecek kadar güvendiği bu adam kimdi? Tüm bu şeylerin başına neden geldiğini anlamayan, bunların adil olmadığını bilen, bu olaylar nedeniyle kızgınlığını ve düş kırıklığını ifade eden, ancak yine de sonuna kadar sadık kalan bu adam kimdi?

Eyüp kitapçığının özünü Eyüp'ün başına gelen felâketlerin sonrası oluştursa da, bu hikâyeden Eyüp'ün önceki hayatına ilişkin bilgiler de alabiliriz. Eyüp'ün geçmişi ve onun nasıl bir adam olduğu hakkında öğrendiklerimiz, bu korkunç acıların, hatta Şeytan'ın onu Allah'tan uzaklaştırmak için yaptığı her şeyin ortasında nasıl hâlâ Rabb'e bağlı kaldığına dair bize daha büyük bir anlayış verir.

Eyüp nasıl biriydi ve onun yaşam tarzı hakkında kendi hayatlarımızda Rabb'in daha sadık takipçileri olmamıza yardımcı olacak ne öğrenebiliriz?


text:
import sys
import time

from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
from oslo_utils import importutils

from neutron.agent.common import config
from neutron.agent import rpc as agent_rpc
from neutron.common import config as common_config
from neutron.common import constants as constants
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron import context
from neutron.i18n import _LE, _LI, _LW
from neutron import manager
from neutron.openstack.common import loopingcall
from neutron.openstack.common import periodic_task
from neutron.openstack.common import service
from neutron import service as neutron_service

LOG = logging.getLogger(__name__)

class MeteringPluginRpc(object):

    def __init__(self, host):
        # NOTE(yamamoto): super.__init__() call here is not only for
        # aesthetics.  Because of multiple inheritances in MeteringAgent,
        # it's actually necessary to initialize parent classes of
        # manager.Manager correctly.
        super(MeteringPluginRpc, self).__init__()
        target = oslo_messaging.Target(topic=topics.METERING_PLUGIN,
                                       version='1.0')
        self.client = n_rpc.get_client(target)

    def _get_sync_data_metering(self, context):
        try:
            cctxt = self.client.prepare()
            return cctxt.call(context, 'get_sync_data_metering',
                              host=self.host)
        except Exception:
            LOG.exception(_LE("Failed synchronizing routers"))

class MeteringAgent(MeteringPluginRpc, manager.Manager):

    Opts = [
        cfg.StrOpt('driver',
                   default='neutron.services.metering.drivers.noop.'
                   'noop_driver.NoopMeteringDriver',
                   help=_("Metering driver")),
        cfg.IntOpt('measure_interval', default=30,
                   help=_("Interval between two metering measures")),
        cfg.IntOpt('report_interval', default=300,
                   help=_("Interval between two metering reports")),
    ]

    def __init__(self, host, conf=None):
        self.conf = conf or cfg.CONF
        self._load_drivers()
        self.context = context.get_admin_context_without_session()
        self.metering_loop = loopingcall.FixedIntervalLoopingCall(
            self._metering_loop
        )
        measure_interval = self.conf.measure_interval
        self.last_report = 0
        self.metering_loop.start(interval=measure_interval)
        self.host = host

        self.label_tenant_id = {}
        self.routers = {}
        self.metering_infos = {}
        super(MeteringAgent, self).__init__(host=host)

    def _load_drivers(self):
        """Loads plugin-driver from configuration."""
        LOG.info(_LI("Loading Metering driver %s"), self.conf.driver)
        if not self.conf.driver:
            raise SystemExit(_('A metering driver must be specified'))
        self.metering_driver = importutils.import_object(
            self.conf.driver, self, self.conf)

    def _metering_notification(self):
        for label_id, info in self.metering_infos.items():
            data = {'label_id': label_id,
                    'tenant_id': self.label_tenant_id.get(label_id),
                    'pkts': info['pkts'],
                    'bytes': info['bytes'],
                    'time': info['time'],
                    'first_update': info['first_update'],
                    'last_update': info['last_update'],
                    'host': self.host}

            LOG.debug("Send metering report: %s", data)
            notifier = n_rpc.get_notifier('metering')
            notifier.info(self.context, 'l3.meter', data)
            info['pkts'] = 0
            info['bytes'] = 0
            info['time'] = 0

    def _purge_metering_info(self):
        deadline_timestamp = int(time.time()) - self.conf.report_interval
        label_ids = [
            label_id
            for label_id, info in self.metering_infos.items()
            if info['last_update'] < deadline_timestamp]
        for label_id in label_ids:
            del self.metering_infos[label_id]

    def _add_metering_info(self, label_id, pkts, bytes):
        ts = int(time.time())
        info = self.metering_infos.get(label_id, {'bytes': 0,
                                                  'pkts': 0,
                                                  'time': 0,
                                                  'first_update': ts,
                                                  'last_update': ts})
        info['bytes'] += bytes
        info['pkts'] += pkts
        info['time'] += ts - info['last_update']
        info['last_update'] = ts

        self.metering_infos[label_id] = info

        return info

    def _add_metering_infos(self):
        self.label_tenant_id = {}
        for router in self.routers.values():
            tenant_id = router['tenant_id']
            labels = router.get(constants.METERING_LABEL_KEY, [])
            for label in labels:
                label_id = label['id']
                self.label_tenant_id[label_id] = tenant_id

            tenant_id = self.label_tenant_id.get
        accs = self._get_traffic_counters(self.context, self.routers.values())
        if not accs:
            return

        for label_id, acc in accs.items():
            self._add_metering_info(label_id, acc['pkts'], acc['bytes'])

    def _metering_loop(self):
        self._add_metering_infos()

        ts = int(time.time())
        delta = ts - self.last_report

        report_interval = self.conf.report_interval
        if delta > report_interval:
            self._metering_notification()
            self._purge_metering_info()
            self.last_report = ts

    @utils.synchronized('metering-agent')
    def _invoke_driver(self, context, meterings, func_name):
        try:
            return getattr(self.metering_driver, func_name)(context, meterings)
        except AttributeError:
            LOG.exception(_LE("Driver %(driver)s does not implement %(func)s"),
                          {'driver': self.conf.driver,
                           'func': func_name})
        except RuntimeError:
            LOG.exception(_LE("Driver %(driver)s:%(func)s runtime error"),
                          {'driver': self.conf.driver,
                           'func': func_name})

    @periodic_task.periodic_task(run_immediately=True)
    def _sync_routers_task(self, context):
        routers = self._get_sync_data_metering(self.context)
        if not routers:
            return
        self._update_routers(context, routers)

    def router_deleted(self, context, router_id):
        self._add_metering_infos()

        if router_id in self.routers:
            del self.routers[router_id]

        return self._invoke_driver(context, router_id,
                                   'remove_router')

    def routers_updated(self, context, routers=None):
        if not routers:
            routers = self._get_sync_data_metering(self.context)
        if not routers:
            return
        self._update_routers(context, routers)

    def _update_routers(self, context, routers):
        for router in routers:
            self.routers[router['id']] = router

        return self._invoke_driver(context, routers,
                                   'update_routers')

    def _get_traffic_counters(self, context, routers):
        LOG.debug("Get router traffic counters")
        return self._invoke_driver(context, routers, 'get_traffic_counters')

    def add_metering_label_rule(self, context, routers):
        return self._invoke_driver(context, routers,
                                   'add_metering_label_rule')

    def remove_metering_label_rule(self, context, routers):
        return self._invoke_driver(context, routers,
                                   'remove_metering_label_rule')

    def update_metering_label_rules(self, context, routers):
        LOG.debug("Update metering rules from agent")
        return self._invoke_driver(context, routers,
                                   'update_metering_label_rules')

    def add_metering_label(self, context, routers):
        LOG.debug("Creating a metering label from agent")
        return self._invoke_driver(context, routers,
                                   'add_metering_label')

    def remove_metering_label(self, context, routers):
        self._add_metering_infos()

        LOG.debug("Delete a metering label from agent")
        return self._invoke_driver(context, routers,
                                   'remove_metering_label')

class MeteringAgentWithStateReport(MeteringAgent):

    def __init__(self, host, conf=None):
        super(MeteringAgentWithStateReport, self).__init__(host=host,
                                                           conf=conf)
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
        self.agent_state = {
            'binary': 'neutron-metering-agent',
            'host': host,
            'topic': topics.METERING_AGENT,
            'configurations': {
                'metering_driver': self.conf.driver,
                'measure_interval':
                self.conf.measure_interval,
                'report_interval': self.conf.report_interval
            },
            'start_flag': True,
            'agent_type': constants.AGENT_TYPE_METERING}
        report_interval = cfg.CONF.AGENT.report_interval
        self.use_call = True
        if report_interval:
            self.heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            self.heartbeat.start(interval=report_interval)

    def _report_state(self):
        try:
            self.state_rpc.report_state(self.context, self.agent_state,
                                        self.use_call)
            self.agent_state.pop('start_flag', None)
            self.use_call = False
        except AttributeError:
            # This means the server does not support report_state
            LOG.warn(_LW("Neutron server does not support state report."
                         " State report for this agent will be disabled."))
            self.heartbeat.stop()
            return
        except Exception:
            LOG.exception(_LE("Failed reporting state!"))

    def agent_updated(self, context, payload):
        LOG.info(_LI("agent_updated by server side %s!"), payload)

def main():
    conf = cfg.CONF
    conf.register_opts(MeteringAgent.Opts)
    config.register_agent_state_opts_helper(conf)
    common_config.init(sys.argv[1:])
    config.setup_logging()
    server = neutron_service.Service.create(
        binary='neutron-metering-agent',
        topic=topics.METERING_AGENT,
        report_interval=cfg.CONF.AGENT.report_interval,
        manager='neutron.services.metering.agents.'
                'metering_agent.MeteringAgentWithStateReport')
    service.launch(server).wait()


text:
from gh import ObjectType, PullRequestRepo
from datetime import datetime
from .policy import Policy

class LogPullRequestPolicy(Policy):
    def __init__(self):
        super().__init__()

    def applies(self, o):
        return ObjectType(o) == 'pull_request'

    def apply(self, g, o):
        days_since_created = None
        days_since_updated = None
        now = datetime.now()
        if o.created_at is not None:
            days_since_created = (now - o.created_at).days

        if o.updated_at is not None:
            days_since_updated = (now - o.updated_at).days

        repo = PullRequestRepo(o)

        reviews = 0
        for r in o.get_reviews():
            reviews += 1

        self.monitoring_db.write('pull_request', {
            'days_since_created': days_since_created,
            'days_since_updated': days_since_updated,
            'review_comments': o.review_comments,
            'reviews': reviews,
            'count': 1
        }, tags={
            'repo': repo,
            'user': o.user.login,
            'mergable_state': o.mergeable_state,
            'state': o.state
        })

LogPullRequestPolicy()


text:
.class final Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo$1;
.super Ljava/lang/Object;
.source "WifiP2pFastConnectInfo.java"

# interfaces
.implements Landroid/os/Parcelable$Creator;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Landroid/os/Parcelable$Creator",
        "<",
        "Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;",
        ">;"
    }
.end annotation

# direct methods
.method constructor <init>()V
    .locals 0

    .prologue
    .line 137
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public createFromParcel(Landroid/os/Parcel;)Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;
    .locals 2
    .parameter "in"

    .prologue
    .line 139
    new-instance v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;

    invoke-direct {v0}, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;-><init>()V

    .line 140
    .local v0, info:Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->networkId:I

    .line 141
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->venderId:I

    .line 142
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->deviceAddress:Ljava/lang/String;

    .line 143
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->ssid:Ljava/lang/String;

    .line 144
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->authType:Ljava/lang/String;

    .line 145
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->encrType:Ljava/lang/String;

    .line 146
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->psk:Ljava/lang/String;

    .line 147
    invoke-virtual {p1}, Landroid/os/Parcel;->readString()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->gcIpAddress:Ljava/lang/String;

    .line 148
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v1

    iput v1, v0, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;->wfdDeviceType:I

    .line 149
    return-object v0
.end method

.method public bridge synthetic createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;
    .locals 1
    .parameter "x0"

    .prologue
    .line 137
    invoke-virtual {p0, p1}, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo$1;->createFromParcel(Landroid/os/Parcel;)Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;

    move-result-object v0

    return-object v0
.end method

.method public newArray(I)[Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;
    .locals 1
    .parameter "size"

    .prologue
    .line 153
    new-array v0, p1, [Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;

    return-object v0
.end method

.method public bridge synthetic newArray(I)[Ljava/lang/Object;
    .locals 1
    .parameter "x0"

    .prologue
    .line 137
    invoke-virtual {p0, p1}, Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo$1;->newArray(I)[Landroid/net/wifi/p2p/fastconnect/WifiP2pFastConnectInfo;

    move-result-object v0

    return-object v0
.end method


text:
Examples
========
1. Time parser

  A simple example of how to write and run the parser on the example of the time string.

2. Closure parser

  A simple example of how to use actions based on closures.

3. Error handler

  A simple example of how to get error information.


text:
package com.che58.ljb.rxjava.protocol;

import android.text.TextUtils;

import com.che58.ljb.rxjava.net.XgoHttpClient;
import com.squareup.okhttp.Request;

import java.util.TreeMap;

import rx.Observable;
import rx.Subscriber;
import rx.schedulers.Schedulers;

/**
 * BaseProtocol
 * Created by Ljb on 2015/12/22.
 */
public abstract class BaseProtocol {

    /**
     *  创建一个工作在IO线程的被观察者(被订阅者)对象
     *  @param url
     *  @param method
     *  @param params
     */
    protected  Observable<String> createObservable(final String url, final String method, final TreeMap<String, Object> params) {
        return Observable.create(new Observable.OnSubscribe<String>() {                         //  (2)
            @Override
            public void call(Subscriber<? super String> subscriber) {
                Request request = XgoHttpClient.getClient().getRequest(url, method, params);    //  (3)
                String json = XgoHttpClient.getClient().execute2String(request);                //  (4)
                setData(subscriber, json);                                                      //  (5)
            }
        }).subscribeOn(Schedulers.io());
    }

    /**
     * 为观察者(订阅者)设置返回数据
     * */
    protected  void setData(Subscriber<? super String> subscriber, String json) {
        if (TextUtils.isEmpty(json)) {                          //  (6)
            subscriber.onError(new Throwable("not data"));
            subscriber.onCompleted();
            return;
        }
        subscriber.onNext(json);                                //  (7)
        subscriber.onCompleted();
    }
}


text:
@interface StatusDisplayer : NSObject {
	IBOutlet NSWindow *window;

	BOOL isGrowlInstalled;
	BOOL isGrowlRunning;
}

@property(assign) BOOL isGrowlInstalled;
@property(assign) BOOL isGrowlRunning;

@end


text:
define([
    'underscore',
    'contrail-common',
    'controller-constants',
    'controller-labels',
    'controller-utils',
    'controller-messages'
], function (_, Contrail, Constants, Labels, Utils, Messages) {
    contrail = new Contrail();
    ctwc = new Constants();
    ctwl = new Labels();
    ctwu = new Utils;
    ctwm = new Messages();

    //deferredObj reading from global variable
    var deferredObj = globalObj['initFeatureAppDefObjMap'][FEATURE_PCK_WEB_CONTROLLER];

    if(contrail.checkIfExist(deferredObj)) {
        deferredObj.resolve()
    }
});


text:
category: components
---

{{paragraph.intro}}

{{paragraph.short}}

{{paragraph.medium}}

{{paragraph.long}}


text:
let Test = require('../../option_test');

describe('Option `eof-newline`, detect', function() {
  describe('css', function() {
    it('Shouldn't detect eof newline', function() {
      let test = new Test(this);
      test.shouldDetect(
          ['eof-newline'],
          'a { color: red }',
          {'eof-newline': false}
      );
    });

    it('Should detect eof newline', function() {
      let test = new Test(this);
      test.shouldDetect(
          ['eof-newline'],
          'a { color: red }\n',
          {'eof-newline': true}
      );
    });

    it('Shouldn't detect eof newline with spaces at the end', function() {
      let test = new Test(this);
      test.shouldDetect(
          ['eof-newline'],
          'a { color: red }  ',
          {'eof-newline': false}
      );
    });

    it('Should detect eof newline with mixed spaces at the end', function() {
      let test = new Test(this);
      test.shouldDetect(
          ['eof-newline'],
          'a { color: red } \n ',
          {'eof-newline': true}
      );
    });
  });
});


text:
namespace Cofoundry.Domain;

/// <summary>
/// Data used for rendering a specific version of a custom entity
/// out to a page, including template data for all the content-editable
/// page regions. This object is specific to a particular version which
/// may not always be the latest (depending on the query), and to a specific
/// page.
/// </summary>
public class CustomEntityRenderDetails : CustomEntityRenderSummary
{
    /// <summary>
    /// Page region and fully mapped block data for a specific page
    /// template, which will have been specified in the query used to
    /// load this instance.
    /// </summary>
    public ICollection<CustomEntityPageRegionRenderDetails> Regions { get; set; }
}


text:
package org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets;

import java.util.Iterator;

import org.eclipse.core.runtime.Assert;

import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.ArrayType;
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType;
import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.TTypes;

public class SubTypesOfSingleton extends TypeSet {
	/**
	 * The "base type" defining the upper bound of this set.
	 */
	private final TType fUpperBound;

	protected SubTypesOfSingleton(TType t, TypeSetEnvironment typeSetEnvironment) {
		super(typeSetEnvironment);
		Assert.isNotNull(t);
		fUpperBound= t;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#isUniverse()
	 */
	@Override
	public boolean isUniverse() {
		return fUpperBound.equals(getJavaLangObject());
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#makeClone()
	 */
	@Override
	public TypeSet makeClone() {
		return this; // new SubTypesOfSingleton(fUpperBound);
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#subTypes()
	 */
	@Override
	public TypeSet subTypes() {
		return this; // makeClone();
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#intersectedWith(org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet)
	 */
	@Override
	public TypeSet specialCasesIntersectedWith(TypeSet other) {
		if (other.isSingleton() && other.anyMember().equals(fUpperBound))
			return other;		// xsect(subTypes(A),A) = A

		if (other instanceof SubTypesOfSingleton) {
			SubTypesOfSingleton otherSub= (SubTypesOfSingleton) other;

			if (TTypes.canAssignTo(otherSub.fUpperBound, fUpperBound))
				return otherSub; // .makeClone();
			if (TTypes.canAssignTo(fUpperBound, otherSub.fUpperBound))
				return this; // makeClone();
		} else if (other.hasUniqueLowerBound()) {
			TType otherLower= other.uniqueLowerBound();

			if (otherLower.equals(fUpperBound))
				return new SingletonTypeSet(fUpperBound, getTypeSetEnvironment());
			if (otherLower != fUpperBound && TTypes.canAssignTo(fUpperBound, otherLower) ||
					! TTypes.canAssignTo(otherLower, fUpperBound))
				return getTypeSetEnvironment().getEmptyTypeSet();
		}
//		else if (other instanceof SubTypesSet) {
//			SubTypesSet otherSub= (SubTypesSet) other;
//			TypeSet otherUppers= otherSub.upperBound();
//
//			for(Iterator iter= otherUppers.iterator(); iter.hasNext(); ) {
//				TType t= (TType) iter.next();
//
//				if ()
//			}
//		}
		return null;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#isEmpty()
	 */
	@Override
	public boolean isEmpty() {
		return false;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#upperBound()
	 */
	@Override
	public TypeSet upperBound() {
		return new SingletonTypeSet(fUpperBound, getTypeSetEnvironment());
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#lowerBound()
	 */
	@Override
	public TypeSet lowerBound() {
		EnumeratedTypeSet e= enumerate();
		return e.lowerBound();
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#hasUniqueLowerBound()
	 */
	@Override
	public boolean hasUniqueLowerBound() {
//		TypeSet lowerBound= lowerBound();

//		return lowerBound.isSingleton();
		return false; // fast, though perhaps inaccurate, but that's ok
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#hasUniqueUpperBound()
	 */
	@Override
	public boolean hasUniqueUpperBound() {
		return true;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#uniqueLowerBound()
	 */
	@Override
	public TType uniqueLowerBound() {
		TypeSet lowerBound= lowerBound();

		return lowerBound.anyMember();
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#uniqueUpperBound()
	 */
	@Override
	public TType uniqueUpperBound() {
		return fUpperBound;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#contains(org.eclipse.jdt.core.TType)
	 */
	@Override
	public boolean contains(TType t) {
		if (t.equals(fUpperBound))
			return true;
		return TTypes.canAssignTo(t, fUpperBound);
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#containsAll(org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet)
	 */
	@Override
	public boolean containsAll(TypeSet other) {
		if (isUniverse())
			return true;

		// Optimization: if other is also a SubTypeOfSingleton, just compare bounds
		if (other instanceof SubTypesOfSingleton) {
			SubTypesOfSingleton otherSub= (SubTypesOfSingleton) other;
			return TTypes.canAssignTo(otherSub.fUpperBound, fUpperBound);
		}
		// Optimization: if other is a SubTypesSet, just compare each of its bounds to mine
		if (other instanceof SubTypesSet) {
			SubTypesSet otherSub= (SubTypesSet) other;
			TypeSet otherUpperBounds= otherSub.upperBound();

			for(Iterator<TType> iter= otherUpperBounds.iterator(); iter.hasNext(); ) {
				TType t= iter.next();
				if (! TTypes.canAssignTo(t, fUpperBound))
					return false;
			}
			return true;
		}
		// For now, no more tricks up my sleeve; get an iterator
		for(Iterator<TType> iter= other.iterator(); iter.hasNext(); ) {
			TType t= iter.next();

			if (! TTypes.canAssignTo(t, fUpperBound))
				return false;
		}
		return true;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#iterator()
	 */
	@Override
	public Iterator<TType> iterator() {
		return enumerate().iterator();
//		return new Iterator() {
//			// First type returned is fUpperBound, then each of the subtypes, in turn
//			//
//			// If the upper bound is an array type, return the set of array types
//			// { Array(subType(elementTypeOf(fUpperBound))) }
//			private Set/*<TType>*/ subTypes= sTypeHierarchy.getAllSubtypes(getElementTypeOf(fUpperBound));
//			private Iterator/*<TType>*/ subTypeIter= subTypes.iterator();
//			private int nDims= getDimsOf(fUpperBound);
//			private int idx=-1;
//			public void remove() { /*do nothing*/}
//			public boolean hasNext() { return idx < subTypes.size(); }
//			public Object next() {
//				int i=idx++;
//				if (i < 0) return fUpperBound;
//				return makePossiblyArrayTypeFor((TType) subTypeIter.next(), nDims);
//			}
//		};
	}

	/**
	 * Returns the element type of the given TType, if an array type, or the
	 * given TType itself, otherwise.
	 *
	 * @param t a type
	 * @return the element type
	 */
	private TType getElementTypeOf(TType t) {
		if (t instanceof ArrayType)
			return ((ArrayType) t).getElementType();
		return t;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#isSingleton()
	 */
	@Override
	public boolean isSingleton() {
		return getElementTypeOf(fUpperBound).getSubTypes().length == 0;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#anyMember()
	 */
	@Override
	public TType anyMember() {
		return fUpperBound;
	}

	private EnumeratedTypeSet fEnumCache= null;

	/* (non-Javadoc)
	 * @see org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet#enumerate()
	 */
	@Override
	public EnumeratedTypeSet enumerate() {
		if (fEnumCache == null) {
			if (fUpperBound instanceof ArrayType) {
				ArrayType at= (ArrayType) fUpperBound;
				fEnumCache= EnumeratedTypeSet.makeArrayTypesForElements(TTypes.getAllSubTypesIterator(at.getComponentType()),getTypeSetEnvironment());
			} else
				fEnumCache= new EnumeratedTypeSet(TTypes.getAllSubTypesIterator(fUpperBound), getTypeSetEnvironment());

			fEnumCache.add(fUpperBound);
			fEnumCache.initComplete();
		}
		return fEnumCache;
	}

	@Override
	public boolean equals(Object o) {
		if (!(o instanceof SubTypesOfSingleton))
			return false;
		SubTypesOfSingleton other= (SubTypesOfSingleton) o;

		return other.fUpperBound.equals(fUpperBound);
	}

	@Override
	public int hashCode() {
		return fUpperBound.hashCode();
	}

	@Override
	public String toString() {
		return "<" + fID + ": subTypes(" + fUpperBound.getPrettySignature() + ")>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	}
}