SensorPanel

This topic applies to .NET version only 

SensorPanel.cs
01/* Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com */ 02 03namespace Db4objects.Db4odoc.Activating 04{ 05 public class SensorPanel 06 { 07 private object _sensor; 08 private SensorPanel _next; 09 10 public SensorPanel() 11 { 12 // default constructor for instantiation 13 } 14 // end SensorPanel 15 16 public SensorPanel(int value) 17 { 18 _sensor = value; 19 } 20 // end SensorPanel 21 22 public object Sensor 23 { 24 get 25 { 26 return _sensor; 27 } 28 } 29 // end Sensor 30 31 public SensorPanel CreateList(int length) 32 { 33 return CreateList(length, 1); 34 } 35 // end CreateList 36 37 public SensorPanel CreateList(int length, int first) 38 { 39 int val = first; 40 SensorPanel root = NewElement(first); 41 SensorPanel list = root; 42 while (--length > 0) 43 { 44 list._next = NewElement(++val); 45 list = list._next; 46 } 47 return root; 48 } 49 // end CreateList 50 51 public SensorPanel Next 52 { 53 get 54 { 55 return _next; 56 } 57 58 set 59 { 60 _next = value; 61 } 62 } 63 // end Next 64 65 protected SensorPanel NewElement(int value) 66 { 67 return new SensorPanel(value); 68 } 69 // end NewElement 70 71 public override string ToString() 72 { 73 return "Sensor #" + _sensor; 74 } 75 // end ToString 76 } 77}
SensorPanel.vb
01' Copyright (C) 2004 - 2007 db4objects Inc. http://www.db4o.com 02 03 04Namespace Db4objects.Db4odoc.Activating 05 Public Class SensorPanel 06 Private _sensor As Object 07 Private _next As SensorPanel 08 09 ' default constructor for instantiation 10 Public Sub New() 11 End Sub 12 13 Public Sub New(ByVal value As Integer) 14 _sensor = value 15 End Sub 16 17 Public Function CreateList(ByVal length As Integer) As SensorPanel 18 Return CreateList(length, 1) 19 End Function 20 21 Public Function CreateList(ByVal length As Integer, ByVal first As Integer) As SensorPanel 22 Dim val As Integer = first 23 Dim root As SensorPanel = NewElement(first) 24 Dim list As SensorPanel = root 25 While System.Threading.Interlocked.Decrement(length) > 0 26 list._next = NewElement(System.Threading.Interlocked.Increment(val)) 27 list = list._next 28 End While 29 Return root 30 End Function 31 32 Public ReadOnly Property Sensor() As Object 33 Get 34 Return _sensor 35 End Get 36 End Property 37 38 Public Property [Next]() As SensorPanel 39 Get 40 Return _next 41 End Get 42 43 Set(ByVal value As SensorPanel) 44 _next = value 45 End Set 46 End Property 47 48 Protected Function NewElement(ByVal value As Integer) As SensorPanel 49 Return New SensorPanel(value) 50 End Function 51 52 Public Overloads Overrides Function ToString() As String 53 Return "Sensor #" + _sensor.ToString 54 End Function 55 End Class 56End Namespace