JVM/src/com/gabongao/jvm/rtda/heap/Object.java
2017-02-21 19:18:15 +08:00

60 lines
2.2 KiB
Java
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
* Vestibulum commodo. Ut rhoncus gravida arcu.
*/
package com.gabongao.jvm.rtda.heap;
/**
*         ┏┓   ┏┓+ +
*        ┏┛┻━━━┛┻┓ + +
*        ┃       ┃
*        ┃   ━   ┃ ++ + + +
*        ████━████ ┃+
*        ┃       ┃ +
*        ┃   ┻   ┃
*        ┃       ┃ + +
*        ┗━┓   ┏━┛
*          ┃   ┃
*          ┃   ┃ + + + +
*                 Code is far away from bug with the animal protecting
*          ┃   ┃ +     神兽保佑,代码无bug
*          ┃   ┃
*          ┃   ┃  +
*          ┃    ┗━━━┓ + +
*          ┃        ┣┓
*          ┃        ┏┛
*          ┗┓┓┏━┳┓┏┛ + + + +
*            ┃┫┫ ┃┫┫
*           ┗┻┛ ┗┻┛+ + + +
* Created by Imgaojp on 2017/2/18.
*/
public class Object {
private ClassStruct classStruct;
private Slots fields;
//TODO
public Object() {
}
public Object(ClassStruct classStruct) {
this.classStruct = classStruct;
this.fields = new Slots(classStruct.getInstanceSlotCount());
}
public ClassStruct getClassStruct() {
return classStruct;
}
public Slots getFields() {
return fields;
}
public boolean isInstanceOf(ClassStruct classStruct) {
return classStruct.isAssignableFrom(this.classStruct);
}
}