本文整理汇总了Java中weka.core.SerializedObject.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java SerializedObject.getObject方法的具体用法?Java SerializedObject.getObject怎么用?Java SerializedObject.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.core.SerializedObject
的用法示例。
在下文中一共展示了SerializedObject.getObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFunction
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Get a named DefineFunction. Returns a deep copy of the function.
*
* @param functionName the name of the function to get
* @return the named function or null if it cannot be found
* @throws Exception if there is a problem deep copying the function
*/
protected DefineFunction getFunction(String functionName) throws Exception {
DefineFunction copy = null;
DefineFunction match = null;
for (DefineFunction f : m_defineFunctions) {
if (f.getName().equals(functionName)) {
match = f;
// System.err.println("Found a match!!!");
break;
}
}
if (match != null) {
SerializedObject so = new SerializedObject(match, false);
copy = (DefineFunction) so.getObject();
// System.err.println(copy);
}
return copy;
}
示例2: DelValueAction
import weka.core.SerializedObject; //导入方法依赖的package包/类
DelValueAction(int nTargetNode, String sValue) {
try {
m_nTargetNode = nTargetNode;
m_sValue = sValue;
m_att = m_Instances.attribute(nTargetNode);
SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
m_CPT = (Estimator[]) so.getObject();
;
m_children = new ArrayList<Integer>();
for (int iNode = 0; iNode < getNrOfNodes(); iNode++) {
if (m_ParentSets[iNode].contains(nTargetNode)) {
m_children.add(iNode);
}
}
m_childAtts = new Estimator[m_children.size()][];
for (int iChild = 0; iChild < m_children.size(); iChild++) {
int nChild = m_children.get(iChild);
m_childAtts[iChild] = m_Distributions[nChild];
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: getFlow
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Gets the current flow being edited. The flow is returned as a single Vector
* containing two other Vectors: the beans and the connections. These two
* vectors are deep-copied via serialization before being returned.
*
* @return the current flow being edited
* @throws Exception if a problem occurs
*/
public Vector<Vector<?>> getFlow() throws Exception {
Vector<Vector<?>> v = new Vector<Vector<?>>();
Vector<Object> beans = BeanInstance.getBeanInstances(m_mainKFPerspective
.getCurrentTabIndex());
Vector<BeanConnection> connections = BeanConnection
.getConnections(m_mainKFPerspective.getCurrentTabIndex());
detachFromLayout(beans);
v.add(beans);
v.add(connections);
SerializedObject so = new SerializedObject(v);
@SuppressWarnings("unchecked")
Vector<Vector<?>> copy = (Vector<Vector<?>>) so.getObject();
// tempWrite(beans, connections);
integrateFlow(beans, connections, true, false);
return copy;
}
示例4: getFlow
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Gets the current flow being edited. The flow is returned as a single Vector
* containing two other Vectors: the beans and the connections. These two
* vectors are deep-copied via serialization before being returned.
*
* @return the current flow being edited
*/
public Vector getFlow() throws Exception {
Vector v = new Vector();
Vector beans = BeanInstance.getBeanInstances();
Vector connections = BeanConnection.getConnections();
detachFromLayout(beans);
v.add(beans);
v.add(connections);
SerializedObject so = new SerializedObject(v);
Vector copy = (Vector) so.getObject();
// tempWrite(beans, connections);
integrateFlow(beans, connections);
return copy;
}
示例5: DelValueAction
import weka.core.SerializedObject; //导入方法依赖的package包/类
DelValueAction(int nTargetNode, String sValue) {
try {
m_nTargetNode = nTargetNode;
m_sValue = sValue;
m_att = m_Instances.attribute(nTargetNode);
SerializedObject so = new SerializedObject(m_Distributions[nTargetNode]);
m_CPT = (Estimator[]) so.getObject();
;
m_children = new FastVector();
for (int iNode = 0; iNode < getNrOfNodes(); iNode++) {
if (m_ParentSets[iNode].contains(nTargetNode)) {
m_children.addElement(iNode);
}
}
m_childAtts = new Estimator[m_children.size()][];
for (int iChild = 0; iChild < m_children.size(); iChild++) {
int nChild = (Integer) m_children.elementAt(iChild);
m_childAtts[iChild] = m_Distributions[nChild];
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例6: makeCopies
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Creates a given number of deep or shallow (if the kernel implements Copyable)
* copies of the given kernel using serialization.
*
* @param model the kernel to copy
* @param num the number of kernel copies to create.
* @return an array of kernels.
* @throws Exception if an error occurs
*/
public static Kernel[] makeCopies(Kernel model, int num) throws Exception {
if (model == null)
throw new Exception("No model kernel set");
Kernel[] kernels = new Kernel[num];
if (model instanceof Copyable) {
for (int i = 0; i < kernels.length; i++) {
kernels[i] = (Kernel) ((Copyable) model).copy();
}
} else {
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < kernels.length; i++)
kernels[i] = (Kernel) so.getObject();
}
return kernels;
}
示例7: makeCopies
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Creates copies of the current clusterer. Note that this method now uses
* Serialization to perform a deep copy, so the Clusterer object must be fully
* Serializable. Any currently built model will now be copied as well.
*
* @param model an example clusterer to copy
* @param num the number of clusterer copies to create.
* @return an array of clusterers.
* @exception Exception if an error occurs
*/
public static Clusterer[] makeCopies(Clusterer model, int num)
throws Exception {
if (model == null) {
throw new Exception("No model clusterer set");
}
Clusterer[] clusterers = new Clusterer[num];
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < clusterers.length; i++) {
clusterers[i] = (Clusterer) so.getObject();
}
return clusterers;
}
示例8: makeCopies
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Creates copies of the current clusterer. Note that this method
* now uses Serialization to perform a deep copy, so the Clusterer
* object must be fully Serializable. Any currently built model will
* now be copied as well.
*
* @param model an example clusterer to copy
* @param num the number of clusterer copies to create.
* @return an array of clusterers.
* @exception Exception if an error occurs
*/
public static DensityBasedClusterer [] makeCopies(DensityBasedClusterer model,
int num) throws Exception {
if (model == null) {
throw new Exception("No model clusterer set");
}
DensityBasedClusterer [] clusterers = new DensityBasedClusterer [num];
SerializedObject so = new SerializedObject(model);
for(int i = 0; i < clusterers.length; i++) {
clusterers[i] = (DensityBasedClusterer) so.getObject();
}
return clusterers;
}
示例9: makeCopies
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Creates copies of the current evaluator. Note that this method now uses
* Serialization to perform a deep copy, so the evaluator object must be fully
* Serializable. Any currently built model will now be copied as well.
*
* @param model an example evaluator to copy
* @param num the number of evaluator copies to create.
* @return an array of evaluators.
* @exception Exception if an error occurs
*/
public static ASEvaluation[] makeCopies(ASEvaluation model,
int num) throws Exception {
if (model == null) {
throw new Exception("No model evaluator set");
}
ASEvaluation[] evaluators = new ASEvaluation[num];
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < evaluators.length; i++) {
evaluators[i] = (ASEvaluation) so.getObject();
}
return evaluators;
}
示例10: makeCopies
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Creates copies of the current search scheme. Note that this method
* now uses Serialization to perform a deep copy, so the search
* object must be fully Serializable. Any currently built model will
* now be copied as well.
*
* @param model an example search scheme to copy
* @param num the number of search scheme copies to create.
* @return an array of search schemes.
* @throws Exception if an error occurs
*/
public static ASSearch[] makeCopies(ASSearch model, int num) throws Exception {
if (model == null)
throw new Exception("No model search scheme set");
ASSearch[] result = new ASSearch[num];
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < result.length; i++)
result[i] = (ASSearch) so.getObject();
return result;
}
示例11: makeCopies
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* returns deep copies of the given object
*
* @param obj the object to copy
* @param num the number of copies
* @return the deep copies
* @throws Exception if copying fails
*/
protected Object[] makeCopies(Object obj, int num) throws Exception {
if (obj == null) {
throw new Exception("No object set");
}
Object[] objs = new Object[num];
SerializedObject so = new SerializedObject(obj);
for (int i = 0; i < objs.length; i++) {
objs[i] = so.getObject();
}
return objs;
}
示例12: AddArcAction
import weka.core.SerializedObject; //导入方法依赖的package包/类
AddArcAction(int nParent, int nChild) {
try {
m_nParent = nParent;
m_children = new ArrayList<Integer>();
m_children.add(nChild);
// m_nChild = nChild;
SerializedObject so = new SerializedObject(m_Distributions[nChild]);
m_CPT = new Estimator[1][];
m_CPT[0] = (Estimator[]) so.getObject();
;
} catch (Exception e) {
e.printStackTrace();
}
}
示例13: makeCopies
import weka.core.SerializedObject; //导入方法依赖的package包/类
/**
* Creates a given number of deep copies of the given estimator using
* serialization.
*
* @param model the estimator to copy
* @param num the number of estimator copies to create.
* @return an array of estimators.
* @exception Exception if an error occurs
*/
public static Estimator[] makeCopies(Estimator model, int num)
throws Exception {
if (model == null) {
throw new Exception("No model estimator set");
}
Estimator[] estimators = new Estimator[num];
SerializedObject so = new SerializedObject(model);
for (int i = 0; i < estimators.length; i++) {
estimators[i] = (Estimator) so.getObject();
}
return estimators;
}
示例14: DeleteArcAction
import weka.core.SerializedObject; //导入方法依赖的package包/类
DeleteArcAction(int nParent, int nChild) {
try {
m_nChild = nChild;
m_nParent = nParent;
m_nParents = new int[getNrOfParents(nChild)];
for (int iParent = 0; iParent < m_nParents.length; iParent++) {
m_nParents[iParent] = getParent(nChild, iParent);
}
SerializedObject so = new SerializedObject(m_Distributions[nChild]);
m_CPT = (Estimator[]) so.getObject();
} catch (Exception e) {
e.printStackTrace();
}
}
示例15: undo
import weka.core.SerializedObject; //导入方法依赖的package包/类
@Override
public void undo() {
try {
SerializedObject so = new SerializedObject(m_CPT);
m_Distributions[m_nChild] = (Estimator[]) so.getObject();
ParentSet parentSet = new ParentSet();
for (int m_nParent2 : m_nParents) {
parentSet.addParent(m_nParent2, m_Instances);
}
m_ParentSets[m_nChild] = parentSet;
} catch (Exception e) {
e.printStackTrace();
}
}