38 */
39
40 package sun.text.bidi;
41
42 /**
43 * A BidiRun represents a sequence of characters at the same embedding level.
44 * The Bidi algorithm decomposes a piece of text into sequences of characters
45 * at the same embedding level, each such sequence is called a "run".
46 *
47 * <p>A BidiRun represents such a run by storing its essential properties,
48 * but does not duplicate the characters which form the run.
49 *
50 * <p>The "limit" of the run is the position just after the
51 * last character, i.e., one more than that position.
52 *
53 * <p>This class has no public constructor, and its members cannot be
54 * modified by users.
55 *
56 * @see com.ibm.icu.text.Bidi
57 */
58 public class BidiRun {
59
60 int start; /* first logical position of the run */
61 int limit; /* last visual position of the run +1 */
62 int insertRemove; /* if >0, flags for inserting LRM/RLM before/after run,
63 if <0, count of bidi controls within run */
64 byte level;
65
66 /*
67 * Default constructor
68 *
69 * Note that members start and limit of a run instance have different
70 * meanings depending whether the run is part of the runs array of a Bidi
71 * object, or if it is a reference returned by getVisualRun() or
72 * getLogicalRun().
73 * For a member of the runs array of a Bidi object,
74 * - start is the first logical position of the run in the source text.
75 * - limit is one after the last visual position of the run.
76 * For a reference returned by getLogicalRun() or getVisualRun(),
77 * - start is the first logical position of the run in the source text.
78 * - limit is one after the last logical position of the run.
89 {
90 this.start = start;
91 this.limit = limit;
92 this.level = embeddingLevel;
93 }
94
95 /*
96 * Copy the content of a BidiRun instance
97 */
98 void copyFrom(BidiRun run)
99 {
100 this.start = run.start;
101 this.limit = run.limit;
102 this.level = run.level;
103 this.insertRemove = run.insertRemove;
104 }
105
106 /**
107 * Get level of run
108 */
109 public byte getEmbeddingLevel()
110 {
111 return level;
112 }
113
114 /**
115 * Check if run level is even
116 * @return true if the embedding level of this run is even, i.e. it is a
117 * left-to-right run.
118 */
119 boolean isEvenRun()
120 {
121 return (level & 1) == 0;
122 }
123
124 }
|
38 */
39
40 package sun.text.bidi;
41
42 /**
43 * A BidiRun represents a sequence of characters at the same embedding level.
44 * The Bidi algorithm decomposes a piece of text into sequences of characters
45 * at the same embedding level, each such sequence is called a "run".
46 *
47 * <p>A BidiRun represents such a run by storing its essential properties,
48 * but does not duplicate the characters which form the run.
49 *
50 * <p>The "limit" of the run is the position just after the
51 * last character, i.e., one more than that position.
52 *
53 * <p>This class has no public constructor, and its members cannot be
54 * modified by users.
55 *
56 * @see com.ibm.icu.text.Bidi
57 */
58 class BidiRun {
59
60 int start; /* first logical position of the run */
61 int limit; /* last visual position of the run +1 */
62 int insertRemove; /* if >0, flags for inserting LRM/RLM before/after run,
63 if <0, count of bidi controls within run */
64 byte level;
65
66 /*
67 * Default constructor
68 *
69 * Note that members start and limit of a run instance have different
70 * meanings depending whether the run is part of the runs array of a Bidi
71 * object, or if it is a reference returned by getVisualRun() or
72 * getLogicalRun().
73 * For a member of the runs array of a Bidi object,
74 * - start is the first logical position of the run in the source text.
75 * - limit is one after the last visual position of the run.
76 * For a reference returned by getLogicalRun() or getVisualRun(),
77 * - start is the first logical position of the run in the source text.
78 * - limit is one after the last logical position of the run.
89 {
90 this.start = start;
91 this.limit = limit;
92 this.level = embeddingLevel;
93 }
94
95 /*
96 * Copy the content of a BidiRun instance
97 */
98 void copyFrom(BidiRun run)
99 {
100 this.start = run.start;
101 this.limit = run.limit;
102 this.level = run.level;
103 this.insertRemove = run.insertRemove;
104 }
105
106 /**
107 * Get level of run
108 */
109 byte getEmbeddingLevel()
110 {
111 return level;
112 }
113
114 /**
115 * Check if run level is even
116 * @return true if the embedding level of this run is even, i.e. it is a
117 * left-to-right run.
118 */
119 boolean isEvenRun()
120 {
121 return (level & 1) == 0;
122 }
123
124 }
|