JALOPY | Java Source Code Formatter Beautifier Pretty Printer
Overview • Download • Documentation • Plug-ins • Links • Contact
Features | History | Manual | FAQ | Javadoc
This page generated: June 8 2004
4.3.2. White Space
Prev | 4.3. Printer | Next
- ### 4.3.2. White Space Controls the white space handling for the individual components of Java statements. #### 4.3.2.1. Space before Lets you choose the components that should get one leading space inserted before them. Method declaration parentheses Example 4.9. Method declaration parentheses
      public void someMethod()) {
        ...
      }

      public void someMethod ()) {
        ...
      }
- Method call parentheses Example 4.10. Method call parentheses
      for (Iterator i = pointList.iterator(); i.hasNext();) {
          ...
      }

      for (Iterator i = pointList.iterator (); i.hasNext ();) {
          ...
      }
- Statement parentheses Example 4.11. Statement parentheses
      while(!isDone)
          doSomething();

      while (!isDone)
          doSomething();
- Braces Example 4.12. Braces
          String[] values = new String[]{
              "One", "Two", "Three", "Four", "Five", "Six", "Seven"
          };

          String[] values = new String[] {
              "One", "Two", "Three", "Four", "Five", "Six", "Seven"
          };
- Brackets Example 4.13. Brackets
      for (i = 0; i < 100; i++)
          sum += value[i];

      for (i = 0; i < 100; i++)
          sum += value [i];
- Brackets in types Example 4.14. Brackets in types
      String[] names = (String[])data.toArray(new String[]);

      String [] names = (String [])data.toArray(new String []);
- Case colon Example 4.15. Case colon
      switch (character) {
          case 'A':
              break;
      }

      switch (character) {
          case 'A' :
              break;
      }
- #### 4.3.2.2. Space after Lets you choose what components should have one trailing space inserted after the component. Comma Example 4.16. Comma
      doSomething (a,b,c,d);

      doSomething (a, b, c, d);
- Semicolon Example 4.17. Semicolon
      for (i=0;i<10;i++) ...

      for (i=0; i<10; i++) ...
- Type Cast Example 4.18. Type Cast
      int line = ((JavaAST)node).getStartLine();

      int line = ((JavaAST) node).getStartLine();
- Negation Prints a space after the unary operators Logical NOT (!) and Bitwise NOT (~). Example 4.19. Logical NOT
      while(!isDone) {
          doSomething();
      }

      while(! isDone) {
          doSomething();
      }
- #### 4.3.2.3. Spaces around Controls what components should have both a leading and trailing space inserted. This is sometimes called "padding". Assignment Operators Example 4.20. Assignment Operators (=, +=, -=, *=, \=, %=, &=, |=, ^=, <<=, >>=, >>>=)
      a=(b+c)*d;
      a = (b+c)*d;
- Logical Operators Example 4.21. Logical Operators (&&, ||)
      if((LA(1)=='/')&&(LA(2)!='*'||(LA(2)=='*'&&LA(3)!='*'))) ...

      if((LA(1)=='/') && (LA(2)!='*' || (LA(2)=='*' && LA(3)!='*'))) ...
- Relational Operators Example 4.22. Relational Operators (==, !=, <, >, <=, >=)
      if((LA(1)=='\n'||LA(1)=='\r')) ...

      if((LA(1) == '\n'||LA(1) == '\r')) ...
- Bitwise Operators Example 4.23. Bitwise Operators (&, |, ^)
      public static final boolean isUnix()
      {
          return (getOperatingSystem()&PLAT_UNIX) != 0;
      }

      public static final boolean isUnix()
      {
          return (getOperatingSystem() & PLAT_UNIX) != 0;
      }
- Mathematical Operators Example 4.24. Mathematical Operators (+, -, /, *, %)
      a=(b+c)*d;

      a=(b + c) * d;
- Shift Operators Example 4.25. Shift Operators (<<, >>, >>>)
      if(((1L<<i)&l)!=0)
          System.out.print("1");

      if(((1L << i)&l)!=0)
          System.out.print("1");
- Braces Example 4.26. Braces
      Object[] items = {"2", "3", "4"};

      Object[] items = { "2", "3", "4" };
- Brackets Example 4.27. Brackets
      for (i = 0; i < 100; i++)
          sum += value[i];

      for(i = 0; i < 100; i++)
          sum += value[ i ];
- Parentheses Example 4.28. Parentheses
      GridBagLayout layout = new GridBagLayout();
      setLayout(layout);

      GridBagLayout layout = new GridBagLayout();
      setLayout( layout );
- Type Cast Parentheses Example 4.29. Type Cast Parentheses
      int line = ((JavaAST)node).getStartLine();

      int line = (( JavaAST )node).getStartLine();
Prev | Up | Next
4.3. Printer | Home | 4.3.3. Indentation
to top