Examples of IntValue


Examples of com.volantis.xml.expression.atomic.numeric.IntValue

    private int getIntRound(Value value) {
        if (value instanceof DoubleValue) {
            DoubleValue doubleValue = (DoubleValue) value;
            return (int) Math.round(doubleValue.asJavaDouble());
        } else if (value instanceof IntValue) {
            IntValue intValue = (IntValue) value;
            return intValue.asJavaInt();
        } else {
            throw new IllegalArgumentException(
                    "'" + value + "' is not a number");
        }
    }
View Full Code Here

Examples of eu.stratosphere.types.IntValue

  public void setup()
  {
    final ArrayList<IntStringPair> source = new ArrayList<IntStringPair>();
   
    // add elements to the source
    source.add(new IntStringPair(new IntValue(1), new StringValue("A")));
    source.add(new IntStringPair(new IntValue(2), new StringValue("B")));
    source.add(new IntStringPair(new IntValue(3), new StringValue("C")));
    source.add(new IntStringPair(new IntValue(3), new StringValue("D")));
    source.add(new IntStringPair(new IntValue(4), new StringValue("E")));
    source.add(new IntStringPair(new IntValue(4), new StringValue("F")));
    source.add(new IntStringPair(new IntValue(4), new StringValue("G")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("H")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("I")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("J")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("K")));
    source.add(new IntStringPair(new IntValue(5), new StringValue("L")));
   
   
    this.sourceIter = new MutableObjectIterator<Record>() {
      final Iterator<IntStringPair> it = source.iterator();
     
View Full Code Here

Examples of net.openhft.lang.values.IntValue

                for (int i = 0; i < threads; i++) {
                    final int t = i;
                    futures.add(es.submit(new Runnable() {
                        @Override
                        public void run() {
                            IntValue value = nativeIntValue();
                            StringBuilder sb = new StringBuilder();
                            long next = 50 * 1000 * 1000;
                            // use a factor to give up to 10 digit numbers.
                            int factor = Math.max(1, (int) ((10 * 1000 * 1000 * 1000L - 1) / entries));
                            for (long j = t % independence; j < entries + independence - 1; j += independence) {
                                sb.setLength(0);
                                sb.append("us:");
                                sb.append(j * factor);
                                map.acquireUsing(sb, value);
                                long n = value.addAtomicValue(1);
                                assert n > 0 && n < 1000 : "Counter corrupted " + n;
                                if (t == 0 && j >= next) {
                                    long size = map.longSize();
                                    if (size < 0) throw new AssertionError("size: " + size);
                                    System.out.println(j + ", size: " + size);
View Full Code Here

Examples of net.openhft.lang.values.IntValue$$Native

        final SharedHashMap<IntValue, CharSequence> map = new SharedHashMapBuilder()
                .entries(1000)
                .entries(20000).file(getPersistenceFile()).kClass(IntValue.class).vClass(CharSequence.class).create();

        IntValue$$Native value = new IntValue$$Native();
        value.bytes(new ByteBufferBytes(ByteBuffer.allocateDirect(4)), 0);

        value.setValue(1);
        final String expected = "test";
        map.put(value, expected);

        final CharSequence actual = map.get(value);
        assertEquals(expected, actual);
View Full Code Here

Examples of org.apache.flink.types.IntValue

  public IntPair(IntValue first, IntValue second) {
    super(first, second);
  }

  public IntPair(int first, int second) {
    super(new IntValue(first), new IntValue(second));
  }
View Full Code Here

Examples of org.apache.flink.types.IntValue

  @Override
  public void map(Record record, Collector<Record> out) throws Exception {
    Tuple inputTuple = record.getField(1, this.inputTuple);
   
    int year = Integer.parseInt(inputTuple.getStringValueAt(4).substring(0, 4));
    record.setField(1, new IntValue(year));
    out.collect(record);
  }
View Full Code Here

Examples of org.apache.flink.types.IntValue

      throws Exception {
    IntPair partAndSupplierKey = value1.getField(0, this.partAndSupplierKey);
    StringValue supplyCostStr = value1.getField(1, this.supplyCostStr);
    Tuple ordersValue = value2.getField(1, this.ordersValue);
   
    IntValue year = new IntValue(Integer.parseInt(ordersValue.getStringValueAt(0)));
    float quantity = Float.parseFloat(ordersValue.getStringValueAt(1));
    float price = Float.parseFloat(ordersValue.getStringValueAt(2));
    float supplyCost = Float.parseFloat(supplyCostStr.toString());
    float amount = price - supplyCost * quantity;
   
 
View Full Code Here

Examples of org.apache.flink.types.IntValue

   */
  @Override
  public void join(Record value1, Record value2, Collector<Record> out)
      throws Exception {

    IntValue year = value1.getField(1, IntValue.class);
    Tuple lineItem = value2.getField(1, Tuple.class);
   
    /* (partkey, suppkey) from lineItem: */
    IntPair newKey = new IntPair(new IntValue(Integer.parseInt(lineItem.getStringValueAt(0))), new IntValue(Integer.parseInt(lineItem.getStringValueAt(1))));
    Tuple newValue = new Tuple();
    newValue.addAttribute(year.toString()); // year
    newValue.addAttribute(lineItem.getStringValueAt(2)); // quantity
    newValue.addAttribute(lineItem.getStringValueAt(3)); // price
   
    value1.setField(0, newKey);
    value1.setField(1, newValue);
View Full Code Here

Examples of org.apache.flink.types.IntValue

   */
  @Override
  public void join(Record value1, Record value2, Collector<Record> out)
      throws Exception {

    IntValue partKey = value1.getField(0, this.partKey);
    Tuple partSuppValue = value2.getField(1, this.partSuppValue);
   
    IntPair newKey = new IntPair(partKey, new IntValue(Integer.parseInt(partSuppValue.getStringValueAt(0))));
    String supplyCost = partSuppValue.getStringValueAt(1);
   
    value1.setField(0, newKey);
    value1.setField(1, new StringValue(supplyCost));
    out.collect(value1);
View Full Code Here

Examples of org.apache.flink.types.IntValue

  public StringIntPair(StringValue first, IntValue second) {
    super(first, second);
  }

  public StringIntPair(String first, int second) {
    super(new StringValue(first), new IntValue(second));
  }
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.