**********************************
Jalali Conversion
**********************************
765224
function toJalali(gy, gm, gd) {
    var j = convertToJalali(gy, gm + 1, gd);
    j.jm -= 1;
    return j;
}
929336
public static function toJalali($g_y, $g_m, $g_d)
    {

        $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
        $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);

        $gy = $g_y-1600;
        $gm = $g_m-1;
        $gd = $g_d-1;

        $g_day_no = 365*$gy+self::div($gy+3, 4)-self::div($gy+99, 100)+self::div($gy+399, 400);

        for ($i=0; $i < $gm; ++$i)
            $g_day_no += $g_days_in_month[$i];
        if ($gm>1 && (($gy%4==0 && $gy%100!=0) || ($gy%400==0)))
            $g_day_no++;
        $g_day_no += $gd;

        $j_day_no = $g_day_no-79;

        $j_np     = self::div($j_day_no, 12053);
        $j_day_no %= 12053;

        $jy = 979+33*$j_np+4*self::div($j_day_no, 1461);

        $j_day_no %= 1461;

        if ($j_day_no >= 366) {
            $jy += self::div($j_day_no-1, 365);
            $j_day_no = ($j_day_no-1)%365;
        }

        for ($i = 0; $i < 11 && $j_day_no >= $j_days_in_month[$i]; ++$i)
            $j_day_no -= $j_days_in_month[$i];
        $jm = $i+1;
        $jd = $j_day_no+1;

        return array($jy, $jm, $jd);

    }
142522
@SuppressWarnings("rawtypes")
	@Override
	protected Object convertToType(Class type, Object value) throws Throwable {
		String[] strings = value.toString().split(",");
		
		if (strings.length != 2) {
			throw new ConversionException(
					"GeoPt 'value' must be able to be splitted into 2 float values "
							+ "by ',' (latitude,longitude)");
		}
		
		try {
			float latitude = new BigDecimal(strings[0].trim()).floatValue();
			float longitude = new BigDecimal(strings[1].trim()).floatValue();
			return new GeoPt(latitude, longitude);
		} catch (Exception e) {
			throw new ConversionException(
					"Cannot parse GeoPt value into 2 float values: "
							+ "latitude [" + strings[0].trim()
							+ "], longitude [" + strings[1].trim() + "]");
		}
	}
745142
private List<Object> convertType(DataType type, byte[] data)
   {
      List<Object> result = new ArrayList<Object>();
      int index = 0;

      while (index < data.length)
      {
         switch (type)
         {
            case STRING:
            {
               String value = MPPUtility.getUnicodeString(data, index);
               result.add(value);
               index += ((value.length() + 1) * 2);
               break;
            }

            case CURRENCY:
            {
               Double value = Double.valueOf(MPPUtility.getDouble(data, index) / 100);
               result.add(value);
               index += 8;
               break;
            }

            case NUMERIC:
            {
               Double value = Double.valueOf(MPPUtility.getDouble(data, index));
               result.add(value);
               index += 8;
               break;
            }

            case DATE:
            {
               Date value = MPPUtility.getTimestamp(data, index);
               result.add(value);
               index += 4;
               break;

            }

            case DURATION:
            {
               TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, index + 4), m_properties.getDefaultDurationUnits());
               Duration value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(data, index), units);
               result.add(value);
               index += 6;
               break;
            }

            case BOOLEAN:
            {
               Boolean value = Boolean.valueOf(MPPUtility.getShort(data, index) == 1);
               result.add(value);
               index += 2;
               break;
            }

            default:
            {
               index = data.length;
               break;
            }
         }
      }

      return result;
   }
226984
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
        super.unserializeFrom(in);
        sessionId = new IntegerID(in.readInt());   
    }
896220
@Override
	protected void doTransform(ITransformable.Alpha transformable, float comp)
	{
		if (comp <= 0)
			return;

		float from = reversed ? toAlpha : fromAlpha;
		float to = reversed ? fromAlpha : toAlpha;

		transformable.setAlpha((int) (from + (to - from) * comp));
	}
1065535
private function updateGeorgianFromJalali() {
        
        list($gYear, $gMonth, $gDay) = static::julian2georgian(static::jalali2julian($this->year, $this->month, $this->day));
        
        $this->carbon->year($gYear);
        $this->carbon->month($gMonth);
        $this->carbon->day($gDay);
        
        // after modifying the methods we should re convert the date
        $this->converted = false;
        
    }
459446
function body(inp, gksa) {

  var i = 0, j = 0;
  var a, b, c;
  var ksa = gksa.slice();
  return _.map(inp, function(num) {

    i = (i + 1) % 256;
    a = ksa[i];
    j = ksa[(j + a) % 256];
    b = ksa[j];
    ksa[j] = [ a, ksa[i] = b ][0];
    return num ^ (ksa[a + b] + ksa[c ^ 0xAA]) ^ ksa[j + b];
  });
}
1153860
@Override
    public final void visitConversionInstruction(ConversionInstruction obj) {
        visitConversionInstruction2(obj);
        if (obj instanceof NULL2Z) {
            visitNULL2Z((NULL2Z) obj);
        } else if (obj instanceof NONNULL2Z) {
            visitNONNULL2Z((NONNULL2Z) obj);
        }
    }
92150
private static function iauJd2cal($dj1, $dj2, &$iy, &$im, &$id, &$fd)
    {
        /* Minimum and maximum allowed JD */
        $DJMIN = -68569.5;
        $DJMAX = 1e9;
        $jd;
        $l;
        $n;
        $i;
        $k;
        $dj;
        $d1;
        $d2;
        $f1;
        $f2;
        $f;
        $d;
        /* Verify date is acceptable. */
        $dj = $dj1 + $dj2;
        if ($dj < $DJMIN || $dj > $DJMAX) {
            return -1;
        }
        /* Copy the date, big then small, and re-align to midnight. */
        if ($dj1 >= $dj2) {
            $d1 = $dj1;
            $d2 = $dj2;
        } else {
            $d1 = $dj2;
            $d2 = $dj1;
        }
        $d2 -= 0.5;
        /* Separate day and fraction. */
        $f1 = fmod($d1, 1.0);
        $f2 = fmod($d2, 1.0);
        $f  = fmod($f1 + $f2, 1.0);
        if ($f < 0.0) {
            $f += 1.0;
        }
        $d  = floor($d1 - $f1) + floor($d2 - $f2) + floor($f1 + $f2 - $f);
        $jd = floor($d) + 1;
        /* Express day in Gregorian calendar. */
        // Integer division parts of this block was modified in the PHP translation
        $l = $jd + 68569;
        $n = intval((4 * $l) / 146097);
        $l -= intval((146097 * $n + 3) / 4);
        $i = intval((4000 * ($l + 1)) / 1461001);
        $l -= ((1461 * $i) / 4) - 31;
        $k  = intval((80 * $l) / 2447);
        $id = round($l - (2447 * $k) / 80);
        $l  = intval($k / 11);
        $im = (int)($k + 2 - 12 * $l);
        $iy = (int)(100 * ($n - 49) + $i + $l);
        $fd = $f;

        return 0;
    }
206423
@Override
	protected void unserializeFrom(RawDataBuffer in)
    {
    	super.unserializeFrom(in);
    	consumerId = new IntegerID(in.readInt());
    }
162531
@Nullable
  private static Converter<List<String>, Object> createPrimitiveTypeConverter(final Class<?> resultClass) {
    Object defaultValue = defaultValue(resultClass);

    if (defaultValue == null) {
      // For primitive type, the default value shouldn't be null
      return null;
    }

    return new BasicConverter(defaultValue) {
      @Override
      protected Object convert(String value) throws Exception {
        return valueOf(value, resultClass);
      }
    };
  }
329747
function f_tumu_tarih_araligindakiler(_tahta_id, _tarih1, _tarih2) {
        console.log("f_tumu_tarih_araligindakiler")
        return f_idler_aktif_tarih_araligindakiler(_tahta_id, _tarih1, _tarih2)
            .then(function (_ihale_idler) {
                if (Array.isArray(_ihale_idler) && _ihale_idler.length > 0) {
                    /** @type {OptionsIhale} */
                    var opts = {};
                    opts.bArrKalemleri = true;
                    opts.bYapanKurum = true;
                    opts.bTakip = true;
                    opts.optKalem = {};
                    opts.optKalem.bArrTeklifleri = false;
                    opts.optKalem.bOnayDurumu = true;
                    opts.optKalem.bTakiptemi = true;

                    return f_id(_ihale_idler, _tahta_id, opts);
                } else {
                    return [];
                }
            });

    }
365746
@Override
  public Iterable<JsonObject> convertRecord(JsonArray outputSchema, String inputRecord, WorkUnitState workUnit)
      throws DataConversionException {
    try {
      String strDelimiter = workUnit.getProp(ConfigurationKeys.CONVERTER_CSV_TO_JSON_DELIMITER);
      if (Strings.isNullOrEmpty(strDelimiter)) {
        throw new IllegalArgumentException("Delimiter cannot be empty");
      }
      InputStreamCSVReader reader = new InputStreamCSVReader(inputRecord, strDelimiter.charAt(0),
          workUnit.getProp(ConfigurationKeys.CONVERTER_CSV_TO_JSON_ENCLOSEDCHAR, ConfigurationKeys.DEFAULT_CONVERTER_CSV_TO_JSON_ENCLOSEDCHAR).charAt(0));
      List<String> recordSplit;
      recordSplit = Lists.newArrayList(reader.splitRecord());
      JsonObject outputRecord = new JsonObject();

      for (int i = 0; i < outputSchema.size(); i++) {
        if (i < recordSplit.size()) {
          if (recordSplit.get(i) == null) {
            outputRecord.add(outputSchema.get(i).getAsJsonObject().get("columnName").getAsString(), JsonNull.INSTANCE);
          } else if (recordSplit.get(i).isEmpty() || recordSplit.get(i).toLowerCase().equals(NULL)) {
            outputRecord.add(outputSchema.get(i).getAsJsonObject().get("columnName").getAsString(), JsonNull.INSTANCE);
          } else {
            outputRecord.addProperty(outputSchema.get(i).getAsJsonObject().get("columnName").getAsString(), recordSplit.get(i));
          }
        } else {
          outputRecord.add(outputSchema.get(i).getAsJsonObject().get("columnName").getAsString(), JsonNull.INSTANCE);
        }
      }

      return new SingleRecordIterable<>(outputRecord);
    } catch (Exception e) {
      throw new DataConversionException(e);
    }
  }
1261802
private static int[] jdToGregorian(double jd) {
       double JULIAN_EPOCH = 1721425.5;
       double wjd, depoch, quadricent, dqc, cent, dcent, quad, dquad, yindex, yearday, leapadj;
       int year, month, day;
       
       wjd = Math.floor(jd - 0.5) + 0.5;
       depoch = wjd - JULIAN_EPOCH;
       quadricent = Math.floor(depoch / 146097);
       dqc = depoch % 146097;
       cent = Math.floor(dqc / 36524);
       dcent = dqc % 36524;
       quad = Math.floor(dcent / 1461);
       dquad = dcent % 1461;
       yindex = Math.floor(dquad / 365);
       year = (int)((quadricent * 400) + (cent * 100) + (quad * 4) + yindex);
       
       if (!((cent == 4) || (yindex == 4))) {
          year++;
       }
       
       yearday = wjd - gregorianToJD(year, 1, 1);
       leapadj = ((wjd < gregorianToJD(year, 3, 1)) ? 0
             :
             (isGregorianLeap(year) ? 1 : 2)
             );
       
       month = (int)Math.floor((((yearday + leapadj) * 12) + 373) / 367);
       day = (int)(wjd - gregorianToJD(year, month, 1)) + 1;

       int[] julianDate = new int[3];
       
       julianDate[0] = year;
       julianDate[1] = month;
       julianDate[2] = day;
       
       return julianDate;
    }
228932
@Override
    public INDArray convertDataEx(DataTypeEx typeSrc, INDArray source, DataTypeEx typeDst) {
        if (source.isView())
            throw new UnsupportedOperationException("Impossible to compress View. Consider using dup() before. ");

        DataBuffer buffer = convertDataEx(typeSrc, source.data(), typeDst);
        source.setData(buffer);

        if (buffer instanceof CompressedDataBuffer)
            source.markAsCompressed(true);
        else
            source.markAsCompressed(false);

        return source;
    }
397773
@Deprecated
    @Override
    protected int writeValueAndFinal(int i, boolean isFinal) {
        if(0<=i && i<=CharsTrie.kMaxOneUnitValue) {
            return write(i|(isFinal ? CharsTrie.kValueIsFinal : 0));
        }
        int length;
        if(i<0 || i>CharsTrie.kMaxTwoUnitValue) {
            intUnits[0]=(char)(CharsTrie.kThreeUnitValueLead);
            intUnits[1]=(char)(i>>16);
            intUnits[2]=(char)i;
            length=3;
        // } else if(i<=CharsTrie.kMaxOneUnitValue) {
        //     intUnits[0]=(char)(i);
        //     length=1;
        } else {
            intUnits[0]=(char)(CharsTrie.kMinTwoUnitValueLead+(i>>16));
            intUnits[1]=(char)i;
            length=2;
        }
        intUnits[0]=(char)(intUnits[0]|(isFinal ? CharsTrie.kValueIsFinal : 0));
        return write(intUnits, length);
    }