[armedbear-cvs] r12464 - branches/metaclass/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Sat Feb 13 22:45:56 UTC 2010


Author: ehuelsmann
Date: Sat Feb 13 17:45:56 2010
New Revision: 12464

Log:
Convert LAYOUT and DIRECT-SUPERCLASSES of STANDARD-CLASS to slots.

Modified:
   branches/metaclass/abcl/src/org/armedbear/lisp/LispClass.java
   branches/metaclass/abcl/src/org/armedbear/lisp/StandardClass.java

Modified: branches/metaclass/abcl/src/org/armedbear/lisp/LispClass.java
==============================================================================
--- branches/metaclass/abcl/src/org/armedbear/lisp/LispClass.java	(original)
+++ branches/metaclass/abcl/src/org/armedbear/lisp/LispClass.java	Sat Feb 13 17:45:56 2010
@@ -122,7 +122,7 @@
     super(layout, layout == null ? 0 : layout.getLength());
     sxhash = hashCode() & 0x7fffffff;
     setName(symbol);
-    this.directSuperclasses = directSuperclasses;
+    setDirectSuperclasses(directSuperclasses);
   }
 
   @Override
@@ -130,8 +130,11 @@
   {
     LispObject result = NIL;
     result = result.push(new Cons("NAME", name != null ? name : NIL));
-    result = result.push(new Cons("LAYOUT", classLayout != null ? classLayout : NIL));
-    result = result.push(new Cons("DIRECT-SUPERCLASSES", directSuperclasses));
+    result = result.push(new Cons("LAYOUT",
+                                  getClassLayout() != null
+                                  ? getClassLayout() : NIL));
+    result = result.push(new Cons("DIRECT-SUPERCLASSES",
+                                  getDirectSuperclasses()));
     result = result.push(new Cons("DIRECT-SUBCLASSES", directSubclasses));
     result = result.push(new Cons("CLASS-PRECEDENCE-LIST", classPrecedenceList));
     result = result.push(new Cons("DIRECT-METHODS", directMethods));
@@ -171,12 +174,12 @@
     propertyList = obj;
   }
 
-  public final Layout getClassLayout()
+  public Layout getClassLayout()
   {
     return classLayout;
   }
 
-  public final void setClassLayout(Layout layout)
+  public void setClassLayout(Layout layout)
   {
     classLayout = layout;
   }
@@ -188,12 +191,12 @@
     return layout.getLength();
   }
 
-  public final LispObject getDirectSuperclasses()
+  public LispObject getDirectSuperclasses()
   {
     return directSuperclasses;
   }
 
-  public final void setDirectSuperclasses(LispObject directSuperclasses)
+  public void setDirectSuperclasses(LispObject directSuperclasses)
   {
     this.directSuperclasses = directSuperclasses;
   }
@@ -211,7 +214,7 @@
   // When there's only one direct superclass...
   public final void setDirectSuperclass(LispObject superclass)
   {
-    directSuperclasses = new Cons(superclass);
+    setDirectSuperclasses(new Cons(superclass));
   }
 
   public final LispObject getDirectSubclasses()

Modified: branches/metaclass/abcl/src/org/armedbear/lisp/StandardClass.java
==============================================================================
--- branches/metaclass/abcl/src/org/armedbear/lisp/StandardClass.java	(original)
+++ branches/metaclass/abcl/src/org/armedbear/lisp/StandardClass.java	Sat Feb 13 17:45:56 2010
@@ -38,13 +38,16 @@
 public class StandardClass extends SlotClass
 {
 
-  private static Symbol name = PACKAGE_MOP.intern("NAME");
+  private static Symbol symName = PACKAGE_MOP.intern("NAME");
+  private static Symbol symLayout = PACKAGE_MOP.intern("LAYOUT");
+  private static Symbol symDirectSuperclasses
+    = PACKAGE_MOP.intern("DIRECT-SUPERCLASSES");
 
   static Layout layoutStandardClass =
       new Layout(null,
-                 list(name,
-                      PACKAGE_MOP.intern("LAYOUT"),
-                      PACKAGE_MOP.intern("DIRECT-SUPERCLASSES"),
+                 list(symName,
+                      symLayout,
+                      symDirectSuperclasses,
                       PACKAGE_MOP.intern("DIRECT-SUBCLASSES"),
                       PACKAGE_MOP.intern("CLASS-PRECEDENCE-LIST"),
                       PACKAGE_MOP.intern("DIRECT-METHODS"),
@@ -76,16 +79,43 @@
   @Override
   public LispObject getName()
   {
-    return getInstanceSlotValue(name);
+    return getInstanceSlotValue(symName);
   }
 
   @Override
   public void setName(LispObject newName)
   {
-    setInstanceSlotValue(name, newName);
+    setInstanceSlotValue(symName, newName);
   }
 
   @Override
+  public Layout getClassLayout()
+  {
+    LispObject layout = getInstanceSlotValue(symLayout);
+    return (layout == UNBOUND_VALUE) ? null : (Layout)layout;
+  }
+
+  @Override
+  public void setClassLayout(Layout newLayout)
+  {
+    setInstanceSlotValue(symLayout, newLayout);
+  }
+
+  @Override
+  public LispObject getDirectSuperclasses()
+  {
+    return getInstanceSlotValue(symDirectSuperclasses);
+  }
+
+  @Override
+  public void setDirectSuperclasses(LispObject directSuperclasses)
+  {
+    setInstanceSlotValue(symDirectSuperclasses, directSuperclasses);
+  }
+
+
+
+  @Override
   public LispObject classOf()
   {
     return STANDARD_CLASS;




More information about the armedbear-cvs mailing list