All Downloads are FREE. Search and download functionalities are using the official Maven repository.

us.ihmc.simulationconstructionset.gui.config.VarGroup Maven / Gradle / Ivy

There is a newer version: 0.25.2
Show newest version
package us.ihmc.simulationconstructionset.gui.config;

import java.util.ArrayList;

public class VarGroup
{
   private ArrayList variables = new ArrayList<>();
   private ArrayList expressions = new ArrayList<>();
   private String name;

   public VarGroup(String name)
   {
      this.name = name;
   }

   public void setName(String name)
   {
      this.name = name;
   }

   public String getName()
   {
      return name;
   }

   public void addVar(String varName)
   {
      variables.add(varName);
   }

   public void addVars(String[] varNames)
   {
      if (varNames == null)
      {
         return;
      }

      for (int i = 0; i < varNames.length; i++)
      {
         variables.add(varNames[i]);
      }
   }

   public void addRegularExpressions(String[] regularExpressions)
   {
      if (regularExpressions == null)
      {
         return;
      }

      for (int i = 0; i < regularExpressions.length; i++)
      {
         expressions.add(regularExpressions[i]);
      }
   }

   /*
    * public void addRegularExpression(String regularExpression) {
    * regularExpressions.add(regularExpression); }
    */
   public void removeVar(String varName)
   {
      variables.remove(varName);
   }

   public void removeRegularExpression(String regularExpressions)
   {
      expressions.remove(regularExpressions);
   }

   public String[] getVars()
   {
      String[] ret = new String[variables.size()];

      variables.toArray(ret);

      return ret;
   }

   public String[] getRegularExpressions()
   {
      String[] ret = new String[expressions.size()];

      expressions.toArray(ret);

      return ret;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy