![JAR search and dependency download from the Maven repository](/logo.png)
cz.vutbr.web.csskit.TermListImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jstyleparser Show documentation
Show all versions of jstyleparser Show documentation
jStyleParser is a CSS parser written in Java. It has its own application interface that is designed to allow an efficient CSS processing in Java and mapping the values to the Java data types. It parses CSS 2.1 style sheets into structures that can be efficiently assigned to DOM elements. It is intended be the primary CSS parser for the CSSBox library. While handling errors, it is user agent conforming according to the CSS specification.
The newest version!
package cz.vutbr.web.csskit;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import cz.vutbr.web.css.Term;
import cz.vutbr.web.css.TermList;
public class TermListImpl extends AbstractList> implements TermList {
protected List> value;
protected Operator operator;
protected TermListImpl() {
this.value = new ArrayList>();
}
protected TermListImpl(int initialSize) {
this.value = new ArrayList>(initialSize);
}
/**
* @return the value
*/
public List> getValue() {
return value;
}
/**
* @param value the value to set
*/
public TermList setValue(List> value) {
this.value = value;
return this;
}
/**
* @return the operator
*/
public Operator getOperator() {
return operator;
}
/**
* @param operator the operator to set
*/
public TermList setOperator(Operator operator) {
this.operator = operator;
return this;
}
@Override
public Term> get(int arg0) {
return value.get(arg0);
}
@Override
public void add(int index, Term> element) {
value.add(index, element);
}
@Override
public Term> remove(int index) {
return value.remove(index);
}
@Override
public int size() {
return value.size();
}
@Override
public Iterator> iterator() {
return value.iterator();
}
@Override
public boolean add(Term> o) {
return value.add(o);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
// append operator
if(operator!=null) sb.append(operator.value());
OutputUtil.appendList(sb, value, OutputUtil.SPACE_DELIM);
return sb.toString();
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((operator == null) ? 0 : operator.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof TermListImpl))
return false;
TermListImpl other = (TermListImpl) obj;
if (operator == null) {
if (other.operator != null)
return false;
} else if (!operator.equals(other.operator))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
public TermList shallowClone() {
try {
return (TermList) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy