是什么导致了类似“”的错误构造函数未定义”

发布于 2024-11-19 20:42:25 字数 630 浏览 9 评论 0原文

我正在尝试在 Eclipse 中编译“Mahout in Action”的示例代码。有一个名为“LimitedMemoryDiffStorage.java”的 java 文件。本质上只是定义一个类

class LimitedMemoryDiffStorage {

Recommender buildRecommender(DataModel model) throws TasteException {
  DiffStorage diffStorage = new MemoryDiffStorage(
    model, Weighting.WEIGHTED, true, 10000000L);
  return new SlopeOneRecommender(
    model, Weighting.WEIGHTED, Weighting.WEIGHTED, diffStorage);
 }

}

但是 Eclipse 编译器指出

构造函数MemoryDiffStorage(DataModel, Weighting, boolean, long)未定义

我认为它是在 mahout-core 库中定义的并且已包含在构建路径中,为什么它仍然会导致这种错误?

I am trying to compile the example code of "Mahout in Action" in Eclipse. There is a java file titled as "LimitedMemoryDiffStorage.java". Which essentially just define a class

class LimitedMemoryDiffStorage {

Recommender buildRecommender(DataModel model) throws TasteException {
  DiffStorage diffStorage = new MemoryDiffStorage(
    model, Weighting.WEIGHTED, true, 10000000L);
  return new SlopeOneRecommender(
    model, Weighting.WEIGHTED, Weighting.WEIGHTED, diffStorage);
 }

}

But the eclipse compiler states

The constructor MemoryDiffStorage(DataModel, Weighting, boolean, long) is undefined

I think it is defined in the mahout-core library and has been included in the build path, why it still causes this kind of error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一向肩并 2024-11-26 20:42:25

也许您使用的库版本与书中描述的版本不同。很多时候,某些方法、构造函数甚至类会被更改甚至删除。检查这一点的最佳方法是检查 mahout-core 库的来源,或者至少是字节码。要在 Eclipse 中查看包括构造函数在内的方法,请按 CTRL + SHIFT + T 并输入类名来打开特定的 MemoryDiffStorage 类。然后在大纲视图中您应该看到实际的构造函数及其签名。

Maybe you are using a version of the library that is different from the one described in the book. Many times it happens that some of the methods, constructors or even classes are changed or even removed. The best way to check this would be to check the sources of mahout-core library, or at least the byte code. To see the methods including constructor in Eclipse, open the specific MemoryDiffStorage class by pressing CTRL + SHIFT + T and typing in the class name. Then in the outline view you should see the actual constructors with their signatures.

儭儭莪哋寶赑 2024-11-26 20:42:25

根据 https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.html MemoryDiffStorage 构造函数需要三个参数,但您传递了四个参数。

According to the documentation at https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/impl/recommender/slopeone/MemoryDiffStorage.html the MemoryDiffStorage constructor requires three parameters but you are passing it four.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文