Changeset 3452
- Timestamp:
- 09/01/10 10:43:07 (17 months ago)
- Location:
- molgenis_distro/3.5
- Files:
-
- 4 added
- 3 edited
-
WebContent/WEB-INF/lib/eclipselink-jpa-modelgen_2.0.2.v20100323-r6872.jar (added)
-
WebContent/WEB-INF/lib/eclipselink.jar (added)
-
WebContent/WEB-INF/lib/javax.persistence_2.0.0.v201002051058.jar (added)
-
handwritten/java/Matrix/DBMatrix.java (modified) (9 diffs)
-
handwritten/java/Matrix/IMatrix1.java (added)
-
handwritten/java/Matrix/MatrixBean.java (modified) (3 diffs)
-
handwritten/java/Matrix/PagableDataModel.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molgenis_distro/3.5/handwritten/java/Matrix/DBMatrix.java
r3414 r3452 1 1 package Matrix; 2 2 3 import java.io.File; 4 import java.io.PrintWriter; 3 5 import java.lang.reflect.Array; 4 6 import java.sql.SQLException; … … 13 15 14 16 import org.apache.commons.lang.StringEscapeUtils; 17 import org.molgenis.framework.db.Database; 15 18 import org.molgenis.framework.db.DatabaseException; 16 19 import org.molgenis.framework.db.QueryRule; … … 20 23 import app.JpaDatabase; 21 24 22 public class DBMatrix<T> implements IMatrix <T> {25 public class DBMatrix<T> implements IMatrix1<T, Column, Integer> { 23 26 private T[][] data; 24 27 private static JpaDatabase db; … … 47 50 } 48 51 49 @Override52 50 53 public List<String> getColumnGroups() { 51 54 String ql = "SELECT DISTINCT SUBSTRING(oFeature.name, 1, LOCATE('.',oFeature.name) - 1) " + … … 79 82 private boolean observationsLoaded = false; 80 83 81 @Override82 84 public void loadData(int numberOfRows, int offset) throws NumberFormatException, DatabaseException, SQLException, ParseException 83 85 { … … 125 127 QueryRule rule = new QueryRule(r); // copy because of side 126 128 // effects 127 // logger.debug(rule);129 // LogFactory.getLog(this.getClass()).debug(rule); 128 130 129 131 // String tablePrefix = ""; … … 426 428 } 427 429 430 /* 428 431 @Override 429 432 public List<Integer> getTargets() { 430 433 return this.observationTargetIds; 431 434 } 435 */ 432 436 433 437 public void addColumn(String columnName) { … … 435 439 } 436 440 437 @Override 441 /* 438 442 public int getNumberofTargets() { 439 443 try { … … 444 448 return observationTargetIds.size(); 445 449 } 450 */ 451 452 @Override 453 public Class<T> getDataObject() { 454 // TODO Auto-generated method stub 455 return this.klass; 456 } 457 458 @Override 459 public int getNumberOfCols() { 460 // TODO Auto-generated method stub 461 return 0; 462 } 463 464 @Override 465 public int getNumberOfRows() { 466 try { 467 loadObservationTargets(); 468 } catch (Exception e) { 469 e.printStackTrace(); 470 } 471 return observationTargetIds.size(); 472 } 473 474 @Override 475 public List<Integer> getRows() { 476 return this.observationTargetIds; 477 } 478 479 @Override 480 public T getElement(int rowIndex, int colIndex) throws Exception { 481 throw new UnsupportedOperationException(); } 482 483 @Override 484 public T getElement(String rowName, String colName) throws Exception { 485 throw new UnsupportedOperationException(); 486 } 487 488 @Override 489 public T[][] getElements() throws Exception { 490 throw new UnsupportedOperationException(); 491 } 492 493 @Override 494 public T[] getCol(int colIndex) throws Exception { 495 throw new UnsupportedOperationException(); 496 } 497 498 @Override 499 public T[] getCol(String colName) throws Exception { 500 throw new UnsupportedOperationException(); 501 } 502 503 @Override 504 public int getColIndexForName(String colName) throws Exception { 505 throw new UnsupportedOperationException(); 506 } 507 508 @Override 509 public T[] getRow(int rowIndex) throws Exception { 510 throw new UnsupportedOperationException(); 511 } 512 513 @Override 514 public T[] getRow(String rowName) throws Exception { 515 throw new UnsupportedOperationException(); 516 } 517 518 @Override 519 public int getRowIndexForName(String rowName) throws Exception { 520 throw new UnsupportedOperationException(); 521 } 522 523 @Override 524 public IMatrix1<T, Column, Integer> getSubMatrix(int[] rowIndices, 525 int[] colIndices) throws Exception { 526 throw new UnsupportedOperationException(); 527 } 528 529 @Override 530 public IMatrix1<T, Column, Integer> getSubMatrix(List<String> rowNames, 531 List<String> colNames) throws Exception { 532 throw new UnsupportedOperationException(); 533 } 534 535 @Override 536 public IMatrix1<T, Column, Integer> getSubMatrixByOffset(int row, 537 int nRows, int col, int nCols) throws Exception { 538 throw new UnsupportedOperationException(); 539 } 540 541 @Override 542 public IMatrix1<T, Column, Integer> getSubMatrixByOffset(String rowName, 543 int nRows, String colName, int nCols) throws Exception { 544 throw new UnsupportedOperationException(); 545 } 546 547 @Override 548 public IMatrix1<T, Column, Integer> getSubMatrixFilterByRowEntityValues( 549 Database db, QueryRule... rules) throws Exception { 550 throw new UnsupportedOperationException(); 551 } 552 553 @Override 554 public IMatrix1<T, Column, Integer> getSubMatrixFilterByRowMatrixValues( 555 QueryRule... rules) throws Exception { 556 throw new UnsupportedOperationException(); 557 } 558 559 @Override 560 public IMatrix1<T, Column, Integer> getSubMatrixFilterByColEntityValues( 561 Database db, QueryRule... rules) throws Exception { 562 throw new UnsupportedOperationException(); 563 } 564 565 @Override 566 public IMatrix1<T, Column, Integer> getSubMatrixFilterByColMatrixValues( 567 QueryRule... rules) throws Exception { 568 throw new UnsupportedOperationException(); 569 } 570 571 @Override 572 public IMatrix1<T, Column, Integer> getMatrixSortByRowEntityValues( 573 boolean asc) throws Exception { 574 throw new UnsupportedOperationException(); 575 } 576 577 @Override 578 public IMatrix1<T, Column, Integer> getMatrixSortByColEntityValues( 579 boolean asc) throws Exception { 580 throw new UnsupportedOperationException(); 581 } 582 583 @Override 584 public IMatrix1<T, Column, Integer> getMatrixSortByRowMatrixValues( 585 boolean asc) throws Exception { 586 throw new UnsupportedOperationException(); 587 } 588 589 @Override 590 public IMatrix1<T, Column, Integer> getMatrixSortByColMatrixValues( 591 boolean asc) throws Exception { 592 throw new UnsupportedOperationException(); 593 } 594 595 @Override 596 public IMatrix1<T, Column, Integer> performUnion( 597 IMatrix1<T, Column, Integer> N) throws Exception { 598 throw new UnsupportedOperationException(); 599 } 600 601 @Override 602 public IMatrix1<T, Column, Integer> performIntersection( 603 IMatrix1<T, Column, Integer> N) throws Exception { 604 throw new UnsupportedOperationException(); 605 } 606 607 @Override 608 public IMatrix1<T, Column, Integer> performDifference( 609 IMatrix1<T, Column, Integer> N) throws Exception { 610 throw new UnsupportedOperationException(); 611 } 612 613 @Override 614 public IMatrix1<T, Column, Integer> performExclusion( 615 IMatrix1<T, Column, Integer> N) throws Exception { 616 throw new UnsupportedOperationException(); 617 } 618 619 @Override 620 public IMatrix1<T, Column, Integer> performTransposition( 621 IMatrix1<T, Column, Integer> N) throws Exception { 622 throw new UnsupportedOperationException(); 623 } 624 625 @Override 626 public File getAsExcelFile() throws Exception { 627 throw new UnsupportedOperationException(); 628 } 629 630 @Override 631 public File getAsFile() throws Exception { 632 throw new UnsupportedOperationException(); 633 } 634 635 @Override 636 public void writeToCsvWriter(PrintWriter out) throws Exception { 637 throw new UnsupportedOperationException(); 638 } 639 640 @Override 641 public void writeToPrintWriter(PrintWriter out) throws Exception { 642 throw new UnsupportedOperationException(); 643 } 644 645 @Override 646 public void addRow() throws Exception { 647 throw new UnsupportedOperationException(); 648 } 649 650 @Override 651 public void addColumn() throws Exception { 652 throw new UnsupportedOperationException(); 653 } 654 655 @Override 656 public void updateElement() throws Exception { 657 throw new UnsupportedOperationException(); 658 } 446 659 } -
molgenis_distro/3.5/handwritten/java/Matrix/MatrixBean.java
r3414 r3452 42 42 43 43 private void loadObservableFeatureGroups() { 44 featureGroups = super.getMatrix().getColumnGroups();44 featureGroups = ((DBMatrix)super.getMatrix()).getColumnGroups(); 45 45 } 46 46 47 47 private void loadObservableFeatureNamesByGroup(String featureGroupName) { 48 features = super.getMatrix().getColumnsGroup(featureGroupName);48 features = ((DBMatrix)super.getMatrix()).getColumnsGroup(featureGroupName); 49 49 } 50 50 … … 72 72 public void sortColumn() { 73 73 super.sortColumn(sortColumnIndex); 74 } 75 76 74 } 77 75 78 76 public void filterChanged(ActionEvent ae) { … … 81 79 82 80 public Collection<Integer> getTargets() { 83 return super.getMatrix().get Targets();81 return super.getMatrix().getRows(); 84 82 } 85 83 -
molgenis_distro/3.5/handwritten/java/Matrix/PagableDataModel.java
r3414 r3452 27 27 private boolean refresh = false; //refresh database if column or filter changes 28 28 29 private IMatrix <T> matrix;29 private IMatrix1<T, Column, Integer> matrix; 30 30 31 public PagableDataModel(IMatrix <T> matrix) {31 public PagableDataModel(IMatrix1<T, Column, Integer> matrix) { 32 32 this.matrix = matrix; 33 33 } … … 55 55 56 56 try { 57 matrix.loadData(numberOfRows, firstRow);57 ((DBMatrix)matrix).loadData(numberOfRows, firstRow); 58 58 59 59 Collection<Column> columns = matrix.getColumns(); … … 64 64 65 65 T[][] data = (T[][]) matrix.getData(); 66 List<Integer> targets = matrix.get Targets();66 List<Integer> targets = matrix.getRows(); 67 67 68 int size = matrix.get Targets().size() < numberOfRows ? matrix.getTargets().size()68 int size = matrix.getRows().size() < numberOfRows ? matrix.getRows().size() 69 69 : numberOfRows; 70 70 for(int idx = 0; idx < size; ++idx) { … … 80 80 } 81 81 82 int size = matrix.get Targets().size() < numberOfRows ? matrix.getTargets().size()82 int size = matrix.getRows().size() < numberOfRows ? matrix.getRows().size() 83 83 : numberOfRows; 84 84 for(int idx = 0; idx < size; ++idx) { 85 visitor.process(context, matrix.get Targets().get(idx), argument);85 visitor.process(context, matrix.getRows().get(idx), argument); 86 86 } 87 87 } … … 118 118 @Override 119 119 public int getRowCount() { 120 return matrix.getNumber ofTargets();120 return matrix.getNumberOfRows(); 121 121 } 122 122 … … 177 177 } 178 178 179 public IMatrix <T> getMatrix() {179 public IMatrix1<T, Column, Integer> getMatrix() { 180 180 return matrix; 181 181 }
Note: See TracChangeset
for help on using the changeset viewer.