Exemple #1
0
  public static Memory[] getMemoriesOfGroup(Memories cfg, String groupName) {
    ArrayList<Memory> res = new ArrayList<Memory>();

    for (Memory g : cfg.getMemory())
      if (groupName == null && g.getGroup() == null
          || groupName != null && groupName.equals(g.getGroup())) res.add(g);

    return (Memory[]) res.toArray(new Memory[res.size()]);
  }
Exemple #2
0
  public static Memory getMemory(Memories cfg, String groupName, String instName) {
    if (cfg == null) return null;

    for (Memory g : cfg.getMemory())
      if ((groupName == null && g.getGroup() == null
              || groupName != null && groupName.equals(g.getGroup()))
          && (instName.equals(g.getInstanceName()))) return g;

    return null;
  }
Exemple #3
0
  public Memories clone(Memories cfg) {

    if (cfg == null) return null;

    Memories newMemories = new Memories();

    if (cfg.getInstanceName() != null) newMemories.setInstanceName(cfg.getInstanceName());

    for (Memory m : cfg.getMemory()) {
      newMemories.getMemory().add(clone(m));
    }

    for (MemoryGroup mg : cfg.getMemoryGroup()) {
      newMemories.getMemoryGroup().add(clone(mg));
    }

    return newMemories;
  }
Exemple #4
0
 public static boolean existGroup(Memories cfg, String groupName) {
   for (MemoryGroup g : cfg.getMemoryGroup()) {
     if (groupName.equals(g.getName())) return true;
   }
   return false;
 }
Exemple #5
0
 /**
  * checks if a memData object still exists in the memory specification
  *
  * @param cfg
  * @param memData
  * @return
  */
 public static boolean existMemDataObject(Memories cfg, Memory memData) {
   for (Memory g : cfg.getMemory()) {
     if (g == memData) return true;
   }
   return false;
 }
Exemple #6
0
  public static MemoryGroup getMemoryGroup(Memories cfg, String groupName) {

    for (MemoryGroup g : cfg.getMemoryGroup()) if (groupName.equals(g.getName())) return g;

    return null;
  }