Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored code using some boolean convenience functions to improve code... #57

Closed
wants to merge 1 commit into from
Closed

Conversation

ghost
Copy link

@ghost ghost commented Sep 2, 2014

... readability.

I'll add a second patch containing only reformatting once this patch has been accepted, to clean up the formatting problems encountered on the previous patch.

}
counter++;
if (isHeavyAtom(chain.getAtom(i))) {
if (!chain.getAtom(i).getFlag(CDKConstants.VISITED)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay - but PMD warns on

if(bool){
  if(bool){
  } // no else
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected that - I split the test from one into two so that I could apply one of my methods, and to disentangle what was going on in the if-statement. Now that I've figured it out, I'll probably recombine these two ifs.

From: John May
Sent: Tuesday, September 02, 2014 8:11 PM
To: cdk/cdk
Cc: mbv31602
Subject: Re: [cdk] Refactored code using some boolean convenience functions to improve code... (#57)

In tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java:

  •             try{
    
  •                 if (getDoubleBondConfiguration2D( molecule.getBond(molecule.getAtom(first_atoms[counter-1]),molecule.getAtom(first_atoms[counter-2])),
    
  •                                 (molecule.getAtom(first_atoms[counter])).getPoint2d(),(molecule.getAtom(first_atoms[counter-1])).getPoint2d(),
    
  •                                 (molecule.getAtom(first_atoms[counter-2])).getPoint2d(),(molecule.getAtom(first_atoms[counter-3])).getPoint2d())
    
  •                     ==5){
    
  •                     dihedrals[counter] = DIHEDRAL_BRANCHED_CHAIN;
    
  •                 }else{ dihedrals[counter] = DIHEDRAL_EXTENDED_CHAIN;}
    
  •             }catch(CDKException ex1){
    
  •                 dihedrals[counter] = DIHEDRAL_EXTENDED_CHAIN;
    
  •             }
    
  •         } else {
    
  •             dihedrals[counter] = -1;
    
  •         }
    
  •         counter++;
    
  •     if (isHeavyAtom(chain.getAtom(i))) {
    
  •            if (!chain.getAtom(i).getFlag(CDKConstants.VISITED)) {
    
    Okay - but PMD warns on

if(bool){
if(bool){
} // no else
}

Reply to this email directly or view it on GitHub.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem.

@johnmay
Copy link
Member

johnmay commented Sep 2, 2014

All good - applied and pushed. Thanks. J

@johnmay johnmay closed this Sep 2, 2014
@ghost ghost deleted the builder3d/refactoring branch September 27, 2014 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant