File indexing completed on 2024-12-15 04:19:54

0001 package mso.generator.utils;
0002 
0003 import org.eclipse.jdt.annotation.Nullable;
0004 
0005 public class Lim {
0006     public Limitation @Nullable [] limitations;
0007     public final Lim @Nullable [] lims;
0008 
0009     Lim(Lim lims[]) {
0010         this.lims = lims;
0011         this.limitations = null;
0012     }
0013 
0014     Lim(Limitation lims[]) {
0015         this.lims = null;
0016         this.limitations = lims;
0017     }
0018 
0019     boolean containsCommonLimitation(Limitation l) {
0020         final Limitation limitations[] = this.limitations;
0021         if (limitations != null) {
0022             for (int i = 0; i < limitations.length; ++i) {
0023                 if (limitations[i].equals(l)) {
0024                     return true;
0025                 }
0026             }
0027         }
0028         return false;
0029     }
0030 
0031     void removeLimitation(Limitation l) {
0032         if (!containsCommonLimitation(l))
0033             return;
0034         final Limitation limitations[] = this.limitations;
0035         if (limitations != null) {
0036             Limitation[] nl = new Limitation[limitations.length - 1];
0037             int pos = 0;
0038             for (int i = 0; i < limitations.length; ++i) {
0039                 if (!limitations[i].equals(l)) {
0040                     nl[pos++] = limitations[i];
0041                 }
0042             }
0043             this.limitations = nl;
0044         }
0045     }
0046 }