public EditAction generate(final Random random, FeatureModel model, OperationType operationType) { EditAction action = new EditAction(); action.setEditType(EditType.Set); action.setEditObjectType(EditObjectType.Optionality); action.addParameter("mandatory", Boolean.valueOf(random.nextBoolean())); action.addParameter("feature", Utility.getRandomFeature(model, random, false)); return action; }
public EditAction generate(final Random random, FeatureModel model, OperationType operationType) { EditAction action = new EditAction(); action.setEditType(EditType.Set); action.setEditObjectType(EditObjectType.Cardinality); action.addParameter("minCard", random.nextInt(5)); action.addParameter("maxCard", random.nextInt(5)); action.addParameter("feature", Utility.getRandomFeature(model, random, false)); return action; }
public EditAction generate(final Random random, FeatureModel model, OperationType operationType) { EditAction action = new EditAction(); if (operationType == OperationType.Random) { operationType = random.nextBoolean() ? OperationType.AllAdd : OperationType.AllRemove; } if (operationType == OperationType.AllAdd) { action.setEditType(EditType.Add); action.addParameter("featureA", Utility.getRandomFeature(model, random, false).getName()); action.addParameter("featureB", Utility.getRandomFeature(model, random, false).getName()); } else { action.setEditType(EditType.Remove); action.addParameter( "constraint", model.getConstraint(random.nextInt(model.getConstraintCount()))); } action.setEditObjectType(EditObjectType.Require); return action; }
public EditAction generate(final Random random, FeatureModel model, OperationType operationType) { EditAction action = new EditAction(); action.setEditType(EditType.Set); action.setEditObjectType(EditObjectType.Name); action.addParameter("newName", Utility.getRandomString(5, random)); action.addParameter("feature", Utility.getRandomFeature(model, random, false)); return action; }
public EditAction generate(final Random random, FeatureModel model, OperationType operationType) { EditAction action = new EditAction(); action.setEditObjectType(EditObjectType.Compound); if (operationType == OperationType.Random) { operationType = random.nextBoolean() ? OperationType.AllAdd : OperationType.AllRemove; } if (operationType == OperationType.AllAdd) { action.setEditType(EditType.Add); action.addParameter("targetFeature", Utility.getRandomFeature(model, random, false)); Feature newCompound = new Feature(Utility.getNewFeatureName(true)); action.addParameter("newCompound", newCompound); } else { action.setEditType(EditType.Remove); action.addParameter("compound", Utility.getRandomCompound(model, random, false)); } return action; }