本文整理汇总了Java中cz.vutbr.web.css.Declaration.asList方法的典型用法代码示例。如果您正苦于以下问题:Java Declaration.asList方法的具体用法?Java Declaration.asList怎么用?Java Declaration.asList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cz.vutbr.web.css.Declaration
的用法示例。
在下文中一共展示了Declaration.asList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processQuotes
import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private boolean processQuotes(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() == 1
&& genericTermIdent(Quotes.class, d.get(0), ALLOW_INH,
"quotes", properties)) {
return true;
} else {
TermList list = tf.createList();
for (Term<?> term : d.asList()) {
if (term instanceof TermString)
list.add(term);
else
return false;
}
// there are pairs of quotes
if (!list.isEmpty() && list.size() % 2 == 0) {
properties.put("quotes", Quotes.list_values);
values.put("quotes", list);
return true;
}
return false;
}
}
示例2: processCounterIncrement
import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private boolean processCounterIncrement(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() == 1
&& genericOneIdent(CounterIncrement.class, d, properties)) {
return true;
}
// counter with increments
else {
// counters are stored there
Set<Term<?>> termList = new LinkedHashSet<Term<?>>();
String counterName = null;
for (Term<?> term : d.asList()) {
// counter name
if (term instanceof TermIdent) {
counterName = ((TermIdent) term).getValue();
termList.add(tf.createPair(counterName, new Integer(1)));
}
// counter reset value follows counter name
else if (term instanceof TermInteger && counterName != null) {
termList.add(tf.createPair(counterName,
((TermInteger) term).getValue()));
counterName = null;
} else {
return false;
}
}
if (!termList.isEmpty()) {
TermList list = tf.createList(termList.size());
list.addAll(termList);
properties.put("counter-increment",
CounterIncrement.list_values);
values.put("counter-increment", list);
return true;
}
return false;
}
}
示例3: processCounterReset
import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private boolean processCounterReset(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() == 1 && genericOneIdent(CounterReset.class, d, properties)) {
return true;
}
// counter with resets
else {
// counters are stored there
Set<Term<?>> termList = new LinkedHashSet<Term<?>>();
String counterName = null;
for (Term<?> term : d.asList()) {
// counter name
if (term instanceof TermIdent) {
counterName = ((TermIdent) term).getValue();
termList.add(tf.createPair(counterName, new Integer(1)));
}
// counter reset value follows counter name
else if (term instanceof TermInteger && counterName != null) {
termList.add(tf.createPair(counterName,
((TermInteger) term).getValue()));
counterName = null;
} else {
return false;
}
}
if (!termList.isEmpty()) {
TermList list = tf.createList(termList.size());
list.addAll(termList);
properties.put("counter-reset", CounterReset.list_values);
values.put("counter-reset", list);
return true;
}
return false;
}
}
示例4: processCursor
import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private boolean processCursor(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() == 1 && genericOneIdent(Cursor.class, d, properties)) {
return true;
} else {
final Set<Cursor> allowedCursors = EnumSet.complementOf(EnumSet
.of(Cursor.INHERIT));
TermList list = tf.createList();
Cursor cur = null;
for (Term<?> term : d.asList()) {
if (term instanceof TermURI) {
list.add(term);
} else if (term instanceof TermIdent
&& (cur = genericPropertyRaw(Cursor.class,
allowedCursors, (TermIdent) term)) != null) {
// this have to be the last cursor in sequence
// and only one generic cursor is allowed
if (d.indexOf(term) != d.size() - 1)
return false;
// passed as last cursor, insert into properties and values
properties.put("cursor", cur);
if (!list.isEmpty())
values.put("cursor", list);
return true;
} else
return false;
}
return false;
}
}
示例5: processTextDecoration
import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private boolean processTextDecoration(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
final Set<TextDecoration> availableDecorations = EnumSet.of(
TextDecoration.BLINK, TextDecoration.LINE_THROUGH,
TextDecoration.OVERLINE, TextDecoration.UNDERLINE);
// it one term
if (d.size() == 1) {
return genericOneIdent(TextDecoration.class, d, properties);
}
// there are more terms, we have to construct list
else {
TermList list = tf.createList();
TextDecoration dec = null;
for (Term<?> term : d.asList()) {
if (term instanceof TermIdent
&& (dec = genericPropertyRaw(TextDecoration.class,
availableDecorations, (TermIdent) term)) != null) {
// construct term with value of parsed decoration
list.add(tf.createTerm(dec));
} else
return false;
}
if (!list.isEmpty()) {
properties.put("text-decoration", TextDecoration.list_values);
values.put("text-decoration", list);
return true;
}
return false;
}
}
示例6: processContent
import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private boolean processContent(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
// content contains no explicit values
if (d.size() == 1 && genericOneIdent(Content.class, d, properties)) {
return true;
} else {
// valid term idents
final Set<String> validTermIdents = new HashSet<String>(Arrays
.asList("open-quote", "close-quote", "no-open-quote",
"no-close-quote"));
// valid term function names
final Set<String> validFuncNames = new HashSet<String>(Arrays
.asList("counter", "counters", "attr"));
TermList list = tf.createList();
for (Term<?> t : d.asList()) {
// one of valid terms
if (t instanceof TermIdent
&& validTermIdents.contains(((TermIdent) t).getValue()
.toLowerCase()))
list.add(t);
else if (t instanceof TermString)
list.add(t);
else if (t instanceof TermURI)
list.add(t);
else if (t instanceof TermFunction
&& validFuncNames.contains(((TermFunction) t)
.getFunctionName().toLowerCase()))
list.add(t);
else
return false;
}
// there is nothing in list after parsing
if (list.isEmpty())
return false;
properties.put("content", Content.list_values);
values.put("content", list);
return true;
}
}
示例7: assignTermsFromDeclaration
import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
/**
* Assigns terms from declaration
*
* @param d
* Declaration which contains terms
*/
public void assignTermsFromDeclaration(Declaration d) {
this.terms = d.asList();
}