Jindent - Java Source Code Formatter http://www.jindent.com
 



title
5.6.2.7.2 Operators

Padding assignment operators = += -= /= *= ...

Padding assignment operators  = += -= /= *= ...

Controls whether white spaces are inserted before and after assignment operators or not.


Use padding:

int·x·=·y-1;                            


Do not use padding:

int·x=y-1;                              



Padding conditional operators && ||

Padding conditional operators  && ||

Controls whether white spaces are inserted before and after conditional operators or not.


Use padding:

BOOLEAN·b·=·condition1·&&·(condition2·||·condition3);


Do not use padding:

BOOLEAN·b·=·condition1&&(condition2||condition3);



Padding equality operators == !=

Padding equality operators  == !=

Controls whether white spaces are inserted before and after equaltiy operators or not.


Use padding:

BOOLEAN·b·=·(value1·==·value2)·||·(value3·!=·value4);


Do not use padding:

BOOLEAN·b·=·(value1==value2)·||·(value3!=value4);



Padding relational operators < > <= =>

Padding relational operators  < > <= =>

Controls whether white spaces are inserted before and after relational operators or not.


Use padding:

BOOLEAN·b·=·(value1·<·value2)·||·(value3·=>·value4);


Do not use padding:

BOOLEAN·b·=·(value1<value2)·||·(value3=>value4);



Padding additive operators + -

Padding additive operators  + -

Controls whether white spaces are inserted before and after additive operators or not.


Use padding:

int·value·=·a·+·b·-·c;                  


Do not use padding:

int·value·=·a+b-c;                      



Padding multiplicative operators * / %

Padding multiplicative operators  * / %

Controls whether white spaces are inserted before and after multiplicative operators or not.


Use padding:

float·value·=·a·*·b·/·c;                


Do not use padding:

float·value·=·a*b/c;                    



Padding bitwise operators & | ^

Padding bitwise operators  & | ^

Controls whether white spaces are inserted before and after bitwise operators or not.


Use padding:

int·value·=·a·&·255·|·b;                


Do not use padding:

int·value·=·a&255|b;                    



Padding shift operators << >>

Padding shift operators  << >>

Controls whether white spaces are inserted before and after shift operators or not.


Use padding:

BYTE·value·=·a·<<·3;                    


Do not use padding:

BYTE·value·=·a<<3;                      



Padding input/output operators << >>

Padding input/output operators  << >>

Controls whether white spaces are inserted before and after input/output operators << and >>.


Use padding:

cout·<<·"some·text"·<<·endl;            


Do not use padding:

cout<<"some·text"<<endl;                



Space before bangs !

Space before bangs !

Controls whether a white space is inserted before bang tokens or not.


Insert a white space before:

if(·!(x·==·3)){                         
    callMethodC();                      
}                                       


Do not insert a white space before:

if(!(x·==·3)){                          
    callMethodC();                      
}                                       



Space after bangs !

Space after bangs !

Controls whether a white space is inserted after bang tokens or not.


Insert a white space after:

if(!·(x·==·3)){                         
    callMethodC();                      
}                                       


Do not insert a white space after:

if(!(x·==·3)){                          
    callMethodC();                      
}                                       



Space before bangs ! appearing together with && ||

Space before bangs ! appearing together with && ||

Controls whether a white space is inserted before bang tokens appearing together with and (&&)/or (||) conditions or not.


Insert a white space before:

if(((w==y)·||·!(w>=0))·&&·!(w<y))·{·    
    
...                                 
}                                       


Do not insert a white space before:

if(((w==y)·||!(w>=0))·&&!(w<y))·{·      
    
...                                 
}                                       



Space after bangs ! appearing together with && ||

Space after bangs ! appearing together with && ||

Controls whether a white space is inserted after bang tokens appearing together with and (&&)/or (||) conditions or not.


Insert a white space after:

if(((w==y)·||!·(w>=0))·&&!·(w<y))·{·    
    
...                                 
}                                       


Do not insert a white space after:

if(((w==y)·||!(w>=0))·&&!(w<y))·{·      
    
...                                 
}                                       



Space before tildes ~

Space before tildes ~

Controls whether a white space is inserted before tildes or not.


Insert a white space before:

BYTE·u·=·~1;                            


Do not insert a white space before:

BYTE·u·=~1;                             



Space after tildes ~

Space after tildes ~

Controls whether a white space is inserted after tildes or not.


Insert a white space after:

BYTE·u·=·~1;                            


Do not insert a white space after:

BYTE·u·=·~·1;                           



Padding pointer operators ->

Padding pointer operators  ->

Controls whether white spaces are inserted before and after pointer operators ->.


Use padding:

myObject·->·getValue();                 


Do not use padding:

myObject->getValue();                   



Space before reference operators & in types

Space before reference operators & in types

Controls whether a white space is inserted before ampersand tokens in types or not.
In the following examples we assume that the setting 'Align ampersands & in pointers to types' is enabled.


Insert a white space before:

    int·&·test(AbstractBuffer·&·········buf1,
    
···········unsigned·char·&··········bytes,
    
···········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space before:

    int&·test(AbstractBuffer&··········buf1,
    
··········unsigned·char&···········bytes,
    
··········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align reference operators & to types and not to names




Space after reference operators & in types

Space after reference operators & in types

Controls whether a white space is inserted after ampersand tokens in types or not.
In the following examples we assume that the setting 'Align ampersands & in pointers to types' is enabled.


Insert a white space after:

    int·&·test(AbstractBuffer·&·········buf1,
    
···········unsigned·char·&··········bytes,
    
···········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space after:

    int·&test(AbstractBuffer·&·········buf1,
    
··········unsigned·char·&··········bytes,
    
··········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align reference operators & to types and not to names




Space before reference operators & in names

Space before reference operators & in names

Controls whether a white space is inserted before ampersand tokens in names or not.
In the following examples we assume that the setting 'Align ampersands & in pointers to types' is disabled.


Insert a white space before:

    int·test(AbstractBuffer···········&buf1,
    
·········unsigned·char············&bytes,
    
·········qualifier·AbstractBuffer·&buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space before:

    int·test(AbstractBuffer··········&buf1,
    
·········unsigned·char···········&bytes,
    
·········qualifier·AbstractBuffer&buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align reference operators & to types and not to names




Space after reference operators & in names

Space after reference operators & in names

Controls whether a white space is inserted after ampersand tokens in names or not.
In the following examples we assume that the setting 'Align ampersands & in pointers to types' is disabled.


Insert a white space after:

    int·test(AbstractBuffer···········&·buf1,
    
·········unsigned·char············&·bytes,
    
·········qualifier·AbstractBuffer·&·buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space after:

    int·test(AbstractBuffer···········&buf1,
    
·········unsigned·char············&bytes,
    
·········qualifier·AbstractBuffer·&buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align reference operators & to types and not to names




Space before dereference operators * in types

Space before dereference operators * in types

Controls whether a white space is inserted before star tokens in types or not.
In the following examples we assume that the setting 'Align stars * in pointers to types' is enabled.


Insert a white space before:

    int·*·test(AbstractBuffer·*·········buf1,
    
···········unsigned·char·*··········bytes,
    
···········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space before:

    int*·test(AbstractBuffer*··········buf1,
    
··········unsigned·char*···········bytes,
    
··········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align dereference operators * to types and not to names




Space after dereference operators * in types

Space after dereference operators * in types

Controls whether a white space is inserted after star tokens in types or not.
In the following examples we assume that the setting 'Align stars * in pointers to types' is enabled.


Insert a white space after:

    int·*·test(AbstractBuffer·*·········buf1,
    
···········unsigned·char·*··········bytes,
    
···········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space after:

    int·*test(AbstractBuffer·*·········buf1,
    
··········unsigned·char·*··········bytes,
    
··········qualifier·AbstractBuffer·buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align dereference operators * to types and not to names




Space before dereference operators * in names

Space before dereference operators * in names

Controls whether a white space is inserted before star tokens in names or not.
In the following examples we assume that the setting 'Align stars * in pointers to types' is disabled.


Insert a white space before:

    int·test(AbstractBuffer···········*buf1,
    
·········unsigned·char············*bytes,
    
·········qualifier·AbstractBuffer·*buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space before:

    int·test(AbstractBuffer··········*buf1,
    
·········unsigned·char···········*bytes,
    
·········qualifier·AbstractBuffer*buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align dereference operators * to types and not to names




Space after dereference operators * in names

Space after dereference operators * in names

Controls whether a white space is inserted after star tokens in names or not.
In the following examples we assume that the setting 'Align stars * in pointers to types' is disabled.


Insert a white space after:

    int·test(AbstractBuffer···········*·buf1,
    
·········unsigned·char············*·bytes,
    
·········qualifier·AbstractBuffer·*·buf2)
    {                                   
    
····//·...                          
    
}                                   


Do not insert a white space after:

    int·test(AbstractBuffer···········*buf1,
    
·········unsigned·char············*bytes,
    
·········qualifier·AbstractBuffer·*buf2)
    {                                   
    
····//·...                          
    
}                                   

See also... See also: Align dereference operators * to types and not to names