[927] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
| 2 | //
|
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 4 | // you may not use this file except in compliance with the License.
|
---|
| 5 | // You may obtain a copy of the License at
|
---|
| 6 | //
|
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 8 | //
|
---|
| 9 | // Unless required by applicable law or agreed to in writing, software
|
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 12 | // See the License for the specific language governing permissions and
|
---|
| 13 | // limitations under the License.
|
---|
| 14 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.plugin.guitar.commands;
|
---|
[196] | 16 |
|
---|
| 17 | import java.util.List;
|
---|
| 18 |
|
---|
[922] | 19 | import de.ugoe.cs.autoquest.plugin.guitar.EFGModelGenerator;
|
---|
| 20 | import de.ugoe.cs.autoquest.usageprofiles.FirstOrderMarkovModel;
|
---|
[196] | 21 | import de.ugoe.cs.util.console.Command;
|
---|
[667] | 22 | import de.ugoe.cs.util.console.GlobalDataContainer;
|
---|
[196] | 23 |
|
---|
| 24 | /**
|
---|
| 25 | * <p>
|
---|
| 26 | * Command to that loads an EFG and creates a first-order Markov model with the
|
---|
| 27 | * same structure.
|
---|
| 28 | * </p>
|
---|
| 29 | *
|
---|
| 30 | * @author Steffen Herbold
|
---|
| 31 | * @version 1.0
|
---|
| 32 | */
|
---|
| 33 | public class CMDefgToMM implements Command {
|
---|
| 34 |
|
---|
| 35 | /*
|
---|
| 36 | * (non-Javadoc)
|
---|
| 37 | *
|
---|
| 38 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
| 39 | */
|
---|
| 40 | @Override
|
---|
| 41 | public void run(List<Object> parameters) {
|
---|
| 42 | String filename;
|
---|
| 43 | String modelname;
|
---|
| 44 | try {
|
---|
| 45 | filename = (String) parameters.get(0);
|
---|
| 46 | modelname = (String) parameters.get(1);
|
---|
| 47 | } catch (Exception e) {
|
---|
[766] | 48 | throw new IllegalArgumentException();
|
---|
[196] | 49 | }
|
---|
| 50 |
|
---|
[227] | 51 | EFGModelGenerator modelGenerator = new EFGModelGenerator();
|
---|
| 52 | FirstOrderMarkovModel model = modelGenerator
|
---|
| 53 | .efgToFirstOrderMarkovModel(filename);
|
---|
[196] | 54 | GlobalDataContainer.getInstance().addData(modelname, model);
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * (non-Javadoc)
|
---|
| 59 | *
|
---|
| 60 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 61 | */
|
---|
| 62 | @Override
|
---|
[664] | 63 | public String help() {
|
---|
| 64 | return "efgToMM <filename> <modelname>";
|
---|
[196] | 65 | }
|
---|
| 66 |
|
---|
| 67 | }
|
---|