The Query entry area is where you specify the constraints of your search by choosing a type of item and indicating what the items should match.
Find offers a list of the types of item to search.
Item Type | Description |
classes and interfaces | Expects a class name or a regular expression in the matching field and returns all classes that match the target. Double-click a class to display the class in the Class card. |
methods | Expects a method name or a regular expression in the matching field and returns all methods that match the target. Double-click a method to display it in the Source panel. Note that if you do not define an init method, the compiler generates a default init method, and Cosmo Code displays this with the query results. Double-clicking the init method in the Query card shows the class definition in the Source panel. |
variables | Expects a variable name or a regular expression in the matching field and returns all variables that match the target. Double-click a variable to display it in the Source panel. |
Type in a regular expression or a complete class, method, or variable name. When you press <Enter>, or click Search, the characters you entered are used to find matching items in the project.
After specifying the item type and entering what it should match, click Search to perform the query. The results are displayed in the Display panel.
History offers a list of the current and previously executed queries. When you select an item from the list, the display area shows the results from the selected query.
The left and right arrow buttons allow you to cycle through previous query results. The left arrow moves back in history, and the right arrow moves forward. Arrow buttons are grayed-out if there is no history in the direction of the arrow.
The display panel shows the results of queries performed from the Query Entry area on the Query card; from the right mouse button menu in the Overview and Query cards; or from the Query menu in the main menu bar.
Display the packages for classes, methods, and variables that appear in query results by choosing View > Show Packages.
Double-click an item displayed in the Query results area to view it in more detail:
If you see the message <could not find file.java> in the source panel, source files for the class could not be found. If the .java files are not in the same directory as the .class files (or in the directory where you compiled the files), add the directory containing the .java files in the File Search Path field of the Project Settings dialog (Project > Project Settings...), then click the Build button and try the query again.
To perform a query on an item in the display panel, select the item and press the right mouse button to get a menu appropriate for the selected item. The menus are
Menu Item | Description |
Show Source | Displays the source code for the selected class in the Source panel. |
Show Class | Displays the selected class in the Class card. |
List Declared Methods | Displays a list of methods in the class. |
List Declared Variables | Displays a list of variables in the class. |
Menu Item | Description |
Show Source | Displays the source code for the definition of the selected method in the source panel. |
What Calls | Displays a list of methods that use the selected method |
What is Called | Displays all the methods called by the selected method. |
What Is Read | Displays all the variables accessed, or read, by the selected method. |
What Is Modified | Displays a list of variables that the selected method changes, or sets. |
Menu Item | Description |
Show Source | Displays the source code for the definition of the selected variable in the source panel. |
What is Modifying | Displays a list of methods that modify the selected variable |
What is Reading | Displays a list of methods that access, or read, the selected variable. |
You can type a regular expression into the matching field using the following syntax:
Syntax | Description |
c | The character c where c is not a special character. |
\c | The character c where c is any character, except a digit in the range 1-9. |
^ | The beginning of the line being compared. |
$ | The end of the line being compared. |
. | Any character in the input. |
[s] | Any character in the set s, where s is a sequence of characters and/or a range of characters, for example, [c-c]. |
[^s] | Any character not in the set s, where s is defined as above |
r* | Zero or more successive occurrences of the regular expression r. The longest leftmost match is chosen. |
rx | The occurrence of regular expression r followed by the occurrence of regular expression x. (Concatenation) |
r\{m,n\} | Any number of m through n successive occurrences of the regular expression r. The regular expression r\{m\} matches exactly m occurrences; r\{m,\} matches at least m occurrences. |
\(r\) | The regular expression r. When \n (where n is a number greater than zero) appears in a constructed regular expression, it stands for the regular expression x where x is the nth regular expression enclosed in \( and \) that appeared earlier in the constructed regular expression. For example, \(r\)x\(y\)z\2 is the concatenation of regular expressions rxyzy. |
Characters that have special meaning except when they appear within square brackets ([]) or are preceded by \ are: ., *, [, \. Other special characters, such as $ have special meaning in more restricted contexts.
The character ^ at the beginning of an expression permits a successful match only immediately after a newline, and the character $ at the end of an expression requires a trailing newline.
Two characters have special meaning only when used within square brackets. The character - denotes a range, [c-c], unless it is just after the open bracket or before the closing bracket, [-c] or [c-] in which case it has no special meaning. When used within brackets, the character ^ has the meaning complement of if it immediately follows the open bracket (example: [^c]); elsewhere between brackets (example: [c^]) it stands for the ordinary character ^.
The special meaning of the \ operator can be escaped only by preceding it with another \, for example, \\.
Guide to the Cosmo Code Development Environment
12-96*270