Example #1
0
 public function sent_mutation_data()
 {
     \DB::statement(\DB::raw('set @rownum=0'));
     $datas = Mutation::select([\DB::raw('@rownum  := @rownum  + 1 AS rownum'), 'id', 'no_mutasi', 'date_mutation', 'status']);
     return Datatables::of($datas)->addColumn('action', function ($data) {
         return '
   <button id="btn-delete" class="btn btn-xs btn-danger" data-remote="./update_sent_mutation/' . $data->id . '">Konfirmasi</button>
   ';
     })->editColumn('date_mutation', function ($data) {
         return $data->date_mutation ? with(new Carbon($data->date_mutation))->format('d/m/Y') : '';
     })->where('status', '=', 'dikirim')->make(true);
 }
Example #2
0
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->tableName);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->row);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::LST) {
                     $this->mutations = array();
                     $_size186 = 0;
                     $_etype189 = 0;
                     $xfer += $input->readListBegin($_etype189, $_size186);
                     for ($_i190 = 0; $_i190 < $_size186; ++$_i190) {
                         $elem191 = null;
                         $elem191 = new Mutation();
                         $xfer += $elem191->read($input);
                         $this->mutations[] = $elem191;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::I64) {
                     $xfer += $input->readI64($this->timestamp);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
Example #3
0
 public static function mutDelete($fullRelationSignature, $stableAtom, $stableConcept, $modifiedAtom, $modifiedConcept, $source)
 {
     $operation = 'Removed';
     Mutation::saveMutation($operation, $fullRelationSignature, $stableAtom, $stableConcept, $modifiedAtom, $modifiedConcept, $source);
 }
Example #4
0
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->row);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::LST) {
                     $this->mutations = array();
                     $_size0 = 0;
                     $_etype3 = 0;
                     $xfer += $input->readListBegin($_etype3, $_size0);
                     for ($_i4 = 0; $_i4 < $_size0; ++$_i4) {
                         $elem5 = null;
                         $elem5 = new Mutation();
                         $xfer += $elem5->read($input);
                         $this->mutations[] = $elem5;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
Example #5
0
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->tableName);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->row);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::LST) {
                     $this->mutations = array();
                     $_size301 = 0;
                     $_etype304 = 0;
                     $xfer += $input->readListBegin($_etype304, $_size301);
                     for ($_i305 = 0; $_i305 < $_size301; ++$_i305) {
                         $elem306 = null;
                         $elem306 = new Mutation();
                         $xfer += $elem306->read($input);
                         $this->mutations[] = $elem306;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::I64) {
                     $xfer += $input->readI64($this->timestamp);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 5:
                 if ($ftype == TType::MAP) {
                     $this->attributes = array();
                     $_size307 = 0;
                     $_ktype308 = 0;
                     $_vtype309 = 0;
                     $xfer += $input->readMapBegin($_ktype308, $_vtype309, $_size307);
                     for ($_i311 = 0; $_i311 < $_size307; ++$_i311) {
                         $key312 = '';
                         $val313 = '';
                         $xfer += $input->readString($key312);
                         $xfer += $input->readString($val313);
                         $this->attributes[$key312] = $val313;
                     }
                     $xfer += $input->readMapEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }
Example #6
0
 /**
  * Splice a mutation into these income slots. The mutation will split
  * one slot in twain, and affect all slots after its mutation point.
  * @param Mutation $mutation
  */
 public function splice($mutation)
 {
     if ($this->debug) {
         tracemsg("IncomeSlots::splice(" . $mutation . " @ " . simple_time($mutation->time) . ")");
     }
     if (isset($mutation->delay)) {
         // find negative splice point
         for ($i = 0; $i < count($this->_slots); $i++) {
             $slot = $this->_slots[$i];
             if ($slot->endTime === INF || $slot->endTime > $mutation->time) {
                 $newSlot = clone $slot;
                 $newSlot->start($mutation->time);
                 $slot->endTime = $mutation->time;
                 array_splice($this->_slots, $i + 1, 0, array($newSlot));
                 $spliceSlot = $i + 1;
                 break;
             }
         }
         // update income beyond negative splice point
         for ($i = $spliceSlot; $i < count($this->_slots); $i++) {
             $mutation->applyNegative($this->_slots[$i]);
         }
         // find positive splice point
         for ($i = 0; $i < count($this->_slots); $i++) {
             $slot = $this->_slots[$i];
             if ($slot->endTime === INF || $slot->endTime > $mutation->time + $mutation->delay) {
                 $newSlot = clone $slot;
                 $newSlot->start($mutation->time + $mutation->delay);
                 $slot->endTime = $mutation->time + $mutation->delay;
                 array_splice($this->_slots, $i + 1, 0, array($newSlot));
                 $spliceSlot = $i + 1;
                 break;
             }
         }
         // update income beyond positive splice point
         for ($i = $spliceSlot; $i < count($this->_slots); $i++) {
             $mutation->applyPositive($this->_slots[$i]);
         }
     } else {
         // find splice point
         for ($i = 0; $i < count($this->_slots); $i++) {
             $slot = $this->_slots[$i];
             if ($slot->endTime === INF || $slot->endTime > $mutation->time) {
                 $newSlot = clone $slot;
                 $newSlot->start($mutation->time);
                 $slot->endTime = $mutation->time;
                 array_splice($this->_slots, $i + 1, 0, array($newSlot));
                 $spliceSlot = $i + 1;
                 break;
             }
         }
         // update income beyond splice point
         for ($i = $spliceSlot; $i < count($this->_slots); $i++) {
             $mutation->apply($this->_slots[$i]);
         }
     }
 }
Example #7
0
 public function when($income)
 {
     return $this->_mutation->when($this->timeStarted, $income);
 }
 /**
  * @expectedException RuntimeException
  * @dataProvider getStrategyExceptionProvider
  * @param string $strategy
  */
 public function testGetStrategyException($strategy)
 {
     $mutation = new Mutation();
     $mutation->strategy = $strategy;
     $mutation->getStrategy();
 }
Example #9
0
 public function read($input)
 {
     $xfer = 0;
     $fname = null;
     $ftype = 0;
     $fid = 0;
     $xfer += $input->readStructBegin($fname);
     while (true) {
         $xfer += $input->readFieldBegin($fname, $ftype, $fid);
         if ($ftype == TType::STOP) {
             break;
         }
         switch ($fid) {
             case 1:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->tableName);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 2:
                 if ($ftype == TType::STRING) {
                     $xfer += $input->readString($this->row);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 3:
                 if ($ftype == TType::LST) {
                     $this->mutations = array();
                     $_size308 = 0;
                     $_etype311 = 0;
                     $xfer += $input->readListBegin($_etype311, $_size308);
                     for ($_i312 = 0; $_i312 < $_size308; ++$_i312) {
                         $elem313 = null;
                         $elem313 = new Mutation();
                         $xfer += $elem313->read($input);
                         $this->mutations[] = $elem313;
                     }
                     $xfer += $input->readListEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 4:
                 if ($ftype == TType::I64) {
                     $xfer += $input->readI64($this->timestamp);
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             case 5:
                 if ($ftype == TType::MAP) {
                     $this->attributes = array();
                     $_size314 = 0;
                     $_ktype315 = 0;
                     $_vtype316 = 0;
                     $xfer += $input->readMapBegin($_ktype315, $_vtype316, $_size314);
                     for ($_i318 = 0; $_i318 < $_size314; ++$_i318) {
                         $key319 = '';
                         $val320 = '';
                         $xfer += $input->readString($key319);
                         $xfer += $input->readString($val320);
                         $this->attributes[$key319] = $val320;
                     }
                     $xfer += $input->readMapEnd();
                 } else {
                     $xfer += $input->skip($ftype);
                 }
                 break;
             default:
                 $xfer += $input->skip($ftype);
                 break;
         }
         $xfer += $input->readFieldEnd();
     }
     $xfer += $input->readStructEnd();
     return $xfer;
 }