Skip to content

Commit

Permalink
Re-enable java code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mario4tier committed Nov 9, 2024
1 parent fc23bd5 commit 87819cd
Show file tree
Hide file tree
Showing 6 changed files with 641 additions and 655 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ar-lib
# Ignore the generated binaries, but keep the bin soft links.
src/tools/gen_code/gen_code
src/tools/ta_regtest/ta_regtest
bin/*.class
!bin/HOLDER
!bin/gen_code

Expand Down
64 changes: 32 additions & 32 deletions java/src/com/tictactec/ta/lib/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
package com.tictactec.ta.lib;

public class Core {

private int[] unstablePeriod;

private CandleSetting[] candleSettings;

private Compatibility compatibility;

/** Creates a new instance of Core */
public Core() {
unstablePeriod = new int[com.tictactec.ta.lib.FuncUnstId.All
Expand All @@ -69,7 +69,7 @@ public Core() {
candleSettings[i] = new CandleSetting(TA_CandleDefaultSettings[i]);
}
}

public RetCode SetCandleSettings(CandleSettingType settingType,
RangeType rangeType, int avgPeriod, double factor) {
if (settingType.ordinal() >= CandleSettingType.AllCandleSettings
Expand All @@ -81,7 +81,7 @@ public RetCode SetCandleSettings(CandleSettingType settingType,
candleSettings[settingType.ordinal()].factor = factor;
return RetCode.Success;
}

final private CandleSetting TA_CandleDefaultSettings[] = {
/*
* real body is long when it's longer than the average of the 10
Expand Down Expand Up @@ -146,7 +146,7 @@ public RetCode SetCandleSettings(CandleSettingType settingType,
*/
new CandleSetting(CandleSettingType.Equal,
RangeType.HighLow, 5, 0.05) };

public RetCode RestoreCandleDefaultSettings(
CandleSettingType settingType) {
int i;
Expand All @@ -163,7 +163,7 @@ public RetCode RestoreCandleDefaultSettings(
}
return RetCode.Success;
}

public RetCode SetUnstablePeriod(FuncUnstId id, int period)
{
if (id.ordinal() >= FuncUnstId.All
Expand All @@ -172,22 +172,22 @@ public RetCode SetUnstablePeriod(FuncUnstId id, int period)
unstablePeriod[id.ordinal()] = period;
return RetCode.Success;
}

public int GetUnstablePeriod(FuncUnstId id)
{
return unstablePeriod[id.ordinal()];
}

public void SetCompatibility(Compatibility compatibility)
{
this.compatibility = compatibility;
}

public Compatibility getCompatibility()
{
return compatibility;
}

/**** START GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/
public int accbandsLookback( int optInTimePeriod )
{
Expand Down Expand Up @@ -2309,7 +2309,7 @@ else if( inReal == outRealMiddleBand )
}
if( tempBuffer1 != outRealMiddleBand )
{
System.arraycopy(tempBuffer1,0,outRealMiddleBand,0,outNBElement.value) ;
System.arraycopy(tempBuffer1,0,outRealMiddleBand,0,outNBElement.value ) ;
}
if( optInNbDevUp == optInNbDevDn )
{
Expand Down Expand Up @@ -10775,11 +10775,11 @@ public RetCode cdlStalledPattern( int startIdx,
return RetCode.Success ;
}
/* Generated */
public int cdlStickSandwhichLookback( )
public int cdlStickSandwichLookback( )
{
return (this.candleSettings[CandleSettingType.Equal.ordinal()].avgPeriod) + 2;
}
public RetCode cdlStickSandwhich( int startIdx,
public RetCode cdlStickSandwich( int startIdx,
int endIdx,
double inOpen[],
double inHigh[],
Expand All @@ -10795,7 +10795,7 @@ public RetCode cdlStickSandwhich( int startIdx,
return RetCode.OutOfRangeStartIndex ;
if( (endIdx < 0) || (endIdx < startIdx))
return RetCode.OutOfRangeEndIndex ;
lookbackTotal = cdlStickSandwhichLookback ();
lookbackTotal = cdlStickSandwichLookback ();
if( startIdx < lookbackTotal )
startIdx = lookbackTotal;
if( startIdx > endIdx )
Expand Down Expand Up @@ -10833,7 +10833,7 @@ public RetCode cdlStickSandwhich( int startIdx,
outBegIdx.value = startIdx;
return RetCode.Success ;
}
public RetCode cdlStickSandwhich( int startIdx,
public RetCode cdlStickSandwich( int startIdx,
int endIdx,
float inOpen[],
float inHigh[],
Expand All @@ -10849,7 +10849,7 @@ public RetCode cdlStickSandwhich( int startIdx,
return RetCode.OutOfRangeStartIndex ;
if( (endIdx < 0) || (endIdx < startIdx))
return RetCode.OutOfRangeEndIndex ;
lookbackTotal = cdlStickSandwhichLookback ();
lookbackTotal = cdlStickSandwichLookback ();
if( startIdx < lookbackTotal )
startIdx = lookbackTotal;
if( startIdx > endIdx )
Expand Down Expand Up @@ -12459,7 +12459,7 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
{
return retCode;
}
secondEMA = new double[firstEMANbElement.value] ;
secondEMA = new double[firstEMANbElement.value ] ;
retCode = TA_INT_EMA ( 0, firstEMANbElement.value -1, firstEMA,
optInTimePeriod, k,
secondEMABegIdx , secondEMANbElement ,
Expand Down Expand Up @@ -12523,7 +12523,7 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
{
return retCode;
}
secondEMA = new double[firstEMANbElement.value] ;
secondEMA = new double[firstEMANbElement.value ] ;
retCode = TA_INT_EMA ( 0, firstEMANbElement.value -1, firstEMA,
optInTimePeriod, k,
secondEMABegIdx , secondEMANbElement ,
Expand Down Expand Up @@ -22001,15 +22001,15 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
inReal, optInTimePeriod,
outBegIdx, outNBElement, outReal );
}
TA_INT_SMA( int startIdx,
RetCode TA_INT_SMA( int startIdx,
int endIdx,
double inReal[], <-- Arrays
double inReal[],
int optInTimePeriod,
MInteger outBegIdx,
MInteger outNBElement,
double outReal[] ) : RetCode
double outReal[] )
{
let mut periodTotal, tempReal;
double periodTotal, tempReal;
int i, outIdx, trailingIdx, lookbackTotal;
lookbackTotal = (optInTimePeriod-1);
if( startIdx < lookbackTotal )
Expand Down Expand Up @@ -22504,7 +22504,7 @@ else if( tmp >= highest )
tempBuffer, optInSlowD_Period,
optInSlowD_MAType,
outBegIdx, outNBElement, outSlowD );
System.arraycopy(tempBuffer,lookbackDSlow,outSlowK,0,(int)outNBElement.value) ;
System.arraycopy(tempBuffer,lookbackDSlow,outSlowK,0,(int) outNBElement.value ) ;
if( retCode != RetCode.Success )
{
outBegIdx.value = 0 ;
Expand Down Expand Up @@ -22638,7 +22638,7 @@ else if( tmp >= highest )
tempBuffer, optInSlowD_Period,
optInSlowD_MAType,
outBegIdx, outNBElement, outSlowD );
System.arraycopy(tempBuffer,lookbackDSlow,outSlowK,0,(int)outNBElement.value) ;
System.arraycopy(tempBuffer,lookbackDSlow,outSlowK,0,(int) outNBElement.value ) ;
if( retCode != RetCode.Success )
{
outBegIdx.value = 0 ;
Expand Down Expand Up @@ -22794,7 +22794,7 @@ else if( tmp >= highest )
outNBElement.value = 0 ;
return retCode;
}
System.arraycopy(tempBuffer,lookbackFastD,outFastK,0,(int)outNBElement.value) ;
System.arraycopy(tempBuffer,lookbackFastD,outFastK,0,(int) outNBElement.value ) ;
if( retCode != RetCode.Success )
{
outBegIdx.value = 0 ;
Expand Down Expand Up @@ -22917,7 +22917,7 @@ else if( tmp >= highest )
outNBElement.value = 0 ;
return retCode;
}
System.arraycopy(tempBuffer,lookbackFastD,outFastK,0,(int)outNBElement.value) ;
System.arraycopy(tempBuffer,lookbackFastD,outFastK,0,(int) outNBElement.value ) ;
if( retCode != RetCode.Success )
{
outBegIdx.value = 0 ;
Expand Down Expand Up @@ -23667,7 +23667,7 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
{
return retCode;
}
secondEMA = new double[firstEMANbElement.value] ;
secondEMA = new double[firstEMANbElement.value ] ;
retCode = TA_INT_EMA ( 0, firstEMANbElement.value -1, firstEMA,
optInTimePeriod, k,
secondEMABegIdx , secondEMANbElement ,
Expand Down Expand Up @@ -23743,7 +23743,7 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
{
return retCode;
}
secondEMA = new double[firstEMANbElement.value] ;
secondEMA = new double[firstEMANbElement.value ] ;
retCode = TA_INT_EMA ( 0, firstEMANbElement.value -1, firstEMA,
optInTimePeriod, k,
secondEMABegIdx , secondEMANbElement ,
Expand Down Expand Up @@ -25175,7 +25175,7 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
{
outBegIdx.value = startIdx;
outNBElement.value = endIdx-startIdx+1;
System.arraycopy(inReal,startIdx,outReal,0,(int)outNBElement.value) ;
System.arraycopy(inReal,startIdx,outReal,0,(int) outNBElement.value ) ;
return RetCode.Success ;
}
divider = (optInTimePeriod*(optInTimePeriod+1))>>1;
Expand Down Expand Up @@ -25272,5 +25272,5 @@ else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
}
/* Generated */
/**** END GENCODE SECTION 1 - DO NOT DELETE THIS LINE ****/

}
2 changes: 1 addition & 1 deletion java/src/com/tictactec/ta/lib/meta/TaFuncMetaInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class TaFuncMetaInfo extends TaFuncSignature

public TaFuncMetaInfo(String name, Method method, Method lookbackMethod)
{
this.name = name;doForEachFunctionPhase2
this.name = name;
this.method = method;
this.lookbackMethod = lookbackMethod;
this.optionTypes = lookbackMethod.getParameterTypes();
Expand Down
2 changes: 1 addition & 1 deletion src/ta_func/ta_utility.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Provides common mathematical or analysis functions.
*
* These functions are all PRIVATE to ta-lib and should
* never be called directly by the user of the TA-LIB.
* never be called directly by the library users.
*/

#ifndef TA_UTILITY_H
Expand Down
Loading

0 comments on commit 87819cd

Please sign in to comment.