NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Objects.PersistentObject Class Reference
Inheritance diagram for Ntp.Analyzer.Objects.PersistentObject:

Public Member Functions

override bool Equals (object obj)
 
override int GetHashCode ()
 
void SetId (int id)
 Sets the identifier after the object have been stored in persistent storage. More...
 
override string ToString ()
 Returns a string that represents the current PersistentObject. More...
 

Protected Member Functions

 PersistentObject (int id)
 Initializes a new instance of the PersistentObject class. More...
 
 PersistentObject ()
 Initializes a new instance of the PersistentObject class. More...
 

Properties

int Id [get, private set]
 Gets the identifier. More...
 
bool NewObject [get, protected set]
 Gets a value indicating whether this PersistentObject is a new object which does not yet exists in the peristing storage (database etc). More...
 

Detailed Description

Definition at line 24 of file PersistentObject.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Objects.PersistentObject.PersistentObject ( int  id)
inlineprotected

Initializes a new instance of the PersistentObject class.

Parameters
idIdentifier.

Constructor used when creating instances from data storage.

Definition at line 33 of file PersistentObject.cs.

34  {
35  Id = id;
36  NewObject = false;
37  }
bool NewObject
Gets a value indicating whether this PersistentObject is a new object which does not yet exists in th...
Ntp.Analyzer.Objects.PersistentObject.PersistentObject ( )
inlineprotected

Initializes a new instance of the PersistentObject class.

Definition at line 42 of file PersistentObject.cs.

43  {
44  Id = -1;
45  NewObject = true;
46  }
bool NewObject
Gets a value indicating whether this PersistentObject is a new object which does not yet exists in th...

Member Function Documentation

override bool Ntp.Analyzer.Objects.PersistentObject.Equals ( object  obj)
inline

Definition at line 66 of file PersistentObject.cs.

67  {
68  if (obj == null)
69  return false;
70 
71  if (obj.GetType() != GetType())
72  return false;
73 
74  return NewObject
75  // ReSharper disable once BaseObjectEqualsIsObjectEquals
76  ? base.Equals(obj)
77  : Id == ((PersistentObject) obj).Id;
78  }
bool NewObject
Gets a value indicating whether this PersistentObject is a new object which does not yet exists in th...
PersistentObject()
Initializes a new instance of the PersistentObject class.
override int Ntp.Analyzer.Objects.PersistentObject.GetHashCode ( )
inline

Definition at line 80 of file PersistentObject.cs.

81  {
82  // ReSharper disable once NonReadonlyMemberInGetHashCode
83  return NewObject
84  // ReSharper disable once BaseObjectGetHashCodeCallInGetHashCode
85  ? base.GetHashCode()
86  // ReSharper disable once NonReadonlyMemberInGetHashCode
87  : (int) (Id*2654435761%2 ^ 32);
88  }
bool NewObject
Gets a value indicating whether this PersistentObject is a new object which does not yet exists in th...
void Ntp.Analyzer.Objects.PersistentObject.SetId ( int  id)
inline

Sets the identifier after the object have been stored in persistent storage.

Parameters
idIdentifier.

Definition at line 94 of file PersistentObject.cs.

Referenced by Ntp.Analyzer.Data.Sql.PeerDatabaseMapper.Insert(), Ntp.Analyzer.Data.Sql.PeerActivityDatabaseMapper.Insert(), Ntp.Analyzer.Data.Sql.DriftReadingDatabaseMapper.Insert(), Ntp.Analyzer.Data.Sql.TimeServerDatabaseMapper.Insert(), Ntp.Analyzer.Data.Sql.HostReadingDatabaseMapper.Insert(), Ntp.Analyzer.Data.Sql.PeerReadingDatabaseMapper.Insert(), Ntp.Analyzer.Data.Sql.HostIoReadingDatabaseMapper.Insert(), and Ntp.Analyzer.Data.Sql.AssociationEntryMapper.Insert().

95  {
96  Id = id;
97  NewObject = false;
98  }
bool NewObject
Gets a value indicating whether this PersistentObject is a new object which does not yet exists in th...

Here is the caller graph for this function:

override string Ntp.Analyzer.Objects.PersistentObject.ToString ( )
inline

Returns a string that represents the current PersistentObject.

Returns
A string that represents the current PersistentObject.

Definition at line 106 of file PersistentObject.cs.

107  {
108  return $"[PersistentObject: Id={Id}, NewObject={NewObject}]";
109  }

Property Documentation

bool Ntp.Analyzer.Objects.PersistentObject.NewObject
getprotected set

Gets a value indicating whether this PersistentObject is a new object which does not yet exists in the peristing storage (database etc).

true if new object; otherwise, false.

Definition at line 64 of file PersistentObject.cs.


The documentation for this class was generated from the following file: