From 02da823b2901dca3a0d9b86d8c7d3bfc84cb52dd Mon Sep 17 00:00:00 2001 From: Marc Kuo Date: Tue, 13 Mar 2012 16:25:30 -0400 Subject: [PATCH] #19 change node and vehicle to defstruct --- lib/class-definitions.lisp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/class-definitions.lisp b/lib/class-definitions.lisp index f665a30..cab8956 100755 --- a/lib/class-definitions.lisp +++ b/lib/class-definitions.lisp @@ -5,24 +5,24 @@ ;; The node object ;; ---------------------- -(defclass node () - ((id :reader node-id :initarg :id) - (xcor :reader node-xcor :initarg :xcor :initform nil) - (ycor :reader node-ycor :initarg :ycor :initform nil) - (demand :reader node-demand :initarg :demand) - (start :reader node-start :initarg :start) - (end :reader node-end :initarg :end) - (duration :reader node-duration :initarg :duration :initform 0))) +(defstruct node + (id 0 :type fixnum :read-only t) + (xcor 0 :type fixnum :read-only t) + (ycor 0 :type fixnum :read-only t) + (demand 0 :type fixnum :read-only t) + (start 0 :type fixnum :read-only t) + (end 0 :type fixnum :read-only t) + (duration 0 :type fixnum :read-only t)) ;; -------------------------- ;; The vehicle object ;; --------------------------- -(defclass vehicle () - ((id :reader vehicle-id :initarg :id) - (route :accessor vehicle-route :initarg :route) - (capacity :reader vehicle-capacity :initarg :capacity) - (speed :accessor vehicle-speed :initarg :speed :initform 1))) +(defstruct vehicle + (id 0 :type fixnum :read-only t) + (route 0 :type fixnum) + (capacity 0 :type fixnum :read-only t) + (speed 1 :type fixnum :read-only t)) ;; ---------------------------- ;; The problem object class