Exemple #1
0
 // ***** VDMTOOLS START Name=getCells#1|Object KEEP=NO
 public Set getCells(final Object p) throws CGException {
   sentinel.entering(((BoardLineSentinel) sentinel).getCells);
   try {
     Set res_s_3 = new HashSet();
     {
       Set e1_set_7 = new HashSet(line.values());
       Cell c = null;
       Set tmpSet_21 = new HashSet(e1_set_7);
       for (Iterator enm_20 = tmpSet_21.iterator(); enm_20.hasNext(); ) {
         Cell elem_19 = (Cell) enm_20.next();
         /* c */
         c = elem_19;
         Boolean pred_8 = null;
         if ((pred_8 = Boolean.valueOf(!UTIL.equals((c.piece), null))).booleanValue())
           pred_8 = Boolean.valueOf(UTIL.equals(((c.piece).belongTo), p));
         if (pred_8.booleanValue()) {
           res_s_3.add(c);
         }
       }
     }
     return res_s_3;
   } finally {
     sentinel.leaving(((BoardLineSentinel) sentinel).getCells);
   }
 }
Exemple #2
0
 // ***** VDMTOOLS START Name=inv_BoardLine KEEP=NO
 public Boolean inv_BoardLine() {
   Boolean rexpr_2 = null;
   Set var2_5 = new HashSet();
   var2_5 = new HashSet();
   for (int count_8 = 1; count_8 <= 9; count_8++) var2_5.add(new Integer(count_8));
   if ((rexpr_2 = Boolean.valueOf(UTIL.Contains(var2_5, y))).booleanValue()) {
     Boolean var2_11 = null;
     Boolean var1_12 = null;
     if ((var1_12 = Boolean.valueOf(new HashSet(line.keySet()).size() == 9)).booleanValue()) {
       Set var2_21 = new HashSet();
       var2_21 = new HashSet();
       for (int count_24 = 1; count_24 <= 9; count_24++) var2_21.add(new Integer(count_24));
       var1_12 = Boolean.valueOf(UTIL.equals(new HashSet(line.keySet()), var2_21));
     }
     if ((var2_11 = var1_12).booleanValue()) {
       Boolean var2_27 = null;
       boolean tmpQuant_29 = true;
       {
         Set e1_set_32 = new HashSet(line.values());
         Cell c = null;
         Set tmpSet_40 = new HashSet(e1_set_32);
         for (Iterator enm_39 = tmpSet_40.iterator(); enm_39.hasNext() && tmpQuant_29; ) {
           Cell elem_38 = (Cell) enm_39.next();
           /* c */
           c = elem_38;
           if (!((c.y).intValue() == y.intValue())) tmpQuant_29 = false;
         }
       }
       if ((var2_27 = Boolean.valueOf(tmpQuant_29)).booleanValue()) {
         boolean tmpQuant_43 = false;
         {
           Set e1_set_46 = new HashSet(line.values());
           Cell c1 = null;
           Cell c2 = null;
           Set e_set_60 = e1_set_46;
           Set tmpSet_63 = new HashSet(e_set_60);
           for (Iterator enm_62 = tmpSet_63.iterator(); enm_62.hasNext() && !tmpQuant_43; ) {
             Cell elem_61 = (Cell) enm_62.next();
             /* c2 */
             c2 = elem_61;
             Set tmpSet_59 = new HashSet(e1_set_46);
             for (Iterator enm_58 = tmpSet_59.iterator(); enm_58.hasNext() && !tmpQuant_43; ) {
               Cell elem_57 = (Cell) enm_58.next();
               /* c1 */
               c1 = elem_57;
               Boolean pred_47 = null;
               if ((pred_47 = Boolean.valueOf(!UTIL.equals(c1, c2))).booleanValue())
                 pred_47 = Boolean.valueOf((c1.x).intValue() == (c2.x).intValue());
               if (pred_47.booleanValue()) tmpQuant_43 = true;
             }
           }
         }
         var2_27 = Boolean.valueOf(!tmpQuant_43);
       }
       var2_11 = var2_27;
     }
     rexpr_2 = var2_11;
   }
   return rexpr_2;
 }
Exemple #3
0
 // ***** VDMTOOLS START Name=getEmptyCells KEEP=NO
 public Set getEmptyCells() throws CGException {
   sentinel.entering(((BoardLineSentinel) sentinel).getEmptyCells);
   try {
     Set res_s_2 = new HashSet();
     {
       Set e1_set_6 = new HashSet(line.values());
       Cell c = null;
       Set tmpSet_14 = new HashSet(e1_set_6);
       for (Iterator enm_13 = tmpSet_14.iterator(); enm_13.hasNext(); ) {
         Cell elem_12 = (Cell) enm_13.next();
         /* c */
         c = elem_12;
         if (UTIL.equals((c.piece), null)) {
           res_s_2.add(c);
         }
       }
     }
     return res_s_2;
   } finally {
     sentinel.leaving(((BoardLineSentinel) sentinel).getEmptyCells);
   }
 }