File Source: LineInfo.java
/*
P/P * Method: com.dmdirc.addons.ui_swing.textpane.LineInfo__static_init
*/
1 /*
2 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.dmdirc.addons.ui_swing.textpane;
24
25 /**
26 * Information about a position in a line.
27 */
28 public final class LineInfo {
29
30 /** Line number. */
31 private int line;
32 /** What part of a line. */
33 private int part;
34 /** Character index? */
35 private int index;
36
37 /**
38 * Creates a new instance of LineInfo.
39 *
40 * @param line Line number
41 * @param part line wrap number
42 */
43 public LineInfo(final int line, final int part) {
/*
P/P * Method: void com.dmdirc.addons.ui_swing.textpane.LineInfo(int, int)
*
* Postconditions:
* this.index == -1
* this.line == line
* init'ed(this.line)
* this.part == part
* init'ed(this.part)
*/
44 this(line, part, -1);
45 }
46
47 /**
48 * Creates a new instance of LineInfo.
49 *
50 * @param line Line number
51 * @param part line wrap number
52 * @param index Position index
53 */
/*
P/P * Method: void com.dmdirc.addons.ui_swing.textpane.LineInfo(int, int, int)
*
* Postconditions:
* this.index == index
* init'ed(this.index)
* this.line == line
* init'ed(this.line)
* this.part == part
* init'ed(this.part)
*/
54 public LineInfo(final int line, final int part, final int index) {
55 this.line = line;
56 this.part = part;
57 this.index = index;
58 }
59
60 /**
61 * Returns the line number of this object.
62 *
63 * @return Line number
64 */
65 public int getLine() {
/*
P/P * Method: int getLine()
*
* Preconditions:
* init'ed(this.line)
*
* Postconditions:
* return_value == this.line
* init'ed(return_value)
*/
66 return line;
67 }
68
69 /**
70 * Returns the part for this line.
71 *
72 * @return Part number
73 */
74 public int getPart() {
/*
P/P * Method: int getPart()
*
* Preconditions:
* init'ed(this.part)
*
* Postconditions:
* return_value == this.part
* init'ed(return_value)
*/
75 return part;
76 }
77
78 /**
79 * Returns the index for this line.
80 *
81 * @return Index for the line of -1
82 */
83 public int getIndex() {
/*
P/P * Method: int getIndex()
*
* Preconditions:
* init'ed(this.index)
*
* Postconditions:
* return_value == this.index
* init'ed(return_value)
*/
84 return index;
85 }
86
87 /**
88 * Sets the index for this line.
89 *
90 * @param index New index
91 */
92 public void setIndex(int index) {
/*
P/P * Method: void setIndex(int)
*
* Postconditions:
* this.index == index
* init'ed(this.index)
*/
93 this.index = index;
94 }
95
96 /**
97 * Sets the line for this line.
98 *
99 * @param line New line
100 */
101 public void setLine(int line) {
/*
P/P * Method: void setLine(int)
*
* Postconditions:
* this.line == line
* init'ed(this.line)
*/
102 this.line = line;
103 }
104
105 /**
106 * Sets the line part for this line
107 *
108 * @param part New part
109 */
110 public void setPart(int part) {
/*
P/P * Method: void setPart(int)
*
* Postconditions:
* this.part == part
* init'ed(this.part)
*/
111 this.part = part;
112 }
113
114 /* {@inheritDoc} */
115 @Override
116 public String toString() {
/*
P/P * Method: String toString()
*
* Preconditions:
* init'ed(this.index)
* init'ed(this.line)
* init'ed(this.part)
*
* Postconditions:
* java.lang.StringBuilder:toString(...)._tainted == 0
* return_value == &java.lang.StringBuilder:toString(...)
*/
117 return "LineInfo[line=" + line + ", part=" + part + ", index=" + index + "]";
118 }
119 }
SofCheck Inspector Build Version : 2.17854
| LineInfo.java |
2009-Jun-25 01:54:24 |
| LineInfo.class |
2009-Sep-02 17:04:14 |