blob: 15d08ccd35f734f2b9fec7727563abd4677d9e5f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/****************************************************************************
* Copyright (c) 2007, 2008 Composent, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Composent, Inc. - initial API and implementation
* Mustafa K. Isik
*****************************************************************************/
package org.eclipse.ecf.internal.provisional.docshare.messages;
/**
*
*/
public class UpdateMessage extends Message {
private static final long serialVersionUID = -3195542805471664496L;
final String text;
int offset;
int length;
public UpdateMessage(int offset, int length, String text) {
this.offset = offset;
this.length = length;
this.text = text;
}
/**
* Returns the modification index of the operation resembled by this
* message.
*
* @return modification index
*/
public int getOffset() {
return offset;
}
public void setOffset(int updatedOffset) {
this.offset = updatedOffset;
}
/**
* Returns the length of replaced text.
*
* @return length of replaced text
*/
public int getLengthOfReplacedText() {
return length;
}
public void setLengthOfReplacedText(int length) {
this.length = length;
}
public String getText() {
return text;
}
public int getLengthOfInsertedText() {
return this.text.length();
}
public String toString() {
StringBuffer buf = new StringBuffer("UpdateMessage["); //$NON-NLS-1$
buf.append("text=").append(text).append(";offset=").append(offset); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(";length=").append(length).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
return buf.toString();
}
}
|