package AXJava;
import LivinGrimoire.DeepCopier;
import java.util.ArrayList;
import java.util.Random;
public class DrawRnd {
// draw a random element, than take said element out
private ArrayList<String> strings = new ArrayList<>();
private ArrayList<String> stringsSource = new ArrayList<>();
private Random rand = new Random();
public DrawRnd(String... values) {
for (int i = 0; i < values.length; i++) {
strings.add(values[i]);
stringsSource.add(values[i]);
}
}
public String draw(){
if (strings.isEmpty()) {return "";}
int x = rand.nextInt(strings.size());
String element = strings.get(x);
strings.remove(x);
return element;
}
public int getSimpleRNDNum(int bound){
// return 0->bound-1
return rand.nextInt(bound);
}
private LGTypeConverter tc = new LGTypeConverter();
public int drawAsInt(){
if (strings.isEmpty()) {return 0;}
Random rand = new Random();
int x = rand.nextInt(strings.size());
String element = strings.get(x);
strings.remove(x);
return tc.convertToInt(element);
}
public void reset(){
DeepCopier dc = new DeepCopier();
strings = dc.copyList(stringsSource);
}
}
package AXJava;
import LivinGrimoire.Algorithm;
import java.util.ArrayList;
public class AXLHub {
// hubs many reply decorators, language translators, encriptors and other string modifiers
// decorate(str) to decorate string using the active string decorator
private Cycler cycler;
private DrawRnd drawRnd = new DrawRnd();
private int size = 0;
private ArrayList<AXLHousing> nyaa = new ArrayList<AXLHousing>();
private int activeNyaa = 0;
public AXLHub(AXLHousing...nyaa) {
for (AXLHousing temp : nyaa)
{
this.nyaa.add(temp);
}
size = this.nyaa.size();
cycler = new Cycler(size);
}
public String decorate(String str1){
return nyaa.get(activeNyaa).decorate(str1);
}
public void cycleDecoration(){
activeNyaa = cycler.cycleCount();
}
public void randomizeDecoration(){
activeNyaa = drawRnd.getSimpleRNDNum(size);
}
public void modeDecoration(int mode){
if(mode < -1){return;}
if(mode >= nyaa.size()){return;}
activeNyaa = mode;
}
}