- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 04 Oct 2012 13:23:41 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/values
In directory hutz:/tmp/cvs-serv10421/values
Modified Files:
CssExpression.java
Log Message:
last step of vendorext for values
Index: CssExpression.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/CssExpression.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- CssExpression.java 18 Aug 2012 20:30:28 -0000 1.12
+++ CssExpression.java 4 Oct 2012 13:23:39 -0000 1.13
@@ -15,214 +15,223 @@
*/
public class CssExpression implements CssOperator {
- private ArrayList<ValueOperator> items = new ArrayList<ValueOperator>();
- private int count = 0;
- private int index = 0;
- private int mark = -1;
+ private ArrayList<ValueOperator> items = new ArrayList<ValueOperator>();
+ private int count = 0;
+ private int index = 0;
+ private int mark = -1;
+ private boolean vendor_extension = false;
- /**
- * mark the current position, it can be set to this
- * position later by using reset
- */
- public void mark() {
- mark = index;
- }
+ public boolean hasVendorExtensions() {
+ return vendor_extension;
+ }
- /**
- * reset to the marked location
- * of the start if nothing has been marked.
- */
- public void reset() {
- if (mark >= 0) {
- index = mark;
- } else {
- index = 0;
- }
- }
+ public void markVendorExtension() {
+ vendor_extension = true;
+ }
- /**
- * Add a value to the end of the expression
- * By default the next operator is a space
- *
- * @param value The value to append
- */
- public void addValue(CssValue value) {
- items.add(new ValueOperator(value));
- count++;
- }
+ /**
+ * mark the current position, it can be set to this
+ * position later by using reset
+ */
+ public void mark() {
+ mark = index;
+ }
- /**
- * Change the next operator
- * Don't check if the operator is correct
- *
- * @param operator The operator
- * @see CssOperator
- */
- public void setOperator(char operator) {
- (items.get(count - 1)).operator = operator;
- }
+ /**
+ * reset to the marked location
+ * of the start if nothing has been marked.
+ */
+ public void reset() {
+ if (mark >= 0) {
+ index = mark;
+ } else {
+ index = 0;
+ }
+ }
- /**
- * Change the next operator for the current position
- * Don't check if the operator is correct
- *
- * @param operator The operator
- * @see CssOperator
- */
- public void setCurrentOperator(char operator) {
- (items.get(index)).operator = operator;
- }
+ /**
+ * Add a value to the end of the expression
+ * By default the next operator is a space
+ *
+ * @param value The value to append
+ */
+ public void addValue(CssValue value) {
+ items.add(new ValueOperator(value));
+ count++;
+ }
- /**
- * Returns the current value of the expression
- * don't change the position in the expression
- */
- public CssValue getValue() {
- if (index == count) {
- return null;
- } else {
- return (items.get(index)).value;
- }
- }
+ /**
+ * Change the next operator
+ * Don't check if the operator is correct
+ *
+ * @param operator The operator
+ * @see CssOperator
+ */
+ public void setOperator(char operator) {
+ (items.get(count - 1)).operator = operator;
+ }
- /**
- * Returns the current value of the expression
- * don't change the position in the expression
- */
- public CssValue getNextValue() {
- if (index + 1 >= count) {
- return null;
- } else {
- return (items.get(index + 1)).value;
- }
- }
+ /**
+ * Change the next operator for the current position
+ * Don't check if the operator is correct
+ *
+ * @param operator The operator
+ * @see CssOperator
+ */
+ public void setCurrentOperator(char operator) {
+ (items.get(index)).operator = operator;
+ }
- /* Modified by Sijtsche de Jong */
+ /**
+ * Returns the current value of the expression
+ * don't change the position in the expression
+ */
+ public CssValue getValue() {
+ if (index == count) {
+ return null;
+ } else {
+ return (items.get(index)).value;
+ }
+ }
- /**
- * Returns the operator <strong>after</strong> the current value
- * don't change the position in the expression
- */
- public char getOperator() {
- if (index == count) {
- return SPACE;
- } else {
- return (items.get(index)).operator;
- }
- }
+ /**
+ * Returns the current value of the expression
+ * don't change the position in the expression
+ */
+ public CssValue getNextValue() {
+ if (index + 1 >= count) {
+ return null;
+ } else {
+ return (items.get(index + 1)).value;
+ }
+ }
- /**
- * Returns the number of elements
- */
- public int getCount() {
- return count;
- }
+ /* Modified by Sijtsche de Jong */
- /**
- * Returns the number of remaining elements
- */
- public int getRemainingCount() {
- return count - index;
- }
+ /**
+ * Returns the operator <strong>after</strong> the current value
+ * don't change the position in the expression
+ */
+ public char getOperator() {
+ if (index == count) {
+ return SPACE;
+ } else {
+ return (items.get(index)).operator;
+ }
+ }
- /**
- * Insert the current value at the current position.
- *
- * @param value The value to insert
- */
- public void insert(CssValue value) {
- items.add(index, new ValueOperator(value));
- count++;
- }
+ /**
+ * Returns the number of elements
+ */
+ public int getCount() {
+ return count;
+ }
- /**
- * Removes the current value and his operator
- */
- public void remove() {
- if (index != count) {
- items.remove(index);
- }
- count--;
- }
+ /**
+ * Returns the number of remaining elements
+ */
+ public int getRemainingCount() {
+ return count - index;
+ }
- /**
- * @return true if there is no other element
- */
- public boolean end() {
- return (index == count);
- }
+ /**
+ * Insert the current value at the current position.
+ *
+ * @param value The value to insert
+ */
+ public void insert(CssValue value) {
+ items.add(index, new ValueOperator(value));
+ count++;
+ }
- /**
- * Change the position to the beginning
- */
- public void starts() {
- index = 0;
- }
+ /**
+ * Removes the current value and his operator
+ */
+ public void remove() {
+ if (index != count) {
+ items.remove(index);
+ }
+ count--;
+ }
- /**
- * Change the position to the end
- */
- public void ends() {
- index = count;
- }
+ /**
+ * @return true if there is no other element
+ */
+ public boolean end() {
+ return (index == count);
+ }
- /**
- * Change the position to the next
- */
- public void next() {
- if (index < count) {
- index++;
- }
- }
+ /**
+ * Change the position to the beginning
+ */
+ public void starts() {
+ index = 0;
+ }
- /**
- * Change the position to the precedent
- */
- public void precedent() {
- if (index > 0)
- index--;
- }
+ /**
+ * Change the position to the end
+ */
+ public void ends() {
+ index = count;
+ }
- /**
- * Returns a string representation of the object from the current position.
- */
- public String toString() {
- StringBuilder sb = new StringBuilder();
- for (int i = index; i < count; i++) {
- ValueOperator vo = items.get(i);
- sb.append(vo.value.toString()).append(vo.operator);
- }
- // remove the last extra operator
- if (sb.length() > 1) {
- sb.setLength(sb.length() - 1);
- return sb.toString();
- } else {
- return "**invalid state**";
- }
- }
+ /**
+ * Change the position to the next
+ */
+ public void next() {
+ if (index < count) {
+ index++;
+ }
+ }
- /**
- * Returns a string representation of the object before the current
- * position.
- */
- public String toStringFromStart() {
- StringBuilder sb = new StringBuilder();
- for (ValueOperator anItem : items) {
- sb.append(anItem.value.toString()).append(anItem.operator);
- }
+ /**
+ * Change the position to the precedent
+ */
+ public void precedent() {
+ if (index > 0)
+ index--;
+ }
+
+ /**
+ * Returns a string representation of the object from the current position.
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (int i = index; i < count; i++) {
+ ValueOperator vo = items.get(i);
+ sb.append(vo.value.toString()).append(vo.operator);
+ }
+ // remove the last extra operator
+ if (sb.length() > 1) {
+ sb.setLength(sb.length() - 1);
+ return sb.toString();
+ } else {
+ return "**invalid state**";
+ }
+ }
+
+ /**
+ * Returns a string representation of the object before the current
+ * position.
+ */
+ public String toStringFromStart() {
+ StringBuilder sb = new StringBuilder();
+ for (ValueOperator anItem : items) {
+ sb.append(anItem.value.toString()).append(anItem.operator);
+ }
// care for the last extra operator
sb.setLength(sb.length() - 1);
- return sb.toString();
- }
+ return sb.toString();
+ }
- private class ValueOperator {
- CssValue value;
- char operator;
+ private class ValueOperator {
+ CssValue value;
+ char operator;
- ValueOperator(CssValue value) {
- this.value = value;
- this.operator = SPACE;
- }
- }
+ ValueOperator(CssValue value) {
+ this.value = value;
+ this.operator = SPACE;
+ }
+ }
}
Received on Thursday, 4 October 2012 13:23:43 UTC