KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > scriptrunner > Script


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.modules.scriptrunner;
14
15
16 /**
17  * This class represents a script. It may be either a standalone JavaScript file or part of a
18  * form.
19  *
20  * @author Eric Galluzzo
21  */

22 public class Script
23 {
24     protected String JavaDoc fieldDescription;
25     protected String JavaDoc fieldScriptText;
26     protected int fieldStartCharNumber;
27     protected int fieldStartLineNumber;
28     /**
29      * Create a new script, with parameters to be filled in later.
30      */

31     public Script()
32     {
33         this("", "");
34     }
35
36     /**
37      * Create a new script with the given script text and description.
38      *
39      * @param inScriptText DOCUMENT ME!
40      * @param inDescription DOCUMENT ME!
41      */

42     public Script(String JavaDoc inScriptText, String JavaDoc inDescription)
43     {
44         this(inScriptText, inDescription, 1, 1);
45     }
46
47     /**
48      * Create a new script with the given script text, description, and starting position within
49      * its file.
50      *
51      * @param inScriptText DOCUMENT ME!
52      * @param inDescription DOCUMENT ME!
53      * @param inStartLineNumber DOCUMENT ME!
54      * @param inStartCharNumber DOCUMENT ME!
55      */

56     public Script(
57         String JavaDoc inScriptText, String JavaDoc inDescription, int inStartLineNumber, int inStartCharNumber)
58     {
59         fieldScriptText = inScriptText;
60         fieldDescription = inDescription;
61         fieldStartLineNumber = inStartLineNumber;
62         fieldStartCharNumber = inStartCharNumber;
63     }
64
65     /**
66      * Sets the description of this script, usually containing the file from which it came.
67      *
68      * @param description The description to set
69      */

70     public void setDescription(String JavaDoc description)
71     {
72         fieldDescription = description;
73     }
74
75     /**
76      * Returns the description of this script, usually containing the file from which it came.
77      *
78      * @return String
79      */

80     public String JavaDoc getDescription()
81     {
82         return fieldDescription;
83     }
84
85     /**
86      * Sets the script itself.
87      *
88      * @param scriptText The script to set
89      */

90     public void setScriptText(String JavaDoc scriptText)
91     {
92         fieldScriptText = scriptText;
93     }
94
95     /**
96      * Returns the script itself.
97      *
98      * @return String
99      */

100     public String JavaDoc getScriptText()
101     {
102         return fieldScriptText;
103     }
104
105     /**
106      * Sets the character number within the file named in the description at which the script
107      * started.
108      *
109      * @param startCharNumber The starting character number
110      */

111     public void setStartCharNumber(int startCharNumber)
112     {
113         fieldStartCharNumber = startCharNumber;
114     }
115
116     /**
117      * Returns the character number within the file named in the description at which the script
118      * started.
119      *
120      * @return int
121      */

122     public int getStartCharNumber()
123     {
124         return fieldStartCharNumber;
125     }
126
127     /**
128      * Sets the line number within the file named in the description at which the script started.
129      *
130      * @param startLineNumber The starting line number
131      */

132     public void setStartLineNumber(int startLineNumber)
133     {
134         fieldStartLineNumber = startLineNumber;
135     }
136
137     /**
138      * Returns the line number within the file named in the description at which the script
139      * started.
140      *
141      * @return int
142      */

143     public int getStartLineNumber()
144     {
145         return fieldStartLineNumber;
146     }
147 }
148
Popular Tags