示例#1
0
  private void generateAndAddOrder() {
    Entity order =
        dataDefinitionService.get(L_ORDERS_PLUGIN_IDENTIFIER, L_ORDERS_MODEL_ORDER).create();

    long dateFrom = generateRandomDate();
    long dateTo = generateRandomDate(dateFrom);

    Preconditions.checkArgument(dateTo > dateFrom, "Order was finished before it was started !");

    Entity product = getRandomProduct();
    Entity technology =
        (getDefaultTechnologyForProduct(product) == null)
            ? getRandomProduct()
            : getDefaultTechnologyForProduct(product);

    String number = generateString(CHARS_AND_DIGITS, RANDOM.nextInt(34) + 5);
    order.setField(L_NUMBER, number);
    order.setField(L_NAME, getNameFromNumberAndPrefix("Order-", number));
    order.setField("dateFrom", new Date(dateFrom));
    order.setField("dateTo", new Date(dateTo));
    order.setField(STATE_L, "01pending");
    order.setField(L_BASIC_MODEL_PRODUCT, product);
    order.setField("plannedQuantity", RANDOM.nextInt(100) + 100);
    order.setField("doneQuantity", RANDOM.nextInt(100) + 1);
    order.setField(L_TECHNOLOGY_MODEL_TECHNOLOGY, technology);
    order.setField("externalSynchronized", true);
    order.setField("typeOfProductionRecording", "01basic");
    order.setField("trackingRecordTreatment", "01duringProduction");

    dataDefinitionService.get(L_ORDERS_PLUGIN_IDENTIFIER, L_ORDERS_MODEL_ORDER).save(order);
  }
示例#2
0
  private void generateAndAddWorkPlan() {
    Entity workPlan = dataDefinitionService.get("workPlans", "workPlan").create();

    workPlan.setField(
        L_NAME,
        getNameFromNumberAndPrefix(
            "WorkPlan-", 5 + generateString(CHARS_AND_DIGITS, RANDOM.nextInt(45))));
    workPlan.setField("date", new Date(generateRandomDate()));
    workPlan.setField(
        "worker",
        getNameFromNumberAndPrefix(
            "Worker-", 5 + generateString(CHARS_AND_DIGITS, RANDOM.nextInt(45))));
    workPlan.setField("generated", false);
    workPlan.setField("type", "01noDistinction");

    workPlan = workPlan.getDataDefinition().save(workPlan);

    List<Entity> allOrders =
        dataDefinitionService.get("orders", L_ORDERS_MODEL_ORDER).find().list().getEntities();

    int iters = RANDOM.nextInt(allOrders.size() / 30 + 1);
    for (int i = 0; i < iters; i++) {
      addWorkPlanComponent(workPlan, allOrders);
    }
  }
  /** Tests the constructors of class MultivariatePolyaDistributionTest. */
  @Override
  public void testConstructors() {
    System.out.println("Constructors");

    MultivariatePolyaDistribution instance = new MultivariatePolyaDistribution();
    assertEquals(
        MultivariatePolyaDistribution.DEFAULT_DIMENSIONALITY, instance.getInputDimensionality());
    assertEquals(MultivariatePolyaDistribution.DEFAULT_NUM_TRIALS, instance.getNumTrials());

    int dim = RANDOM.nextInt(100) + 10;
    int numTrials = RANDOM.nextInt(100) + 10;
    instance = new MultivariatePolyaDistribution(dim, numTrials);
    assertEquals(dim, instance.getInputDimensionality());
    assertEquals(numTrials, instance.getNumTrials());

    Vector p = VectorFactory.getDefault().createUniformRandom(dim, 0.0, 10.0, RANDOM);
    instance = new MultivariatePolyaDistribution(p, numTrials);
    assertSame(p, instance.getParameters());
    assertEquals(numTrials, instance.getNumTrials());

    MultivariatePolyaDistribution i2 = new MultivariatePolyaDistribution(instance);
    assertNotSame(i2.getParameters(), instance.getParameters());
    assertEquals(i2.getParameters(), instance.getParameters());
    assertEquals(i2.getNumTrials(), instance.getNumTrials());
  }
示例#4
0
  private Entity addOperationComponent(
      final Entity technology,
      final Entity parent,
      final Entity operation,
      final int productsComponentsQuantity) {
    Preconditions.checkNotNull(technology, "Technology entity is null");
    Entity operationComponent =
        dataDefinitionService
            .get(L_TECHNOLOGIES_PLUGIN_IDENTIFIER, "technologyOperationComponent")
            .create();

    int productInComponentQuantity = RANDOM.nextInt(productsComponentsQuantity);
    int productOutComponentQuantity = productsComponentsQuantity - productInComponentQuantity;

    operationComponent.setField(
        L_NAME, "operationComponent" + generateString(CHARS_AND_DIGITS, 15));
    operationComponent.setField(L_NUMBER, generateString(CHARS_AND_DIGITS, 20));
    operationComponent.setField(L_TECHNOLOGY_MODEL_TECHNOLOGY, technology);
    operationComponent.setField("parent", parent);
    operationComponent.setField(L_TECHNOLOGY_MODEL_OPERATION, operation);
    operationComponent.setField("entityType", L_TECHNOLOGY_MODEL_OPERATION);
    operationComponent.setField(L_TPZ, operation.getField(L_TPZ));
    operationComponent.setField(L_TJ, operation.getField(L_TJ));
    operationComponent.setField("machineUtilization", operation.getField("machineUtilization"));
    operationComponent.setField("laborUtilization", operation.getField("laborUtilization"));
    operationComponent.setField("productionInOneCycle", operation.getField("productionInOneCycle"));
    operationComponent.setField(
        L_NEXT_OPERATION_AFTER_PRODUCED_TYPE,
        operation.getField(L_NEXT_OPERATION_AFTER_PRODUCED_TYPE));
    operationComponent.setField("nextOperationAfterProducedQuantity", "0");
    operationComponent.setField("timeNextOperation", operation.getField("timeNextOperation"));

    operationComponent = operationComponent.getDataDefinition().save(operationComponent);
    List<Entity> listOut = new LinkedList<Entity>();
    Entity productOut = null;
    for (int i = 0; i < productOutComponentQuantity; i++) {
      productOut = getRandomProduct();

      while (listOut.contains(productOut)) {
        productOut = getRandomProduct();
      }
      listOut.add(productOut);
      generateAndAddOperationProductOutComponent(
          operationComponent, new BigDecimal(RANDOM.nextInt(50) + 5), productOut);
    }
    List<Entity> listIn = new LinkedList<Entity>();
    Entity productIn = null;
    for (int i = 0; i < productInComponentQuantity; i++) {
      productIn = getRandomProduct();

      while (listIn.contains(productIn)) {
        productIn = getRandomProduct();
      }
      listIn.add(productIn);
      generateAndAddOperationProductInComponent(
          operationComponent, new BigDecimal(RANDOM.nextInt(50) + 5), productIn);
    }

    return operationComponent;
  }
示例#5
0
      public void paint(GC gc) {
        int i = 2 * x + 1;
        if (values == null || i >= values.length) {
          return;
        }

        int value = getNextValue() * (90 + RANDOM.nextInt(20)) / 100 + RANDOM.nextInt(4) - 2;
        if (value > 100) {
          value = 100;
        } else if (value < -100) {
          value = -100;
        }

        int fx = y + value * channelHeight / 100;
        values[i] = fx;

        gc.setForeground(white);
        gc.setLineWidth(1);
        gc.drawPolyline(values);

        gc.setForeground(black);
        gc.setLineWidth(2);
        gc.drawRectangle(x, fx, 2, 2);

        if (++x >= width) {
          x = 0;
        }
      }
示例#6
0
  private void generateAndAddStaff() {
    Entity staff =
        dataDefinitionService.get(L_BASIC_PLUGIN_IDENTIFIER, L_BASIC_MODEL_STAFF).create();

    String number = generateString(DIGITS_ONLY, RANDOM.nextInt(40) + 5);

    staff.setField(L_NUMBER, number);
    staff.setField(L_NAME, getNameFromNumberAndPrefix("Staff-", number));
    staff.setField("surname", generateString(CHARS_ONLY, RANDOM.nextInt(12)));
    staff.setField("post", generateString(CHARS_ONLY, RANDOM.nextInt(5)));

    dataDefinitionService.get(L_BASIC_PLUGIN_IDENTIFIER, L_BASIC_MODEL_STAFF).save(staff);
  }
示例#7
0
  private void addSubstituteToProduct(final Entity product) {
    Entity substitute = dataDefinitionService.get(L_BASIC_PLUGIN_IDENTIFIER, "substitute").create();

    String number = generateString(DIGITS_ONLY, RANDOM.nextInt(34) + 5);

    substitute.setField(L_NUMBER, number);
    substitute.setField(L_NAME, getNameFromNumberAndPrefix("ProductSubstitute-", number));
    substitute.setField(L_BASIC_MODEL_PRODUCT, product);
    substitute.setField("priority", RANDOM.nextInt(7));

    substitute =
        dataDefinitionService.get(L_BASIC_PLUGIN_IDENTIFIER, "substitute").save(substitute);
    addSubstituteComponent(
        substitute, getRandomProduct(), RANDOM.nextInt(997) * RANDOM.nextDouble());
  }
 /** Test of getNumTrials method, of class MultivariatePolyaDistribution. */
 public void testGetNumTrials() {
   System.out.println("getNumTrials");
   int numTrials = RANDOM.nextInt(100) + 1;
   MultivariatePolyaDistribution instance = this.createInstance();
   instance.setNumTrials(numTrials);
   assertEquals(numTrials, instance.getNumTrials());
 }
示例#9
0
  private void generateAndAddWorkstationType() {
    Entity machine =
        dataDefinitionService
            .get(L_BASIC_PLUGIN_IDENTIFIER, L_BASIC_MODEL_WORKSTATION_TYPE)
            .create();

    String number = generateString(CHARS_AND_DIGITS, RANDOM.nextInt(40) + 5);

    machine.setField(L_NAME, getNameFromNumberAndPrefix("Workstation type-", number));
    machine.setField(L_NUMBER, number);
    machine.setField("description", generateString(CHARS_ONLY, RANDOM.nextInt(100)));

    dataDefinitionService
        .get(L_BASIC_PLUGIN_IDENTIFIER, L_BASIC_MODEL_WORKSTATION_TYPE)
        .save(machine);
  }
  private void splat(PointF start, PointF end, PointF mid, float d) {

    Path firstPath = new Path();
    if (d < 0) {
      d = 0;
    }

    firstPath.moveTo(start.x, start.y);
    firstPath.quadTo(mid.x, mid.y, end.x, end.y);
    fCurrentOperation.addPath(firstPath, d);

    float dst = dist(start.x, start.y, end.x, end.y);
    int quarterDrips = fDrips / 4;
    int nbDrips = quarterDrips + RANDOM.nextInt(fDrips);

    for (int i = 0; i < nbDrips; i++) {
      // positioning of splotch varies between ±4dd, tending towards 0

      float x4 = dst * getProbability(0.5f);
      float y4 = dst * getProbability(0.5f);
      // direction of splotch varies between ±0.5
      float x5 = getProbability(0.5f);
      float y5 = getProbability(0.5f);

      float dd = Math.min(d * (RANDOM.nextFloat() + 0.4f), d);
      Path subPath = new Path();
      subPath.moveTo(start.x + x4, start.y + y4);
      subPath.lineTo(start.x + x4 + x5, start.y + y4 + y5);
      fCurrentOperation.addPath(subPath, dd);
    }
  }
示例#11
0
 private Entity getRandomEntity(final String pluginIdentifier, final String modelName) {
   SearchCriteriaBuilder searchBuilder =
       dataDefinitionService.get(pluginIdentifier, modelName).find();
   int totalNumberOfEntities = searchBuilder.list().getTotalNumberOfEntities();
   return searchBuilder
       .setMaxResults(1)
       .setFirstResult(RANDOM.nextInt(totalNumberOfEntities))
       .uniqueResult();
 }
示例#12
0
 private void generateAndAddTechnologyOperationComponent(final Entity technology) {
   List<Entity> operations = new LinkedList<Entity>();
   Entity operation = null;
   for (int i = 0; i < 4; i++) {
     if (operations.isEmpty()) {
       operation =
           addOperationComponent(technology, null, getRandomOperation(), RANDOM.nextInt(3) + 3);
     } else {
       operation =
           addOperationComponent(
               technology,
               operations.get(RANDOM.nextInt(operations.size())),
               getRandomOperation(),
               RANDOM.nextInt(3) + 3);
     }
     operations.add(operation);
   }
 }
示例#13
0
  private String generateRandomEmail() {
    String email;

    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append(generateString(CHARS_AND_DIGITS, RANDOM.nextInt(3) + 3));
    stringBuilder.append("@").append(generateString(CHARS_AND_DIGITS, 4)).append(".");
    stringBuilder.append("org");
    email = stringBuilder.toString();
    return email;
  }
示例#14
0
 /**
  * Returns a pseudo random <code>int</code> value in the range <code>[min, max]</code> (fast and
  * thread-safe without synchronization).
  *
  * @param min the minimum value inclusive.
  * @param max the maximum value exclusive.
  * @return a pseudo random number in the range <code>[min, max]</code>.
  */
 public static int random(int min, int max) {
   int next = RANDOM.nextInt();
   if ((next >= min) && (next <= max)) return next;
   next += Integer.MIN_VALUE;
   if ((next >= min) && (next <= max)) return next;
   // We should not have interval overflow as the interval has to be less
   // or equal to Integer.MAX_VALUE (otherwise we would have exited before).
   final int interval = 1 + max - min; // Positive.
   if (interval <= 0) throw new Error("Interval [" + min + ".." + max + "] error"); // In case.
   return MathLib.abs(next % interval) + min;
 }
 /** Test of setNumTrials method, of class MultivariatePolyaDistribution. */
 public void testSetNumTrials() {
   System.out.println("setNumTrials");
   int numTrials = RANDOM.nextInt(100) + 1;
   MultivariatePolyaDistribution instance = this.createInstance();
   instance.setNumTrials(numTrials);
   assertEquals(numTrials, instance.getNumTrials());
   try {
     instance.setNumTrials(0);
     fail("numTrials must be > 0");
   } catch (Exception e) {
     System.out.println("Good: " + e);
   }
 }
示例#16
0
  @Override
  public void spawnServerSide(
      EntityPlayer player, NBTTagCompound dataFromClient, NBTTagCompound rewardData) {
    for (int i = 0; i < dataFromClient.getInteger(AMOUNTOFORBS_KEY); i++) {
      double X = player.posX, Y = player.posY, Z = player.posZ;

      X += (0.5 - RANDOM.nextDouble());
      Z += (0.5 - RANDOM.nextDouble());

      player.worldObj.spawnEntityInWorld(
          new EntityXPOrb(player.worldObj, X, Y, Z, RANDOM.nextInt(5) + 1));
    }
  }
示例#17
0
 private String generateString(final String allowedChars, final int stringLength) {
   int stringLen = stringLength;
   String generatedString;
   if (stringLen <= 0) {
     stringLen = 1;
   }
   char[] chars = new char[stringLen];
   for (int i = 0; i < stringLen; i++) {
     chars[i] = allowedChars.charAt(RANDOM.nextInt(allowedChars.length()));
   }
   generatedString = new String(chars);
   return generatedString;
 }
示例#18
0
  private void generateAndAddTechnology(final Entity product) {
    Entity technology =
        dataDefinitionService.get(TECHNOLOGIES_PLUGIN, L_TECHNOLOGY_MODEL_TECHNOLOGY).create();

    Entity defaultTechnology = getDefaultTechnologyForProduct(product);

    String number = generateString(DIGITS_ONLY, RANDOM.nextInt(40) + 5);

    technology.setField("master", defaultTechnology == null);
    technology.setField(L_NAME, getNameFromNumberAndPrefix("Technology-", number));
    technology.setField(L_NUMBER, number);
    technology.setField(L_BASIC_MODEL_PRODUCT, product);
    technology.setField(STATE_L, "01draft");
    technology.setField("batchRequired", true);
    technology.setField("postFeatureRequired", false);
    technology.setField("otherFeatureRequired", false);
    technology.setField("shiftFeatureRequired", false);
    technology.setField("minimalQuantity", RANDOM.nextInt(40) + 10);
    technology.setField("technologyBatchRequired", false);

    technology.setField("qualityControlType", "02forUnit");
    technology.setField("unitSamplingNr", "123");
    technology.setField("qualityControlInstruction", "asd23");

    technology =
        dataDefinitionService
            .get(TECHNOLOGIES_PLUGIN, L_TECHNOLOGY_MODEL_TECHNOLOGY)
            .save(technology);
    generateAndAddTechnologyOperationComponent(technology);

    treeNumberingService.generateNumbersAndUpdateTree(
        dataDefinitionService.get(L_TECHNOLOGIES_PLUGIN_IDENTIFIER, "technologyOperationComponent"),
        L_TECHNOLOGY_MODEL_TECHNOLOGY,
        technology.getId());

    technology.setField(STATE_L, "02accepted");
    dataDefinitionService.get(TECHNOLOGIES_PLUGIN, L_TECHNOLOGY_MODEL_TECHNOLOGY).save(technology);
  }
示例#19
0
  private void generateAndAddShift(final String locale) {
    Entity shift = dataDefinitionService.get(L_BASIC_PLUGIN_IDENTIFIER, "shift").create();

    shift.setField(
        L_NAME,
        getNameFromNumberAndPrefix("Shift-", generateString(CHARS_ONLY, RANDOM.nextInt(40) + 5)));

    for (int i = 0; i < SHIFT_HOURS.length; i++) {
      shift.setField(WORK_SHIFT[i], RANDOM.nextBoolean());
      shift.setField(SHIFT_HOURS[i], generateWorkingHours(locale));
    }

    dataDefinitionService.get(L_BASIC_PLUGIN_IDENTIFIER, "shift").save(shift);
  }
示例#20
0
  private void generateAndAddUser() {
    Entity user = dataDefinitionService.get("qcadooSecurity", "user").create();

    user.setField("userName", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    user.setField("email", generateRandomEmail());
    user.setField("firstname", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    user.setField("lastname", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));

    Entity group =
        dataDefinitionService
            .get("qcadooSecurity", "group")
            .find()
            .add(SearchRestrictions.eq(L_NAME, "Admin"))
            .setMaxResults(1)
            .uniqueResult();
    user.setField("group", group);

    user.setField("password", "123");
    user.setField("passwordConfirmation", "123");
    user.setField("enabled", true);

    dataDefinitionService.get("qcadooSecurity", "user").save(user);
  }
示例#21
0
  private void generateAndAddOrderGroup() {
    Entity orderGroup =
        dataDefinitionService
            .get(ORDER_GROUPS_PLUGIN_NAME, ORDER_GROUPS_MODEL_ORDER_GROUP)
            .create();

    final String number = generateString(CHARS_AND_DIGITS, RANDOM.nextInt(34) + 5);

    orderGroup.setField(L_NUMBER, number);
    orderGroup.setField(L_NAME, getNameFromNumberAndPrefix("OrderGroup-", number));

    orderGroup = orderGroup.getDataDefinition().save(orderGroup);

    addOrdersToOrderGroup(orderGroup);
  }
示例#22
0
  private void generateAndAddProduct() {
    Entity product =
        dataDefinitionService.get(L_BASIC_PLUGIN_IDENTIFIER, L_BASIC_MODEL_PRODUCT).create();

    String number = generateString(DIGITS_ONLY, RANDOM.nextInt(34) + 5);

    product.setField("category", getRandomDictionaryItem("categories"));
    product.setField("ean", generateString(DIGITS_ONLY, 13));
    product.setField(L_NAME, getNameFromNumberAndPrefix("Product-", number));
    product.setField("unit", getRandomDictionaryItem("units"));
    product.setField("globalTypeOfMaterial", generateTypeOfProduct());
    product.setField(L_NUMBER, number);

    product = product.getDataDefinition().save(product);
    addSubstituteToProduct(product);
  }
示例#23
0
  public void addColumn(Chunk chunk) {
    int x = com.chunkmapper.math.Matthewmatics.mod(absx, 16);
    int z = com.chunkmapper.math.Matthewmatics.mod(absz, 16);

    chunk.Blocks[h - 3][z][x] = Block.Dirt.val;
    chunk.Blocks[h - 2][z][x] = Block.Dirt.val;
    if (hasWater) {
      chunk.Blocks[h - 1][z][x] = Block.Water.val;
    } else {
      chunk.Blocks[h - 1][z][x] = Block.Grass.val;
      int i = RANDOM.nextInt(3);
      if (i > 0) {
        chunk.Blocks[h][z][x] = Block.Long_Grass.val;
        chunk.Data[h][z][x] = i == 1 ? DataSource.Fern.val : DataSource.Long_Grass.val;
      }
    }
  }
示例#24
0
 private void addOrdersToOrderGroup(final Entity orderGroup) {
   List<Entity> orders;
   SearchCriteriaBuilder searchBuilder =
       dataDefinitionService.get(L_ORDERS_PLUGIN_IDENTIFIER, L_ORDERS_MODEL_ORDER).find();
   int ordersLeft =
       searchBuilder
           .add(SearchRestrictions.isNull(ORDER_GROUP_LITERAL))
           .list()
           .getTotalNumberOfEntities();
   if (ordersLeft >= 0) {
     orders =
         searchBuilder
             .add(SearchRestrictions.isNull(ORDER_GROUP_LITERAL))
             .setMaxResults(10)
             .list()
             .getEntities();
     for (Entity order : orders) {
       order.setField(ORDER_GROUP_LITERAL, orderGroup);
       order.setField("doneQuantity", RANDOM.nextInt(10) + 1);
       order.getDataDefinition().save(order);
     }
   }
 }
  private String insertOptionalNonStandardCharacterFrom(
      final Character[] nonStandardChars, final String generated) {
    String resultString = generated;
    final boolean includeNonStandardChars = BOOLEAN.next();

    if (includeNonStandardChars) {
      final int positionToInsert = RANDOM.nextInt(generated.length());
      String charToInsert = valueOf(values(nonStandardChars).next());

      if (NONSTANDARD_CHARACTERS_TO_HAVE_BACKSLASH.contains(charToInsert)) {
        charToInsert = format("\\%s", charToInsert);
      }

      resultString =
          format(
              "\"%s%s%s\"",
              generated.substring(0, positionToInsert),
              charToInsert,
              generated.substring(positionToInsert, generated.length()));
    }

    return resultString;
  }
示例#26
0
  private void generateAndAddOperation() {
    Entity operation =
        dataDefinitionService.get(TECHNOLOGIES_PLUGIN, L_TECHNOLOGY_MODEL_OPERATION).create();

    String number = generateString(CHARS_ONLY, RANDOM.nextInt(40) + 5);

    operation.setField(L_NUMBER, number);
    operation.setField("name", getNameFromNumberAndPrefix("Operation-", number));
    operation.setField(L_BASIC_MODEL_STAFF, getRandomStaff());
    operation.setField(L_BASIC_MODEL_WORKSTATION_TYPE, getRandomMachine());

    operation.setField(L_TPZ, RANDOM.nextInt(1000));
    operation.setField(L_TJ, RANDOM.nextInt(1000));
    operation.setField("productionInOneCycle", RANDOM.nextInt(20));
    operation.setField(L_NEXT_OPERATION_AFTER_PRODUCED_TYPE, RANDOM.nextInt(10));
    operation.setField(
        "machineUtilization", numberService.setScale(new BigDecimal(RANDOM.nextDouble()).abs()));
    operation.setField(
        "laborUtilization", numberService.setScale(new BigDecimal(RANDOM.nextDouble()).abs()));
    operation.setField("nextOperationAfterProducedQuantity", RANDOM.nextInt(15));
    operation.setField(L_NEXT_OPERATION_AFTER_PRODUCED_TYPE, "01all");
    operation.setField("timeNextOperation", RANDOM.nextInt(30));
    operation.setField("nextOperationAfterProducedQuantity", "0");

    if (isEnabledOrEnabling("costNormsForOperation")) {
      operation.setField("pieceworkCost", RANDOM.nextInt(100));
      operation.setField("machineHourlyCost", RANDOM.nextInt(100));
      operation.setField("laborHourlyCost", RANDOM.nextInt(100));
      operation.setField("numberOfOperations", RANDOM.nextInt(10) + 1);
    }
    dataDefinitionService.get(TECHNOLOGIES_PLUGIN, L_TECHNOLOGY_MODEL_OPERATION).save(operation);
  }
示例#27
0
 private Long generateRandomDate(final Long dateFrom) {
   long dateOffset = RANDOM.nextInt();
   return dateFrom + ((dateOffset > 0) ? dateOffset : -dateOffset);
 }
示例#28
0
 private Long generateRandomDate() {
   long date = new Date().getTime() - RANDOM.nextInt();
   return ((date > 0) ? date : -date);
 }
示例#29
0
 private String generateTypeOfProduct() {
   return ACCEPTABLE_PRODUCT_TYPE[RANDOM.nextInt(ACCEPTABLE_PRODUCT_TYPE.length)];
 }
示例#30
0
  private void generateAndAddCompany() {
    Map<String, String> values = new HashMap<String, String>();
    values.put(L_NUMBER, generateString(DIGITS_ONLY, RANDOM.nextInt(34) + 5));
    values.put(L_NAME, generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("tax", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("street", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("house", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("flat", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("zipCode", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("city", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put(STATE_L, generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("country", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("email", generateRandomEmail());
    values.put("website", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("phone", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));
    values.put("owner", generateString(CHARS_ONLY, RANDOM.nextInt(4) + 3));

    addCompany(values);
  }