id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
5abb946f-60f2-47e0-b1f4-96106b9812c0 | public void setItem(int index, int id, short dam, String title, String action, List<String> lore) throws IllegalArgumentException
{
String[] acpar = action.split("\\|");
if(acpar.length != 2) return;
if(index < 0 || index > 26) throw new IllegalArgumentException("Index is "+(index < 0 ? "too... |
4a460f5c-4b65-4772-803a-e87df1c0cef1 | public void onClick(final Player player, int slot)
{
if(slot < 0 || slot > 26) return;
Slot s = this.slots[slot];
if(s != null)
{
String action = s.getAction();
final String parameter = s.getParameter();
if(action == null || parameter == null)
... |
6208bf1f-4bb0-4b81-a223-dc9fe5d95eba | @Override
public void run()
{
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.0f, 94f);
player.openInventory(m.createMenu(player));
main.crafting.put(player.getName(), para... |
3e8f0dca-cd0b-4852-91e6-efb78ec61cec | @Override
public void run()
{
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1.0f, 94f);
final CraftingInventory ci = (CraftingInventory) player.openWorkbench(null, true).getTopInventory();
mai... |
e2bbb8f3-7ce9-4314-ae0a-984831800c74 | public boolean hasParent()
{
return parent != null;
} |
3a981928-53f6-4699-9c5a-913174ca721a | public Inventory createMenu(Player holder)
{
Inventory inv = Bukkit.createInventory(holder, 27, ChatColor.translateAlternateColorCodes('&',this.name));
inv.setContents(this.contents);
return inv;
} |
489d3354-31ae-4065-8984-2c38cc948fc6 | @Bean
public ZipCodeValidator zipCodeValidator() {
return new ZipCodeValidator();
} |
5db6275c-eec4-4284-9cda-0627442df415 | @Override
public boolean supports(Class<?> aClass) {
return String.class.equals(aClass);
} |
8012f0fa-f7c7-4868-97c4-63f37e681e2a | @Override
public void validate(Object o, Errors errors) {
String zipCode = o.toString();
if (zipCode == null || zipCode.length() == 0 || zipCode.trim().length() == 0) {
errors.reject(ZIP_CODE, BLANK_ZIP);
} else if (zipCode.length() != 5) {
errors.reject(ZIP_CODE, INV... |
3c7dbc51-7617-43b5-b9a2-d0057e1af714 | public void validateZip(int zip); |
f5a7f458-d34a-4080-a699-406991e5de02 | public Weather getWeatherData(int zip) throws WeatherServiceException, WeatherServiceException; |
dbb72d82-8bbb-435d-9a61-6be958e207c7 | @Override
public void validateZip(int zip) {
} |
88855683-eba6-4691-b772-f37e053b8bdc | @SuppressWarnings("unchecked")
@Override
public Weather getWeatherData(int zip) throws WeatherServiceException {
HttpClient httpClient = new DefaultHttpClient();
try {
HttpGet httpGet = new HttpGet(new URI(format(urlFormat, apiKey, zip)));
HttpResponse response = httpClie... |
19fb6d3e-6069-465c-a0b3-186e93313ed0 | public WeatherServiceException() {
} |
e46e1873-291b-4af9-af63-87bb37691f6d | public WeatherServiceException(String message) {
super(message);
} |
a014b89e-4c48-4ab7-ab2c-433397e07977 | public WeatherServiceException(String message, Throwable cause) {
super(message, cause);
} |
5d251ac5-1ff8-4649-b504-c98e41cc34ac | public WeatherServiceException(Throwable cause) {
super(cause);
} |
46112ad0-8c4b-4041-832c-9b593d2a5bf7 | public WeatherServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
} |
9f2c4931-27e1-41ee-ad42-a4ab84efac83 | public Weather(int zip) {
this.zip = zip;
} |
622fd1ca-f830-4bd0-9edd-7bd8c86aff4a | public Weather(int zip, String city, String state, double temperatureFahrenheit) {
this.zip = zip;
this.city = city;
this.state = state;
this.temperatureFahrenheit = temperatureFahrenheit;
} |
9fa9ebf9-8fc5-44c8-9692-c3ba8db85604 | public int getZip() {
return zip;
} |
c7be815c-4b4b-4a1d-aa31-f20724426baa | public String getCity() {
return city;
} |
4950e21d-1bd4-4f49-a2d3-e48a0ad10ff9 | public String getState() {
return state;
} |
42287a5d-3b46-4a49-9f8f-e99e727ce48e | public double getTemperatureFahrenheit() {
return temperatureFahrenheit;
} |
4c8df89f-f955-4fd9-bbc8-68f4dd076c70 | public Pair(T1 item1, T2 item2) {
this.item1 = item1;
this.item2 = item2;
} |
4bef5f06-9810-4dbb-8530-5704fa0bb5e4 | public T1 getItem1() {
return item1;
} |
8ebf348d-3cdf-4490-a8a3-3586fb3b3ac6 | public T2 getItem2() {
return item2;
} |
c0ca38c2-67fa-4249-bf4d-d874a89810e5 | public static <T1, T2> Pair<T1, T2> pair(T1 t1, T2 t2) {
return new Pair<T1, T2>(t1, t2);
} |
c0e2f413-e509-46a0-830a-7ffc2543221f | public static ModelAndView render(Object model, HttpServletResponse response) {
MappingJacksonHttpMessageConverter jsonConverter = new MappingJacksonHttpMessageConverter();
MediaType jsonMimeType = MediaType.APPLICATION_JSON;
try {
jsonConverter.write(model, jsonMimeType, new Servlet... |
c1ca434e-ba74-4986-8157-e272207d9da0 | public static Map<String, Object> map(Pair<String, ?>... pairs) {
Map<String, Object> map = new HashMap<String, Object>();
for (Pair<String, ?> pair : pairs) {
map.put(pair.getItem1(), pair.getItem2());
}
return map;
} |
a27b57e3-1bfa-43b1-af03-fca60e7d6c6e | public static String serialize(Pair<String, ?>... pairs) {
return new Gson().toJson(map(pairs));
} |
a96540fc-40de-4c3a-a15f-2bf9e7f5741c | @SuppressWarnings("unchecked")
public static <T> T get(Map<String, ?> map, String... nestedKeys) {
Map<String, ?> tmp = map;
for (int i = 0; i < nestedKeys.length; i++) {
String key = nestedKeys[i];
if (tmp.containsKey(key)) {
if (i == nestedKeys.length - 1) {... |
3a157dfe-b0ed-48f4-9f55-6a839ad800ff | @RequestMapping(method = RequestMethod.POST)
public String fetchWeather(@ModelAttribute(ZIP_PARAM_NAME) String zipCode, HttpServletResponse response, BindingResult result) throws IOException {
if (!zipCodeValidator.supports(zipCode.getClass())) {
throw new IllegalArgumentException("No validators... |
3a2f1177-3e26-495d-a456-56566df83568 | @SuppressWarnings("unchecked")
private Map<String, Object> fetch(String zipCode) {
try {
String url = weatherController.getClass().getAnnotation(RequestMapping.class).value()[0];
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(this.weatherController).build();
ResultActi... |
19131662-d720-4a4e-8d0c-77626c27bfee | @Test
public void testBlankZip() {
Map<String, Object> map = fetch("");
assertTrue(map.containsKey(ERROR_KEY));
assertTrue(!map.containsKey(DATA_KEY));
assertEquals(map.get(ERROR_KEY), BLANK_ZIP);
} |
ccb695f5-6eb9-4d7e-903e-dd1691a1a425 | @Test
public void testInvalidFormatZip() {
Map<String, Object> map = fetch("Test1");
assertTrue(map.containsKey(ERROR_KEY));
assertTrue(!map.containsKey(DATA_KEY));
assertEquals(map.get(ERROR_KEY), INVALID_ZIP_FORMAT);
} |
18d0b9d7-fa06-427b-8484-25cdbfe9b41a | @Test
public void testIncompleteZip() {
Map<String, Object> map = fetch("1234");
assertTrue(map.containsKey(ERROR_KEY));
assertTrue(!map.containsKey(DATA_KEY));
assertEquals(map.get(ERROR_KEY), INVALID_ZIP);
} |
981b04e8-a03f-4a85-88d1-936847bac159 | @Test
public void testNegativeZip() {
Map<String, Object> map = fetch("-1234");
assertTrue(map.containsKey(ERROR_KEY));
assertTrue(!map.containsKey(DATA_KEY));
assertEquals(map.get(ERROR_KEY), INVALID_ZIP);
} |
370ed037-9d6c-445f-af28-746a757d4de2 | @Test
public void testZipNotFound() {
Map<String, Object> map = fetch("00000");
assertTrue(map.containsKey(ERROR_KEY));
assertTrue(!map.containsKey(DATA_KEY));
assertEquals(map.get(ERROR_KEY), ZIP_NOT_FOUND);
} |
c6796102-0645-4245-a5b2-22327cf31ebb | @Test
@SuppressWarnings("unchecked")
public void testValidZip() {
Map<String, Object> map = fetch("94538");
assertTrue(!map.containsKey(ERROR_KEY));
assertTrue(map.containsKey(DATA_KEY));
Map<String, Object> data = (Map<String, Object>) map.get(DATA_KEY);
assertEquals(dat... |
c126aab3-5888-4b8f-b456-f997bc2eccdf | @Test
public void testWeatherServiceReturnsValidZip() {
try {
Weather w = weatherService.getWeatherData(94538);
assertEquals(w.getZip(), 94538);
assertEquals(w.getCity(), "Fremont");
assertEquals(w.getState(), "California");
assertTrue(w.getTempera... |
ed56154b-b04f-4cf0-a318-ae40c5ffa7e7 | @Test
public void testWeatherServiceFailsForInvalidZip() {
try {
weatherService.getWeatherData(-94538);
throw new AssertionError("Test Failed. Code should never reach here.");
} catch (WeatherServiceException e) {
assertNotNull(e);
}
} |
19610d23-d999-45b3-a5f3-9a9feb5a9224 | @Test
public void testWeatherServiceReturnsZipNotFound() {
try {
weatherService.getWeatherData(0);
} catch (WeatherServiceException e) {
assertEquals(e.getMessage(), ZIP_NOT_FOUND);
}
} |
56f94451-ebae-4533-84ed-5c8085281b9b | public ChangerPanel(SongChanger SChanger)
{
this.SChanger = SChanger;
change = new JButton("Change!");
ButtonListener changer = new ButtonListener();
change.addActionListener(changer);
percentage = new JLabel("By what percent?");
percentage2 = new JLabel("By what percent?");
tempo = new JCheckBox("Cha... |
fdf91f88-f372-4e33-a552-abf6e825a857 | public void actionPerformed(ActionEvent event)
{
if(tempoChanged)
SChanger.changeTempo(Integer.parseInt(tempoPercent.getText()) / 100);
if(bassChanged)
SChanger.changeBass(Integer.parseInt(bassPercent.getText()) / 100);
SChanger.changeOctave(octaveChange);
SChanger.changeInstument(inst);
Ch... |
a1c7cae7-5ee4-4ac8-9e25-824cc6913a10 | public void itemStateChanged(ItemEvent event)
{
tempoChanged = tempo.isSelected();
bassChanged = bass.isSelected();
} |
e28d3899-2853-44fc-bfc4-cd40f3d1af01 | public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if(source == upOctave)
octaveChange = 1;
else
{
if(source == downOctave)
octaveChange = -1;
else
octaveChange = 0;
}
} |
70f3ad72-9f60-4984-b706-9699d20c75e4 | public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if(source == instrument1)
inst[0] = 1; //change to instrument number array
else
{
if(source == instrument2)
inst[0] = 2;//change to instrument number array
else
inst[0] = 3;//change to instrument numb... |
2a9f93d7-dfcd-4bce-834b-cdd10e735430 | public void recieveSong(Song song)
{
tempo = (double)song.bpm;
bass = song.bass;
octave = song.octave;
instruments = song.instruments;
} |
fc67dfb4-039e-4bc5-90d8-c3b4e296136b | public void changeSong(boolean useGui)
{
if(useGui)
{
//using a GUI
JFrame frame = new JFrame("Song Changer");
ChangerPanel panel = new ChangerPanel(this);
frame.getContentPane().add(panel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
else
... |
92017ca7-6181-43c1-a6ea-4cd06b88b118 | public void changeTempo(double change)
{
tempo = tempo * change;
} |
7dda7779-99fd-4af6-b230-9c33cb605428 | public void changeBass(double change)
{
bass = bass * change;
} |
ec764f6c-f4d6-47ab-aefd-e6467bcd2b00 | public void changeOctave(int change)
{
octave = octave + change;
} |
b61c0e1f-7d33-4a4e-ac10-7754b6a469e8 | public void changeInstument(int[] change)
{
instruments = change;
} |
8907e88f-77df-400f-88b7-7105c8dc0fbe | public void createNewSong(Song song)
{
song.bpm = (int) tempo;
song.bass = bass;
song.octave = octave;
song.instruments = instruments;
} |
49f2db07-220e-4d01-aabf-445287bd061a | public Note(NoteType type, String pitch, boolean perc, int velocity, int octave){
nt = type;
this.pitch = pitch;
if(pitch.equals("e#")){
this.pitch = "f";
}else if(pitch.equals("b#")){
this.pitch = "c";
}
this.isperc = perc;
this.velocity = velocity;
this.octave = octave;
} |
81beccfc-d28c-4823-842d-9fb6f0669dd4 | public Note(double noteLength, String pitch, boolean perc, int velocity, int octave){
this(fromLength(noteLength), pitch, perc, velocity, octave);
} |
9b9cf2ac-d84d-4cd5-82d1-de4a4cd22c21 | public Note(double noteLength, String pitch, boolean perc, int velocity, int octave, boolean isDotted){
this(fromLength(noteLength), pitch, perc, velocity, octave);
this.isdotted = isDotted;
// System.out.println
} |
f8a29611-1301-47a1-8b26-ee4e903de295 | public Note(NoteType type, String pitch, boolean perc, int velocity){
this(type, pitch, perc, velocity, defaultOctave);
} |
59af86a4-c97e-4649-a70d-19ba6f2ffa3c | public Note(double noteLength, String pitch, boolean perc, int velocity){
this(fromLength(noteLength),pitch, perc, velocity);
} |
1fc3e46a-ec35-48bd-8ab0-8b56c8534d89 | public Note(NoteType type, String pitch, boolean perc){
this(type, pitch, perc, defaultVelocity, defaultOctave);
} |
ade1e682-b7e7-4a69-838b-53ae4ae80441 | public Note(double noteLength, String pitch, boolean perc){
this(fromLength(noteLength),pitch, perc, defaultVelocity);
} |
c8d063e1-3885-4298-a16d-2878013b0101 | public static NoteType fromLength(double length){
if(length >= 1){
return NoteType.WHOLE;
}else if(length >= .5){
return NoteType.HALF;
}else if(length >= .25){
return NoteType.QUARTER;
}else if(length >= .125){
return NoteType.EIGTH;
}else {
return NoteType.SIXTEENTH;
}
} |
7a1e0eba-f1d0-4360-bf73-dc547f5a45d2 | public int noteLength(){
int base = (isdotted ? 3:2);
switch(nt){
case WHOLE:
base*=2;
case HALF:
base*=2;
case QUARTER:
base*=2;
case EIGTH:
base*=2;
case SIXTEENTH:
base*=1;
break;
}
return base;
} |
b14af7ef-6fbf-4c49-b9d3-054b5cfbab8e | public int asMidi(){
for (int i = 0; i < Song.keys.length; i++){
if(Song.keys[i].equals(pitch)){
return i + 11*octave;
}
}
System.out.println("invalid pitch " + pitch);
return -1;
} |
9329d7cb-3ee3-4fc1-9034-d7c7986ccccd | public void play(){
} |
1ccea256-0ca6-48bc-847c-404439b4d66a | public SongRenderer() throws MidiUnavailableException{
seqencer = MidiSystem.getSequencer();
synth = MidiSystem.getSynthesizer();
synth.open();
try {
Soundbank sb = MidiSystem.getSoundbank(new File("mariopaint.sf2"));
boolean success = synth.loadAllInstruments(sb);
// synth.getChannels()[0].programChang... |
9f23eafc-d6fe-480f-8f17-d50143759941 | public long play(Song s) throws MidiUnavailableException, InvalidMidiDataException{
seqencer.stop();
seqencer.setMicrosecondPosition(0);
seqencer.setTempoInBPM(s.bpm);
Sequence seq = s.getSequence();
seqencer.setSequence(seq);
seqencer.start();
return seq.getTracks()[0].ticks();
} |
caf6ad46-5567-4530-9945-40aeaa10a388 | public void write(Song s){
// Encoding ae = AudioFormat.Encoding.PCM_UNSIGNED;
// int rate = 44100;//khz
// int samplesize = 16;
// int channels = 1;
// boolean bigEndian = true;
// AudioFormat fmt = new AudioFormat(ae, rate, samplesize, channels,(samplesize/8) * channels,rate ,bigEndian);
File out = new File(... |
05cd4528-623d-49dd-a637-7f05abd39ef2 | Song(NoteTrack[] tracks, int bpm){
//arbitrary doubles to change song elements (to be given meaning soon), will probably change
this.tracks = tracks;
this.bpm = bpm;
} |
32f7db3b-cbcc-4514-b187-d7cd1190c061 | Sequence getSequence() {
Sequence s = null;
try {
s = new Sequence(Sequence.PPQ, 8);
Track t = s.createTrack();
for (int i = 0; i < tracks.length; i++) {
tracks[i].fillMIDITrack(t, i, this.bpm);
}
} catch (InvalidMidiDataException e) {
// TODO Auto-generated catch block
e.printStackTrace... |
d5862d96-cf8c-43c0-a70d-d3f83ec21231 | public Song(){
pickKey();
System.out.println("Key: " + key);
boolean sharps = false;
//assigns index in natural array
int natIndex = 0;
for(int i = 0; i<natKeys.length; i++){
if(natKeys[i].equals(keys[keyIndex].substring(0, 1))){
natIndex = i;
break;
}
}
int sharpCount = 0;
//check if sh... |
62eb8b21-c8b3-47d1-8ab0-43c82237d317 | public static int getKeyIndex(String note){
int index = -1;
for(int i = 0; i<chordTones.length; i++){
if(note.equals(chordTones[i])){
index = i;
break;
}
}
return index;
} |
8075b356-05cb-4006-9da0-94a3b71ce669 | public static int getNatIndex(String note){
int index = -1;
for(int i = 0; i<natKeys.length; i++){
if(note.equals(natKeys[i])){
index = i;
break;
}
}
return index;
} |
b9913a94-4d6e-4290-b0be-5a764bb0434e | public void pickKey(){
Random randy = new Random();
keyIndex = randy.nextInt(keys.length);
key = keys[keyIndex];
} |
fb1e69c0-7e41-4ed1-99ba-d4d197cb1358 | public void play(){
} |
f3138a4f-4c3c-4319-ba95-895a13113e20 | public void play(){
} |
00c6122f-3a58-4f55-b628-67f318045662 | public static void main(String[] args){
SongRenderer sr = null;
try {
sr = new SongRenderer();
Song s = new Song();
System.out.println("Song generated");
s.bpm = 150;
// System.out.println("Playing, len = " + sr.play(s));
sr.write(s);
// while(sr.seqencer.isRunning()){
// sr.seqencer.getMicros... |
d4d6c579-79d6-4336-b2fe-c33cb3e095ae | public void play(){
} |
a3b17ab8-857c-4464-a43c-d33204a66e2b | public void create(String key, int pKeyIndex){
keyIndex = pKeyIndex;
createRhythm();
createSoprano();
createChords();
createBass();
createPercussion();
for(int i = 0; i < trackRhythm.size(); i++){
System.out.println("Chord: " + chordProg[i][0] + chordProg[i][1] + chordProg[i][2] + " Soprano: " + sopran... |
2d471c2c-10c4-4b3a-bcd6-9265e60b7157 | public void createRhythm(){
fillTriads();
boolean upFlow = true;
Random randy = new Random();
double time = 0;
for(int i = 0; i<numMeasures; i++){
System.out.println("Measure: " + i);
upFlow = trueOrFalse[randy.nextInt(2)];
System.out.println(upFlow);
double beatsLeft = numBeats;
while(beatsLef... |
cbfd6bb9-4683-4f66-8194-120cf4fee735 | public void createPercussion(){
Random randy = new Random();
for(int i = 0; i<numMeasures*numBeats; i++){
if(randy.nextBoolean()){
if(randy.nextBoolean()){
for(int j = 0; j<8; j++){
percRhythm.add(.125);
}
}else{
for(int b = 0; b<4; b++){
percRhythm.add(.125*1.5);
percRhy... |
f346be2f-dac3-469f-90a7-c16441898142 | public void createChords(){
chordProg = new String[trackRhythm.size()][3];
chordProg[0] = I;
for(int i = 1; i<chordProg.length; i++){
chordProg[i] = pickChord(chordProg[i-1],sopranoLine[i].pitch);
// chordProg[i] = pickChord(chordProg[i-1], chordWithRoot(Song.chords[Song.getKeyIndex(sopranoLine[i].pitch)][0]... |
1cfefd61-c908-4d90-a738-9c8715235e42 | public String[] pickChord(String[] lastChord, String root){
String[] optionOne = I;
String[] optionTwo = I;
String[] optionThree = I;
for(int i = 0; i<Song.chords.length; i++){
if(root.equals(Song.chords[i][0])){
optionOne = Song.chords[i];
}else if(root.equals(Song.chords[i][1])){
optionTwo = Son... |
3a68bf8e-8763-4ad3-a138-d59b3ff772ab | public double trackLength(){
double time = 0 ;
for(int i = 0; i<trackRhythm.size();i++){
time += trackRhythm.get(i);
}
return time;
} |
3ab64a6e-1ecb-4d6c-9cb4-9bd8029d61e9 | public void createSoprano(){
sopranoLine = new Note[trackRhythm.size()];
sopranoLine[0] = new Note(trackRhythm.get(0),pickNoteFromChord(I),false);
sopranoLine[sopranoLine.length-1] = new Note(trackRhythm.get(sopranoLine.length-1),pickNoteFromChord(I),false);
sopranoLine[sopranoLine.length-2] = new Note(trackRhy... |
32b5d529-cb28-42ab-a3a2-65166a0c8aa0 | public void createAltoAndTenor(){
String[] notesUsed = new String[2];
altoLine = new Note[trackRhythm.size()];
altoLine[0] = new Note(trackRhythm.get(0),pickNoteFromChord(I),false);
tenorLine = new Note[trackRhythm.size()];
tenorLine[0] = new Note(trackRhythm.get(0),pickNoteFromChord(I),false);
} |
f6b89e77-a724-4210-8e60-e54d193b2033 | public void createBass(){
bassLine = new Note[trackRhythm.size()];
bassLine[0] = new Note(trackRhythm.get(0),pickNoteFromChord(I),false,Note.defaultVelocity,Note.defaultOctave-3);
bassLine[bassLine.length-1] = new Note(trackRhythm.get(bassLine.length-1),pickNoteFromChord(I),false,Note.defaultVelocity,Note.default... |
4b10dd0c-6af3-4f9e-b0d2-31fcb7a10a15 | public String pickNoteFromChord(String[] chord){
Random randy = new Random();
String note = chord[randy.nextInt(chord.length)];
return note;
} |
30427639-ef94-44ae-8e2d-d006358f393e | public String pickNoteFromChord(String[] chord,String[] notesUsed){
ArrayList<String> newChord = new ArrayList<String>();
Random randy = new Random();
for(int i = 0; i<chord.length; i++){
for(int j = 0; j<notesUsed.length; j++){
}
}
String note = chord[randy.nextInt(chord.length)];
return note;
... |
0e955f21-aafa-4283-bdd4-d588bf3f3fa1 | public String pickNotePitchBass(String startingPitch, boolean upFlow){
Random randy = new Random();
String pitch = startingPitch;
//System.out.println(Song.getKeyIndex(pitch));
String[] noteRange = new String[7];
if(upFlow){
for(int i = 0; i<noteRange.length; i++){
if((Song.chordTones.length>Song.getKe... |
968cb935-c1e4-4f86-b202-7610286374cc | public String pickNotePitchSop(String startingPitch, boolean upFlow){
Random randy = new Random();
String pitch = startingPitch;
//System.out.println(Song.getKeyIndex(pitch));
String[] noteRange = new String[5];
if(upFlow){
for(int i = 0; i<noteRange.length; i++){
if((Song.chordTones.length>Song.getKey... |
a7710c57-1ae3-417d-8d03-79515294223d | public double pickNoteDur(double beatsLeft){
double noteType;
Random randy = new Random();
noteType = noteTypes[randy.nextInt(noteTypes.length)];
while(true){
if(noteType<=beatsLeft){
break;
}else{
noteType = noteTypes[randy.nextInt(noteTypes.length)];
}
}
return noteType;
} |
bac319c6-6f94-4b5c-a8d2-f493715f25d6 | public String[] chordWithRoot(String root){
for(int i = 0; i<Song.chords.length; i++){
if(root.equals(Song.chords[i][0])){
return Song.chords[i];
}
}
return I;
} |
908806c3-5504-4ece-b6e7-3807de570683 | public void fillTriads(){
I = Song.chords[0];
ii = Song.chords[1];
iii = Song.chords[2];
IV = Song.chords[3];
V = Song.chords[4];
vi = Song.chords[5];
vii = Song.chords[6];
leadingTone = vii[0];
} |
ecf688fd-0cd2-4e96-9962-a51810b8dfcf | public Verse(int pNumMeasures, int pNumBeats){
numMeasures = pNumMeasures;
numBeats = pNumBeats;
} |
71153011-0d54-4df6-a7a4-240bb657a767 | public NoteTrack(Note[] notes, int instrument){
this.notes = notes;
this.instrument = instrument;
} |
3d973e3c-ddb6-41c6-89fd-b34e67d17103 | public void fillMIDITrack(Track t, int channel, int bpm) throws InvalidMidiDataException{
long timestamp = 0;
t.add(new MidiEvent(new ShortMessage(ShortMessage.PROGRAM_CHANGE, channel, instrument, 0), 0));
for(int i =0; i< notes.length; i++){
if(notes[i].pitch == null){
timestamp += notes[i].noteLength();
... |
329f80ae-4ce2-40f2-8b8d-cc7c61ead256 | Commands(AutoRefill plugin) {
this.plugin = plugin;
} |
4334fa26-b418-4bf1-bc51-5f9621363a8a | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
//Check to see if sender is a player
if(sender instanceof Player) {
player = (Player) sender;
} else {
sender.sendMessage("Only players may use this command!");
return true;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.