Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 2 FirstFirst 12
Results 26 to 35 of 35

Thread: how to code a work around for a missing class

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: how to code a work around for a missing class

    Where is the variable: properties given a value? In other words: Where is it to the left of an =?

    no
    I have asked so many questions that you have skipped or ignored, I do not know which one this is an answer to.
    Please explain.

    --- Update ---

    Where is the variable: properties declared?
    Something like: Properties properties ...
    If you don't understand my answer, don't ignore it, ask a question.

  2. #27
    Member
    Join Date
    Mar 2021
    Posts
    37
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: how to code a work around for a missing class

    [QUOTE=Norm;170906]Where is the variable: properties given a value? In other words: Where is it to the left of an =?
    public class BM_mod10 implements IStrategy {
        //
        private         Vector<Stg_Base>     strategies;        
        private            boolean           mInitialized  = false;
        private            long              mTimeInfoS    = 0;
        private            long              mTimeLev      = 0;
        private static final     boolean           testing          = false;
        /**
         * Interface to the main engine, that allows orders submission, merging etc
         */
        private static    IEngine           engine         = null;
            /**
         * Methods of this interface allows to retrieve account information such as
         * current equity
         */
        private static final    IAccount          account        = null;
        /**
         * The IHistory interface represents API for historical data
         * access.
         */
        private static final    IHistory          history        = null;
        private static    IConsole          console        = null;
        private static    IContext          context        = null;
        //Instantiating the properties file
        public static     Properties        properties     = new Properties();
        public  static    Logger            logger         = null;

    I have asked so many questions that you have skipped or ignored, I do not know which one this is an answer to.
    Please explain.[COLOR="Silver"]

    no - in answer to question:-Have you tried adding the source for a Properties class with the required methods to the source of one of your programs that uses Properties class?

  3. #28
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: how to code a work around for a missing class

    Ok, that looks about right.
    Can you try adding a Properties class with the required methods to see if your code will compile without errors?
    If you don't understand my answer, don't ignore it, ask a question.

  4. #29
    Member
    Join Date
    Mar 2021
    Posts
    37
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: how to code a work around for a missing class

    That's where I am at a loss

    All I understand is that I need to create a properties class which has 3 methods
    putProperty(), getProperty() and containsKeyProperty()
    The first should be identical to the existing java putProperty() with both arguments being strings
    The second needs to cater for the second argument being either an integer, a double or a boolean value
    The third, I am unsure

  5. #30
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: how to code a work around for a missing class

    What have you tried? Post the current code and any error messages you get when compiling it.

    When you get a clean compile for the Properties class, try adding it to one of your classes that uses it to see if that class will compile with your version.

    When you get clean compiles, then work on filling in the details on what the code needs to do.

    A sample get method for testing:
       boolean getProperty(String s, boolean b) {
          return b;
       }

    ================================================== ==============
    Why have properties? What good are they? Why not just hardcode the values set by the put method?
    Instead of having these two statements:
                properties.put("signaler.macd.gemFast","12"); 
                gemFast        = BM_mod10.properties.getProperty("signaler.macd.gemFast", 12);

    Just have this one simple statement:
    		gemFast = 12;
    If you don't understand my answer, don't ignore it, ask a question.

  6. #31
    Member
    Join Date
    Mar 2021
    Posts
    37
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: how to code a work around for a missing class

    re your second point:-

    That is exactly what I have coded in the meantime
    I have commented out all the put, get, containsKey code

    and have a whole lot of variable = value lines

    It is just that I am unsure that the correct variables are getting the correct values

    Do you think the whole properties exercise is not necessary?

    --- Update ---

    an example of what I have at the moment
                // STATIC properties
    /*            gebAmount           = BM_mod10.properties.getProperty("strategy.gebAmount",0.01);
                gebMaxOrders        = BM_mod10.properties.getProperty("strategy.gebMaxOrders", 1);                
                gebRatGoal          = BM_mod10.properties.getProperty("strategy.gebRatGoal", 60);
                gebRatStop          = BM_mod10.properties.getProperty("strategy.gebRatStop", 100);
                gebRatTrailing      = BM_mod10.properties.getProperty("strategy.gebRatTrailing", 0);
                gebOrderWithLimit   = BM_mod10.properties.getProperty("strategy.gebOrderWithLimit", true);
                gebOrderToRun       = BM_mod10.properties.getProperty("strategy.gebOrderToRun", false);
                gebReEnter          = BM_mod10.properties.getProperty("strategy.gebReEnter", true);
    */
                gebAmount           = 0.01;
                gebMaxOrders        = 1;                
                gebRatGoal          = 60;
                gebRatStop          = 100;
                gebRatTrailing      = 0;
                gebOrderWithLimit   = true;
                gebOrderToRun       = false;
                gebReEnter          = true;

  7. #32
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: how to code a work around for a missing class

    Do you think the whole properties exercise is not necessary?
    Yes. I don't see any use for them if the put methods always set the same values.

    I use properties in my programs to save program state/values across executions of the program. For example the last folder where a file was loaded from or the location on the screen where the window was displayed.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #33
    Member
    Join Date
    Mar 2021
    Posts
    37
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: how to code a work around for a missing class

    Norm

    Thank you for expending so much energy in trying to unravel my brain

    I need to go away and convince myself that removing the whole property concept and hard-coding the values results in the same set of variable values

    I shall come back if I find it hard to do that exercise successfully

    Bob M
    New Zealand

    p.s. I am 75 years young

  9. #34
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: how to code a work around for a missing class

    Glad to be able to help. Come back anytime.
    I spent 18 months in NZ in 89-91. Worked at AirNZ in Auckland for a year. Loved NZ.
    If you don't understand my answer, don't ignore it, ask a question.

  10. #35
    Member
    Join Date
    Mar 2021
    Posts
    37
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: how to code a work around for a missing class

    You were correct Norm,
    Of all the many variables, only 3 have different values depending on the currency pair traded
    One a boolean and the other two integer values
    Now hard coded...........
    All good

    Bob M
    Dunedin, NZ

Page 2 of 2 FirstFirst 12

Similar Threads

  1. what is missing for txt to work I have several errors
    By jairofrg in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 31st, 2019, 01:30 AM
  2. Missing Class?
    By aussiemcgr in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 18th, 2013, 07:49 AM
  3. Missing class file
    By Skybear in forum What's Wrong With My Code?
    Replies: 6
    Last Post: April 7th, 2013, 08:07 PM
  4. This Code worked on a separate class but does not work on another class
    By titowinky in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 25th, 2012, 08:48 AM
  5. Java error in password generator program
    By Lizard in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 16th, 2009, 07:49 PM

Tags for this Thread