All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.thaiopensource.validate.mns.ElementsOrAttributes Maven / Gradle / Ivy

Go to download

Jing is a validator for RELAX NG and other schema languages. This project was taken from http://code.google.com/p/jing-trang and mavenized for inclusion in the Wicket Stuff HTML Validator. The code was taken from the 20091111 release.

There is a newer version: 1.11
Show newest version
package com.thaiopensource.validate.mns;

class ElementsOrAttributes {
  private static final int ELEMENTS_FLAG = 01;
  private static final int ATTRIBUTES_FLAG = 02;

  static final ElementsOrAttributes NEITHER = new ElementsOrAttributes(0);
  static final ElementsOrAttributes ELEMENTS = new ElementsOrAttributes(ELEMENTS_FLAG);
  static final ElementsOrAttributes ATTRIBUTES = new ElementsOrAttributes(ATTRIBUTES_FLAG);
  static final ElementsOrAttributes BOTH = new ElementsOrAttributes(ELEMENTS_FLAG|ATTRIBUTES_FLAG);

  private static final ElementsOrAttributes values[] = {
    NEITHER,
    ELEMENTS,
    ATTRIBUTES,
    BOTH
  };

  private int flags = 0;

  private ElementsOrAttributes(int flags) {
    this.flags = flags;
  }

  ElementsOrAttributes addElements() {
    return values[flags | ELEMENTS_FLAG];
  }

  ElementsOrAttributes addAttributes() {
    return values[flags | ATTRIBUTES_FLAG];
  }

  boolean containsAttributes() {
    return (flags & ATTRIBUTES_FLAG) != 0;
  }

  boolean containsElements() {
    return (flags & ELEMENTS_FLAG) != 0;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy