Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

MasterCard.java

Go to the documentation of this file.
00001 package net.threebit.utils.sosc ; 
00002 
00009 public class MasterCard extends CreditCard
00010 {   
00018         public MasterCard(final String mastercard)
00019         {        
00020                 super(mastercard, "MasterCard");
00021         }
00022 
00031         public boolean equals(final Object o)
00032         {
00033                 if (!(o instanceof MasterCard))
00034                 {
00035                         return (false);
00036                 }
00037                 return (super.equals(o));
00038         }
00039 
00046         protected boolean checkSize()
00047         {                
00048                 return(16 == (number.length()));
00049         }
00050 
00058         protected boolean checkPrefix()
00059         {
00060                 final int prefix;
00061                 prefix = (((number.charAt(0) - '0') * 10) + (number.charAt(1) - '0')); 
00062                 return ((prefix > 50) && (prefix < 56));
00063         }
00064 
00072         public static boolean validate(String num)
00073         {
00074                 return(new MasterCard(num).validate());
00075         }
00076 }

Generated on Mon Jul 14 17:19:20 2003 for SOSC by doxygen1.2.15