Menu

Code explanation

Help
Marc
2008-06-11
2013-04-24
  • Marc

    Marc - 2008-06-11

    Hi there,

    I'm trying to 1) trace the code and 2) understand some statements.

    1) tracing the code

    where is the code that executes when I choose from the menu:

    1.a) Table > All Stocks > List All

    and then, after choosing one stock in the displayed table:

    1.b) Symbols > Table

    I am curious to see how are the quote stored and then retrieved.

    2) understanding some statements

    I have never seen these kinds of statements (the "run()" inside a method):

        public void tableStocks(final int type) {
            Thread thread = new Thread(new Runnable() {
                    public void run() {
                        String title =
                            new String(Locale.getString("LIST_IT",
                                EODQuoteRange.getDescription(type)));
                        tableStocks(title, type, null, null, null);
                    }
                });
            thread.start();
        }

    My guess is that a thread is defined, then the "method/code" associated with that thread is described, and then the thread is started. However that's just a guess... Would anyone have a reference (web page etc) that I can read on the subject?

    Thank you

     
    • Mark Hummel

      Mark Hummel - 2008-06-11

      1. Hint: What sort of user interface element is involved here? What sort of frame is created? Search for class names with this element as a suffix. If I recall correctly from previous discussions, you are a linux user. So combinations of find and grep are useful ways of discovering where things are in the source. e.g find . -name "*java" |xargs grep "void methodName"

      2. Pretty much. The code is an implementation of the Runnable interface. See:
      http://java.sun.com/docs/books/tutorial/essential/concurrency/
      http://www.javaworld.com/javaworld/jw-04-1996/jw-04-threads.html
      http://www.javabeginner.com/java-threads-tutorial.htm

      Hope that helps,
      Mark.

       
    • Marc

      Marc - 2008-06-11

      Thanks. Will check the references in #2.

      re: 1), I put some breakpoints in:

      public void tableStocks(final int type)

      public void tableStocks(final List symbols)

      private void tableStocks(String title, int type, String rule, SortedSet symbols, TradingDate date)

      and started to have an idea of what's going on.

      It lead me to QuoteModule(EODQuoteBundle quoteBundle,String filterExpressionString,boolean singleDate) and extractQuotesUsingRule(String filterExpression, EODQuoteBundle quoteBundle) but I have not found yet where the code is accessing the "files" containing the historical data.

       
    • Mark Hummel

      Mark Hummel - 2008-06-16

      Check out quote/QuoteSourceManager.java. There a few references to it in EODQuoteBundle.

       

Log in to post a comment.