| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2014, the Dart project authors. | |
| 3 * | |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | |
| 5 * in compliance with the License. You may obtain a copy of the License at | |
| 6 * | |
| 7 * http://www.eclipse.org/legal/epl-v10.html | |
| 8 * | |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | |
| 11 * or implied. See the License for the specific language governing permissions a
nd limitations under | |
| 12 * the License. | |
| 13 */ | |
| 14 package com.google.dart.server; | |
| 15 | |
| 16 /** | |
| 17 * A description of the change to the content of a file. If any of the optional
fields are provided | |
| 18 * then all of the optional fields must be provided. | |
| 19 * | |
| 20 * @coverage dart.server | |
| 21 */ | |
| 22 public class ContentChange { | |
| 23 private final String content; | |
| 24 private final boolean incremental; | |
| 25 private final int offset; | |
| 26 private final int oldLength; | |
| 27 private final int newLength; | |
| 28 | |
| 29 public ContentChange(String content) { | |
| 30 this.content = content; | |
| 31 this.incremental = false; | |
| 32 this.offset = 0; | |
| 33 this.oldLength = 0; | |
| 34 this.newLength = 0; | |
| 35 } | |
| 36 | |
| 37 public ContentChange(String content, int offset, int oldLength, int newLength)
{ | |
| 38 this.content = content; | |
| 39 this.incremental = true; | |
| 40 this.offset = offset; | |
| 41 this.oldLength = oldLength; | |
| 42 this.newLength = newLength; | |
| 43 } | |
| 44 | |
| 45 /** | |
| 46 * The new content of the file, or {@code null} if the content of the file sho
uld be read from | |
| 47 * disk. | |
| 48 */ | |
| 49 public String getContent() { | |
| 50 return content; | |
| 51 } | |
| 52 | |
| 53 /** | |
| 54 * The (optional) length of the region that was added. | |
| 55 */ | |
| 56 public int getNewLength() { | |
| 57 return newLength; | |
| 58 } | |
| 59 | |
| 60 /** | |
| 61 * The (optional) offset of the region that was modified. | |
| 62 */ | |
| 63 public int getOffset() { | |
| 64 return offset; | |
| 65 } | |
| 66 | |
| 67 /** | |
| 68 * The (optional) length of the region that was removed. | |
| 69 */ | |
| 70 public int getOldLength() { | |
| 71 return oldLength; | |
| 72 } | |
| 73 | |
| 74 /** | |
| 75 * Is {@code true} if this is an incremental change, so {@link #getOffset()}, | |
| 76 * {@link #getOldLength()} and {@link #getNewLength()} values are set. | |
| 77 */ | |
| 78 public boolean isIncremental() { | |
| 79 return incremental; | |
| 80 } | |
| 81 } | |
| OLD | NEW |