This file is indexed.

/usr/include/BALL/KERNEL/standardPredicates.h is in libball1.4-dev 1.4.1+20111206-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: standardPredicates.h,v 1.52.16.2 2007/03/29 10:34:59 bertsch Exp $
//

#ifndef BALL_KERNEL_STANDARDPREDICATES_H
#define BALL_KERNEL_STANDARDPREDICATES_H

#ifndef BALL_DATATYPE_STRINGHASHMAP_H
#	include <BALL/DATATYPE/stringHashMap.h>
#endif

#ifndef BALL_DATATYPE_HASHSET_H
#	include <BALL/DATATYPE/hashSet.h>
#endif

#ifndef BALL_KERNEL_BOND_H
#	include <BALL/KERNEL/bond.h>
#endif

#ifndef BALL_KERNEL_EXPRESSION_H
#	include <BALL/KERNEL/expression.h>
#endif

#ifndef BALL_STRUCTURE_SMARTSMATCHER_H
# include <BALL/STRUCTURE/smartsMatcher.h>
#endif

#ifndef BALL_QSAR_AROMATICITYPROCESSOR_H
# include <BALL/QSAR/aromaticityProcessor.h>
#endif

#ifndef BALL_QSAR_RINGPERCEPTIONPROCESSOR_H
# include <BALL/QSAR/ringPerceptionProcessor.h>
#endif

namespace BALL 
{
	class Atom;

	/**	@name	Predefined Predicates. 
			<b>Note:</b> These predicates do not provide the OCI.
			@see ExpressionPredicate
			
    	\ingroup  Predicates
	*/
	//@{

	/** Default predicate.
			This predicate may be used to implement
			default rules. It is always <b>true</b>.
	 */
	class BALL_EXPORT TruePredicate
		:	public ExpressionPredicate
	{
		public:
			BALL_CREATE(TruePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>
					@param atom the atom to test
					@return true - always
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** False predicate.
			This predicate may be used to implement
			default rules. It is always <b>false</b>.
	 */
	class BALL_EXPORT FalsePredicate
		:	public ExpressionPredicate
	{
		public:
		BALL_CREATE(FalsePredicate)

		/** Evaluate the predicate for the atom <tt>atom</tt>
				@param atom the atom to test
				@return false - always
		*/
		virtual bool operator () (const Atom& atom) const;
	};

	/** Selection predicate.
			This predicate is <b>true</b>, if the atom is selected, <b>false</b>
			otherwise.
	 */
	class BALL_EXPORT SelectedPredicate
		:	public ExpressionPredicate
	{
		public:
			BALL_CREATE(SelectedPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true - always
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching atom names. Returns <tt>true</tt>, if the name of
			the atom matches the argument of this predicate. This is an exact
			match.
	 */
	class BALL_EXPORT AtomNamePredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(AtomNamePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching atom types. Returns <tt>true</tt>, if the type name
			of the atom matches exactly the argument of this predicate. 
	 */
	class BALL_EXPORT AtomTypePredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(AtomTypePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching elements. Returns <tt>true</tt>, if the element
			symbol of the atom matches exactly the argument  of this predicate.
	 */
	class BALL_EXPORT ElementPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(ElementPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching residues. Returns <tt>true</tt>, if the name of the 
			residue that the atom belongs to matches exactly the argument of this
			predicate.
	 */
	class BALL_EXPORT ResiduePredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(ResiduePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching residues IDs. Returns <tt>true</tt>, if the ID of
			the residue that the atom belongs to matches exactly the argument of
			this predicate.
	 */
	class BALL_EXPORT ResidueIDPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(ResidueIDPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching proteins. Returns <tt>true</tt>, if the name of the
			protein that the atom belongs to matches exactly the argument of this
			predicate.
	 */
	class BALL_EXPORT ProteinPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(ProteinPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching chains. Returns <tt>true</tt>, if the name of the
			chain that the atom belongs to matches exactly the argument of this
			expression.
	 */
	class BALL_EXPORT ChainPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(ChainPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching secondary structures. Returns <tt>true</tt>, if the
			name of the secondary structure that the atom belongs to matches
			exactly the argument of this predicate.
	 */
	class BALL_EXPORT SecondaryStructurePredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(SecondaryStructurePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate indicating solvent atoms. 
			Returns <tt>true</tt>, if the atom
			belongs to a solvent molecule. This predicate is <b>true</b> if the 
			atom is contained in a molecule with the property  \link Molecule::IS_SOLVENT Molecule::IS_SOLVENT \endlink 
			set. This is usually the case for solvents added automatically by a
			force field.
			@see PeriodicBoundary::addSolvent
	 */
	class BALL_EXPORT SolventPredicate
		:	public	ExpressionPredicate
	{
		public:
		BALL_CREATE(SolventPredicate)

		/** Evaluate the predicate for the atom <tt>atom</tt>.
				@param atom the atom to test
				@return true, if the predicate is true, false otherwise
		*/
		virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for matching molecules. Returns <tt>true</tt>, if the atom
			belongs to the molecule defined by the expression of this predicate.
	 */
	class BALL_EXPORT MoleculePredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(MoleculePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate indicating backbone atoms. Returns <tt>true</tt>, if the atom
			belongs to the backbone of a protein, i. e. is one of the members of
			the peptide bond.
	 */
	class BALL_EXPORT BackBonePredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(BackBonePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/**
	 */
	class BALL_EXPORT NucleicAcidPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(NucleicAcidPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate indicating nucleotide atoms. Returns <tt>true</tt>, if the
			atom belongs to a nucleotide.
	 */
	class BALL_EXPORT NucleotidePredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(NucleotidePredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for atoms being included in rings of a certain number.
	 */
	class BALL_EXPORT InRingPredicate
		:	public	ExpressionPredicate
	{
		public:

			BALL_CREATE(InRingPredicate)

			/// Default constructor;
			InRingPredicate();

			/// Detailed constructor;
			InRingPredicate(Size n);

			/// Destructor;
			~InRingPredicate();

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;

	};

	/** Predicate class for atoms bearing a certain number of bonds.
			Arguments of this class are	<b> required </b> to consist 
			of an relational operator and a number between 1 and 8.
			The default is ">0" which means that the atom under siege has to bear
			at least one bond to make this predicate's operator () () return
			true.
	 */
	class BALL_EXPORT NumberOfBondsPredicate
		:	public	ExpressionPredicate
	{
		public:

			/// Default constructor.
			NumberOfBondsPredicate();

			BALL_CREATE(NumberOfBondsPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;

		protected:
			bool testPredicate_(const Atom& atom, Bond::Order order) const;
	};


	/** Predicate class for atoms bearing single bonds.
			Arguments of this class are	<b> required </b> to consist 
			of an relational operator and a number between 1 and 8.
	 */
	class BALL_EXPORT SingleBondsPredicate
		:	public NumberOfBondsPredicate
	{
		public:
			BALL_CREATE(SingleBondsPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};


	/** Predicate for atoms bearing double bonds. 
			Arguments of this class are	<b> required </b> to consist 
			of an relational operator and a number between 1 and 8.
	 */
	class BALL_EXPORT DoubleBondsPredicate
		:	public NumberOfBondsPredicate
	{
		public:
			BALL_CREATE(DoubleBondsPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;

	};


	/** Predicate class for atoms bearing triple bonds.
			Arguments of this class are	<b> required </b> to consist 
			of an relational operator and a number between 1 and 8.
	 */
	class BALL_EXPORT TripleBondsPredicate
		:	public DoubleBondsPredicate
	{
		public:
			BALL_CREATE(TripleBondsPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
				*/
			virtual bool operator () (const Atom& atom) const;
	};


	/** Predicate class for atoms bearing a certain number of aromatic bonds.
			Arguments of this class are	<b> required </b> to consist 
			of an relational operator and a number between 1 and 8.
			The default is ">0" which means that the atom under siege has to bear
			at least one aromatic bond to make this predicate's operator () () return
			true.

			A bond is defined as aromatic if it has the property Bond::IS_AROMATIC set, or
			if its bond order equals Bond::ORDER__AROMATIC.
	 */
	class BALL_EXPORT AromaticBondsPredicate
		:	public ExpressionPredicate
	{
		public:
			BALL_CREATE(AromaticBondsPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;

		protected:
			bool testPredicate_(const Atom& atom) const;
	};


	/** Predicate class for atoms being connected to a constellation defined
			by an expression. Syntax:
      \begin{tabular}{cl}
        Bonds  \par
        <tt>-</tt>            & single  \par
   
        <tt>=</tt>            & double  \par
   
        <tt>\#</tt>           & triple  \par
     
        <tt>\symbol{126</tt>} & aromatic  \par
     
        <tt>.</tt>            & any  \par
   
        Elements           &  \par
        <tt>symbol</tt>       & the desired element  \par
   
        <tt>*</tt>            & any element  \par
   
        Groups             &  \par
        <tt>( )</tt>          & symbols enlosed by brackets denote groups  \par
   
      \end{tabular}
	*/
	class BALL_EXPORT ConnectedToPredicate
		:	public	ExpressionPredicate
	{

		public:

			class BALL_EXPORT CTPNode
			{
				public:

					enum BondType
					{
						BONDTYPE__UNINITIALISED = 0,
						BONDTYPE__ANY           = 1,
						BONDTYPE__SINGLE        = 2,
						BONDTYPE__DOUBLE        = 3,
						BONDTYPE__TRIPLE        = 4,
						BONDTYPE__QUADRUPLE     = 5,
						BONDTYPE__AROMATIC      = 6
					};

					typedef std::list<CTPNode*>::iterator Iterator;
					typedef std::list<CTPNode*>::const_iterator ConstIterator;

					/*
					 */
					CTPNode();

					/*
					 */
					CTPNode(const CTPNode& node);

					/*
					 */
					virtual ~CTPNode();

					/*
					*/
					virtual void destroy();

					/*
					 */
					void setParent(CTPNode* parent);

					/*
					 */
					CTPNode* getParent() const;

					/*
					 */
					void addChild(CTPNode* child);

					/*
					 */
					void removeChild(CTPNode* child);

					/*
					 */
					::std::list<CTPNode*>& getChildren();

					Iterator begin();

					ConstIterator begin() const;

					Iterator end();

					ConstIterator end() const;

					/*
					 */
					Size getNumberOfChildren() const;

					/*
					 */
					void setBondType(Size type);

					/*
					 */
					void setBondType(char type);

					/*
					 */
					Size getBondType() const;

					/*
					 */
					char getBondTypeChar() const;

					/*
					 */
					String getSymbol() const;

					/*
					 */
					void setSymbol(const String& symbol);

					/*
					 */
					void setFinished();

					/*
					 */
					void unsetFinished();

					/*
					 */
					bool isFinished() const;

					/*
					 */
					void setLinked();

					/*
					 */
					void unsetLinked();

					/*
					 */
					bool isLinked() const;

					/*
					 */
					void linkWith(CTPNode* partner);

					/*
					 */
					const HashSet<CTPNode*>& getLinkSet() const;


				private: 

					/*
					 */
					String element_symbol_;

					/* Bond type means the bond connecting *to* this node.
					 */
					Size bond_type_;

					/*
					 */
					std::list<CTPNode*> children_;

					/*
					 */
					CTPNode* parent_;

					/*
					 */
					bool finished_;

					/*
					 */
					bool linked_;

					/*
					 */
					HashSet<CTPNode*> link_set_;

					/*
					*/
					struct greater_
						: public binary_function<const CTPNode*, const CTPNode*, bool>
					{

						bool operator () (const CTPNode* a, const CTPNode* b) const
						{
							if ((a != 0) && (b != 0))
							{
								if (a->getSymbol() == "*")
								{
									return true;
								}
								else
								{
									return false;
								}
							}
							else
							{
								Log.error() << "greater_: got NULL pointers" << std::endl;
								return false;
							}
						}

					};

			};

		public:
			BALL_CREATE(ConnectedToPredicate)

			ConnectedToPredicate();

			ConnectedToPredicate(const ConnectedToPredicate& predicate);

			virtual ~ConnectedToPredicate();

			virtual void clear();

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
		
			void dump() const;

			void dump(const CTPNode* current) const;

			virtual void setArgument(const String& argument);

		private:
			/*_ The syntax tree
			*/
			CTPNode* tree_;

			/*_ Needed for realising parsing of loops (or links).
			*/
			HashMap<char, std::pair<CTPNode*, CTPNode*> > link_map_;

			/*_ Needed for realising parsing of loops (or links).
			*/
			char link_mark_;

			/*_ Keep it consistent
			*/
			CTPNode* createNewNode_(CTPNode* node);
		
			/*_
			*/
			CTPNode* parse_();

			// Clean up nodes created if parse_ exits with a parse error.
			void cleanUpNodes_(std::vector<CTPNode*>& all_nodes);

			/*_
			*/
			CTPNode* parse_(const String& input);

			bool bondOrderMatch_(const Bond& bond, const CTPNode& node) const;

			bool find_(const Atom& atom, const CTPNode* current,
					HashSet<const Bond*>& visited) const;

	};

	/** Predicate indicating sp hybridized atoms.
	 */
	class BALL_EXPORT SpHybridizedPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(SpHybridizedPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate indicating sp2 hybridized atoms.
	 */
	class BALL_EXPORT Sp2HybridizedPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(Sp2HybridizedPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};


	/** Predicate indicating sp3 hybridized atoms.
	 */
	class BALL_EXPORT Sp3HybridizedPredicate
		:	public	ExpressionPredicate
	{
		public:
			BALL_CREATE(Sp3HybridizedPredicate)

			/** Evaluate the predicate for the atom <tt>atom</tt>.
					@param atom the atom to test
					@return true, if the predicate is true, false otherwise
			*/
			virtual bool operator () (const Atom& atom) const;
	};

	/** Charge predicate
	 */
	class BALL_EXPORT ChargePredicate
		:	public	ExpressionPredicate
	{
		public:
		BALL_CREATE(ChargePredicate)

		/** Return true if the charge is in the indicated range.
				The argument of this predicate is either a number,
				in which case the charge of the atom has to be equal to 
				that number (down to the specified accuracy for floating 
				point comparisons,  \link EPSILON EPSILON \endlink ), or an operator followed	
				by a number. Possible operators are: <tt><</tt>, <tt>></tt>, <tt>>=</tt>, <tt> <= </tt>, <tt> = </tt>.
				@param atom the atom to test
				@return true, if the predicate is true, false otherwise
		*/
		virtual bool operator () (const Atom& atom) const;
	};

	/** Axial predicate.
			This predicate tries to tell whether a C1 of a sugar is in axial
			position. 
	 */
	class BALL_EXPORT AxialPredicate
		:	public	ExpressionPredicate
	{
		public:
		BALL_CREATE(AxialPredicate)

		/** Axial predicate needed for the determination of Glycam parameters.
				This is no generally applicable predicate.
				Return true if the atom is a C in a 6 membered ring containing
				and is connected to an H which is standing perpendicular
				on the plane containing the atom itself and those two Cs of the
				ring which are each one atom away.
				@param atom the atom to test
				@return true, if the predicate is true, false otherwise
		*/
		virtual bool operator () (const Atom& atom) const;
	};

	/** Predicate for determining whether a sugar ring is in 4C1
			conformation.
	 */
	class BALL_EXPORT Conformation4C1Predicate
		:	public	ExpressionPredicate
	{
		public:
		BALL_CREATE(Conformation4C1Predicate)

		/** 
				@param atom the atom to test
				@return true, if the predicate is true, false otherwise
		*/
		virtual bool operator () (const Atom& atom) const;
	};

	/** Helper class for all predicates that need ring information.
	*/
	class BALL_EXPORT RingFinder
	{
		public:

			// BALL_CREATE(RingFinder)

			/// Default constructor
			RingFinder();

			/** Detailed constructor. Initialize this instance with the size of
					the ring we want to find. Default setting is 0 which means that
					any ring size will match.
			*/
			RingFinder(Size n);

			/// Destructor
			virtual ~RingFinder();

			/** Return true, if atom is in a ring.
			*/
			bool operator () (const Atom& atom);

			/** Depth first search for finding rings.
			*/
			bool dfs(const Atom& atom, const Size limit);

			/** Set the ring size we want to find. Ring sizes below 3 will always
					return false, except if the size is set to 0, then any ring size
					will match. 
			*/
			void setRingSize(Size n);

			/** Return the hashset containing all visited bonds.
			*/
			const HashSet<const Bond*>& getVisitedBonds() const;

			/** Return the vector of ring atoms.
			*/
			const std::vector<const Atom*>& getRingAtoms() const;

		private:

			/**
			*/
			const Atom* first_atom_;
			
			/**
			*/
			Size n_;

			/**
			*/
			bool exact_;

			/*_
			*/
			HashSet<const Bond*> visited_bonds_;

			/*_
			*/
			std::vector<const Atom*> ring_atoms_;

	};

	/** Predicate for using smarts
	 */
	class BALL_EXPORT SMARTSPredicate
		:	public ExpressionPredicate
	{
		public:

		///
		SMARTSPredicate();

		///
		SMARTSPredicate(const SMARTSPredicate& pred);

		///
		virtual ~SMARTSPredicate();
	
		BALL_CREATE(SMARTSPredicate)

		/** 
				@param atom the atom to test
				@return true, if the predicate is true, false otherwise
		*/
		virtual bool operator () (const Atom& atom) const;

 		mutable SmartsMatcher matcher_;
		mutable Molecule* last_molecule_;
		mutable AromaticityProcessor arom_proc_;
		mutable RingPerceptionProcessor ring_proc_;
		// when was the aromaticity lastly calculated for a given molecule:
		static HashMap<Molecule*, TimeStamp> call_time_map_;
		static Molecule dummy_molecule_;
		mutable HashSet<Atom*> matches_;
	};


	//@}	
} // namespace BALL

#endif // BALL_KERNEL_STANDARDPREDICATES_H