当前位置: 首页>>代码示例>>Java>>正文


Java Declaration.size方法代码示例

本文整理汇总了Java中cz.vutbr.web.css.Declaration.size方法的典型用法代码示例。如果您正苦于以下问题:Java Declaration.size方法的具体用法?Java Declaration.size怎么用?Java Declaration.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cz.vutbr.web.css.Declaration的用法示例。


在下文中一共展示了Declaration.size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tryOneTermVariant

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
/**
 * Uses variator functionality to test selected variant on term
 * 
 * @param variant
 *            Which variant will be tested
 * @param d
 *            The declaration on which variant will be tested
 * @param properties
 *            Properties map where to store property type
 * @param values
 *            Values map where to store property value
 * @return <code>true</code> in case of success, <code>false</code>
 *         otherwise
 */
public boolean tryOneTermVariant(int variant, Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {

	// only one term is allowed
	if (d.size() != 1)
		return false;

	// try inherit variant
	if (checkInherit(variant, d.get(0), properties))
		return true;

	this.terms = new ArrayList<Term<?>>();
	this.terms.add(d.get(0));

	return variant(variant, new IntegerRef(0), properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:31,代码来源:Variator.java

示例2: 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;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:27,代码来源:DeclarationTransformer.java

示例3: processAdditionalCSSGenericProperty

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
/**
 * Processes an unknown property and stores its value. Unknown properties containing
 * multiple values are ignored (the interpretation is not clear).
 * 
 * @param d the declaration.
 * @param properties the properties.
 * @param values the values.
 * 
 * @return <code>true</code>, if the property has been pared successfully
 */
private boolean processAdditionalCSSGenericProperty(Declaration d, Map<String, CSSProperty> properties, Map<String, Term<?>> values)
{
	if (d.size() == 1)
	{
     Term<?> term = d.get(0);
	
     if (term instanceof TermIdent)
         return genericProperty(GenericCSSPropertyProxy.class, (TermIdent) term, true, properties, d.getProperty());
     else
         return genericTerm(TermLength.class, term, d.getProperty(), null, false, properties, values)
             || genericTerm(TermPercent.class, term, d.getProperty(), null, false, properties, values)
             || genericTerm(TermInteger.class, term, d.getProperty(), null, false, properties, values)
             || genericTermColor(term, d.getProperty(), null, properties, values);
	}
	else
	{
		log.warn("Ignoring unsupported property " + d.getProperty() + " with multiple values");
		return false;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:31,代码来源:DeclarationTransformer.java

示例4: genericOneIdentOrInteger

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
protected <T extends CSSProperty> boolean genericOneIdentOrInteger(
		Class<T> type, T integerIdentification, boolean sanify,
		Declaration d, Map<String, CSSProperty> properties,
		Map<String, Term<?>> values) {

	if (d.size() != 1)
		return false;

	return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
			properties)
			|| genericTerm(TermInteger.class, d.get(0), d.getProperty(),
					integerIdentification, sanify, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:14,代码来源:DeclarationTransformer.java

示例5: genericOneIdentOrIntegerOrNumber

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
protected <T extends CSSProperty> boolean genericOneIdentOrIntegerOrNumber(
        Class<T> type, T integerIdentification, T numberIdentification, boolean sanify,
        Declaration d, Map<String, CSSProperty> properties,
        Map<String, Term<?>> values) {

    if (d.size() != 1)
        return false;

    return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(), properties)
            || genericTerm(TermInteger.class, d.get(0), d.getProperty(),
                    integerIdentification, sanify, properties, values)
            || genericTerm(TermNumber.class, d.get(0), d.getProperty(),
                    numberIdentification, sanify, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:15,代码来源:DeclarationTransformer.java

示例6: genericOneIdentOrLength

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
protected <T extends CSSProperty> boolean genericOneIdentOrLength(
		Class<T> type, T lengthIdentification, boolean sanify,
		Declaration d, Map<String, CSSProperty> properties,
		Map<String, Term<?>> values) {

	if (d.size() != 1)
		return false;

	return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
			properties)
			|| genericTermLength(d.get(0), d.getProperty(),
					lengthIdentification, sanify, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:14,代码来源:DeclarationTransformer.java

示例7: genericOneIdentOrLengthOrPercent

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
protected <T extends Enum<T> & CSSProperty> boolean genericOneIdentOrLengthOrPercent(
		Class<T> type, T lengthIdentification, T percentIdentification,
		boolean sanify, Declaration d, Map<String, CSSProperty> properties,
		Map<String, Term<?>> values) {

	if (d.size() != 1)
		return false;

	return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
			properties)
			|| genericTermLength(d.get(0), d.getProperty(),
					lengthIdentification, sanify, properties, values)
			|| genericTerm(TermPercent.class, d.get(0), d.getProperty(),
					percentIdentification, sanify, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:16,代码来源:DeclarationTransformer.java

示例8: 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;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:40,代码来源:DeclarationTransformer.java

示例9: 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;
	}

}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:39,代码来源:DeclarationTransformer.java

示例10: 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;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:36,代码来源:DeclarationTransformer.java

示例11: 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;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:34,代码来源:DeclarationTransformer.java

示例12: 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;
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:47,代码来源:DeclarationTransformer.java

示例13: repeatOverFourTermDeclaration

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
/**
 * Construct terms array to be used by repeated object from available terms
 * (in size 1 to 4) according to CSS rules.
 * 
 * Example:
 * <p>
 * <code>margin: 2px 5px;</code> creates virtual terms array with terms
 * <code>2px 5px 2px 5px</code> so top and bottom; left and right contains
 * the same margin
 * </p>
 * 
 * @param d
 *            Declaration with terms
 * @param properties
 *            Properties map where to store properties types
 * @param values
 *            Value map where to store properties values
 * @return <code>true</code> in case of success, <code>false</code>
 *         elsewhere
 * @throws IllegalArgumentException
 *             In case when number of terms passed does not correspond to
 *             iteration times
 */
public boolean repeatOverFourTermDeclaration(Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values)
		throws IllegalArgumentException {

	switch (d.size()) {
	case 1:
		// one term for all value
		Term<?> term = d.get(0);
		
		// check inherit
		if(term instanceof TermIdent && CSSProperty.INHERIT_KEYWORD.equalsIgnoreCase(((TermIdent) term).getValue())) {
			CSSProperty property = CSSProperty.Translator.createInherit(type);
			for(int i = 0; i < times; i++) {
				properties.put(names.get(i), property);
			}
			return true;
		}
		
		assignTerms(term, term, term, term);
		return repeat(properties, values);
	case 2:
		// one term for bottom-top and left-right
		Term<?> term1 = d.get(0);
		Term<?> term2 = d.get(1);
		assignTerms(term1, term2, term1, term2);
		return repeat(properties, values);
	case 3:
		// terms for bottom, top, left-right
		Term<?> term31 = d.get(0);
		Term<?> term32 = d.get(1);
		Term<?> term33 = d.get(2);
		assignTerms(term31, term32, term33, term32);
		return repeat(properties, values);
	case 4:
		// four individual terms (or more - omitted)
	    //if (d.size() > 4)
	    //    LoggerFactory.getLogger(Repeater.class).warn("Omitting additional terms in four-term declaration");
		Term<?> term41 = d.get(0);
		Term<?> term42 = d.get(1);
		Term<?> term43 = d.get(2);
		Term<?> term44 = d.get(3);
		assignTerms(term41, term42, term43, term44);
		return repeat(properties, values);
	default:
		throw new IllegalArgumentException(
				"Invalid length of terms in Repeater.");
	}
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:72,代码来源:Repeater.java

示例14: genericOneIdent

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
/**
 * Processes declaration which is supposed to contain one identification
 * term
 * 
 * @param <T>
 *            Type of CSSProperty
 * @param type
 *            Class of CSSProperty to be stored
 * @param d
 *            Declaration to be parsed
 * @param properties
 *            Properties map where to store enum
 * @return <code>true</code> in case of success, <code>false</code>
 *         elsewhere
 */
protected <T extends CSSProperty> boolean genericOneIdent(Class<T> type,
		Declaration d, Map<String, CSSProperty> properties) {

	if (d.size() != 1)
		return false;

	return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
			properties);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:25,代码来源:DeclarationTransformer.java

示例15: genericOneIdentOrColor

import cz.vutbr.web.css.Declaration; //导入方法依赖的package包/类
/**
 * Processes declaration which is supposed to contain one identification
 * term or one TermColor
 * 
 * @param <T>
 *            Type of CSSProperty
 * @param type
 *            Class of enum to be stored
 * @param colorIdentification
 *            Instance of CSSProperty stored into properties to indicate
 *            that additional value of type TermColor is stored in values
 * @param d
 *            Declaration to be parsed
 * @param properties
 *            Properties map where to store enum
 * @param values
 * @return <code>true</code> in case of success, <code>false</code>
 *         elsewhere
 */
protected <T extends CSSProperty> boolean genericOneIdentOrColor(
		Class<T> type, T colorIdentification, Declaration d,
		Map<String, CSSProperty> properties, Map<String, Term<?>> values) {

	if (d.size() != 1)
		return false;

	return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
			properties)
			|| genericTermColor(d.get(0), d.getProperty(),
					colorIdentification, properties, values);
}
 
开发者ID:mantlik,项目名称:swingbox-javahelp-viewer,代码行数:32,代码来源:DeclarationTransformer.java


注:本文中的cz.vutbr.web.css.Declaration.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。