public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) {
    Chunk chunk = this.getOrCreateChunk(i, j);

    if (!chunk.done) {
      chunk.done = true;
      if (this.chunkProvider != null) {
        this.chunkProvider.getChunkAt(ichunkprovider, i, j);

        // CraftBukkit start
        BlockSand.instaFall = true;
        Random random = new Random();
        random.setSeed(world.getSeed());
        long xRand = random.nextLong() / 2L * 2L + 1L;
        long zRand = random.nextLong() / 2L * 2L + 1L;
        random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed());

        org.bukkit.World world = this.world.getWorld();
        if (world != null) {
          for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) {
            populator.populate(world, random, chunk.bukkitChunk);
          }
        }
        BlockSand.instaFall = false;
        this.world
            .getServer()
            .getPluginManager()
            .callEvent(new org.bukkit.event.world.ChunkPopulateEvent(chunk.bukkitChunk));
        // CraftBukkit end

        chunk.e();
      }
    }
  }
Ejemplo n.º 2
0
 /** java.util.Random#setSeed(long) */
 public void test_setSeedJ() {
   // Test for method void java.util.Random.setSeed(long)
   long[] randomArray = new long[100];
   boolean someDifferent = false;
   final long firstSeed = 1000;
   long aLong, anotherLong, yetAnotherLong;
   Random aRandom = new Random();
   Random anotherRandom = new Random();
   Random yetAnotherRandom = new Random();
   aRandom.setSeed(firstSeed);
   anotherRandom.setSeed(firstSeed);
   for (int counter = 0; counter < randomArray.length; counter++) {
     aLong = aRandom.nextLong();
     anotherLong = anotherRandom.nextLong();
     assertTrue(
         "Two randoms with same seeds gave differing nextLong values", aLong == anotherLong);
     yetAnotherLong = yetAnotherRandom.nextLong();
     randomArray[counter] = aLong;
     if (aLong != yetAnotherLong) someDifferent = true;
   }
   assertTrue("Two randoms with the different seeds gave the same chain of values", someDifferent);
   aRandom.setSeed(firstSeed);
   for (int counter = 0; counter < randomArray.length; counter++)
     assertTrue(
         "Reseting a random to its old seed did not result in the same chain of values as it gave before",
         aRandom.nextLong() == randomArray[counter]);
 }
  public void generateMapGen(
      Block[] blocks,
      byte[] metadata,
      Long seed,
      World world,
      WorldChunkManagerRTG cmr,
      Random mapRand,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float noise[]) {

    int k = 5;
    mapRand.setSeed(seed);
    long l = (mapRand.nextLong() / 2L) * 2L + 1L;
    long l1 = (mapRand.nextLong() / 2L) * 2L + 1L;
    for (int baseX = chunkX - k; baseX <= chunkX + k; baseX++) {
      for (int baseY = chunkY - k; baseY <= chunkY + k; baseY++) {
        mapRand.setSeed((long) baseX * l + (long) baseY * l1 ^ seed);
        rMapGen(
            blocks, metadata, world, cmr, mapRand, baseX, baseY, chunkX, chunkY, simplex, cell,
            noise);
      }
    }
  }
Ejemplo n.º 4
0
 public void generate(IChunkProvider ichunkprovider, World world, int i, int j, Block blocks[]) {
   int k = range;
   worldObj = world;
   rand.setSeed(worldObj.getSeed());
   long l = (rand.nextLong() / 2L) * 2L + 1L;
   long l1 = (rand.nextLong() / 2L) * 2L + 1L;
   for (int i1 = i - k; i1 <= i + k; i1++) {
     for (int j1 = j - k; j1 <= j + k; j1++) {
       rand.setSeed((long) i1 * l + (long) j1 * l1 ^ worldObj.getSeed());
       recursiveGenerate(worldObj, i1, j1, i, j, blocks);
     }
   }
 }
  @Override
  protected void postSubmit() throws Exception {
    final Random randPoints = new Random();
    final Random randModels = new Random();
    final Pattern p = Pattern.compile("(\\d+) (\\d+) (\\d+)");

    long[][] results = new long[NUM_POINTS][NUM_MODELS];
    boolean[][] occurs = new boolean[NUM_POINTS][NUM_MODELS];
    for (int i = 0; i < NUM_POINTS; i++) {
      for (int j = 0; j < NUM_MODELS; j++) {
        long actDotProd = 0;
        randPoints.setSeed(SEED_POINTS + 1000 * (i + 1));
        randModels.setSeed(SEED_MODELS + 1000 * (j + 1));
        for (int z = 1; z <= NUM_FEATURES; z++) {
          actDotProd += randPoints.nextInt(1000) * randModels.nextInt(100);
        }
        results[i][j] = actDotProd;
        occurs[i][j] = false;
      }
    }

    for (BufferedReader reader : getResultReader(this.resultPath)) {
      String line = null;
      while (null != (line = reader.readLine())) {
        final Matcher m = p.matcher(line);
        Assert.assertTrue(m.matches());

        int modelId = Integer.parseInt(m.group(1));
        int pointId = Integer.parseInt(m.group(2));
        long expDotProd = Long.parseLong(m.group(3));

        Assert.assertFalse(
            "Dot product for record (" + pointId + ", " + modelId + ") occurs more than once",
            occurs[pointId - 1][modelId - 1]);
        Assert.assertEquals(
            String.format("Bad product for (%04d, %04d)", pointId, modelId),
            expDotProd,
            results[pointId - 1][modelId - 1]);

        occurs[pointId - 1][modelId - 1] = true;
      }
    }

    for (int i = 0; i < NUM_POINTS; i++) {
      for (int j = 0; j < NUM_MODELS; j++) {
        Assert.assertTrue(
            "Dot product for record (" + (i + 1) + ", " + (j + 1) + ") does not occur",
            occurs[i][j]);
      }
    }
  }
 public void generate(World world, int x, int z, byte blockArray[]) {
   Random rand = new Random();
   rand.setSeed(world.getSeed());
   int k = 8;
   rand.setSeed(world.getSeed());
   long l = (rand.nextLong() / 2L) * 2L + 1L;
   long l1 = (rand.nextLong() / 2L) * 2L + 1L;
   for (int i1 = x - k; i1 <= x + k; i1++) {
     for (int j1 = z - k; j1 <= z + k; j1++) {
       rand.setSeed((long) i1 * l + (long) j1 * l1 ^ world.getSeed());
       func_868_a(world, rand, i1, j1, x, z, blockArray);
     }
   }
 }
Ejemplo n.º 7
0
  private void initOriginal() throws Exception {
    int size = 500000;
    float x;
    float y;
    float z;
    float a;

    Coord3d[] points = new Coord3d[size];
    Color[] colors = new Color[size];

    Random r = new Random();
    r.setSeed(0);

    for (int i = 0; i < size; i++) {
      x = r.nextFloat() - 0.5f;
      y = r.nextFloat() - 0.5f;
      z = r.nextFloat() - 0.5f;
      points[i] = new Coord3d(x, y, z);
      a = 0.25f;
      colors[i] = new Color(x, y, z, a);
    }

    Scatter scatter = new Scatter(points, colors);
    chart = AWTChartComponentFactory.chart(Quality.Advanced, "newt");
    chart.getScene().add(scatter);
  }
Ejemplo n.º 8
0
  private void b(World world, Random random, int i, int j) {
    random.setSeed(world.getSeed());
    long k = random.nextLong();
    long l = random.nextLong();
    long i1 = (long) i * k;
    long j1 = (long) j * l;

    random.setSeed(i1 ^ j1 ^ world.getSeed());
    int k1 = i * 16 + 8 - 29;
    int l1 = j * 16 + 8 - 29;
    EnumDirection enumdirection = EnumDirectionLimit.HORIZONTAL.a(random);

    this.a.add(new WorldGenMonumentPiece1(random, k1, l1, enumdirection));
    this.c();
    this.d = true;
  }
Ejemplo n.º 9
0
  static synchronized Random getRandom(String algorithm, Double seed) throws ExpressionException {

    algorithm = algorithm.toLowerCase();

    Random result = randoms.get(algorithm);

    if (result == null || !seed.isNaN()) {
      if (CFMXCompat.ALGORITHM_NAME.equalsIgnoreCase(algorithm)) {

        result = new Random();
      } else {

        try {

          result = SecureRandom.getInstance(algorithm);
        } catch (NoSuchAlgorithmException e) {
          throw new ExpressionException(
              "random algorithm [" + algorithm + "] is not installed on the system",
              e.getMessage());
        }
      }

      if (!seed.isNaN()) result.setSeed(seed.longValue());

      randoms.put(algorithm, result);
    }

    return result;
  }
Ejemplo n.º 10
0
  /** Populate a single chunk if needed. */
  private void populateChunk(int x, int z, boolean force) {
    GlowChunk chunk = getChunk(x, z);
    // cancel out if it's already populated
    if (chunk.isPopulated()) {
      return;
    }

    // cancel out if the 3x3 around it isn't available
    for (int x2 = x - 1; x2 <= x + 1; ++x2) {
      for (int z2 = z - 1; z2 <= z + 1; ++z2) {
        if (!getChunk(x2, z2).isLoaded() && (!force || !loadChunk(x2, z2, true))) {
          return;
        }
      }
    }

    // it might have loaded since before, so check again that it's not already populated
    if (chunk.isPopulated()) {
      return;
    }
    chunk.setPopulated(true);

    Random random = new Random(world.getSeed());
    long xRand = random.nextLong() / 2 * 2 + 1;
    long zRand = random.nextLong() / 2 * 2 + 1;
    random.setSeed((long) x * xRand + (long) z * zRand ^ world.getSeed());

    for (BlockPopulator p : world.getPopulators()) {
      p.populate(world, random, chunk);
    }

    EventFactory.callEvent(new ChunkPopulateEvent(chunk));
  }
  public Chunk provideChunk(int i, int j) {
    field_913_j.setSeed((long) i * 0x4f9939f508L + (long) j * 0x1ef1565bd5L);
    byte abyte0[] = new byte[32768];
    field_4179_v =
        worldObj_16
            .getWorldChunkManager()
            .loadBlockGeneratorData(field_4179_v, i * 16, j * 16, 16, 16);
    double ad[] = BWG4WorldChunkManager.temperature;
    generateTerrain(i, j, abyte0, field_4179_v, ad);
    replaceBlocksForBiome(i, j, abyte0, field_4179_v);
    field_902_u.generate(this, worldObj_16, i, j, abyte0);

    if (mapFeaturesEnabled) {
      strongholdGenerator.generate(this, worldObj_16, i, j, abyte0);
    }

    Chunk chunk = new Chunk(worldObj_16, abyte0, i, j);
    byte abyte1[] = chunk.getBiomeArray();

    for (int k = 0; k < abyte1.length; k++) {
      abyte1[k] = (byte) field_4179_v[k].biomeID;
    }

    chunk.generateSkylightMap();
    return chunk;
  }
Ejemplo n.º 12
0
 public static double RandomDouble(double min, double max) {
   if (!isRand) {
     rand.setSeed((new Date()).getTime());
     isRand = true;
   }
   return min + rand.nextDouble() * (max - min);
 }
Ejemplo n.º 13
0
  private void init(int height, int width) {

    mRandom.setSeed(System.currentTimeMillis());

    if ((height != mHeight) || (width != mWidth)) {
      mGrid = new KruskalCell[height][width];
    }

    for (int i = 0; i < height; i++) {
      for (int j = 0; j < width; j++) {
        if (mGrid[i][j] == null) {
          mGrid[i][j] = new KruskalCell(i, j);
        }

        mGrid[i][j].init();
      }
    }

    Integer[] walls = new Integer[height * (width - 1) + width * (height - 1)];
    for (int i = 0; i < walls.length; i++) {
      walls[i] = i;
    }

    mWalls = Arrays.asList(walls);
    Collections.shuffle(mWalls, mRandom);

    this.mHeight = height;
    this.mWidth = width;
  }
Ejemplo n.º 14
0
  @Test(groups = "1m")
  public void testSumvsIntLinCombTest() {
    Random rand = new Random();
    for (int seed = 0; seed < 400; seed++) {
      rand.setSeed(seed);
      int n = 1 + rand.nextInt(6);
      int min = -10 + rand.nextInt(20);
      int max = min + rand.nextInt(20);
      int[][] domains = DomainBuilder.buildFullDomains(n, min, max, rand, 1.0, false);
      int[] coeffs = new int[n];
      for (int i = 0; i < n; i++) {
        coeffs[i] = -25 + rand.nextInt(50);
      }
      int lb = -50 + rand.nextInt(100);
      int op = -1 + rand.nextInt(3);

      Solver sum = sum(domains, coeffs, lb, op);
      Solver intlincomb = intlincomb(domains, coeffs, lb, op);

      sum.findAllSolutions();
      intlincomb.findAllSolutions();
      Assert.assertEquals(
          sum.getMeasures().getSolutionCount(), intlincomb.getMeasures().getSolutionCount());
      Assert.assertEquals(
          sum.getMeasures().getNodeCount(), intlincomb.getMeasures().getNodeCount());
      LoggerFactory.getLogger("test")
          .info(
              "({}) {}ms vs {}ms",
              op,
              sum.getMeasures().getTimeCount(),
              intlincomb.getMeasures().getTimeCount());
    }
  }
Ejemplo n.º 15
0
  @Override
  protected int[] filterPixels(int width, int height, int[] inPixels, Rectangle transformedSpace) {
    int[] outPixels = new int[width * height];

    randomGenerator.setSeed(seed);

    int w1 = width - 1;
    int h1 = height - 1;
    putPixel(0, 0, randomRGB(inPixels, 0, 0), outPixels, width);
    putPixel(w1, 0, randomRGB(inPixels, w1, 0), outPixels, width);
    putPixel(0, h1, randomRGB(inPixels, 0, h1), outPixels, width);
    putPixel(w1, h1, randomRGB(inPixels, w1, h1), outPixels, width);
    putPixel(w1 / 2, h1 / 2, randomRGB(inPixels, w1 / 2, h1 / 2), outPixels, width);
    putPixel(0, h1 / 2, randomRGB(inPixels, 0, h1 / 2), outPixels, width);
    putPixel(w1, h1 / 2, randomRGB(inPixels, w1, h1 / 2), outPixels, width);
    putPixel(w1 / 2, 0, randomRGB(inPixels, w1 / 2, 0), outPixels, width);
    putPixel(w1 / 2, h1, randomRGB(inPixels, w1 / 2, h1), outPixels, width);

    int depth = 1;
    while (doPixel(0, 0, width - 1, height - 1, outPixels, width, depth, 0)) depth++;

    if (useColormap && colormap != null) {
      int index = 0;
      for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
          outPixels[index] = colormap.getColor((outPixels[index] & 0xff) / 255.0f);
          index++;
        }
      }
    }
    return outPixels;
  }
Ejemplo n.º 16
0
 @Override
 public void open() throws IOException {
   LOG.info("Resetting count and seed; openingSynthSourceRandSize");
   // resetting the seed
   count = 0;
   rand.setSeed(seed);
 }
Ejemplo n.º 17
0
  public Result getResult() throws OlapException {

    // make result reproducable for testing purposes
    random.setSeed(123427);

    int cellCount = 1;
    for (int i = 0; i < axes.length; i++) cellCount *= axes[i].getPositions().size();

    Locale locale = super.getLocale();
    if (locale == null) locale = Locale.getDefault();
    DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(locale);
    fmt.applyPattern("#,##0.00");
    ArrayList cells = new ArrayList();
    for (int i = 0; i < cellCount; i++) {
      CellImpl c = new CellImpl();
      if (false) {
        c.setValue(new Integer(i));
        c.setFormattedValue(Integer.toString(i));
      } else {
        double value = random.nextGaussian() * 100 + 1000;
        c.setValue(new Double(value));
        c.setFormattedValue(fmt.format(value));
      }
      addProperties(c, i);
      cells.add(c);
    }

    ResultImpl res = new ResultImpl();
    res.setAxes(axes);
    res.setCells(cells);
    res.setSlicer(slicer);
    return res;
  }
  @Override
  public void rMapGen(
      Block[] blocks,
      byte[] metadata,
      World world,
      WorldChunkManagerRTG cmr,
      Random mapRand,
      int baseX,
      int baseY,
      int chunkX,
      int chunkY,
      OpenSimplexNoise simplex,
      CellNoise cell,
      float noise[]) {

    if (baseX % 4 == 0 && baseY % 4 == 0 && mapRand.nextInt(6) == 0) {
      float river = cmr.getRiverStrength(baseX * 16, baseY * 16) + 1f;
      if (river > 0.98f && cmr.isBorderlessAt(baseX * 16, baseY * 16)) {
        long i1 = mapRand.nextLong() / 2L * 2L + 1L;
        long j1 = mapRand.nextLong() / 2L * 2L + 1L;
        mapRand.setSeed((long) chunkX * i1 + (long) chunkY * j1 ^ world.getSeed());

        WorldGenVolcano.build(
            blocks, metadata, world, mapRand, baseX, baseY, chunkX, chunkY, simplex, cell, noise);
      }
    }
  }
Ejemplo n.º 19
0
 public static double RandomDouble() {
   if (!isRand) {
     rand.setSeed((new Date()).getTime());
     isRand = true;
   }
   return rand.nextDouble();
 }
Ejemplo n.º 20
0
 /** Returns a new Random that's seeded based on the world seed and the x,z position */
 public static Random getRandom(World world, BlockPos pos) {
   Random random = new Random(world.getSeed());
   long l = ((random.nextLong() / 2L) * 2L) + 1L;
   long l1 = ((random.nextLong() / 2L) * 2L) + 1L;
   random.setSeed(((pos.getX() * l) + (pos.getZ() * l1)) ^ world.getSeed());
   return random;
 }
Ejemplo n.º 21
0
 public static boolean RandomBoolean() {
   if (!isRand) {
     rand.setSeed((new Date()).getTime());
     isRand = true;
   }
   return rand.nextBoolean();
 }
Ejemplo n.º 22
0
  @Override
  protected double doUpdate(double durationSeconds, long sampleCounter) {

    // Update phase in the wave
    currentPhase += durationSeconds * frequency.get();

    // Update noise value if needed
    if (currentPhase >= 1) {
      currentPhase -= 1;

      // Update seed if needed
      final double newSeed = seed.get();
      if (currentSeed != newSeed) {
        random.setSeed(Double.doubleToLongBits(newSeed));
        currentSeed = newSeed;
      }

      // White noise
      currentNoiseValue = random.nextDouble() * 2.0 - 1.0;

      // Bring phase down if it gets too large
      if (currentPhase > 100000) currentPhase -= 100000;
      if (currentPhase > 1000) currentPhase -= 1000;
      if (currentPhase > 100) currentPhase -= 100;
      if (currentPhase > 10) currentPhase -= 10;
    }

    // Apply amplitude and offset
    return amplitude.get() * currentNoiseValue + offset.get();
  }
Ejemplo n.º 23
0
  @Override
  public Chunk provideChunk(int chunkX, int chunkZ) {
    rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);

    biomesForGeneration =
        worldObj
            .getBiomeProvider()
            .loadBlockGeneratorData(biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);

    ChunkPrimer primer = new ChunkPrimer();

    setBlocksInChunk(primer);

    caveGenerator.generate(worldObj, chunkX, chunkZ, primer);

    if (CavelandConfig.generateRiver) {
      ravineGenerator.generate(worldObj, chunkX, chunkZ, primer);
    }

    replaceBiomeBlocks(chunkX, chunkZ, primer);

    Chunk chunk = new Chunk(worldObj, primer, chunkX, chunkZ);
    byte[] biomeArray = chunk.getBiomeArray();

    for (int i = 0; i < biomeArray.length; ++i) {
      biomeArray[i] = (byte) Biome.getIdForBiome(biomesForGeneration[i]);
    }

    chunk.resetRelightChecks();

    return chunk;
  }
Ejemplo n.º 24
0
 @Test(groups = "10s", timeOut = 60000)
 public void test1() {
   boolean bounded; // true if domains are bounded, false if they are enumerated
   Random rand = new Random(0);
   for (int k = 0; k < 20000; k++) {
     long seed = System.currentTimeMillis();
     rand.setSeed(seed);
     bounded = rand.nextBoolean();
     int size = 5; // domain size
     int range = 15; // value range
     int[][] domains;
     if (bounded) {
       domains = DomainBuilder.buildFullDomains(3, size, range, rand);
     } else {
       domains =
           DomainBuilder.buildFullDomains2(
               3, size, range, rand, rand.nextDouble(), rand.nextBoolean());
     }
     // total number of solutions: brut force algorithm
     long base = brutForceTest(domains, bounded);
     Model s = modeler(domains, bounded, seed);
     //            SearchMonitorFactory.log(s, false, false);
     try {
       while (s.getSolver().solve()) ;
     } catch (AssertionError ae) {
       System.err.printf("seed: %d\n", seed);
       throw ae;
     }
     long cp = s.getSolver().getSolutionCount();
     Assert.assertEquals(
         cp, base, "found: " + cp + " solutions, while " + base + " are expected (" + seed + ")");
   }
 }
Ejemplo n.º 25
0
  @Override
  public boolean doReplanning(MobsimAgent withinDayAgent) {

    random.setSeed(
        Integer.parseInt(withinDayAgent.getId().toString()) * this.controler.getIterationNumber());

    Plan executedPlan = WithinDayAgentUtils.getModifiablePlan(withinDayAgent);

    // If we don't have an executed plan
    if (executedPlan == null) return false;

    PlanElement currentPlanElement = WithinDayAgentUtils.getCurrentPlanElement(withinDayAgent);
    if (!(currentPlanElement instanceof Leg)) return false;
    Leg currentLeg = (Leg) currentPlanElement;
    int currentLinkIndex = WithinDayAgentUtils.getCurrentRouteLinkIdIndex(withinDayAgent);

    // new Route for current Leg
    this.microRouteCurrentLegRoute(
        currentLeg,
        executedPlan.getPerson(),
        currentLinkIndex,
        this.time,
        scenario.getNetwork(),
        tripRouter,
        random,
        executedPlan);

    // Finally reset the cached Values of the PersonAgent - they may have changed!
    WithinDayAgentUtils.resetCaches(withinDayAgent);

    return true;
  }
Ejemplo n.º 26
0
  @Override
  public void initialize(URL url, ResourceBundle resourceBundle) {
    Random random = new Random();
    random.setSeed(System.currentTimeMillis());

    Singleton.INSTANCE.magicNumber = random.nextLong();
    Singleton.INSTANCE.rightPairs = new ArrayList<String>();

    Singleton.INSTANCE.balloons = FXCollections.observableArrayList();

    Singleton.INSTANCE.pontosPlayer1 = 0;
    Singleton.INSTANCE.pontosPlayer2 = 0;

    this.imagesGridPane.setDisable(true);
    this.messagesListView.setDisable(true);
    this.messageInputField.setDisable(true);
    this.enviarButton.setDisable(true);

    for (Node node : this.imagesGridPane.getChildren()) {
      node.getStyleClass().addAll("imageview", "imageview:hover");
    }

    this.messagesListView.setItems(Singleton.INSTANCE.balloons);
    this.ipAddressLabel.setText(
        String.format(
            "Endereço IP: %s:%d",
            Singleton.INSTANCE.localIPAddress, Singleton.INSTANCE.localIMServerPort));
  }
 @Before
 public void setUp() throws Exception {
   seed = System.currentTimeMillis();
   rnd.setSeed(seed);
   //		rnd.setSeed(1308989334661L);
   System.out.println(" > seed = " + seed);
 }
  /** RG-1: Tests if a all matchings are correct (on some random graphs). */
  @Test
  public void testRandomGraphs() {
    Random rnd = new Random();
    rnd.setSeed(54321);

    for (int i = 1; i < 50; i++) {
      int vertexCount = 2 + rnd.nextInt(i),
          edgeCount = vertexCount + rnd.nextInt(vertexCount * (vertexCount - 1)) / 2,
          subVertexCount = 1 + rnd.nextInt(vertexCount);

      DirectedGraph<Integer, DefaultEdge>
          g1 = SubgraphIsomorphismTestUtils.randomGraph(vertexCount, edgeCount, i),
          g2 = SubgraphIsomorphismTestUtils.randomSubgraph(g1, subVertexCount, i);

      VF2SubgraphIsomorphismInspector<Integer, DefaultEdge> vf2 =
          new VF2SubgraphIsomorphismInspector<>(g1, g2);

      SubgraphIsomorphismTestUtils.showLog(i + ": " + vertexCount + "v, " + edgeCount + "e ");

      for (Iterator<GraphMapping<Integer, DefaultEdge>> mappings = vf2.getMappings();
          mappings.hasNext(); ) {
        assertEquals(true, SubgraphIsomorphismTestUtils.isCorrectMatching(mappings.next(), g1, g2));
        SubgraphIsomorphismTestUtils.showLog(".");
      }
      SubgraphIsomorphismTestUtils.showLog("\n");
    }
  }
  public TableModel produce(final DataRow parameters, final DataFactoryContext dataFactoryContext)
      throws ReportDataFactoryException {
    final int limit = getTypedParameter("limit", Integer.class, 100);
    final long seed = getTypedParameter("seed", Long.class, System.currentTimeMillis());

    final TypedTableModel model = new TypedTableModel();
    model.addColumn("rowcount", Integer.class);
    model.addColumn("integer", Integer.class);
    model.addColumn("double", Double.class);
    model.addColumn("text", String.class);
    model.addColumn("text2", String.class);
    model.addColumn("date", Date.class);

    final Random random = new Random();
    random.setSeed(seed);

    final Calendar baseDate = new GregorianCalendar(2000, 1, 1);
    baseDate.setTimeZone(TimeZone.getTimeZone("UTC"));
    final long millis = baseDate.getTimeInMillis();
    for (int i = 0; i < limit; i++) {
      model.addRow(
          i,
          (int) (random.nextDouble() * Integer.MAX_VALUE) - (Integer.MAX_VALUE / 2),
          random.nextDouble() * Integer.MAX_VALUE,
          "Some Text with breaks " + i,
          "SomeTextWithoutBreaks" + i,
          new Date(millis + (long) (200 * random.nextDouble() * Integer.MAX_VALUE)));
    }

    return model;
  }
Ejemplo n.º 30
0
 public void ask(String channel, String sender, String login, String hostname, String message) {
   Random random = new Random();
   random.setSeed(message.hashCode());
   List<String> list = new ArrayList<String>();
   list.add("As I see it, yes");
   list.add("It is certain");
   list.add("It is decidedly so");
   list.add("Most likely");
   list.add("Outlook good");
   list.add("Signs point to yes");
   list.add("Without a doubt");
   list.add("Yes");
   list.add("Yes, definitely");
   list.add("You may rely on it");
   list.add("Don't count on it");
   list.add("My reply is no");
   list.add("My sources say no");
   list.add("Outlook not so good");
   list.add("Very doubtful");
   list.add("Don't lose hope");
   list.add("It may happen");
   list.add("Maybe");
   if (!(message.trim() == "")) {
     Main.bot.sendMessage(channel, list.get(random.nextInt(list.size())));
   }
 }