| 1 | # | ||
| 2 | # BioPerl module for Bio::Factory::ObjectBuilderI | ||
| 3 | # | ||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||
| 5 | # | ||
| 6 | # Cared for by Hilmar Lapp <hlapp at gmx.net> | ||
| 7 | # | ||
| 8 | # Copyright Hilmar Lapp | ||
| 9 | # | ||
| 10 | # You may distribute this module under the same terms as perl itself | ||
| 11 | |||
| 12 | # | ||
| 13 | # (c) Hilmar Lapp, hlapp at gmx.net, 2002. | ||
| 14 | # (c) GNF, Genomics Institute of the Novartis Research Foundation, 2002. | ||
| 15 | # | ||
| 16 | # You may distribute this module under the same terms as perl itself. | ||
| 17 | # Refer to the Perl Artistic License (see the license accompanying this | ||
| 18 | # software package, or see http://www.perl.com/language/misc/Artistic.html) | ||
| 19 | # for the terms under which you may use, modify, and redistribute this module. | ||
| 20 | # | ||
| 21 | # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED | ||
| 22 | # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | ||
| 23 | # MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
| 24 | # | ||
| 25 | |||
| 26 | # POD documentation - main docs before the code | ||
| 27 | |||
| 28 | =head1 NAME | ||
| 29 | |||
| 30 | Bio::Factory::ObjectBuilderI - Interface for an object builder | ||
| 31 | |||
| 32 | =head1 SYNOPSIS | ||
| 33 | |||
| 34 | Give standard usage here | ||
| 35 | |||
| 36 | =head1 DESCRIPTION | ||
| 37 | |||
| 38 | An object builder is different from an object factory in that it | ||
| 39 | accumulates information for the object and finally, or constantly, | ||
| 40 | depending on the implementation, builds the object. It also allows for | ||
| 41 | implementations that can tell the information feed in which kind of | ||
| 42 | information the builder is interested in which not. In addition, the | ||
| 43 | implementation may choose to filter, transform, or completely ignore | ||
| 44 | certain content it is fed for certain slots. | ||
| 45 | |||
| 46 | Implementations will hence be mostly used by stream-based parsers to | ||
| 47 | parse only desired content, and/or skip over undesired entries. | ||
| 48 | |||
| 49 | =head1 FEEDBACK | ||
| 50 | |||
| 51 | =head2 Mailing Lists | ||
| 52 | |||
| 53 | User feedback is an integral part of the evolution of this and other | ||
| 54 | Bioperl modules. Send your comments and suggestions preferably to | ||
| 55 | the Bioperl mailing list. Your participation is much appreciated. | ||
| 56 | |||
| 57 | bioperl-l@bioperl.org - General discussion | ||
| 58 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||
| 59 | |||
| 60 | =head2 Support | ||
| 61 | |||
| 62 | Please direct usage questions or support issues to the mailing list: | ||
| 63 | |||
| 64 | I<bioperl-l@bioperl.org> | ||
| 65 | |||
| 66 | rather than to the module maintainer directly. Many experienced and | ||
| 67 | reponsive experts will be able look at the problem and quickly | ||
| 68 | address it. Please include a thorough description of the problem | ||
| 69 | with code and data examples if at all possible. | ||
| 70 | |||
| 71 | =head2 Reporting Bugs | ||
| 72 | |||
| 73 | Report bugs to the Bioperl bug tracking system to help us keep track | ||
| 74 | of the bugs and their resolution. Bug reports can be submitted via the | ||
| 75 | web: | ||
| 76 | |||
| 77 | https://github.com/bioperl/bioperl-live/issues | ||
| 78 | |||
| 79 | =head1 AUTHOR - Hilmar Lapp | ||
| 80 | |||
| 81 | Email hlapp at gmx.net | ||
| 82 | |||
| 83 | =head1 APPENDIX | ||
| 84 | |||
| 85 | The rest of the documentation details each of the object methods. | ||
| 86 | Internal methods are usually preceded with a _ | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | |||
| 91 | # Let the code begin... | ||
| 92 | |||
| 93 | |||
| 94 | package Bio::Factory::ObjectBuilderI; | ||
| 95 | 103 | $Bio::Factory::ObjectBuilderI::VERSION = '1.7.8'; | |
| 96 | 103 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 97 | 103 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 98 | |||
| 99 | 103 | ▶ | use base qw(Bio::Root::RootI); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 100 | |||
| 101 | =head2 want_slot | ||
| 102 | |||
| 103 | Title : want_slot | ||
| 104 | Usage : | ||
| 105 | Function: Whether or not the object builder wants to populate the | ||
| 106 | specified slot of the object to be built. | ||
| 107 | |||
| 108 | The slot can be specified either as the name of the | ||
| 109 | respective method, or the initialization parameter that | ||
| 110 | would be otherwise passed to new() of the object to be | ||
| 111 | built. | ||
| 112 | |||
| 113 | Example : | ||
| 114 | Returns : TRUE if the object builder wants to populate the slot, and | ||
| 115 | FALSE otherwise. | ||
| 116 | Args : the name of the slot (a string) | ||
| 117 | |||
| 118 | |||
| 119 | =cut | ||
| 120 | |||
| 121 | 0 | ▶ | sub want_slot{ |
|
Subroutine
want_slot: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 122 | 0 | shift->throw_not_implemented(); | |
| 123 | } | ||
| 124 | |||
| 125 | =head2 add_slot_value | ||
| 126 | |||
| 127 | Title : add_slot_value | ||
| 128 | Usage : | ||
| 129 | Function: Adds one or more values to the specified slot of the object | ||
| 130 | to be built. | ||
| 131 | |||
| 132 | Naming the slot is the same as for want_slot(). | ||
| 133 | |||
| 134 | The object builder may further filter the content to be | ||
| 135 | set, or even completely ignore the request. | ||
| 136 | |||
| 137 | If this method reports failure, the caller should not add | ||
| 138 | more values to the same slot. In addition, the caller may | ||
| 139 | find it appropriate to abandon the object being built | ||
| 140 | altogether. | ||
| 141 | |||
| 142 | Example : | ||
| 143 | Returns : TRUE on success, and FALSE otherwise | ||
| 144 | Args : the name of the slot (a string) | ||
| 145 | parameters determining the value to be set | ||
| 146 | |||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | 0 | ▶ | sub add_slot_value{ |
|
Subroutine
add_slot_value: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 151 | 0 | shift->throw_not_implemented(); | |
| 152 | } | ||
| 153 | |||
| 154 | =head2 want_object | ||
| 155 | |||
| 156 | Title : want_object | ||
| 157 | Usage : | ||
| 158 | Function: Whether or not the object builder is still interested in | ||
| 159 | continuing with the object being built. | ||
| 160 | |||
| 161 | If this method returns FALSE, the caller should not add any | ||
| 162 | more values to slots, or otherwise risks that the builder | ||
| 163 | throws an exception. In addition, make_object() is likely | ||
| 164 | to return undef after this method returned FALSE. | ||
| 165 | |||
| 166 | Example : | ||
| 167 | Returns : TRUE if the object builder wants to continue building | ||
| 168 | the present object, and FALSE otherwise. | ||
| 169 | Args : none | ||
| 170 | |||
| 171 | |||
| 172 | =cut | ||
| 173 | |||
| 174 | 0 | ▶ | sub want_object{ |
|
Subroutine
want_object: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 175 | 0 | shift->throw_not_implemented(); | |
| 176 | } | ||
| 177 | |||
| 178 | =head2 make_object | ||
| 179 | |||
| 180 | Title : make_object | ||
| 181 | Usage : | ||
| 182 | Function: Get the built object. | ||
| 183 | |||
| 184 | This method is allowed to return undef if no value has ever | ||
| 185 | been added since the last call to make_object(), or if | ||
| 186 | want_object() returned FALSE (or would have returned FALSE) | ||
| 187 | before calling this method. | ||
| 188 | |||
| 189 | For an implementation that allows consecutive building of | ||
| 190 | objects, a caller must call this method once, and only | ||
| 191 | once, between subsequent objects to be built. I.e., a call | ||
| 192 | to make_object implies 'end_object.' | ||
| 193 | |||
| 194 | Example : | ||
| 195 | Returns : the object that was built | ||
| 196 | Args : none | ||
| 197 | |||
| 198 | |||
| 199 | =cut | ||
| 200 | |||
| 201 | 0 | ▶ | sub make_object{ |
|
Subroutine
make_object: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 202 | 0 | shift->throw_not_implemented(); | |
| 203 | } | ||
| 204 | |||
| 205 | 103 | 1; | |