Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / wpf / src / Core / CSharp / MS / Internal / Ink / StrokeFIndices.cs / 1 / StrokeFIndices.cs
//------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
using MS.Utility;
using MS.Internal;
using System;
using System.Windows;
using System.Collections.Generic;
using System.Globalization;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace MS.Internal.Ink
{
#region StrokeFIndices
///
/// A helper struct that represents a fragment of a stroke spine.
///
internal struct StrokeFIndices : IEquatable
{
#region Private statics
private static StrokeFIndices s_empty = new StrokeFIndices(AfterLast, BeforeFirst);
private static StrokeFIndices s_full = new StrokeFIndices(BeforeFirst, AfterLast);
#endregion
#region Internal API
///
/// BeforeFirst
///
///
internal static double BeforeFirst { get { return double.MinValue; } }
///
/// AfterLast
///
///
internal static double AfterLast { get { return double.MaxValue; } }
///
/// StrokeFIndices
///
/// beginFIndex
/// endFIndex
internal StrokeFIndices(double beginFIndex, double endFIndex)
{
_beginFIndex = beginFIndex;
_endFIndex = endFIndex;
}
///
/// BeginFIndex
///
///
internal double BeginFIndex
{
get { return _beginFIndex; }
set { _beginFIndex = value; }
}
///
/// EndFIndex
///
///
internal double EndFIndex
{
get { return _endFIndex; }
set { _endFIndex = value;}
}
///
/// ToString
///
public override string ToString()
{
return "{" + GetStringRepresentation(_beginFIndex) + "," + GetStringRepresentation(_endFIndex) + "}";
}
///
/// Equals
///
///
///
public bool Equals(StrokeFIndices strokeFIndices)
{
return (strokeFIndices == this);
}
///
/// Equals
///
///
///
public override bool Equals(Object obj)
{
// Check for null and compare run-time types
if (obj == null || GetType() != obj.GetType())
return false;
return ((StrokeFIndices)obj == this);
}
///
/// GetHashCode
///
///
public override int GetHashCode()
{
return _beginFIndex.GetHashCode() ^ _endFIndex.GetHashCode();
}
///
/// operator ==
///
///
///
///
public static bool operator ==(StrokeFIndices sfiLeft, StrokeFIndices sfiRight)
{
return (DoubleUtil.AreClose(sfiLeft._beginFIndex, sfiRight._beginFIndex)
&& DoubleUtil.AreClose(sfiLeft._endFIndex, sfiRight._endFIndex));
}
///
/// operator !=
///
///
///
///
public static bool operator !=(StrokeFIndices sfiLeft, StrokeFIndices sfiRight)
{
return !(sfiLeft == sfiRight);
}
internal static string GetStringRepresentation(double fIndex)
{
if (DoubleUtil.AreClose(fIndex, StrokeFIndices.BeforeFirst))
{
return "BeforeFirst";
}
if (DoubleUtil.AreClose(fIndex, StrokeFIndices.AfterLast))
{
return "AfterLast";
}
return fIndex.ToString(CultureInfo.InvariantCulture);
}
///
///
///
internal static StrokeFIndices Empty { get { return s_empty; } }
///
///
///
internal static StrokeFIndices Full { get { return s_full; } }
///
///
///
internal bool IsEmpty { get { return DoubleUtil.GreaterThanOrClose(_beginFIndex, _endFIndex); } }
///
///
///
internal bool IsFull { get { return ((DoubleUtil.AreClose(_beginFIndex, BeforeFirst)) && (DoubleUtil.AreClose(_endFIndex,AfterLast))); } }
#if DEBUG
///
///
///
private bool IsValid { get { return !double.IsNaN(_beginFIndex) && !double.IsNaN(_endFIndex) && _beginFIndex < _endFIndex; } }
#endif
///
/// Compare StrokeFIndices based on the BeinFIndex
///
///
///
internal int CompareTo(StrokeFIndices fIndices)
{
#if DEBUG
System.Diagnostics.Debug.Assert(!double.IsNaN(_beginFIndex) && !double.IsNaN(_endFIndex) && DoubleUtil.LessThan(_beginFIndex, _endFIndex));
#endif
if (DoubleUtil.AreClose(BeginFIndex, fIndices.BeginFIndex))
{
return 0;
}
else if (DoubleUtil.GreaterThan(BeginFIndex, fIndices.BeginFIndex))
{
return 1;
}
else
{
return -1;
}
}
#endregion
#region Fields
private double _beginFIndex;
private double _endFIndex;
#endregion
}
#endregion
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
using MS.Utility;
using MS.Internal;
using System;
using System.Windows;
using System.Collections.Generic;
using System.Globalization;
using SR=MS.Internal.PresentationCore.SR;
using SRID=MS.Internal.PresentationCore.SRID;
namespace MS.Internal.Ink
{
#region StrokeFIndices
///
/// A helper struct that represents a fragment of a stroke spine.
///
internal struct StrokeFIndices : IEquatable
{
#region Private statics
private static StrokeFIndices s_empty = new StrokeFIndices(AfterLast, BeforeFirst);
private static StrokeFIndices s_full = new StrokeFIndices(BeforeFirst, AfterLast);
#endregion
#region Internal API
///
/// BeforeFirst
///
///
internal static double BeforeFirst { get { return double.MinValue; } }
///
/// AfterLast
///
///
internal static double AfterLast { get { return double.MaxValue; } }
///
/// StrokeFIndices
///
/// beginFIndex
/// endFIndex
internal StrokeFIndices(double beginFIndex, double endFIndex)
{
_beginFIndex = beginFIndex;
_endFIndex = endFIndex;
}
///
/// BeginFIndex
///
///
internal double BeginFIndex
{
get { return _beginFIndex; }
set { _beginFIndex = value; }
}
///
/// EndFIndex
///
///
internal double EndFIndex
{
get { return _endFIndex; }
set { _endFIndex = value;}
}
///
/// ToString
///
public override string ToString()
{
return "{" + GetStringRepresentation(_beginFIndex) + "," + GetStringRepresentation(_endFIndex) + "}";
}
///
/// Equals
///
///
///
public bool Equals(StrokeFIndices strokeFIndices)
{
return (strokeFIndices == this);
}
///
/// Equals
///
///
///
public override bool Equals(Object obj)
{
// Check for null and compare run-time types
if (obj == null || GetType() != obj.GetType())
return false;
return ((StrokeFIndices)obj == this);
}
///
/// GetHashCode
///
///
public override int GetHashCode()
{
return _beginFIndex.GetHashCode() ^ _endFIndex.GetHashCode();
}
///
/// operator ==
///
///
///
///
public static bool operator ==(StrokeFIndices sfiLeft, StrokeFIndices sfiRight)
{
return (DoubleUtil.AreClose(sfiLeft._beginFIndex, sfiRight._beginFIndex)
&& DoubleUtil.AreClose(sfiLeft._endFIndex, sfiRight._endFIndex));
}
///
/// operator !=
///
///
///
///
public static bool operator !=(StrokeFIndices sfiLeft, StrokeFIndices sfiRight)
{
return !(sfiLeft == sfiRight);
}
internal static string GetStringRepresentation(double fIndex)
{
if (DoubleUtil.AreClose(fIndex, StrokeFIndices.BeforeFirst))
{
return "BeforeFirst";
}
if (DoubleUtil.AreClose(fIndex, StrokeFIndices.AfterLast))
{
return "AfterLast";
}
return fIndex.ToString(CultureInfo.InvariantCulture);
}
///
///
///
internal static StrokeFIndices Empty { get { return s_empty; } }
///
///
///
internal static StrokeFIndices Full { get { return s_full; } }
///
///
///
internal bool IsEmpty { get { return DoubleUtil.GreaterThanOrClose(_beginFIndex, _endFIndex); } }
///
///
///
internal bool IsFull { get { return ((DoubleUtil.AreClose(_beginFIndex, BeforeFirst)) && (DoubleUtil.AreClose(_endFIndex,AfterLast))); } }
#if DEBUG
///
///
///
private bool IsValid { get { return !double.IsNaN(_beginFIndex) && !double.IsNaN(_endFIndex) && _beginFIndex < _endFIndex; } }
#endif
///
/// Compare StrokeFIndices based on the BeinFIndex
///
///
///
internal int CompareTo(StrokeFIndices fIndices)
{
#if DEBUG
System.Diagnostics.Debug.Assert(!double.IsNaN(_beginFIndex) && !double.IsNaN(_endFIndex) && DoubleUtil.LessThan(_beginFIndex, _endFIndex));
#endif
if (DoubleUtil.AreClose(BeginFIndex, fIndices.BeginFIndex))
{
return 0;
}
else if (DoubleUtil.GreaterThan(BeginFIndex, fIndices.BeginFIndex))
{
return 1;
}
else
{
return -1;
}
}
#endregion
#region Fields
private double _beginFIndex;
private double _endFIndex;
#endregion
}
#endregion
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OracleCommand.cs
- XmlEnumAttribute.cs
- VerificationException.cs
- ColorContext.cs
- LongSumAggregationOperator.cs
- BooleanExpr.cs
- DataReceivedEventArgs.cs
- XmlSchemaSequence.cs
- CodeBlockBuilder.cs
- ForwardPositionQuery.cs
- FrameworkContentElementAutomationPeer.cs
- EventDescriptorCollection.cs
- XamlGridLengthSerializer.cs
- TraceLog.cs
- HtmlControl.cs
- CustomCredentialPolicy.cs
- RequiredAttributeAttribute.cs
- SqlSupersetValidator.cs
- InvalidAsynchronousStateException.cs
- ProxyAttribute.cs
- MailMessageEventArgs.cs
- AsymmetricSignatureDeformatter.cs
- XmlSchemaSequence.cs
- StateWorkerRequest.cs
- WindowsRebar.cs
- StyleHelper.cs
- ConfigUtil.cs
- SqlDataSourceParameterParser.cs
- PreservationFileReader.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- cache.cs
- UtilityExtension.cs
- ComponentDispatcher.cs
- ButtonBaseAutomationPeer.cs
- AutoGeneratedFieldProperties.cs
- Util.cs
- TypeSystem.cs
- RuntimeResourceSet.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- CodeDOMUtility.cs
- ModelServiceImpl.cs
- BitmapFrameEncode.cs
- EventProviderWriter.cs
- GeometryHitTestParameters.cs
- SimpleTypeResolver.cs
- NTAccount.cs
- ProfileWorkflowElement.cs
- LockRecoveryTask.cs
- TabPage.cs
- ColorInterpolationModeValidation.cs
- ProviderConnectionPointCollection.cs
- CursorInteropHelper.cs
- Line.cs
- MemberListBinding.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- TransportElement.cs
- DataGridPagerStyle.cs
- OutputCacheProfileCollection.cs
- EventMap.cs
- DefaultPropertyAttribute.cs
- ProvidersHelper.cs
- XmlSchemaIdentityConstraint.cs
- ChangePassword.cs
- XmlSignatureManifest.cs
- BypassElement.cs
- InputScopeConverter.cs
- EntityCommandCompilationException.cs
- WindowsNonControl.cs
- RelatedCurrencyManager.cs
- AddingNewEventArgs.cs
- ConfigXmlSignificantWhitespace.cs
- SolidColorBrush.cs
- UsernameTokenFactoryCredential.cs
- ExpressionBuilderCollection.cs
- XmlSerializerObjectSerializer.cs
- HitTestFilterBehavior.cs
- DataListCommandEventArgs.cs
- PrintingPermissionAttribute.cs
- ToolStripItemImageRenderEventArgs.cs
- HttpProfileBase.cs
- UnsafeNativeMethodsTablet.cs
- HtmlInputHidden.cs
- ParagraphVisual.cs
- NotSupportedException.cs
- ByteStack.cs
- WebConfigurationManager.cs
- DbSetClause.cs
- OdbcConnectionString.cs
- PagedDataSource.cs
- EventSinkHelperWriter.cs
- DesignTimeType.cs
- TemplateContainer.cs
- TypedDataSourceCodeGenerator.cs
- PropertyTabAttribute.cs
- SystemThemeKey.cs
- sqlinternaltransaction.cs
- DataGridViewDataErrorEventArgs.cs
- ButtonFlatAdapter.cs
- FormViewInsertedEventArgs.cs
- IEnumerable.cs