Class RGroupList
- java.lang.Object
-
- org.openscience.cdk.isomorphism.matchers.RGroupList
-
- All Implemented Interfaces:
IRGroupList
public class RGroupList extends Object implements IRGroupList
Represents a list of Rgroup substitutes to be associated with someRGroupQuery
.- Author:
- Mark Rijnbeek
- Source code:
- main
- Belongs to CDK module:
- isomorphism
- Keywords:
- Rgroup, R group, R-group
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_OCCURRENCE
Default value for occurrence field.
-
Constructor Summary
Constructors Constructor Description RGroupList(int rGroupNumber)
Default constructor.RGroupList(int rGroupNumber, boolean restH, String occurrence, int requiredRGroupNumber)
Constructor with attributes given.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getOccurrence()
Returns the occurrence value.int
getRequiredRGroupNumber()
Access the dependant Rgroup number if R1 then R2.int
getRGroupNumber()
Get the Rgroup number, for example R1 => 1.List<IRGroup>
getRGroups()
Access the list of possible RGroups.int
hashCode()
boolean
isRestH()
Indicates that sites labeled with this Rgroup may only be substituted with a member of the Rgroup or with hydrogen.static boolean
isValidOccurrenceSyntax(String occ)
Validates the occurrence value.List<Integer>
matchOccurence(int maxAttachments)
Matches the 'occurrence' condition with a provided maximum number of RGroup attachments.void
setOccurrence(String occurrence)
Picky setter for occurrence fields.void
setRequiredRGroupNumber(int rGroupNumberImplicated)
void
setRestH(boolean restH)
void
setRGroupNumber(int rGroupNumber)
Setter for rGroupNumber, checks for valid range.void
setRGroups(List<IRGroup> rGroups)
-
-
-
Field Detail
-
DEFAULT_OCCURRENCE
public static final String DEFAULT_OCCURRENCE
Default value for occurrence field.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RGroupList
public RGroupList(int rGroupNumber)
Default constructor.
-
RGroupList
public RGroupList(int rGroupNumber, boolean restH, String occurrence, int requiredRGroupNumber) throws CDKException
Constructor with attributes given.- Parameters:
rGroupNumber
- R-Group numberrestH
- restHoccurrence
- occurrencerequiredRGroupNumber
- number of other R-Group required- Throws:
CDKException
-
-
Method Detail
-
setRGroupNumber
public void setRGroupNumber(int rGroupNumber)
Setter for rGroupNumber, checks for valid range. Spec: "value from 1 to 32 *, labels position of Rgroup on root."- Parameters:
rGroupNumber
- R-Group number
-
getRGroupNumber
public int getRGroupNumber()
Description copied from interface:IRGroupList
Get the Rgroup number, for example R1 => 1.- Specified by:
getRGroupNumber
in interfaceIRGroupList
- Returns:
- the Rgroup number
-
setRestH
public void setRestH(boolean restH)
-
isRestH
public boolean isRestH()
Description copied from interface:IRGroupList
Indicates that sites labeled with this Rgroup may only be substituted with a member of the Rgroup or with hydrogen.- Specified by:
isRestH
in interfaceIRGroupList
-
setRequiredRGroupNumber
public void setRequiredRGroupNumber(int rGroupNumberImplicated)
-
getRequiredRGroupNumber
public int getRequiredRGroupNumber()
Description copied from interface:IRGroupList
Access the dependant Rgroup number if R1 then R2.- Specified by:
getRequiredRGroupNumber
in interfaceIRGroupList
- Returns:
- the required Rgroup number.
-
getRGroups
public List<IRGroup> getRGroups()
Description copied from interface:IRGroupList
Access the list of possible RGroups.- Specified by:
getRGroups
in interfaceIRGroupList
- Returns:
- the rgroups.
-
getOccurrence
public String getOccurrence()
Returns the occurrence value.- Specified by:
getOccurrence
in interfaceIRGroupList
- Returns:
- occurrence
-
setOccurrence
public void setOccurrence(String occurrence) throws CDKException
Picky setter for occurrence fields. Validates user input to be conform the (Symyx) specification.- Parameters:
occurrence
- occurence value- Throws:
CDKException
-
isValidOccurrenceSyntax
public static boolean isValidOccurrenceSyntax(String occ)
Validates the occurrence value.- n : exactly n ;
- n - m : n through m ;
- > n : greater than n ;
- < n : fewer than n ;
- default (blank) is > 0 ;
- Parameters:
occ
- String to validate.- Returns:
- true if valid String provided.
-
matchOccurence
public List<Integer> matchOccurence(int maxAttachments)
Matches the 'occurrence' condition with a provided maximum number of RGroup attachments. Returns the valid occurrences (numeric) for these two combined. If none found, returns empty list.
Example: if R1 occurs 3 times attached to some root structure, then stating ">5" as an occurrence for that RGoupList does not make sense: the example R1 can occur 0..3 times. Empty would be returned.
If the occurence would be >2, then 3 would be returned. Etcetera.- Specified by:
matchOccurence
in interfaceIRGroupList
- Parameters:
maxAttachments
- number of attachments- Returns:
- valid values by combining a max for R# with the occurrence cond.
-
-