Example #1
0
  @Override
  public void readValue(Object data, Tagable tagabale) {
    if (data instanceof MacroSeqData) {
      MacroSeqData macro = (MacroSeqData) data;
      Object val = getValue(macro.getAttributes());
      if (val instanceof Sequence) {
        Sequence seq = (Sequence) val;
        if (!seq.isEmpty()) {
          val = seq.get(0);
        }
      }

      if (val instanceof Attributes) {
        Attributes dataset = (Attributes) val;
        Predicate<? super Attributes> predicate = macro.getApplicable();
        if (predicate == null || predicate.test(dataset)) {
          for (TagW tag : macro.getTags()) {
            if (tag != null) {
              tag.readValue(dataset, tagabale);
            }
          }
        }
      }
    }
  }
 private Attributes nestedKeys(int[] tags) {
   Attributes item = attrs;
   for (int i = 0; i < tags.length - 1; i++) {
     int tag = tags[i];
     Sequence sq = item.getSequence(tag);
     if (sq == null) sq = item.newSequence(tag, 1);
     if (sq.isEmpty()) sq.add(new Attributes());
     item = sq.get(0);
   }
   return item;
 }