Examples of apply()


Examples of org.apache.hadoop.fs.shell.find.Replicas.apply()

  public void applyEquals() throws IOException {
    Replicas rep = new Replicas();
    addArgument(rep, "3");
    rep.initialise(new FindOptions());

    assertEquals(Result.FAIL, rep.apply(one));
    assertEquals(Result.FAIL, rep.apply(two));
    assertEquals(Result.PASS, rep.apply(three));
    assertEquals(Result.FAIL, rep.apply(four));
    assertEquals(Result.FAIL, rep.apply(five));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Size.apply()

  public void applyEqualsBlock() throws IOException {
    Size size = new Size();
    addArgument(size, "5");
    size.initialise(new FindOptions());

    assertEquals(Result.PASS, size.apply(fiveBlocks));
    assertEquals(Result.FAIL, size.apply(sixBlocks));
    assertEquals(Result.FAIL, size.apply(fourBlocks));
    assertEquals(Result.PASS, size.apply(fiveBlocksPlus));
    assertEquals(Result.FAIL, size.apply(fiveBlocksMinus));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.shell.find.Type.apply()

    type.initialise(new FindOptions());
   
    when(mockFstat.isDirectory()).thenReturn(true);
    PathData item = new PathData("/one/two/test", conf);

    assertEquals(Result.PASS, type.apply(item));
  }

  @Test
  public void testIsNotDirectory() throws IOException{
    Type type = new Type();
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.IndexHook.apply()

        builder.setProperty("foo", "bar");
        NodeState after = builder.getNodeState();

        IndexHook l = new LuceneIndexDiff(builder);
        after.compareAgainstBaseState(before, l);
        l.apply();
        l.close();

        IndexDefinition testDef = new IndexDefinitionImpl("lucene",
                TYPE_LUCENE, "/oak:index/lucene");
        QueryIndex queryIndex = new LuceneIndex(testDef);
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.nodetype.TypePredicate.apply()

    @Test
    public void emptyNodeTypeList() {
        NodeState node = createNodeOfType(NT_BASE);
        TypePredicate p = new TypePredicate(node, new String[] {});
        assertFalse(p.apply(node));
    }

    @Test
    public void singleNodeTypeMatch() {
        NodeState node = createNodeOfType(NT_BASE);
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.ProfilingRule.apply()

        // test applying it
        RequestContext context = new MockRequestContext();
        Subject subject = createSubject();
        context.setPath("/homepage.psml");       
        context.setSubject(subject);
        ProfileLocator locator = rule.apply(context, profiler);
        System.out.println("locator = " + locator);
        assertTrue("locator string " + locator.toString(), locator.toString().equals("/homepage.psml:user:david:navigation:/:role:ATP:role:NB:role:ATP-NB:page:/homepage.psml"));
       
        System.out.println("COMPLETED: running test user role fallback.");
    }
View Full Code Here

Examples of org.apache.lucene.index.DocumentsWriterDeleteQueue.DeleteSlice.apply()

        last1 = j + 1;
      }
      if (random().nextInt(10) == 5 || j == ids.length - 1) {
        queue.updateSlice(slice2);
        assertTrue(slice2.isTailItem(term));
        slice2.apply(bd2, j);
        assertAllBetween(last2, j, bd2, ids);
        last2 = j + 1;
      }
      assertEquals(j+1, queue.numGlobalTermDeletes());
    }
View Full Code Here

Examples of org.apache.mahout.ep.Mapping.apply()

  @Test
  public void testSoftLimitDeserialization() {
    Mapping m = ModelSerializer.gson().fromJson(new StringReader("{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}"), Mapping.SoftLimit.class);
    assertTrue(m instanceof Mapping.SoftLimit);
    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);

    String data = "{\"class\":\"org.apache.mahout.ep.Mapping$SoftLimit\",\"value\":{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}}";
    m = ModelSerializer.gson().fromJson(new StringReader(data), Mapping.class);
    assertTrue(m instanceof Mapping.SoftLimit);
    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);
View Full Code Here

Examples of org.apache.mahout.math.function.DoubleDoubleFunction.apply()

    final DoubleDoubleFunction costFunction = NeuralNetworkFunctions.getDerivativeDoubleDoubleFunction(this.costFunctionName);

    Matrix lastWeightMatrix = this.weightMatrixList.get(this.weightMatrixList.size() - 1);

    for (int i = 0; i < deltaVec.size(); ++i) {
      double costFuncDerivative = costFunction.apply(labels.get(i), output.get(i + 1));
      // add regularization
      costFuncDerivative += this.regularizationWeight * lastWeightMatrix.viewRow(i).zSum();
      deltaVec.set(i, costFuncDerivative);
      deltaVec.set(i, deltaVec.get(i) * derivativeSquashingFunction.apply(output.get(i + 1)));
    }
View Full Code Here

Examples of org.apache.mahout.math.function.DoubleFunction.apply()

    for (int i = 0; i < deltaVec.size(); ++i) {
      double costFuncDerivative = costFunction.apply(labels.get(i), output.get(i + 1));
      // add regularization
      costFuncDerivative += this.regularizationWeight * lastWeightMatrix.viewRow(i).zSum();
      deltaVec.set(i, costFuncDerivative);
      deltaVec.set(i, deltaVec.get(i) * derivativeSquashingFunction.apply(output.get(i + 1)));
    }

    // start from previous layer of output layer
    for (int layer = this.layerSizeList.size() - 2; layer >= 0; --layer) {
      deltaVec = backPropagate(layer, deltaVec, internalResults, weightUpdateMatrices[layer]);
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.