Module clopwh.clopwh
CLOPWH Core Author : combacsa (combacsa@gmail.com, aka Byun, Kyuhong aka Francisco)
Functions
class_names_to_class_ids (class_names) | Class 들이 들어있는 table(array) 를 class_id 들의 table(array)로 변환. |
constructor (class_id, ...) | class_id 에 대응되는 클래스의 객체를 생성하는 함수. |
get_inherits (class_id, inherits) | inherits 에 나열된 클래스 이름들로부터 클래스 id 목록을 뽑아낸다. |
get_type (object) | 주어진 object 의 type 을 돌려준다. |
is_a (object, class_name) | 주어진 object 의 클래스가 class 가 맞는지 검사. |
is_a_by_id (object_id, class_id) | 주어진 object_id 의 클래스가 class_id 의 클래스인지 검사. |
linearize (class_id, direct_parents) | 주어진 class_id 에 대한 부모들에 대한 정보를 바탕으로 상속관계를 linearize 한다. |
lookup (class_id, key) | class_id 에 대응되는 클래스에서 key 의 함수를 찾아서 리턴한다. |
merge (class_id, seqs) | C3 Linearization 에 따른 merge 를 시행한다. |
register_class (declaration, class_function, lookup_function, inherits) | 새로운 Class 를 선언하면 그 선언을 토대로 Class 를 만든다. |
register_default_classes () | Register very special types 가장 기본이 되는 Class 들을 선언한다. |
Functions
- class_names_to_class_ids (class_names)
-
Class 들이 들어있는 table(array) 를 class_id 들의 table(array)로 변환.
Parameters
- class_names: table(array)of class names
Return value:
table(array)of class ids - constructor (class_id, ...)
-
class_id 에 대응되는 클래스의 객체를 생성하는 함수. 생성자 함수가 주어지지 않았다면 상위클래스를 뒤진다.
Parameters
- class_id: Unique id for given class
- ...: Parameters passed to the class constructor
Return value:
Object created by that constructor - get_inherits (class_id, inherits)
-
inherits 에 나열된 클래스 이름들로부터 클래스 id 목록을 뽑아낸다. 단, inherits 가 주어지지 않으면 자동으로 Object 로부터 상속받은셈 친다.
Parameters
- class_id: current class' id
- inherits: table(array) of function (class) which it inherits
Return value:
table(array)of Unique ids of given classes - get_type (object)
-
주어진 object 의 type 을 돌려준다. 즉 Class 를 돌려준다.
Parameters
- object: Object to know the class
Return value:
Class for the object - is_a (object, class_name)
-
주어진 object 의 클래스가 class 가 맞는지 검사. 실질적으로는 is_a 를 호출하는 wrapper 일 뿐이다.
Parameters
- object: Given object to test whether it belongs to given class_name
- class_name: Given class (function) to test whether given object belongs to it
Return value:
whether given objec is of given class - is_a_by_id (object_id, class_id)
-
주어진 object_id 의 클래스가 class_id 의 클래스인지 검사. 상속구조도 일일이 뒤진다.
Parameters
- object_id: Unique class id of given object
- class_id: Unique class id which will be tested
Return value:
whether given object is of given class - linearize (class_id, direct_parents)
-
주어진 class_id 에 대한 부모들에 대한 정보를 바탕으로 상속관계를 linearize 한다.
Parameters
- class_id: Class' unique id
- direct_parents: Class' direct parents
Return value:
linearized class inheritance - lookup (class_id, key)
-
class_id 에 대응되는 클래스에서 key 의 함수를 찾아서 리턴한다. 만일 없다면 상위클래스들을 뒤진다.
Parameters
- class_id: Unique id for class.
- key: Given function name to lookup.
Return value:
The function matching with key. If nothing exist, nil. - merge (class_id, seqs)
-
C3 Linearization 에 따른 merge 를 시행한다.
Parameters
- class_id: current class' id
- seqs: table(array) of table(array) contains all inheritance
Return value:
linearized inheritance table(array) - register_class (declaration, class_function, lookup_function, inherits)
-
새로운 Class 를 선언하면 그 선언을 토대로 Class 를 만든다.
Parameters
- declaration: table which contains Class declaration
- class_function: (optional) constructor function for given class
- lookup_function: (optional) lookup function for given class
- inherits: (optional) inheritance for given class
Return value:
Constructor function which is capable of creating object for given class - register_default_classes ()
- Register very special types 가장 기본이 되는 Class 들을 선언한다.