我正在尝试制作一个隐藏马尔可夫模型,并且正在使用在R中使用depmixS4
包的纸张。还有public static BaseProduct input(Class<? extends BaseProduct> productClass, InputStream in) throws IOException {
DataInputStream dataInputStream = new DataInputStream(in);
String brand = dataInputStream.readUTF();
String productName = dataInputStream.readUTF();
BigDecimal price = new BigDecimal(dataInputStream.readUTF());
int totalQuantity = dataInputStream.readInt();
int defectiveQuantity = dataInputStream.readInt();
List<Review> reviews = new ArrayList<>();
for (Review review : reviews) {
String userName = dataInputStream.readUTF();
int rating = dataInputStream.readInt();
}
return createProductInstance(brand, productName, price, totalQuantity, defectiveQuantity, reviews, productClass);
}
private static BaseProduct createProductInstance(String brand, String productName, BigDecimal price, int totalQuantity, int defectiveQuantity, List<Review> reviews, Class<? extends BaseProduct> productClass) {
try {
Constructor<? extends BaseProduct> productConstructor = productClass.getConstructor(String.class, String.class, BigDecimal.class, int.class, int.class, List.class);
return productConstructor.newInstance(brand, productName, price, totalQuantity, defectiveQuantity, reviews);
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
throw new IllegalArgumentException("Could not create product instance: " + e);
}
}
包。我似乎无法找到关于两个软件包之间差异的任何帖子或文档。它们是否实际上是相同的或意图用于不同的目的?