Examples of Allocation


Examples of com.indeed.proctor.common.model.Allocation

        double DELTA = 0;

        List<Allocation> allocations = fromCompactAllocationFormat("ruleA|10:0,11:0.5,12:0.5", "0:0,1:0.5,2:0.5");
        assertEquals(2, allocations.size());
        {
            Allocation allocationA = allocations.get(0);
            assertEquals("ruleA", allocationA.getRule());
            assertEquals(3, allocationA.getRanges().size());
            assertEquals(10, allocationA.getRanges().get(0).getBucketValue());
            assertEquals(0, allocationA.getRanges().get(0).getLength(), DELTA);
            assertEquals(11, allocationA.getRanges().get(1).getBucketValue());
            assertEquals(0.5, allocationA.getRanges().get(1).getLength(), DELTA);
            assertEquals(12, allocationA.getRanges().get(2).getBucketValue());
            assertEquals(0.5, allocationA.getRanges().get(2).getLength(), DELTA);
        }
        {
            Allocation allocationB = allocations.get(1);
            assertNull(allocationB.getRule());
            assertEquals(3, allocationB.getRanges().size());
            assertEquals(0, allocationB.getRanges().get(0).getBucketValue());
            assertEquals(0, allocationB.getRanges().get(0).getLength(), DELTA);
            assertEquals(1, allocationB.getRanges().get(1).getBucketValue());
            assertEquals(0.5, allocationB.getRanges().get(1).getLength(), DELTA);
            assertEquals(2, allocationB.getRanges().get(2).getBucketValue());
            assertEquals(0.5, allocationB.getRanges().get(2).getLength(), DELTA);
        }
    }
View Full Code Here

Examples of com.indeed.proctor.common.model.Allocation

            for(String sRange : allRanges) {
                // Could handle index-out of bounds + number formatting exception better.
                String[] rangeParts = sRange.split(":");
                ranges.add(new Range(Integer.parseInt(rangeParts[0], 10), Double.parseDouble(rangeParts[1])));
            }
            allocationList.add(new Allocation(rule, ranges));
        }
        return allocationList;
    }
View Full Code Here

Examples of com.indeed.proctor.common.model.Allocation

            for(String sRange : allRanges) {
                // Could handle index-out of bounds + number formatting exception better.
                String[] rangeParts = sRange.split(":");
                ranges.add(new Range(Integer.parseInt(rangeParts[0], 10), Double.parseDouble(rangeParts[1])));
            }
            allocationList.add(new Allocation(rule, ranges));
        }
        return allocationList;
    }
View Full Code Here

Examples of com.indeed.proctor.common.model.Allocation

            Assert.assertEquals("test", testBucket.getName());
            Assert.assertEquals(1, testBucket.getValue());
            Assert.assertNull(testBucket.getDescription());

            Assert.assertEquals(2, definition.getAllocations().size());
            final Allocation englishAllocation = definition.getAllocations().get(0);
            Assert.assertEquals("${lang == ENGLISH}", englishAllocation.getRule());
            Assert.assertEquals(0.25, englishAllocation.getRanges().get(0).getLength(), 1E-16);
            Assert.assertEquals(0, englishAllocation.getRanges().get(0).getBucketValue());
            Assert.assertEquals(0.75, englishAllocation.getRanges().get(1).getLength(), 1E-16);
            Assert.assertEquals(1, englishAllocation.getRanges().get(1).getBucketValue());

            final Allocation defaultAllocation = definition.getAllocations().get(1);
            Assert.assertNull(defaultAllocation.getRule());
            Assert.assertEquals(0.1, defaultAllocation.getRanges().get(0).getLength(), 1E-16);
            Assert.assertEquals(0, defaultAllocation.getRanges().get(0).getBucketValue());
            Assert.assertEquals(0.90, defaultAllocation.getRanges().get(1).getLength(), 1E-16);
            Assert.assertEquals(1, defaultAllocation.getRanges().get(1).getBucketValue());
        } finally {
            input.close();
        }

    }
View Full Code Here

Examples of net.sf.mpxj.planner.schema.Allocation

      m_plannerProject.setAllocations(allocations);

      List<Allocation> allocationList = allocations.getAllocation();
      for (ResourceAssignment mpxjAssignment : m_projectFile.getAllResourceAssignments())
      {
         Allocation plannerAllocation = m_factory.createAllocation();
         allocationList.add(plannerAllocation);

         plannerAllocation.setTaskId(getIntegerString(mpxjAssignment.getTask().getUniqueID()));
         plannerAllocation.setResourceId(getIntegerString(mpxjAssignment.getResourceUniqueID()));
         plannerAllocation.setUnits(getIntegerString(mpxjAssignment.getUnits()));

         m_projectFile.fireAssignmentWrittenEvent(mpxjAssignment);
      }
   }
View Full Code Here

Examples of org.apache.cassandra.db.commitlog.CommitLogSegment.Allocation

     */
    public Allocation allocate(Mutation mutation, int size)
    {
        CommitLogSegment segment = allocatingFrom();

        Allocation alloc;
        while ( null == (alloc = segment.allocate(mutation, size)) )
        {
            // failed to allocate, so move to a new segment with enough room
            advanceAllocatingFrom(segment);
            segment = allocatingFrom;
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.MemStoreLAB.Allocation

    if (allocator == null) {
      return kv;
    }

    int len = kv.getLength();
    Allocation alloc = allocator.allocateBytes(len);
    if (alloc == null) {
      // The allocation was too large, allocator decided
      // not to do anything with it.
      return kv;
    }
    assert alloc != null && alloc.getData() != null;
    System.arraycopy(kv.getBuffer(), kv.getOffset(), alloc.getData(), alloc.getOffset(), len);
    KeyValue newKv = new KeyValue(alloc.getData(), alloc.getOffset(), len);
    newKv.setMemstoreTS(kv.getMemstoreTS());
    return newKv;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.MemStoreLAB.Allocation

    if (allocator == null) {
      return kv;
    }

    int len = kv.getLength();
    Allocation alloc = allocator.allocateBytes(len);
    if (alloc == null) {
      // The allocation was too large, allocator decided
      // not to do anything with it.
      return kv;
    }
    assert alloc != null && alloc.getData() != null;
    System.arraycopy(kv.getBuffer(), kv.getOffset(), alloc.getData(), alloc.getOffset(), len);
    KeyValue newKv = new KeyValue(alloc.getData(), alloc.getOffset(), len);
    newKv.setMemstoreTS(kv.getMemstoreTS());
    return newKv;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.MemStoreLAB.Allocation

    if (allocator == null) {
      return kv;
    }

    int len = kv.getLength();
    Allocation alloc = allocator.allocateBytes(len);
    if (alloc == null) {
      // The allocation was too large, allocator decided
      // not to do anything with it.
      return kv;
    }
    assert alloc != null && alloc.getData() != null;
    System.arraycopy(kv.getBuffer(), kv.getOffset(), alloc.getData(), alloc.getOffset(), len);
    KeyValue newKv = new KeyValue(alloc.getData(), alloc.getOffset(), len);
    newKv.setMvccVersion(kv.getMvccVersion());
    return newKv;
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.regionserver.MemStoreLAB.Allocation

    if (allocator == null) {
      return kv;
    }

    int len = kv.getLength();
    Allocation alloc = allocator.allocateBytes(len);
    if (alloc == null) {
      // The allocation was too large, allocator decided
      // not to do anything with it.
      return kv;
    }
    assert alloc != null && alloc.getData() != null;
    System.arraycopy(kv.getBuffer(), kv.getOffset(), alloc.getData(), alloc.getOffset(), len);
    KeyValue newKv = new KeyValue(alloc.getData(), alloc.getOffset(), len);
    newKv.setMemstoreTS(kv.getMemstoreTS());
    return newKv;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.