123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package tests;
- import java.util.ArrayList;
- import java.util.Iterator;
- import static java.lang.Math.*;
- import classes.Category;
- import classes.CpsObject;
- import classes.HolonElement;
- import classes.HolonObject;
- import java.lang.reflect.Constructor;
- import java.lang.reflect.Field;
- import java.lang.reflect.InvocationTargetException;
- public class praktikumHolonsAdapter {
-
- /**
- * Generate Sequence of Categories from A - ZZZ
- * @param arr
- */
- public void generateCategories(ArrayList<Category> arr) {
- for (int i = 1; i < 18279; i++) {
- arr.add(new Category(generate(i)));
- }
- }
-
- /**
- * Generate Sequence of Objects from A - ZZZ
- * @param arr
- */
- public void generateObjects(ArrayList<CpsObject> arr) {
- for (int i = 1; i < 18279; i++) {
- arr.add(new HolonObject(generate(i)));
- }
- }
-
- /**
- * Generate Sequence of Elements from A - ZZZ
- * @param arr
- */
- public void generateElements(ArrayList<HolonElement> arr) {
- for (int i = 1; i < 18279; i++) {
- arr.add(new HolonElement(generate(i), 1, 10));
- }
- }
-
- /**
- * Generate Alphabetical Sequences
- * @param n
- * @return
- */
- public String generate(int n) {
- char[] buf = new char[(int) floor(log(25 * (n + 1)) / log(26))];
- for (int i = buf.length - 1; i >= 0; i--) {
- n--;
- buf[i] = (char) ('A' + n % 26);
- n /= 26;
- }
- return new String(buf);
- }
-
- }
|