1 20 21 package org.apache.directory.ldapstudio.browser.core.model.schema; 22 23 24 import java.util.HashSet ; 25 import java.util.Set ; 26 27 28 public abstract class SchemaPart2 extends SchemaPart 29 { 30 31 protected String [] names; 32 33 protected boolean isObsolete; 34 35 36 protected SchemaPart2() 37 { 38 super(); 39 this.names = new String [0]; 40 this.isObsolete = false; 41 } 42 43 44 public Set getLowerCaseIdentifierSet() 45 { 46 Set idSet = new HashSet (); 47 if ( this.numericOID != null ) 48 { 49 idSet.add( this.numericOID.toLowerCase() ); 50 } 51 idSet.addAll( toLowerCaseSet( this.names ) ); 52 return idSet; 53 } 54 55 56 61 public String toString() 62 { 63 StringBuffer sb = new StringBuffer (); 64 for ( int i = 0; i < names.length; i++ ) 65 { 66 sb.append( names[i] ).append( ", " ); 67 } 68 if ( sb.length() > 2 ) 69 { 70 sb.delete( sb.length() - 2, sb.length() ); 71 } 72 return sb.toString(); 73 } 74 75 76 80 public String [] getNames() 81 { 82 return names; 83 } 84 85 86 public void setNames( String [] names ) 87 { 88 this.names = names; 89 } 90 91 92 96 public boolean isObsolete() 97 { 98 return isObsolete; 99 } 100 101 102 public void setObsolete( boolean isObsolete ) 103 { 104 this.isObsolete = isObsolete; 105 } 106 107 108 protected Set toLowerCaseSet( String [] names ) 109 { 110 Set set = new HashSet (); 111 if ( names != null ) 112 { 113 for ( int i = 0; i < names.length; i++ ) 114 { 115 set.add( names[i].toLowerCase() ); 116 } 117 } 118 return set; 119 } 120 121 } 122 | Popular Tags |