a query-based code browser
 
Home
Download
Papers
Screen Shots
Contact
 

Appendix 2: Built-in JQuery Specific TyRuBa predicates and rules

< ^ >

This appendix contains information about the JQuery specific TyRuBa types, predicates, and rules.

Type Hierarchy

JQuery has a TyRuBa type hierarchy that must be adhered to with respect to predicate arguments.

  • Element
    • Package
    • CU
    • Field
    • Type
      • Primitive
      • RefType (interface or class)
    • Block
      • Initializer
      • Callable
        • Method
        • Constructor
    • Marker
      • Bookmark
      • Warning
      • Error
      • Task

Type Checking "Predicates"

Each type has a "predicate" defined for it that does dynamic type checking on its argument. The quotes are around predicate because these predicates are defined implicitly whenever a type is created. For example, the CU(?X) predicate succeeds if ?X is bound to a compilation unit, and fails otherwise.

Note: There is a difference between the type checking predicates and the core fact predicates. The type checking predicates do not have to access the fact database. However, they cannot be used always. For example: the query "CU(?X)" will cause a mode checker error to occur, as ?X is not bound (and CU is not defined if its argument is not bound), while "cu(?X)" will bind ?X to all of the compilation units in the fact database.

Core Fact Predicates

These are the predicates that directly operate on the facts that are stored in the fact database. All other predicates are derived from these with rules.

Unary Predicates

Predicate Name Argument Type Description
cu CU cu(?X) means: "?X is a Compilation Unit (.class or .java file)"
package Package package(?X) means: "?X is a package"
class RefType class(?X) means: "?X is a class"
interface RefType interface(?X) means: "?X is an interface"
method Method method(?X) means: "?X is a method"
constructor Constructor constructor(?X) means: "?X is a constructor"
initializer Initializer initializer(?X) means: "?X is an initializer"
field Field field(?X) means: "?X is a field"
bookmark Bookmark bookmark(?X) means: "?X is a bookmark"
warning Warning warning(?X) means: "?X is a compiler warning"
error Error error(?X) means: "?X is a compiler error"
task Task task(?X) means: "?X is a task"

Binary Predicates

Predicate Name Argument Types Description
priority Task, String priority(?T,?P) means: "Task ?T has priority ?P"
name Element, String name(?E,?S) means: "Element ?E has name ?S"
child Element, Element child(?Sup,?Sub) means: "Element ?Sup has a child ?Sub"
extends RefType, RefType extends(?C1,?C2) means: "Class (or Interface) ?C1 extends Class (or Interface) ?C2"
implements RefType, RefType implements(?C,?I) means: "Class ?C implements Interface ?I"
throws Callable, RefType throws(?C,?T) means: "Callable ?C throws ?T"
type Field, Type type(?F,?T) means: "Field ?F is of type ?T"
modifier Element, String modifier(?E,?S) means: "Element ?E has modifier (i.e public, private, static, etc) ?S"
arg Callable, Type arg(?C,?T) means: "Callable ?C has an argument of type ?T"
returns Callable, Type returns(?C,?T) means: "Callable ?C returns Type ?T"
signature Callable, String signature(?C,?S) means: "Callable ?C has signature ?S"

Ternary Predicates

Predicate Name Argument Types Description
methodCall Block, Method, SourceLocation methodCall(?B,?M,?L) means: "Block ?B calls Method ?M at location ?L"
thisCall Constructor, Constructor, SourceLocation methodCall(?C1,?C2,?L) means: "Constructor ?C1 makes a "this" call to Constructor ?C2 at location ?L"
superCall Callable, Callable, SourceLocation superCall(?C1,?C2,?L) means: "Callable ?C1 makes a "super" call to Callable ?C2 at location ?L"
constructorCall Block, Constructor, SourceLocation constructorCall(?B,?C,?L) means: "Block ?B calls Constructor ?C at location ?L"
instanceOf Block, RefType, SourceLocation instanceOf(?B,?T,?L) means: "Block ?B performs an instanceof test for type ?T at location ?L"
reads Block, Field, SourceLocation reads(?B,?F,?L) means: "Block ?B reads field ?F at location ?L"
writes Block, Field, SourceLocation writes(?B,?F,?L) means: "Block ?B writes to field ?F at location ?L"
param Callable, Type, Integer param(?C,?T,?N) means: "Callable ?C has an argument of type ?T as its ?Nth argument"
tag Element, String, String tag(?E,?N,?V) means: "Element ?E has javadoc tag ?N with value ?V"

Derived Predicates

These are useful predicates that have been derived from the core fact predicates using rules. The rule declarations are contained in the derived_preds.rub file.

Predicate Name Argument Types Description
type Type type(?T) means: "?T is a type (a class, interface, or primitive)"
element Element element(?E) means: "?T is an element"
likeThis Element, Element likeThis(?E1,?E2) means: "?E1 and ?E2 have the same name, but are not the same object"
strongLikeThis Callable, Callable strongLikeThis(?C1,?C1) means: "?C1 and ?C2 have the same signature"
child+ Element, Element child+(?E1,?E1) means: "?E2 has ?E1 as one of its ancestors"
package Element, Package package(?E,?P) means: "Element ?E is in package ?P"
constructor Class, Constructor constructor(?CL,?CON) means: "Class ?CL declares constructor ?CON"
method Type, Method method(?T,?M) means: "Type ?T declares method ?M"
subtype Type, Type subtype(?T1,?T2) means: "?T2 is a direct subtype of ?T1"
subtype+ Type, Type subtype+(?T1,?T2) means: "?T2 is in ?T1's type hierarchy"
subtype* Type, Type subtype*(?T1,?T2) means: "?T2 is in ?T1's type hierarchy (?T2 can equal ?T1)"
field Type, Field field(?T,?F) means: "Type ?T declares field ?F"
inheritedField Type, Field, Type inheritedField(?T,?F,?InhT) means: "Type ?T inherites field ?F from type ?InhT"
calls Block, Callable, SourceLocation calls(?B,?C,?L) means: "Block ?B calls ?C at location ?L"
staticCall Block, Callable, SourceLocation staticCall(?B,?C,?L) means: "Block?B statically calls ?C at location ?L"
dynamicCall Block, Callable, SourceLocation dynamicCall(?B,?C,?L) means: "Block ?B dynamically calls ?C at location ?L"
polyCalls Block, Callable, SourceLocation polyCalls(?B,?C,?L) means: "Block ?B calls polymorphic callable ?C at location ?L"
accesses Block, Field, SourceLocation accesses(?B,?F,?L) means: "Block ?B accesses field ?F at location ?L"
inheritedMethod Type, Callable, Type inheritedMethod(?T,?C,?SUP) means: "Type ?T inherits ?C from ?SUP"
overrides Callable, Callable overrides(?C1,?C2) means: "Callable ?C1 overrides callable ?C2"
creator Class, Block, SourceLocation creator(?C1, ?Ctor, ?L) means: "Class ?C1 is created by block ?Ctor at location ?L"
implements+ Class, Interface implements+(?C,?I) means: "Interface ?I is implemented by ?C or an ancestor of ?C"
outerType Type outerType(?T) means: "?T is an outer type"
nestedType RefType nestedType(?T) means: "?T is a nested type"
memberType RefType memberType(?T) means: "?T is a member type"
staticNestedType RefType nestedType(?T) means: "?T is a static nested type"
localType RefType localType(?T) means: "?T is a local type"
anonymousType RefType anonymousType(?T) means: "?T is an anonymous type"
viewFromHere Element, [Element] viewFromHere(?X,?ViewStructure) means: "?ViewStructure is a tree representation of all child relationships below parent element ?X"
re_match RegExp, String re_match(?RE,?S) means: "String ?S matches Regular Expression ?RE"
re_name Element, RegExp re_name(?E,?RE) means: "?E has a name that matches ?RE"

 

< ^ >