Skip to content
Snippets Groups Projects

Hinzufügen von Problemen zur problem.java

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Robin Kreft
    Edited
    problem.java 1.12 KiB
    //Beispiel für das Hinzufügen von Problemen zum switch/case in der compare- und modify-Methode.
    
    public boolean c(String[] v_r, String[] v_sr){
    
        //v_r  --> Loesung des Generators
        //v_sr --> Loesung des Solvers 
    
        switch (name) {
            //Cases können hier hinzugefügt werden:
    
            case "Beispiel":
                //Code für den neuen Fall 'Beispiel'
    
            case "part":
                //Code für das Partitionsproblem
    
            default:
                //Standardfall für Stringvergleich
    
                for(int i=0;i<v_r.length;i++){
                    if(!(v_r[i].equals(v_sr[i]))){
    
                        //return-statements geben wieder, ob ein Vergleich erfolgreich war.
                        return false;
                    }
                }
                return true;
        }  
    }
    
    public String m(String in_str){
    
        //in_str  --> Ausgabestring des aktuellen Java Programms.
    
        switch (name) {
    
            case "Beispiel"
                //Code für den neuen Fall 'Beispiel'
    
            case "part":
                //Code für das Partitionsproblem
        
            default:
                //Standardfall für Stringübergabe
    
                return in_str;
        }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment