1 22 package org.jboss.ha.framework.interfaces; 23 24 import java.io.Serializable ; 25 26 38 public class SubPartitionsInfo implements Serializable , Cloneable 39 { 40 44 private static final long serialVersionUID = 3231573521328800529L; 45 46 48 public SubPartitionInfo[] partitions = null; 49 protected long groupId = 0; 50 51 53 55 public SubPartitionsInfo () {} 56 57 59 62 public long getNextGroupId () 63 { 64 return groupId++; 65 } 66 67 70 public SubPartitionInfo getSubPartitionWithName (String name) 71 { 72 if (partitions != null) 73 { 74 for (int i=0; i<partitions.length; i++) 75 if ((partitions[i]).containsNode (name)) 76 return partitions[i]; 77 } 78 79 return null; 80 } 81 82 84 public Object clone () 85 { 86 SubPartitionsInfo theClone = new SubPartitionsInfo (); 87 88 if (partitions != null) 89 { 90 theClone.partitions = new SubPartitionInfo[partitions.length]; 91 for (int i=0; i<partitions.length; i++) 92 theClone.partitions[i] = (SubPartitionInfo)partitions[i].clone (); 93 } 94 95 theClone.groupId = groupId; 96 97 return theClone; 98 99 } 100 101 103 public String toString () 104 { 105 String result = null; 106 107 if (partitions == null) 108 result = "{null}"; 109 else 110 { 111 result = "{"; 112 for (int i=0; i<partitions.length; i++) 113 result+= "\n " + partitions[i].toString (); 114 result+= "\n}"; 115 } 116 117 return result; 118 } 119 120 122 124 126 128 } 129 | Popular Tags |