Esempio n. 1
0
  private static <T extends AbstractJaxb> void execute(T target, Pattern pattern) {

    TagEnum tagEnum = TagEnum.valueOf(target.getClass().getSimpleName().toUpperCase());

    switch (tagEnum) {
      case A:
        A a = (A) target;
        if (idMatch(a.getId(), pattern)) {
          a.setId(null);
        }
        unsetAllIdWithinObjectList(a.getContent(), pattern);
        break;
      case ABBR:
        Abbr abbr = (Abbr) target;
        if (idMatch(abbr.getId(), pattern)) {
          abbr.setId(null);
        }
        unsetAllIdWithinObjectList(abbr.getContent(), pattern);
        break;
      case ACRONYM:
        Acronym acronym = (Acronym) target;
        if (idMatch(acronym.getId(), pattern)) {
          acronym.setId(null);
        }
        unsetAllIdWithinObjectList(acronym.getContent(), pattern);
        break;
      case ADDRESS:
        Address address = (Address) target;
        if (idMatch(address.getId(), pattern)) {
          address.setId(null);
        }
        unsetAllIdWithinObjectList(address.getContent(), pattern);
        break;
      case APPLET:
        Applet applet = (Applet) target;
        if (idMatch(applet.getId(), pattern)) {
          applet.setId(null);
        }
        unsetAllIdWithinObjectList(applet.getContent(), pattern);
        break;
      case AREA:
        Area area = (Area) target;
        if (idMatch(area.getId(), pattern)) {
          area.setId(null);
        }
        // area is empty element.
        break;
      case B:
        B b = (B) target;
        if (idMatch(b.getId(), pattern)) {
          b.setId(null);
        }
        unsetAllIdWithinObjectList(b.getContent(), pattern);
        break;
      case BASE:
        Base base = (Base) target;
        if (idMatch(base.getId(), pattern)) {
          base.setId(null);
        }
        // empty element.
        break;
      case BASEFONT:
        Basefont basefont = (Basefont) target;
        if (idMatch(basefont.getId(), pattern)) {
          basefont.setId(null);
        }
        // empty element.
        break;
      case BDO:
        Bdo bdo = (Bdo) target;
        if (idMatch(bdo.getId(), pattern)) {
          bdo.setId(null);
        }
        unsetAllIdWithinObjectList(bdo.getContent(), pattern);
        break;
      case BIG:
        Big big = (Big) target;
        if (idMatch(big.getId(), pattern)) {
          big.setId(null);
        }
        unsetAllIdWithinObjectList(big.getContent(), pattern);
        break;
      case BLOCKQUOTE:
        Blockquote blockquote = (Blockquote) target;
        if (idMatch(blockquote.getId(), pattern)) {
          blockquote.setId(null);
        }
        unsetAllIdWithinObjectList(blockquote.getContent(), pattern);
        break;
      case BODY:
        Body body = (Body) target;
        if (idMatch(body.getId(), pattern)) {
          body.setId(null);
        }
        unsetAllIdWithinObjectList(body.getContent(), pattern);
        break;
      case BR:
        Br br = (Br) target;
        if (idMatch(br.getId(), pattern)) {
          br.setId(null);
        }
        // empty element.
        break;
      case BUTTON:
        Button button = (Button) target;
        if (idMatch(button.getId(), pattern)) {
          button.setId(null);
        }
        unsetAllIdWithinObjectList(button.getContent(), pattern);
        break;
      case CAPTION:
        Caption caption = (Caption) target;
        if (idMatch(caption.getId(), pattern)) {
          caption.setId(null);
        }
        unsetAllIdWithinObjectList(caption.getContent(), pattern);
        break;
      case CENTER:
        Center center = (Center) target;
        if (idMatch(center.getId(), pattern)) {
          center.setId(null);
        }
        unsetAllIdWithinObjectList(center.getContent(), pattern);
        break;
      case CITE:
        Cite cite = (Cite) target;
        if (idMatch(cite.getId(), pattern)) {
          cite.setId(null);
        }
        unsetAllIdWithinObjectList(cite.getContent(), pattern);
        break;
      case CODE:
        Code code = (Code) target;
        if (idMatch(code.getId(), pattern)) {
          code.setId(null);
        }
        unsetAllIdWithinObjectList(code.getContent(), pattern);
        break;
      case COL:
        Col col = (Col) target;
        if (idMatch(col.getId(), pattern)) {
          col.setId(null);
        }
        // empty element.
        break;
      case COLGROUP:
        Colgroup colgroup = (Colgroup) target;
        if (idMatch(colgroup.getId(), pattern)) {
          colgroup.setId(null);
        }
        for (Col tmpcol : colgroup.getCol()) {
          execute(tmpcol, pattern);
        }
        break;
      case DD:
        Dd dd = (Dd) target;
        if (idMatch(dd.getId(), pattern)) {
          dd.setId(null);
        }
        unsetAllIdWithinObjectList(dd.getContent(), pattern);
        break;
      case DEL:
        Del del = (Del) target;
        if (idMatch(del.getId(), pattern)) {
          del.setId(null);
        }
        unsetAllIdWithinObjectList(del.getContent(), pattern);
        break;
      case DFN:
        Dfn dfn = (Dfn) target;
        if (idMatch(dfn.getId(), pattern)) {
          dfn.setId(null);
        }
        unsetAllIdWithinObjectList(dfn.getContent(), pattern);
        break;
      case DIR:
        Dir dir = (Dir) target;
        if (idMatch(dir.getId(), pattern)) {
          dir.setId(null);
        }
        for (Li tmpli : dir.getLi()) {
          execute(tmpli, pattern);
        }
        break;
      case DIV:
        Div div = (Div) target;
        if (idMatch(div.getId(), pattern)) {
          div.setId(null);
        }
        unsetAllIdWithinObjectList(div.getContent(), pattern);
        break;
      case DL:
        Dl dl = (Dl) target;
        if (idMatch(dl.getId(), pattern)) {
          dl.setId(null);
        }
        for (AbstractJaxb aj : dl.getDtOrDd()) {
          execute(aj, pattern);
        }
        break;
      case DT:
        Dt dt = (Dt) target;
        if (idMatch(dt.getId(), pattern)) {
          dt.setId(null);
        }
        unsetAllIdWithinObjectList(dt.getContent(), pattern);
        break;
      case EM:
        Em em = (Em) target;
        if (idMatch(em.getId(), pattern)) {
          em.setId(null);
        }
        unsetAllIdWithinObjectList(em.getContent(), pattern);
        break;
      case FIELDSET:
        Fieldset fieldset = (Fieldset) target;
        if (idMatch(fieldset.getId(), pattern)) {
          fieldset.setId(null);
        }
        unsetAllIdWithinObjectList(fieldset.getContent(), pattern);
        break;
      case FONT:
        Font font = (Font) target;
        if (idMatch(font.getId(), pattern)) {
          font.setId(null);
        }
        unsetAllIdWithinObjectList(font.getContent(), pattern);
        break;
      case FORM:
        Form form = (Form) target;
        if (idMatch(form.getId(), pattern)) {
          form.setId(null);
        }
        unsetAllIdWithinObjectList(form.getContent(), pattern);
        break;
      case H1:
        H1 h1 = (H1) target;
        if (idMatch(h1.getId(), pattern)) {
          h1.setId(null);
        }
        unsetAllIdWithinObjectList(h1.getContent(), pattern);
        break;
      case H2:
        H2 h2 = (H2) target;
        if (idMatch(h2.getId(), pattern)) {
          h2.setId(null);
        }
        unsetAllIdWithinObjectList(h2.getContent(), pattern);
        break;
      case H3:
        H3 h3 = (H3) target;
        if (idMatch(h3.getId(), pattern)) {
          h3.setId(null);
        }
        unsetAllIdWithinObjectList(h3.getContent(), pattern);
        break;
      case H4:
        H4 h4 = (H4) target;
        if (idMatch(h4.getId(), pattern)) {
          h4.setId(null);
        }
        unsetAllIdWithinObjectList(h4.getContent(), pattern);
        break;
      case H5:
        H5 h5 = (H5) target;
        if (idMatch(h5.getId(), pattern)) {
          h5.setId(null);
        }
        unsetAllIdWithinObjectList(h5.getContent(), pattern);
        break;
      case H6:
        H6 h6 = (H6) target;
        if (idMatch(h6.getId(), pattern)) {
          h6.setId(null);
        }
        unsetAllIdWithinObjectList(h6.getContent(), pattern);
        break;
      case HGROUP:
        Hgroup hgroup = (Hgroup) target;
        if (idMatch(hgroup.getId(), pattern)) {
          hgroup.setId(null);
        }
        for (AbstractJaxb aj : hgroup.getH1OrH2OrH3()) {
          execute(aj, pattern);
        }
        break;
      case HEAD:
        Head head = (Head) target;
        if (idMatch(head.getId(), pattern)) {
          head.setId(null);
        }
        for (AbstractJaxb aj : head.getContent()) {
          execute(aj, pattern);
        }
        break;
      case HR:
        Hr hr = (Hr) target;
        if (idMatch(hr.getId(), pattern)) {
          hr.setId(null);
        }
        // hr is empty element.
        break;
      case HTML:
        Html html = (Html) target;
        if (idMatch(html.getId(), pattern)) {
          html.setId(null);
        }
        execute(html.getHead(), pattern);
        execute(html.getBody(), pattern);
        break;
      case I:
        I i = (I) target;
        if (idMatch(i.getId(), pattern)) {
          i.setId(null);
        }
        unsetAllIdWithinObjectList(i.getContent(), pattern);
        break;
      case IFRAME:
        Iframe iframe = (Iframe) target;
        if (idMatch(iframe.getId(), pattern)) {
          iframe.setId(null);
        }
        unsetAllIdWithinObjectList(iframe.getContent(), pattern);
        break;
      case IMG:
        Img img = (Img) target;
        if (idMatch(img.getId(), pattern)) {
          img.setId(null);
        }
        // img is empty element.
        break;
      case INPUT:
        Input input = (Input) target;
        if (idMatch(input.getId(), pattern)) {
          input.setId(null);
        }
        // input is empty element.
        break;
      case INS:
        Ins ins = (Ins) target;
        if (idMatch(ins.getId(), pattern)) {
          ins.setId(null);
        }
        unsetAllIdWithinObjectList(ins.getContent(), pattern);
        break;
      case ISINDEX:
        Isindex isindex = (Isindex) target;
        if (idMatch(isindex.getId(), pattern)) {
          isindex.setId(null);
        }
        // empty element.
        break;
      case KBD:
        Kbd kbd = (Kbd) target;
        if (idMatch(kbd.getId(), pattern)) {
          kbd.setId(null);
        }
        unsetAllIdWithinObjectList(kbd.getContent(), pattern);
        break;
      case LABEL:
        Label label = (Label) target;
        if (idMatch(label.getId(), pattern)) {
          label.setId(null);
        }
        unsetAllIdWithinObjectList(label.getContent(), pattern);
        break;
      case LEGEND:
        Legend legend = (Legend) target;
        if (idMatch(legend.getId(), pattern)) {
          legend.setId(null);
        }
        unsetAllIdWithinObjectList(legend.getContent(), pattern);
        break;
      case LI:
        Li li = (Li) target;
        if (idMatch(li.getId(), pattern)) {
          li.setId(null);
        }
        unsetAllIdWithinObjectList(li.getContent(), pattern);
        break;
      case LINK:
        Link link = (Link) target;
        if (idMatch(link.getId(), pattern)) {
          link.setId(null);
        }
        // empty element.
        break;
      case MAIN:
        Main main = (Main) target;
        if (idMatch(main.getId(), pattern)) {
          main.setId(null);
        }
        unsetAllIdWithinObjectList(main.getContent(), pattern);
        break;
      case MAP:
        Map map = (Map) target;
        if (idMatch(map.getId(), pattern)) {
          map.setId(null);
        }
        for (Area tmpArea : map.getArea()) {
          execute(tmpArea, pattern);
        }
        break;
      case MENU:
        Menu menu = (Menu) target;
        if (idMatch(menu.getId(), pattern)) {
          menu.setId(null);
        }
        unsetAllIdWithinObjectList(menu.getContent(), pattern);
        break;
      case META:
        Meta meta = (Meta) target;
        if (idMatch(meta.getId(), pattern)) {
          meta.setId(null);
        }
        // empty element.
        break;
      case NOFRAMES:
        Noframes noframes = (Noframes) target;
        if (idMatch(noframes.getId(), pattern)) {
          noframes.setId(null);
        }
        unsetAllIdWithinObjectList(noframes.getContent(), pattern);
        break;
      case NOSCRIPT:
        Noscript noscript = (Noscript) target;
        if (idMatch(noscript.getId(), pattern)) {
          noscript.setId(null);
        }
        unsetAllIdWithinObjectList(noscript.getContent(), pattern);
        break;
      case OBJECT:
        org.mixer2.jaxb.xhtml.Object object = (org.mixer2.jaxb.xhtml.Object) target;
        if (idMatch(object.getId(), pattern)) {
          object.setId(null);
        }
        unsetAllIdWithinObjectList(object.getContent(), pattern);
        break;
      case OL:
        Ol ol = (Ol) target;
        if (idMatch(ol.getId(), pattern)) {
          ol.setId(null);
        }
        for (Li tmpli : ol.getLi()) {
          execute(tmpli, pattern);
        }
        break;
      case OPTGROUP:
        Optgroup optgroup = (Optgroup) target;
        if (idMatch(optgroup.getId(), pattern)) {
          optgroup.setId(null);
        }
        for (Option tmpOption : optgroup.getOption()) {
          execute(tmpOption, pattern);
        }
        break;
      case OPTION:
        Option option = (Option) target;
        if (idMatch(option.getId(), pattern)) {
          option.setId(null);
        }
        // option tag includes no other element.
        break;
      case P:
        P p = (P) target;
        if (idMatch(p.getId(), pattern)) {
          p.setId(null);
        }
        unsetAllIdWithinObjectList(p.getContent(), pattern);
        break;
      case PARAM:
        Param param = (Param) target;
        if (idMatch(param.getId(), pattern)) {
          param.setId(null);
        }
        // empty element.
        break;
      case PRE:
        Pre pre = (Pre) target;
        if (idMatch(pre.getId(), pattern)) {
          pre.setId(null);
        }
        unsetAllIdWithinObjectList(pre.getContent(), pattern);
        break;
      case Q:
        Q q = (Q) target;
        if (idMatch(q.getId(), pattern)) {
          q.setId(null);
        }
        unsetAllIdWithinObjectList(q.getContent(), pattern);
        break;
      case S:
        S s = (S) target;
        if (idMatch(s.getId(), pattern)) {
          s.setId(null);
        }
        unsetAllIdWithinObjectList(s.getContent(), pattern);
        break;
      case SAMP:
        Samp samp = (Samp) target;
        if (idMatch(samp.getId(), pattern)) {
          samp.setId(null);
        }
        unsetAllIdWithinObjectList(samp.getContent(), pattern);
        break;
      case SCRIPT:
        Script script = (Script) target;
        if (idMatch(script.getId(), pattern)) {
          script.setId(null);
        }
        // script include no other element.
        break;
      case SELECT:
        Select select = (Select) target;
        if (idMatch(select.getId(), pattern)) {
          select.setId(null);
        }
        for (AbstractJaxb aj : select.getOptgroupOrOption()) {
          execute(aj, pattern);
        }
        break;
      case SMALL:
        Small small = (Small) target;
        if (idMatch(small.getId(), pattern)) {
          small.setId(null);
        }
        unsetAllIdWithinObjectList(small.getContent(), pattern);
        break;
      case SPAN:
        Span span = (Span) target;
        if (idMatch(span.getId(), pattern)) {
          span.setId(null);
        }
        unsetAllIdWithinObjectList(span.getContent(), pattern);
        break;
      case STRIKE:
        Strike strike = (Strike) target;
        if (idMatch(strike.getId(), pattern)) {
          strike.setId(null);
        }
        unsetAllIdWithinObjectList(strike.getContent(), pattern);
        break;
      case STRONG:
        Strong strong = (Strong) target;
        if (idMatch(strong.getId(), pattern)) {
          strong.setId(null);
        }
        unsetAllIdWithinObjectList(strong.getContent(), pattern);
        break;
      case STYLE:
        Style style = (Style) target;
        if (idMatch(style.getId(), pattern)) {
          style.setId(null);
        }
        // has no other element.
        break;
      case SUB:
        Sub sub = (Sub) target;
        if (idMatch(sub.getId(), pattern)) {
          sub.setId(null);
        }
        unsetAllIdWithinObjectList(sub.getContent(), pattern);
        break;
      case SUP:
        Sup sup = (Sup) target;
        if (idMatch(sup.getId(), pattern)) {
          sup.setId(null);
        }
        unsetAllIdWithinObjectList(sup.getContent(), pattern);
        break;
      case TABLE:
        Table table = (Table) target;
        if (idMatch(table.getId(), pattern)) {
          table.setId(null);
        }
        if (table.isSetCaption()) {
          execute(table.getCaption(), pattern);
        }
        for (Col tmpCol : table.getCol()) {
          execute(tmpCol, pattern);
        }
        for (Colgroup tmpColgroup : table.getColgroup()) {
          execute(tmpColgroup, pattern);
        }
        for (Tbody tmpTbody : table.getTbody()) {
          execute(tmpTbody, pattern);
        }
        if (table.isSetThead()) {
          execute(table.getThead(), pattern);
        }
        if (table.isSetTfoot()) {
          execute(table.getTfoot(), pattern);
        }
        for (Tr tmpTr : table.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TBODY:
        Tbody tbody = (Tbody) target;
        if (idMatch(tbody.getId(), pattern)) {
          tbody.setId(null);
        }
        for (Tr tmpTr : tbody.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TD:
        Td td = (Td) target;
        if (idMatch(td.getId(), pattern)) {
          td.setId(null);
        }
        unsetAllIdWithinObjectList(td.getContent(), pattern);
        break;
      case TEXTAREA:
        Textarea textarea = (Textarea) target;
        if (idMatch(textarea.getId(), pattern)) {
          textarea.setId(null);
        }
        // textarea has no other element.
        break;
      case TFOOT:
        Tfoot tfoot = (Tfoot) target;
        if (idMatch(tfoot.getId(), pattern)) {
          tfoot.setId(null);
        }
        for (Tr tmpTr : tfoot.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TH:
        Th th = (Th) target;
        if (idMatch(th.getId(), pattern)) {
          th.setId(null);
        }
        unsetAllIdWithinObjectList(th.getContent(), pattern);
        break;
      case THEAD:
        Thead thead = (Thead) target;
        if (idMatch(thead.getId(), pattern)) {
          thead.setId(null);
        }
        for (Tr tmpTr : thead.getTr()) {
          execute(tmpTr, pattern);
        }
        break;
      case TITLE:
        Title title = (Title) target;
        if (idMatch(title.getId(), pattern)) {
          title.setId(null);
        }
        // has no other element.
        break;
      case TR:
        Tr tr = (Tr) target;
        if (idMatch(tr.getId(), pattern)) {
          tr.setId(null);
        }
        for (AbstractJaxb aj : tr.getThOrTd()) {
          execute(aj, pattern);
        }
        break;
      case TT:
        Tt tt = (Tt) target;
        if (idMatch(tt.getId(), pattern)) {
          tt.setId(null);
        }
        unsetAllIdWithinObjectList(tt.getContent(), pattern);
        break;
      case U:
        U u = (U) target;
        if (idMatch(u.getId(), pattern)) {
          u.setId(null);
        }
        unsetAllIdWithinObjectList(u.getContent(), pattern);
        break;
      case UL:
        Ul ul = (Ul) target;
        if (idMatch(ul.getId(), pattern)) {
          ul.setId(null);
        }
        for (Li tmpLi : ul.getLi()) {
          execute(tmpLi, pattern);
        }
        break;
      case VAR:
        Var var = (Var) target;
        if (idMatch(var.getId(), pattern)) {
          var.setId(null);
        }
        unsetAllIdWithinObjectList(var.getContent(), pattern);
        break;
      case ARTICLE:
        Article article = (Article) target;
        if (idMatch(article.getId(), pattern)) {
          article.setId(null);
        }
        unsetAllIdWithinObjectList(article.getContent(), pattern);
        break;
      case ASIDE:
        Aside aside = (Aside) target;
        if (idMatch(aside.getId(), pattern)) {
          aside.setId(null);
        }
        unsetAllIdWithinObjectList(aside.getContent(), pattern);
        break;
      case AUDIO:
        Audio audio = (Audio) target;
        if (idMatch(audio.getId(), pattern)) {
          audio.setId(null);
        }
        unsetAllIdWithinObjectList(audio.getContent(), pattern);
        break;
      case BDI:
        Bdi bdi = (Bdi) target;
        if (idMatch(bdi.getId(), pattern)) {
          bdi.setId(null);
        }
        unsetAllIdWithinObjectList(bdi.getContent(), pattern);
        break;
      case CANVAS:
        Canvas canvas = (Canvas) target;
        if (idMatch(canvas.getId(), pattern)) {
          canvas.setId(null);
        }
        unsetAllIdWithinObjectList(canvas.getContent(), pattern);
        break;
      case COMMAND:
        Command command = (Command) target;
        if (idMatch(command.getId(), pattern)) {
          command.setId(null);
        }
        // empty element
        break;
      case DATALIST:
        Datalist datalist = (Datalist) target;
        if (idMatch(datalist.getId(), pattern)) {
          datalist.setId(null);
        }
        unsetAllIdWithinObjectList(datalist.getContent(), pattern);
        break;
      case DETAILS:
        Details details = (Details) target;
        if (idMatch(details.getId(), pattern)) {
          details.setId(null);
        }
        unsetAllIdWithinObjectList(details.getContent(), pattern);
        break;
      case EMBED:
        Embed embed = (Embed) target;
        if (idMatch(embed.getId(), pattern)) {
          embed.setId(null);
        }
        // empty element
        break;
      case FIGCAPTION:
        Figcaption figcaption = (Figcaption) target;
        if (idMatch(figcaption.getId(), pattern)) {
          figcaption.setId(null);
        }
        unsetAllIdWithinObjectList(figcaption.getContent(), pattern);
        break;
      case FIGURE:
        Figure figure = (Figure) target;
        if (idMatch(figure.getId(), pattern)) {
          figure.setId(null);
        }
        unsetAllIdWithinObjectList(figure.getContent(), pattern);
        break;
      case FOOTER:
        Footer footer = (Footer) target;
        if (idMatch(footer.getId(), pattern)) {
          footer.setId(null);
        }
        unsetAllIdWithinObjectList(footer.getContent(), pattern);
        break;
      case HEADER:
        Header header = (Header) target;
        if (idMatch(header.getId(), pattern)) {
          header.setId(null);
        }
        unsetAllIdWithinObjectList(header.getContent(), pattern);
        break;
      case KEYGEN:
        Keygen keygen = (Keygen) target;
        if (idMatch(keygen.getId(), pattern)) {
          keygen.setId(null);
        }
        // empty element
        break;
      case MARK:
        Mark mark = (Mark) target;
        if (idMatch(mark.getId(), pattern)) {
          mark.setId(null);
        }
        unsetAllIdWithinObjectList(mark.getContent(), pattern);
        break;
      case METER:
        Meter meter = (Meter) target;
        if (idMatch(meter.getId(), pattern)) {
          meter.setId(null);
        }
        unsetAllIdWithinObjectList(meter.getContent(), pattern);
        break;
      case NAV:
        Nav nav = (Nav) target;
        if (idMatch(nav.getId(), pattern)) {
          nav.setId(null);
        }
        unsetAllIdWithinObjectList(nav.getContent(), pattern);
        break;
      case OUTPUT:
        Output output = (Output) target;
        if (idMatch(output.getId(), pattern)) {
          output.setId(null);
        }
        unsetAllIdWithinObjectList(output.getContent(), pattern);
        break;
      case PROGRESS:
        Progress progress = (Progress) target;
        if (idMatch(progress.getId(), pattern)) {
          progress.setId(null);
        }
        unsetAllIdWithinObjectList(progress.getContent(), pattern);
        break;
      case RP:
        Rp rp = (Rp) target;
        if (idMatch(rp.getId(), pattern)) {
          rp.setId(null);
        }
        unsetAllIdWithinObjectList(rp.getContent(), pattern);
        break;
      case RT:
        Rt rt = (Rt) target;
        if (idMatch(rt.getId(), pattern)) {
          rt.setId(null);
        }
        unsetAllIdWithinObjectList(rt.getContent(), pattern);
        break;
      case RUBY:
        Ruby ruby = (Ruby) target;
        if (idMatch(ruby.getId(), pattern)) {
          ruby.setId(null);
        }
        unsetAllIdWithinObjectList(ruby.getContent(), pattern);
        break;
      case SECTION:
        Section section = (Section) target;
        if (idMatch(section.getId(), pattern)) {
          section.setId(null);
        }
        unsetAllIdWithinObjectList(section.getContent(), pattern);
        break;
      case SOURCE:
        Source source = (Source) target;
        if (idMatch(source.getId(), pattern)) {
          source.setId(null);
        }
        break;
      case SUMMARY:
        Summary summary = (Summary) target;
        if (idMatch(summary.getId(), pattern)) {
          summary.setId(null);
        }
        unsetAllIdWithinObjectList(summary.getContent(), pattern);
        break;
      case TIME:
        Time time = (Time) target;
        if (idMatch(time.getId(), pattern)) {
          time.setId(null);
        }
        unsetAllIdWithinObjectList(time.getContent(), pattern);
        break;
      case TRACK:
        Track track = (Track) target;
        if (idMatch(track.getId(), pattern)) {
          track.setId(null);
        }
        // empty element
        break;
      case VIDEO:
        Video video = (Video) target;
        if (idMatch(video.getId(), pattern)) {
          video.setId(null);
        }
        unsetAllIdWithinObjectList(video.getContent(), pattern);
        break;
      case WBR:
        Wbr wbr = (Wbr) target;
        if (idMatch(wbr.getId(), pattern)) {
          wbr.setId(null);
        }
        // empty element
        break;
    }
  }
Esempio n. 2
0
  /**
   * Prepare the world for the start of the program. That is: create the initial objects and add
   * them to the world.
   */
  private void prepare() {
    Small small = new Small();
    addObject(small, 127, 105);
    Big big = new Big();
    addObject(big, 843, 121);
    small.setLocation(113, 95);
    big.setLocation(860, 113);
    big.setLocation(885, 111);
    Number_5 number_5 = new Number_5();
    addObject(number_5, 157, 288);
    Number_4 number_4 = new Number_4();
    addObject(number_4, 69, 297);
    number_5.setLocation(167, 295);
    Number_6 number_6 = new Number_6();
    addObject(number_6, 273, 300);
    number_6.setLocation(266, 295);
    Number_7 number_7 = new Number_7();
    addObject(number_7, 369, 303);
    number_7.setLocation(361, 298);
    Number_8 number_8 = new Number_8();
    addObject(number_8, 463, 300);
    number_8.setLocation(456, 298);
    Number_9 number_9 = new Number_9();
    addObject(number_9, 559, 305);
    Number_10 number_10 = new Number_10();
    addObject(number_10, 659, 312);
    Number_11 number_11 = new Number_11();
    addObject(number_11, 767, 312);
    Number_12 number_12 = new Number_12();
    addObject(number_12, 872, 315);
    number_9.setLocation(552, 298);
    number_10.setLocation(650, 300);
    number_11.setLocation(747, 299);
    number_12.setLocation(843, 302);
    Number_13 number_13 = new Number_13();
    addObject(number_13, 950, 306);
    number_13.setLocation(942, 303);
    Combo1And2 combo1and2 = new Combo1And2();
    addObject(combo1and2, 173, 478);
    Combo5And6 combo5and6 = new Combo5And6();
    addObject(combo5and6, 948, 480);
    combo1and2.setLocation(149, 467);
    combo5and6.setLocation(948, 472);

    Number_14 number_14 = new Number_14();
    addObject(number_14, 1046, 311);
    number_14.setLocation(1039, 303);
    Number_15 number_15 = new Number_15();
    addObject(number_15, 1145, 308);
    number_15.setLocation(1138, 303);
    Number_16 number_16 = new Number_16();
    addObject(number_16, 1245, 310);
    number_16.setLocation(1238, 305);
    Number_17 number_17 = new Number_17();
    addObject(number_17, 1342, 309);
    number_17.setLocation(1336, 303);
    big.setLocation(1277, 101);
    big.setLocation(1283, 104);
    small.setLocation(114, 101);
    big.setLocation(1287, 101);
    combo1and2.setLocation(162, 467);
    combo5and6.setLocation(943, 472);
    Combo1And2 combo1and22 = new Combo1And2();
    addObject(combo1and22, 1237, 683);
    removeObject(combo1and22);
    TwoDie twodie = new TwoDie();
    addObject(twodie, 76, 467);
    Combo1And3 combo1and3 = new Combo1And3();
    addObject(combo1and3, 251, 475);
    combo1and3.setLocation(243, 469);
    Combo1And4 combo1and4 = new Combo1And4();
    addObject(combo1and4, 331, 476);
    combo1and4.setLocation(325, 469);
    Combo1And5 combo1and5 = new Combo1And5();
    addObject(combo1and5, 409, 477);
    combo1and5.setLocation(402, 468);
    Combo1And6 combo1and6 = new Combo1And6();
    addObject(combo1and6, 493, 475);
    combo1and6.setLocation(487, 469);
    combo1and5.setLocation(404, 470);
    combo1and6.setLocation(486, 470);
    Combo2And3 combo2and3 = new Combo2And3();
    addObject(combo2and3, 570, 473);
    combo2and3.setLocation(565, 470);
    Combo2And4 combo2and4 = new Combo2And4();
    addObject(combo2and4, 653, 476);
    combo2and4.setLocation(646, 470);
    Combo2And6 combo2and6 = new Combo2And6();
    addObject(combo2and6, 824, 479);
    Combo2And5 combo2and5 = new Combo2And5();
    addObject(combo2and5, 734, 480);
    combo2and5.setLocation(726, 471);
    combo2and6.setLocation(802, 471);
    Combo3And4 combo3and4 = new Combo3And4();
    addObject(combo3and4, 885, 478);
    combo5and6.setLocation(1039, 472);
    combo3and4.setLocation(883, 472);
    combo2and5.setLocation(726, 471);
    Combo1And5 combo1and52 = new Combo1And5();
    addObject(combo1and52, 1233, 659);
    removeObject(combo1and52);
    Combo3And6 combo3and6 = new Combo3And6();
    addObject(combo3and6, 968, 478);
    combo3and6.setLocation(961, 471);
    combo5and6.setLocation(1305, 478);
    Combo4And6 combo4and6 = new Combo4And6();
    addObject(combo4and6, 1131, 481);
    combo5and6.setLocation(1211, 474);
    combo4and6.setLocation(1130, 477);
    Combo4And5 combo4and5 = new Combo4And5();
    addObject(combo4and5, 1049, 479);
    combo4and5.setLocation(1040, 473);
    combo4and6.setLocation(1118, 474);
    combo5and6.setLocation(1196, 473);
    combo1and2.setLocation(162, 467);
    combo2and5.setLocation(726, 475);
    combo3and6.setLocation(961, 473);
    combo3and4.setLocation(883, 474);
    combo2and6.setLocation(805, 473);
    combo3and6.setLocation(961, 473);
    combo5and6.setLocation(1197, 472);
    Combo1And1 combo1and1 = new Combo1And1();
    addObject(combo1and1, 274, 131);
    Combo2And2 combo2and2 = new Combo2And2();
    addObject(combo2and2, 368, 140);
    combo2and2.setLocation(363, 131);
    Combo3And3 combo3and3 = new Combo3And3();
    addObject(combo3and3, 459, 137);
    combo3and3.setLocation(454, 132);
    OneWinsEleven onewinseleven = new OneWinsEleven();
    addObject(onewinseleven, 1038, 736);
    removeObject(onewinseleven);
    EachDoubleOneWinsEleven eachdoubleonewinseleven = new EachDoubleOneWinsEleven();
    addObject(eachdoubleonewinseleven, 363, 38);
    eachdoubleonewinseleven.setLocation(360, 33);
    Combo6And6 combo6and6 = new Combo6And6();
    addObject(combo6and6, 1136, 130);
    number_15.setLocation(1136, 298);
    number_16.setLocation(1235, 299);
    number_17.setLocation(1330, 300);
    number_14.setLocation(1039, 298);
    number_13.setLocation(942, 295);
    number_12.setLocation(842, 296);
    number_11.setLocation(748, 294);
    number_12.setLocation(844, 296);
    number_10.setLocation(650, 295);
    number_8.setLocation(456, 297);
    combo2and3.setLocation(564, 468);
    combo2and4.setLocation(646, 467);
    combo2and5.setLocation(726, 470);
    combo2and6.setLocation(804, 471);
    combo3and4.setLocation(883, 472);
    combo3and6.setLocation(960, 469);
    combo4and5.setLocation(1039, 468);
    combo4and6.setLocation(1118, 468);
    combo4and5.setLocation(1039, 468);
    combo5and6.setLocation(1198, 467);
    Combo5And5 combo5and5 = new Combo5And5();
    addObject(combo5and5, 1042, 136);
    combo5and5.setLocation(1043, 132);
    Combo4And4 combo4and4 = new Combo4And4();
    addObject(combo4and4, 950, 136);
    combo4and4.setLocation(949, 133);
    combo4and4.setLocation(950, 130);
    EachDoubleOneWinsEleven eachdoubleonewinseleven2 = new EachDoubleOneWinsEleven();
    addObject(eachdoubleonewinseleven2, 1054, 35);
    eachdoubleonewinseleven2.setLocation(1041, 33);
    combo2and4.setLocation(646, 470);
    combo2and5.setLocation(728, 473);
    combo3and6.setLocation(961, 469);
    combo4and5.setLocation(1040, 471);
    combo4and6.setLocation(1119, 471);
    combo5and6.setLocation(1198, 470);
    SicBoTiles tiles = new SicBoTiles();
    Dice dice_1 = new Dice_1();
    dice_1.addObserver(tiles);
    addObject(dice_1, 570, 139);
    dice_1.setLocation(568, 140);
    Dice dice_2 = new Dice_2();
    dice_2.addObserver(tiles);
    addObject(dice_2, 684, 150);
    dice_2.setLocation(679, 146);
    dice_2.setLocation(678, 145);
    Dice dice_3 = new Dice_3();
    dice_3.addObserver(tiles);
    addObject(dice_3, 828, 145);
    dice_2.setLocation(686, 130);
    dice_1.setLocation(587, 125);
    dice_3.setLocation(799, 130);
    dice_2.setLocation(693, 129);
    dice_3.setLocation(811, 129);
    dice_2.setLocation(699, 129);
    dice_3.setLocation(820, 129);
    dice_2.setLocation(704, 128);
    Triple triple = new Triple();
    addObject(triple, 49, 605);
    triple.setLocation(359, 752);

    dice_3.setLocation(819, 125);
    dice_2.setLocation(704, 127);
    dice_1.setLocation(588, 124);
    dice_1.setLocation(589, 139);
    dice_2.setLocation(704, 144);
    dice_3.setLocation(818, 144);
    SingleValue_1 singlevalue_1 = new SingleValue_1();
    addObject(singlevalue_1, 215, 645);
    singlevalue_1.setLocation(201, 589);
    SingleValue_2 singlevalue_2 = new SingleValue_2();
    addObject(singlevalue_2, 392, 593);
    singlevalue_2.setLocation(384, 589);
    singlevalue_2.setLocation(384, 588);
    SingleValue_3 singlevalue_3 = new SingleValue_3();
    addObject(singlevalue_3, 574, 598);
    singlevalue_3.setLocation(567, 592);
    singlevalue_2.setLocation(385, 592);
    singlevalue_1.setLocation(201, 595);
    SingleValue_4 singlevalue_4 = new SingleValue_4();
    addObject(singlevalue_4, 760, 599);
    singlevalue_4.setLocation(749, 592);
    SingleValue_5 singlevalue_5 = new SingleValue_5();
    addObject(singlevalue_5, 947, 596);
    singlevalue_5.setLocation(934, 592);
    SingleValue_6 singlevalue_6 = new SingleValue_6();
    addObject(singlevalue_6, 1134, 598);
    singlevalue_6.setLocation(1120, 590);
    singlevalue_2.setLocation(387, 594);
    singlevalue_3.setLocation(569, 593);
    singlevalue_4.setLocation(755, 593);
    singlevalue_6.setLocation(1141, 590);
    singlevalue_5.setLocation(944, 592);
    singlevalue_6.setLocation(1134, 593);
    singlevalue_3.setLocation(570, 596);
    singlevalue_5.setLocation(961, 789);
    singlevalue_4.setLocation(722, 766);
    singlevalue_3.setLocation(494, 754);
    singlevalue_2.setLocation(326, 758);
    singlevalue_6.setLocation(1145, 593);
    singlevalue_4.setLocation(714, 629);
    singlevalue_5.setLocation(955, 595);
    singlevalue_4.setLocation(762, 595);
    singlevalue_3.setLocation(574, 596);
    singlevalue_2.setLocation(389, 596);
    singlevalue_4.setLocation(763, 597);
    singlevalue_5.setLocation(956, 596);
    singlevalue_6.setLocation(1144, 594);
    OneIsToOne oneistoone = new OneIsToOne();
    addObject(oneistoone, 306, 678);
    oneistoone.setLocation(299, 671);
    TwoIsToOne twoistoone = new TwoIsToOne();
    addObject(twoistoone, 680, 678);
    twoistoone.setLocation(677, 671);
    ThreeIsToOne threeistoone = new ThreeIsToOne();
    addObject(threeistoone, 1060, 676);
    threeistoone.setLocation(1054, 670);
    IPlayer nobody = new Nobody();
    Display disp = new Display(nobody);
    ScoreBoard scoreboard = new ScoreBoard(disp);
    addObject(scoreboard, 701, 824);
    // Reset reset=new Reset();
    // addObject(reset,1073, 824);
    Combo3And5 combo3and5 = new Combo3And5();
    addObject(combo3and5, 1348, 597);
    combo4and5.setLocation(1339, 471);
    combo3and6.setLocation(1047, 470);
    combo3and5.setLocation(965, 472);
    combo5and6.setLocation(1258, 468);
    combo4and6.setLocation(1179, 469);
    combo4and5.setLocation(1130, 470);
    combo4and6.setLocation(1187, 469);
    combo5and6.setLocation(1305, 472);
    combo4and5.setLocation(1126, 471);
    combo4and6.setLocation(1205, 473);
    combo5and6.setLocation(1285, 472);
    triple.setLocation(650, 418);
    triple.setLocation(700, 154);
    // NumberInputBox1 numberinputbox1 = new NumberInputBox1();
    // addObject(numberinputbox1, 106, 745);
    // NumberInputBox2 numberinputbox2 = new NumberInputBox2();
    // addObject(numberinputbox2, 304, 753);
    // numberinputbox2.setLocation(309, 749);
    // numberinputbox2.setLocation(311, 746);
    CreateChip1 createchip1 = new CreateChip1();
    addObject(createchip1, 120, 846);
    CreateChip2 createchip2 = new CreateChip2();
    addObject(createchip2, 395, 847);
    // numberinputbox2.setLocation(383, 749);
    // numberinputbox1.setLocation(116, 748);
    NumberInputBox numberinputbox = new NumberInputBox();
    addObject(numberinputbox, 168, 749);
    numberinputbox.setLocation(253, 742);
    dice_1.setLocation(581, 53);
    dice_2.setLocation(695, 53);
    dice_3.setLocation(809, 53);
    /*dice_1.setLocation(785, 362);
    dice_1.setLocation(906, 851);
    dice_3.setLocation(766, 440);
    triple.setLocation(690, 119);
    triple.setLocation(697, 114);
    //reset.setLocation(1216, 721);
    dice_2.setLocation(1061, 843);
    dice_3.setLocation(1150, 828);
    dice_1.setLocation(906, 821);
    dice_2.setLocation(1019, 825);
    dice_3.setLocation(1130, 821);
    dice_3.setLocation(1130, 825);*/
    numberinputbox.setLocation(262, 771);
    createchip2.setLocation(437, 848);
    scoreboard.setLocation(842, 823);
    createchip2.setLocation(480, 853);
    numberinputbox.setLocation(324, 770);
    createchip2.setLocation(531, 843);
    scoreboard.setLocation(878, 814);

    removeObject(oneistoone);
    removeObject(twoistoone);
    removeObject(threeistoone);
    numberinputbox.setLocation(676, 690);
    scoreboard.setLocation(702, 809);

    createchip2.setLocation(1207, 817);
    scoreboard.setLocation(679, 805);
    createchip1.setLocation(156, 804);
    createchip2.setLocation(1203, 791);
    createchip2.setLocation(1199, 794);
    createchip1.setLocation(157, 795);
    createchip2.setLocation(1200, 797);
    createchip2.setLocation(1199, 793);
    createchip2.setLocation(1199, 795);
    Dice.pScoreOne = 0;
    Dice.pScoreTwo = 0;
  }