01: /*
02: * ====================================================================
03: * Copyright (c) 2004 Marc Strapetz, marc.strapetz@smartsvn.com.
04: * All rights reserved.
05: *
06: * This software is licensed as described in the file COPYING, which
07: * you should have received as part of this distribution. Use is
08: * subject to license terms.
09: * ====================================================================
10: */
11:
12: package de.regnis.q.sequence;
13:
14: import de.regnis.q.sequence.core.*;
15:
16: /**
17: * @author Marc Strapetz
18: */
19: public class QSequenceDifferenceBlock {
20:
21: // Fields =================================================================
22:
23: private int leftFrom;
24: private int leftTo;
25: private int rightFrom;
26: private int rightTo;
27:
28: // Setup ==================================================================
29:
30: public QSequenceDifferenceBlock(int leftFrom, int leftTo,
31: int rightFrom, int rightTo) {
32: QSequenceAssert.assertTrue(leftFrom <= leftTo
33: || rightFrom <= rightTo);
34:
35: this .leftFrom = leftFrom;
36: this .leftTo = leftTo;
37: this .rightFrom = rightFrom;
38: this .rightTo = rightTo;
39: }
40:
41: // Accessing ==============================================================
42:
43: public int getLeftFrom() {
44: return leftFrom;
45: }
46:
47: public int getLeftTo() {
48: return leftTo;
49: }
50:
51: public int getLeftSize() {
52: return leftTo - leftFrom + 1;
53: }
54:
55: public int getRightFrom() {
56: return rightFrom;
57: }
58:
59: public int getRightTo() {
60: return rightTo;
61: }
62:
63: public int getRightSize() {
64: return rightTo - rightFrom + 1;
65: }
66:
67: // Package ================================================================
68:
69: void setLeftFrom(int leftFrom) {
70: this .leftFrom = leftFrom;
71: }
72:
73: void setLeftTo(int leftTo) {
74: this .leftTo = leftTo;
75: }
76:
77: void setRightFrom(int rightFrom) {
78: this .rightFrom = rightFrom;
79: }
80:
81: void setRightTo(int rightTo) {
82: this .rightTo = rightTo;
83: }
84:
85: // Implemented ============================================================
86:
87: public String toString() {
88: return "[" + leftFrom + "/" + leftTo + "/" + rightFrom + "/"
89: + rightTo + "]";
90: }
91: }
|