id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
8f47ef50-0ed8-40e0-8e09-c2daac9f3078 | public void setCell(double arg){
input=arg;
} |
576b4c84-f40b-4f77-8217-660c30c30910 | public String getInputValue(){
return String.valueOf(input);
} |
fd7dbf0e-2aef-46bc-b979-af95a528dfd9 | public String getPrintValue(){
return String.valueOf(input);
} |
d7a2b6d0-b625-4ff0-9af9-e503ceebbfa7 | public StringCell(){
this("");
} |
4d627982-6a99-4a86-8f0f-795125ead891 | public StringCell(char input){
this(Character.toString(input));
} |
24811ae0-5bfb-407a-ac4a-d20cfb1314e3 | public StringCell(String input){
this.input=input;
} |
ee4e84e1-c735-4ef6-8b11-0d5d52980f20 | public void setCell(String arg){
input=arg;
} |
81ef11c8-819e-44df-aa79-eeeee9230b08 | public void setCell(char arg){
setCell(Character.toString(arg));
} |
5e853fa0-47a3-44e3-b395-3eac506809f7 | public String getInputValue(){
return input;
} |
ef8b60bf-b3ce-4a50-b5e1-592aac658ce1 | public String getPrintValue(){
return input.replace("\"", "");
} |
9e7a02e2-4446-4d35-98ce-a15861a36571 | public DateCell(Date input) {
this.input=input;
// TODO Auto-generated constructor stub
} |
38b12dfe-b80e-4814-80a7-93b46507f4ee | public void setCell(Date arg){
input=arg;
} |
93609436-3ad2-4224-a4c1-7f874a1c0f8e | public String getInputValue(){
return String.valueOf(formatter.format(input));
} |
79a00695-df74-44f1-bbe1-d579a5835bcd | public String getPrintValue(){
return String.valueOf(formatter.format(input));
} |
4fffcee3-76ca-4169-a25a-9134eeba5374 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanIn=new Scanner(System.in);
System.out.println("Welcome to TextExcel!");
// System.out.print("Enter rows:");
// int rows=input.nextInt();
// System.out.print("Enter columns (up to 26):");
// int columns=input.nextInt();
C... |
e458748a-3d98-4087-bf5a-5d3f4ab7a4b2 | private static void checkInput(String input, CellMatrix matrix) {
// TODO Auto-generated method stub
String cellIdRegex="[A-G](10|[1-9])";
if(input.equalsIgnoreCase("print"))
CellMatrix.printSheet(matrix);
else if(input.equalsIgnoreCase("help")){
System.out.println("exit: exits TextExcel program");
Sys... |
d4f1d9db-481d-48ec-b459-636812bb8671 | public CellMatrix(){
this(10,7);
} |
e0395cdd-ba60-41c5-8502-dfa19cf07ca0 | public CellMatrix(int r, int c) {
rows=r+1;
columns=c+1;
sheet=new Cell[rows][columns]; //initialize array of Cells
for(int i=0;i<rows;i++){
for(int j=0;j<columns;j++){
sheet[i][j]= new Cell(); //initialize each Cell
}
}
fillTableHeader();
} |
81c0fb06-102d-446a-8bb0-b0d93483c2b5 | private void fillTableHeader(){
String alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if(columns>27)
columns=27; //display max 26 columns usable columns
for(int i=1;i<columns;i++){
sheet[0][i]=new StringCell(alpha.charAt(i-1));//fill first row with alphabet
}
for(int i=1;i<rows;i++){
sheet[i][0]=new StringCell(Integer... |
f7a6c858-e385-4303-8e72-8a8e19a9a7ce | private static void print(CellMatrix matrix){ //prints entire spreadsheet
for (int i=0;i<matrix.rows;i++){
for(int j=0;j<matrix.columns;j++){
System.out.print(printFormat(matrix.sheet[i][j].getPrintValue()));
System.out.print("|");
}
System.out.println();
for(int j=0;j<matrix.columns;j++){
for(int k=... |
6c92070c-f525-4ea7-bacb-1fa463e78482 | private static String printFormat(String input){ //adds correct cell padding
String cellPrint="";
if(input.length()>12){
input=input.substring(0, 12);
}
for(int i=0;i<(12-input.length())/2;i++){
cellPrint+=" ";
}
cellPrint+=input;
for(int i=0;i<(12-input.length()+1)/2;i++){
cellPrint+=" ";
}
return cellP... |
e5dc393b-d5d3-4b4b-a5cf-ef28cb420306 | public static void printSheet(CellMatrix matrix){ //public method for TextExcel class
print(matrix);
} |
deb5ba10-acbb-4fcb-8c27-c95756769e5b | private void set(int row, int column, String input){
CellParser parser=new CellParser(); //create CellParser object
try {
sheet[row][column+1]=parser.parseCell(input);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
89179858-33c6-4be2-9026-358b562c3807 | public void setCell(int row, char column, String sheet){
set(row,column-'A',sheet);
} |
3aa4fa22-f79c-497a-a3d1-b65ea7ea6179 | public String getCell(int row, char column){
return sheet[row][(column-'A')+1].getInputValue();
} |
ee9af3ec-cf13-4366-84e4-1986c6bd4aa7 | public Cell(){
} |
8efd25a8-80e4-427b-a751-7fa34f2ae555 | public String getInputValue(){
return new String("<empty>");
} |
08148e69-7477-4a61-8874-322e87609f4f | public String getPrintValue(){
return new String("");
} |
5616cab0-b6c8-484a-bffe-a060f1bc63f6 | private boolean isString(String input){
return (Character.toString(input.charAt(0)).equals("\"") && Character.toString(input.charAt(input.length()-1)).equals("\"")); //check both start and end have "
} |
397e4b54-09e1-40b7-a6e5-93069e1ff7cf | private boolean isDouble(String input){
final String Digits = "(\\p{Digit}+)";
final String HexDigits = "(\\p{XDigit}+)";
// an exponent is 'e' or 'E' followed by an optionally
// signed decimal integer.
final String Exp = "[eE][+-]?"+Digits;
final String fpR... |
c1d546b8-f6c4-4556-878c-de197b111b60 | private boolean isDate(String input){
try {
formatter.parse(input);
return true;
} catch (Exception e) {
return false;
}
} |
276427c7-a1b1-45ba-9ffd-f68c3ef1ceb6 | public Cell parseCell(String input) throws Exception{
if(isString(input))
return new StringCell(input);
else if (isDouble(input)) //integer or decimal
return new DoubleCell(Double.valueOf(input));
else if (isDate(input))
return new DateCell(formatter.parse(input));
throw new Exception("not yet implem... |
0e5f3712-1495-482e-8484-96652cc2a136 | @Test
public void testFile2Array() {
try {
System.out.println("file2Array");
File file = new File("/home/mansueli/NetBeansProjects/ECE422.Project1/build/test/classes/ece422/utils/file.input");
int[] expResult = {12, 28, 121, 892, 29, 9, 23, 29, 77, 7, -32, -10, 24, 42};
... |
0af8c891-51b7-4e9e-a8b4-a167f5f365dd | @Test
public void testSaveFile() {
System.out.println("saveFile");
File file = new File("output.txt");
int[] content = {12, 28, 121, 892, 29, 9, 23, 29, 77, 7, -32, -10, 24, 42};
FileUtils.saveFile(file, content);
assertEquals(file.exists(), true);
} |
844abd6d-d550-493b-bc71-767449de590d | @Test
public void testVerify() {
System.out.println("verify");
int[] arrayFalse = {2,3,2,3,4,5,23,23,12};
int[] arrayTrue = {-21,-10,2,12,20,21,21,25,27};
boolean expResultFalse = false;
boolean expResultTrue = true;
Adjucator adj = new AcceptanceTest();
boole... |
5f1d4229-cec9-4339-b8e0-bdaa130482e4 | @Test
public void testRun() {
System.out.println("WDog run");
int time = 1000;
Timer t = new Timer();
Thread tr = new Thread() {
@Override
public void run() {
while (true) {
doNothing();
}
}
... |
9b234abc-7390-474a-b49b-552a453cde40 | @Override
public void run() {
while (true) {
doNothing();
}
} |
92645fd8-962e-4852-b4b3-c9bceab3f3aa | private void doNothing() {
} |
4c7edf99-45f8-4330-9057-4a5c27485670 | @Test
public void testGetRand() {
System.out.println("getRand");
double expResult = 0.0;
double results[] = new double[10];
for(double result : results){
result = Random.getRand();
assertEquals(expResult, result, 1);
}
} |
9109c07a-ce81-4e07-a9a0-061217ad3b9f | @Test
public void testGet() throws Exception {
System.out.println("testGet");
String urlString = "http://www.random.org/integers/?format=plain&min=0&max=100&num=1&base=10&col=1";
double expResult = 0.0;
String result = Random.get(urlString);
double num = Double.parseDouble(re... |
899b2abc-d067-4d1f-9713-2129becaea7f | @Test
public void testRun() {
System.out.println("InsertionSort");
int time = 1000;
int[] inputArray = {12, 28, 121, 892, 29, 9, 23, 29, 77, 7, -32, -10, 24, 42};
double cHazard = 0.01;
Sort sorter;
boolean succedded;
try {
sorter = new InsertionSo... |
2d8888d4-f565-4866-967e-4e5131511e8b | @Test
public void testRun() {
System.out.println("doSort");
int[] array = new int[200];
Random rand = new Random();
Adjucator adj = new AcceptanceTest();
for (int i : array) {
i = rand.nextInt();
}
InsertionSort instance = new InsertionSort(0.0);
... |
19322371-3ea9-4d7c-b908-57ec6c0e2db7 | @Test
public void testRun() {
System.out.println("HeapSort");
int time = 1000;
double jHazard = 0.01;
Sort sorter;
int[] inputArray = {12, 28, 121, 892, 29, 9, 23, 29, 77, 7, -32, -10, 24, 42};
boolean succedded;
try {
sorter = new HeapSort(jHazard... |
56e47a13-904f-45ea-8eac-4e76c1e34dba | @Test
public void testDoSort() {
System.out.println("HeapdoSort");
int[] array = new int[200];
Random rand = new Random();
Adjucator adj = new AcceptanceTest();
for (int i : array) {
i = rand.nextInt();
}
HeapSort instance = new HeapSort(0.0);
... |
077647e0-8735-404f-9a15-9fb341933be1 | public static int[] file2Array(File file) throws IOException {
int length = (int) file.length();
byte[] bytes = new byte[length];
int[] result = null;
try (FileInputStream fis = new FileInputStream(file.getAbsolutePath())) {
fis.read(bytes);
String[] rawArray = ne... |
d78ecd85-5c61-4138-82f7-eac67952f306 | public static void saveFile(File file, int[] content) {
try (Writer writer = new FileWriter(file.getAbsolutePath(), false)) {
for (int i : content) {
writer.write(Integer.toString(i) + " ");
}
} catch (IOException e) {
Logger.getLogger(FileUtils.class.... |
f139ef64-e10e-41ca-82b0-01e6c31a36f1 | public static void loadLibrary(String path) throws Exception {
File temp = File.createTempFile("libJNI","so");
temp.deleteOnExit();
byte[] buffer = new byte[256];
int readBytes;
InputStream is = FileUtils.class.getResourceAsStream(path);
try (OutputStream os = new FileOut... |
06e38ec9-4987-4dba-89a4-493414e07fbd | public CliParser(String[] args) {
this.args = args;
options.addOption("h", "help", false, "show help.");
options.addOption("j", "java-hazard", true, "Defines the Java Hazard value (Default = 0.15).");
options.addOption("c", "c-hazard", true, "Defines the C Hazard value (Default = 0.11)."... |
65f7bf51-833b-4abc-9501-100bc3f90dc7 | public void parse() {
CommandLineParser parser = new BasicParser();
CommandLine cmd;
try {
cmd = parser.parse(options, args);
if (cmd.hasOption("h")) {
help();
} else {
jHazard = cmd.hasOption("j") ? Double.parseDouble(cmd.getO... |
3d46821c-398e-47ba-abc8-c101f8a16e22 | private void help() {
// This prints out some help
HelpFormatter formater = new HelpFormatter();
formater.printHelp("Main", options);
System.exit(0);
} |
c7fb8bb5-a41a-4823-9e4a-a25895507d89 | public File getInput() {
return input;
} |
fc82f757-3c45-469c-9414-96f3e7804469 | public void setInput(File input) {
this.input = input;
} |
f5bc7103-5ab7-4b57-8309-eb669f2bbbd6 | public File getOutput() {
return output;
} |
ff120423-4c35-42f0-828c-eea63df2f05b | public void setOutput(File output) {
this.output = output;
} |
37edf9e6-2401-482d-84fe-13430635452a | public double getcHazard() {
return cHazard;
} |
920daefc-81af-43bd-aba2-a315d1878064 | public void setcHazard(double cHazard) {
this.cHazard = cHazard;
} |
f488a51d-8112-4954-b343-9abbf1bea795 | public double getjHazard() {
return jHazard;
} |
9388d808-020d-4f6d-ab84-f7ca5a68a154 | public void setjHazard(double jHazard) {
this.jHazard = jHazard;
} |
dfe318db-870c-4a8e-9a00-d8c1d28e2fd9 | public int getTime() {
return time;
} |
db79e491-f8f5-4829-86cd-8aedbd222459 | public void setTime(int time) {
this.time = time;
} |
da070f44-9451-4996-ac73-bb0a5e01db64 | public static double getRand() {
String rand;
try {
final String query = "http://www.random.org/integers/?format=plain&min=0&max=100&num=1&base=10&col=1";
rand = get(query);
return Double.parseDouble(rand)/100.0;
} catch (IOException ex) {
Logger.g... |
58bcec63-5353-4ecd-8131-15235259a5a6 | public static String get(String urlString) throws IOException {
HttpURLConnection connection;
BufferedReader br = null;
String number = "";
try {
URL url = new URL(urlString);
connection = (HttpURLConnection) url.openConnection();
connection.setRequest... |
176795ec-9fe1-430d-b0e3-f7af330a81b0 | public abstract boolean verify(int[] array); |
4daaf8af-9004-4fa4-9323-115e0c9f5eb9 | @Override
public boolean verify(int[] array) {
if (array == null) {
return false;
}
int aux = -Integer.MAX_VALUE;
for (int i : array) {
if (i >= aux) {
aux = i;
} else {
return false;
}
}
... |
917ccd13-13a9-4208-a0ab-5d5233f01aad | public static void main(String[] args) {
CliParser parser = new CliParser(args);
parser.parse();
input = parser.getInput();
int[] inputArray = null;
try {
inputArray = FileUtils.file2Array(input);
} catch (IOException e) {
Logger.getLogger(Main.cla... |
6e609744-864c-438e-8fe9-51092fd573e7 | public WatchDogTimer(Thread thread) {
this.watched = thread;
} |
61fa46e4-d5d2-44c0-9a52-f6cb4ecee54a | @Override
public void run() {
watched.stop();
} |
b50bb0b9-39f2-46a0-811e-102a9af9e8ef | public InsertionSort(double hazard) {
super.setHazard(hazard);
} |
89c9f8a2-2915-4de3-8269-5bfb5a8f2f44 | private native int[] sort(int[] array); |
0b95769f-4eee-45a8-96fe-ea3b176edf96 | @Override
public void run() {
try {
if (super.getArray() == null || super.getArray().length == 0) {
System.out.println("Array wasn´t set.");
} else {
doSort();
if (super.getHazard() > 0.5) {
//Handles both numbers bi... |
7a4be625-4f8b-4093-9dfe-d1597138710b | private void errorMethod() {
} |
daed79b8-107c-4aa1-b8fd-0e4d33b0f3fc | public void doSort() {
int[] array = sort(super.getArray());
super.setArray(array);
} |
6abca824-60ac-495b-a2f6-4dfdc9787b6d | public int[] getArray() {
return array;
} |
f6bc6d02-8102-453b-9fca-d9feb0c3455d | public void setArray(int[] array) {
this.array = array;
} |
c736eaec-448a-4db6-8960-b1e192403f6d | public double getHazard() {
return hazard;
} |
b941c5e7-7fab-4b89-93ca-53b5c2b3ee75 | public void setHazard(double hazard) {
this.hazard = hazard;
} |
593009ec-36e1-43e8-8547-4ee9b96532f5 | public HeapSort(double hazard) {
super.setHazard(hazard);
} |
56176c42-b1b8-49f8-a6fb-4a3ac5ec5eef | @Override
public void run() {
try {
if (super.getArray() == null || super.getArray().length == 0) {
System.out.println("Array wasn´t set.");
} else {
doSort();
if (super.getHazard() > 0.5) {
//Handles both numbers bi... |
da538989-e27b-455e-a944-955703aabe5a | public void doSort() {
int aux = super.getArray().length;
buildHeap(super.getArray(), aux);
int last = --aux;
while (last > 0) {
swap(super.getArray(), 0, last);
heapify(super.getArray(), 0, --last);
}
} |
7cafeea4-2010-454a-8487-dd5918c2dda0 | private void swap(int[] array, int i, int j) {
int temp = array[j];
array[j] = array[i];
array[i] = temp;
memoryAccess+=2;
} |
49e5ab24-1d62-4226-9a51-fb799ac98a10 | private void buildHeap(int[] array, int num) {
int start = (num - 2) / 2;
while (start >= 0) {
heapify(array, start, num - 1);
start--;
}
} |
62a886f6-e34b-4f99-a708-fd5f0306ae8c | private void heapify(int[] array, int first, int last) {
int parent = first;
while (((parent * 2) + 1) <= last) {
memoryAccess++;
int leaf = (parent * 2) + 1;
if (leaf + 1 <= last && array[leaf] < array[leaf + 1]) {
leaf++;
}
if... |
48f22dd9-803f-48a1-9ef7-05ef4e3e8844 | private void errorMethod() {} |
5f7ad953-f17d-45d2-870f-3ed1cdbd2ad6 | public HRV(String getHrvResult) {
super();
System.out.println(getHrvResult);
parse(getHrvResult);
} |
32dd635f-70a0-4897-ad87-59ccc796c473 | public double getAVNN() {
return AVNN;
} |
5f4f7dee-1453-474f-9fec-dae8907b3d4a | public double getHF_PWR() {
return HF_PWR;
} |
ca85e841-ef56-4348-9de3-a88d0a93d974 | public double getLF_PWR() {
return LF_PWR;
} |
0999ccbb-6f06-437a-a473-7f8d4b91172f | public double getLFHF() {
return LFHF;
} |
c3810146-c78a-40b8-90d0-a0d82bba1d4e | public double getNNRR() {
return NNRR;
} |
10cd4d93-9942-44b1-9e6e-5f3a8f4ac31d | public double getpNN20() {
return pNN20;
} |
a83b469e-32bd-4685-bffe-bcd4b1e19585 | public double getpNN50() {
return pNN50;
} |
37d6076e-527f-4c4a-9fbb-42f25da6e34a | public double getrMSSD() {
return rMSSD;
} |
fc7a3f45-1222-41ee-adb8-402b477fca2d | public double getSDANN() {
return SDANN;
} |
eb9a82d6-7467-4f55-9623-65a647c6d07a | public double getSDNN() {
return SDNN;
} |
328da0a1-ebec-483d-a0a8-2b5040bb5dcf | public double getSDNNIDX() {
return SDNNIDX;
} |
8af59508-b875-47c6-a4dd-676074c31afc | public double getTOT_PWR() {
return TOT_PWR;
} |
ff73b193-07d0-4944-a033-cf813561ccd0 | public double getULF_PWR() {
return ULF_PWR;
} |
1e320a7f-0690-4146-a861-3dce661328bd | public double getVLF_PWR() {
return VLF_PWR;
} |
7b636747-71e0-4af3-9047-15d7c3a3a0e1 | private void parse(String string) {
Scanner s = new Scanner(string);
while (s.hasNextLine()) {
processLine(s.nextLine());
}
} |
7889d19f-7842-4cb5-ab8c-ff9cc2737da6 | private void processLine(String line) {
Scanner s = new Scanner(line);
s.useDelimiter(" = ");
if (s.hasNext()) {
String name = s.next().trim();
if (s.hasNext()) {
String valueStr = s.next().trim();
double value = Double.parseDouble(valueStr);
/**
* next: beautif... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.