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

templates.tablesFilter.stg Maven / Gradle / Ivy

There is a newer version: 1.6.2
Show newest version

filter(className) ::=
<<
   public Table filter(Predicate\<  > predicate)
   {
      ArrayList\ > oldTable = (ArrayList\ >) this.table.clone();
      this.table.clear();
      for (ArrayList\ row : oldTable)
      {
          start = () row.get(columnMap.get(this.getColumnName()));
         if (predicate.test(start))
         {
            this.table.add(row);
         }
      }
      return this;
   }
>>



filterRow(className) ::=
<<
   public Table filterRow(Predicate\ > predicate)
   {
      ArrayList\ > oldTable = (ArrayList\ >) this.table.clone();
      this.table.clear();
      for (ArrayList\ row : oldTable)
      {
         LinkedHashMap\ map = new LinkedHashMap\< >();
         for (String key : columnMap.keySet())
         {
            map.put(key, row.get(columnMap.get(key)));
         }
         if (predicate.test(map))
         {
            this.table.add(row);
         }
      }
      return this;
   }
>>