Java Code Examples for weka.core.Capabilities#test()

The following examples show how to use weka.core.Capabilities#test() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSaver.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/** Sets the strcuture of the instances for the first step of incremental saving.
  * The instances only need to have a header.
  * @param headerInfo an instances object.
  * @return the appropriate write mode
  */  
 public int setStructure(Instances headerInfo){
 
     Capabilities cap = getCapabilities();
     if (!cap.test(headerInfo))
throw new IllegalArgumentException(cap.getFailReason());
 
     if(m_writeMode == WAIT && headerInfo != null){
       m_instances = headerInfo;
       m_writeMode = STRUCTURE_READY;
     }
     else{
       if((headerInfo == null)  || !(m_writeMode == STRUCTURE_READY) || !headerInfo.equalHeaders(m_instances)){
           m_instances = null;
           if(m_writeMode != WAIT)
               System.err.println("A structure cannot be set up during an active incremental saving process.");
           m_writeMode = CANCEL;
       }
     }
     return m_writeMode;
 }
 
Example 2
Source File: AbstractSaver.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
/**
  * Sets instances that should be stored.
  *
  * @param instances the instances
  */
 public void setInstances(Instances instances){

     Capabilities cap = getCapabilities();
     if (!cap.test(instances))
throw new IllegalArgumentException(cap.getFailReason());
   
     if(m_retrieval == INCREMENTAL){
         if(setStructure(instances) == CANCEL)
             cancel();
     }
     else  
       m_instances = instances;
 }