test_class.file: jtstoolkit/src/test/java/ec/tstoolkit/timeseries/regression/StockTradingDaysVariablesTest.java
test_class.identifier: StockTradingDaysVariablesTest
test_case.body: @Test
      public void test1() {
          StockTradingDaysVariables td=new StockTradingDaysVariables(31);
          TsDomain dom=new TsDomain(TsFrequency.Monthly, 2014, 0, 12);
          Matrix m=new Matrix(12, 6);
          td.data(dom, m.columnList());
          assertTrue(m.get(0, 4)==1);
          assertTrue(m.get(1, 4)==1);
          assertTrue(m.get(2, 0)==1);
          assertTrue(m.get(3, 2)==1);
          assertTrue(m.get(4, 5)==1);
      }
test_case.class_method_signature: StockTradingDaysVariablesTest.test1()
test_case.full_signature: @Test public void test1()
test_case.identifier: test1
test_case.invocations: data columnList assertTrue get assertTrue get assertTrue get assertTrue get assertTrue get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test1()
focal_class.declarator: w_
focal_class.modifier: private final
focal_class.original_string: private final int w_;
focal_class.type: int
focal_class.var_name: w_
focal_class.file: jtstoolkit/src/main/java/ec/tstoolkit/timeseries/regression/StockTradingDaysVariables.java
focal_class.identifier: StockTradingDaysVariables
focal_class.interfaces: implements ITradingDaysVariable, Cloneable
focal_class.class_method_signature: StockTradingDaysVariables.StockTradingDaysVariables(int w)
focal_class.full_signature: public  StockTradingDaysVariables(int w)
focal_class.identifier: StockTradingDaysVariables
focal_class.modifiers: public
focal_class.parameters: (int w)
focal_class.signature:  StockTradingDaysVariables(int w)
focal_class.class_method_signature: StockTradingDaysVariables.clone()
focal_class.full_signature: @Override public StockTradingDaysVariables clone()
focal_class.identifier: clone
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: StockTradingDaysVariables
focal_class.signature: StockTradingDaysVariables clone()
focal_class.class_method_signature: StockTradingDaysVariables.getDefinitionDomain()
focal_class.full_signature: @Override public TsDomain getDefinitionDomain()
focal_class.identifier: getDefinitionDomain
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: TsDomain
focal_class.signature: TsDomain getDefinitionDomain()
focal_class.class_method_signature: StockTradingDaysVariables.getDefinitionFrequency()
focal_class.full_signature: @Override public TsFrequency getDefinitionFrequency()
focal_class.identifier: getDefinitionFrequency
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: TsFrequency
focal_class.signature: TsFrequency getDefinitionFrequency()
focal_class.class_method_signature: StockTradingDaysVariables.getDescription(TsFrequency context)
focal_class.full_signature: @Override public String getDescription(TsFrequency context)
focal_class.identifier: getDescription
focal_class.modifiers: @Override public
focal_class.parameters: (TsFrequency context)
focal_class.return: String
focal_class.signature: String getDescription(TsFrequency context)
focal_class.class_method_signature: StockTradingDaysVariables.getDim()
focal_class.full_signature: @Override public int getDim()
focal_class.identifier: getDim
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getDim()
focal_class.class_method_signature: StockTradingDaysVariables.getItemDescription(int idx, TsFrequency context)
focal_class.full_signature: @Override public String getItemDescription(int idx, TsFrequency context)
focal_class.identifier: getItemDescription
focal_class.modifiers: @Override public
focal_class.parameters: (int idx, TsFrequency context)
focal_class.return: String
focal_class.signature: String getItemDescription(int idx, TsFrequency context)
focal_class.class_method_signature: StockTradingDaysVariables.isSignificant(TsDomain domain)
focal_class.full_signature: @Override public boolean isSignificant(TsDomain domain)
focal_class.identifier: isSignificant
focal_class.modifiers: @Override public
focal_class.parameters: (TsDomain domain)
focal_class.return: boolean
focal_class.signature: boolean isSignificant(TsDomain domain)
focal_class.class_method_signature: StockTradingDaysVariables.data(TsDomain domain, List<DataBlock> data)
focal_class.full_signature: public void data(TsDomain domain, List<DataBlock> data)
focal_class.identifier: data
focal_class.modifiers: public
focal_class.parameters: (TsDomain domain, List<DataBlock> data)
focal_class.return: void
focal_class.signature: void data(TsDomain domain, List<DataBlock> data)
focal_method.body: public void data(TsDomain domain, List<DataBlock> data) {
          int n = domain.getLength();
          TsPeriod d0 = domain.getStart();
          int conv = 12 / d0.getFrequency().intValue();
          int[] begin = new int[n];
          int[] monthlen = new int[n];
          TsPeriod month = new TsPeriod(TsFrequency.Monthly);
          month.set(d0.getYear(), d0.getPosition() * conv);
          month.move(conv - 1);
          for (int i = 0; i < begin.length; ++i) {
              // begin contains the first day of the last month of each period
              begin[i] = Day.calc(month.getYear(), month.getPosition(), 0);
              monthlen[i] = Day.getNumberOfDaysByMonth(month.getYear(), month.getPosition());
              month.move(conv);
          }
          double[] z0 = new double[7];
          for (int j = 0; j < n; j++) {
              java.util.Arrays.fill(z0, 0.0d);
              //
              // z0[0] = Sunday
              //
              int dayofweek = (begin[j] - 3) % 7;
              int mlen = monthlen[j];
              if (dayofweek < 0) {
                  dayofweek += 7;
              }
              // 
              // w_ (like in Tramo ??) could be negative. (if we want to stock on the -w_ day before month-end
              // Example : 
              // w_ = -2 
              // 
              // Jan 29
              // Feb 26 or 27 (if LY)
              // .............
              // Apr 28
              // .............
              //
              if (this.w_ >= 0) {
                  if (this.w_ < mlen) {
                      mlen = this.w_;
                  }
              } else {
                  mlen += this.w_;
                  if (mlen <= 0) {
                      mlen = 1;
                  }
              }
              int Lastdayofweek = (dayofweek + (mlen - 1)) % 7;
              z0[Lastdayofweek] = 1.0d;
              for (int i = 0; i < 6; ++i) {
                  DataBlock x = data.get(i);
                  x.set(j, z0[i + 1] - z0[0]);
              }
          }
      }
focal_method.class_method_signature: StockTradingDaysVariables.data(TsDomain domain, List<DataBlock> data)
focal_method.full_signature: public void data(TsDomain domain, List<DataBlock> data)
focal_method.identifier: data
focal_method.invocations: getLength getStart intValue getFrequency set getYear getPosition move calc getYear getPosition getNumberOfDaysByMonth getYear getPosition move fill get set
focal_method.modifiers: public
focal_method.parameters: (TsDomain domain, List<DataBlock> data)
focal_method.return: void
focal_method.signature: void data(TsDomain domain, List<DataBlock> data)