test_class.declarator: builder
test_class.modifier: private
test_class.original_string: private ProtocolBuilderNumeric builder;
test_class.type: ProtocolBuilderNumeric
test_class.var_name: builder
test_class.declarator: context
test_class.modifier: private
test_class.original_string: private BasicNumericContext context;
test_class.type: BasicNumericContext
test_class.var_name: context
test_class.declarator: result
test_class.modifier: private
test_class.original_string: private DummyArithmeticNativeProtocol<SInt> result;
test_class.type: DummyArithmeticNativeProtocol<SInt>
test_class.var_name: result
test_class.declarator: rolledBit
test_class.modifier: private
test_class.original_string: private BigInteger rolledBit;
test_class.type: BigInteger
test_class.var_name: rolledBit
test_class.declarator: fieldElement
test_class.modifier: private
test_class.original_string: private FieldElement fieldElement;
test_class.type: FieldElement
test_class.var_name: fieldElement
test_class.file: core/src/test/java/dk/alexandra/fresco/suite/dummy/arithmetic/DummyArithmeticBuilderFactoryTest.java
test_class.identifier: DummyArithmeticBuilderFactoryTest
test_case.body: @Test
    public void createNumericRandomElement() {
      BuilderFactoryNumeric dummy = new DummyArithmeticBuilderFactory(context);
      Numeric numeric = dummy.createNumeric(builder);
      numeric.randomBit();
      Assert.assertNotNull(result);
      Assert.assertEquals(
          result.evaluate(0, mock(DummyArithmeticResourcePool.class), mock(Network.class)),
          EvaluationStatus.IS_DONE);
      Assert.assertTrue(rolledBit.intValue() >= 0);
      Assert.assertTrue(rolledBit.intValue() < 2);
  
      Assert.assertTrue(result.out().toString().contains("Mock for FieldElement"));
    }
test_case.class_method_signature: DummyArithmeticBuilderFactoryTest.createNumericRandomElement()
test_case.full_signature: @Test public void createNumericRandomElement()
test_case.identifier: createNumericRandomElement
test_case.invocations: createNumeric randomBit assertNotNull assertEquals evaluate mock mock assertTrue intValue assertTrue intValue assertTrue contains toString out
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void createNumericRandomElement()
focal_class.declarator: basicNumericContext
focal_class.modifier: private
focal_class.original_string: private BasicNumericContext basicNumericContext;
focal_class.type: BasicNumericContext
focal_class.var_name: basicNumericContext
focal_class.declarator: rand
focal_class.modifier: private
focal_class.original_string: private Random rand;
focal_class.type: Random
focal_class.var_name: rand
focal_class.file: core/src/main/java/dk/alexandra/fresco/suite/dummy/arithmetic/DummyArithmeticBuilderFactory.java
focal_class.identifier: DummyArithmeticBuilderFactory
focal_class.interfaces: implements BuilderFactoryNumeric
focal_class.class_method_signature: DummyArithmeticBuilderFactory.DummyArithmeticBuilderFactory(BasicNumericContext basicNumericContext)
focal_class.full_signature: public  DummyArithmeticBuilderFactory(BasicNumericContext basicNumericContext)
focal_class.identifier: DummyArithmeticBuilderFactory
focal_class.modifiers: public
focal_class.parameters: (BasicNumericContext basicNumericContext)
focal_class.signature:  DummyArithmeticBuilderFactory(BasicNumericContext basicNumericContext)
focal_class.class_method_signature: DummyArithmeticBuilderFactory.getBasicNumericContext()
focal_class.full_signature: @Override public BasicNumericContext getBasicNumericContext()
focal_class.identifier: getBasicNumericContext
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: BasicNumericContext
focal_class.signature: BasicNumericContext getBasicNumericContext()
focal_class.class_method_signature: DummyArithmeticBuilderFactory.createNumeric(ProtocolBuilderNumeric builder)
focal_class.full_signature: @Override public Numeric createNumeric(ProtocolBuilderNumeric builder)
focal_class.identifier: createNumeric
focal_class.modifiers: @Override public
focal_class.parameters: (ProtocolBuilderNumeric builder)
focal_class.return: Numeric
focal_class.signature: Numeric createNumeric(ProtocolBuilderNumeric builder)
focal_method.body: @Override
    public Numeric createNumeric(ProtocolBuilderNumeric builder) {
      return new Numeric() {
  
        private DummyArithmeticSInt createSIntFromConstant(BigInteger b) {
          return new DummyArithmeticSInt(basicNumericContext.getFieldDefinition().createElement(b));
        }
  
        @Override
        public DRes<SInt> sub(DRes<SInt> a, BigInteger b) {
          DummyArithmeticNativeProtocol<SInt> c =
              new DummyArithmeticSubtractProtocol(a, () -> createSIntFromConstant(b));
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> sub(BigInteger a, DRes<SInt> b) {
          DummyArithmeticSubtractProtocol c =
              new DummyArithmeticSubtractProtocol(() -> createSIntFromConstant(a), b);
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> sub(DRes<SInt> a, DRes<SInt> b) {
          DummyArithmeticSubtractProtocol c = new DummyArithmeticSubtractProtocol(a, b);
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> randomElement() {
          DummyArithmeticNativeProtocol<SInt> c = new DummyArithmeticNativeProtocol<SInt>() {
  
            DummyArithmeticSInt elm;
  
            @Override
            public EvaluationStatus evaluate(int round, DummyArithmeticResourcePool resourcePool,
                Network network) {
              BigInteger r;
              BigInteger modulus = basicNumericContext.getModulus();
              do {
                r = new BigInteger(modulus.bitLength() + 1, rand);
              } while (r.compareTo(modulus) >= 0);
              elm = createSIntFromConstant(r);
              return EvaluationStatus.IS_DONE;
            }
  
            @Override
            public SInt out() {
              return elm;
            }
          };
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> randomBit() {
          DummyArithmeticNativeProtocol<SInt> c = new DummyArithmeticNativeProtocol<SInt>() {
  
            DummyArithmeticSInt bit;
  
            @Override
            public EvaluationStatus evaluate(int round, DummyArithmeticResourcePool resourcePool,
                Network network) {
              bit = createSIntFromConstant(BigInteger.valueOf(rand.nextInt(2)));
              return EvaluationStatus.IS_DONE;
            }
  
            @Override
            public SInt out() {
              return bit;
            }
          };
          return builder.append(c);
        }
  
        @Override
        public DRes<BigInteger> open(DRes<SInt> secretShare) {
          DummyArithmeticOpenToAllProtocol c = new DummyArithmeticOpenToAllProtocol(secretShare);
          return builder.append(c);
        }
  
        @Override
        public DRes<BigInteger> open(DRes<SInt> secretShare, int outputParty) {
          DummyArithmeticOpenProtocol c = new DummyArithmeticOpenProtocol(secretShare, outputParty);
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> mult(BigInteger a, DRes<SInt> b) {
          DummyArithmeticMultProtocol c =
              new DummyArithmeticMultProtocol(() -> createSIntFromConstant(a), b);
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> mult(DRes<SInt> a, DRes<SInt> b) {
          DummyArithmeticMultProtocol c = new DummyArithmeticMultProtocol(a, b);
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> known(BigInteger value) {
          DummyArithmeticNativeProtocol<SInt> c = new DummyArithmeticNativeProtocol<SInt>() {
  
            DummyArithmeticSInt val;
  
            @Override
            public EvaluationStatus evaluate(int round, DummyArithmeticResourcePool resourcePool,
                Network network) {
              val = createSIntFromConstant(value);
              return EvaluationStatus.IS_DONE;
            }
  
            @Override
            public SInt out() {
              return val;
            }
          };
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> input(BigInteger value, int inputParty) {
          FieldElement open =
              value != null ? basicNumericContext.getFieldDefinition().createElement(value) : null;
          DummyArithmeticCloseProtocol c = new DummyArithmeticCloseProtocol(open, inputParty);
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> add(BigInteger a, DRes<SInt> b) {
          DummyArithmeticAddProtocol c =
              new DummyArithmeticAddProtocol(() -> createSIntFromConstant(a), b);
          return builder.append(c);
        }
  
        @Override
        public DRes<SInt> add(DRes<SInt> a, DRes<SInt> b) {
          DummyArithmeticAddProtocol c = new DummyArithmeticAddProtocol(a, b);
          return builder.append(c);
        }
      };
    }
focal_method.class_method_signature: DummyArithmeticBuilderFactory.createNumeric(ProtocolBuilderNumeric builder)
focal_method.full_signature: @Override public Numeric createNumeric(ProtocolBuilderNumeric builder)
focal_method.identifier: createNumeric
focal_method.invocations: createElement getFieldDefinition createSIntFromConstant append createSIntFromConstant append append getModulus bitLength compareTo createSIntFromConstant append createSIntFromConstant valueOf nextInt append append append createSIntFromConstant append append createSIntFromConstant append createElement getFieldDefinition append createSIntFromConstant append append
focal_method.modifiers: @Override public
focal_method.parameters: (ProtocolBuilderNumeric builder)
focal_method.return: Numeric
focal_method.signature: Numeric createNumeric(ProtocolBuilderNumeric builder)