This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void setCurrentGame(Game currentGame) throws Exception { | |
if(!games.contains(currentGame)) throw new Exception("This game does not exist in the system"); | |
this.currentGame = currentGame; | |
} | |
public void add(Game game) throws Exception{ | |
if(games.contains(currentGame)) throw new Exception("This game does not exist in the system"); | |
games.add(game); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lp2.lab08; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
/** | |
* Representa uma disciplina convencional | |
* @author João Pedro Leôncio <joopeeds@gmail.com> | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Devolve um item de um usuario a outro | |
* | |
* @param EmprestadorID | |
* Id do usuario emprestador | |
* @param EmprestadoID | |
* Id do usuario que recebe o item | |
* @param ItemID | |
* Id do item | |
* @throws Exception |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lp2.lab07; | |
public class Item { | |
private String ID, descricao, IDdono; | |
public Item(String ID, String descricao, String IDdono) throws Exception { | |
setID(ID); | |
setDescricao(descricao); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public double cofactor(int ii, int jj){ | |
return Math.pow(-1,ii+jj)*(this.submatrix(ii,jj)).determinant(); | |
} | |
public Matrix cofactorMatrix(){ | |
double[][] comatrix = new double[ this.data.length ][ this.data[0].length ]; | |
for(int i = 0; i < this.data.length; i++ ){ | |
for(int j = 0; j < this.data[0].length; j++ ){ | |
comatrix[i][j] = this.cofactor(i,j); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean isUpperTriangular(){ | |
for(int i = 0; i < this.data.length; i++){ | |
for(int j = 0; j < this.data[0].length; j++){ | |
if( i<j && data[i][j]!=0 ) return false; | |
} | |
} | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Matrix multiply(Matrix m2){ | |
double[][] matrix2 = m2.getArrayMatrix(); | |
double[][] product = new double[this.data.length][matrix2[0].length]; | |
for(int i = 0; i < this.data.length; i++){ | |
for(int k = 0; k < matrix2[0].length; k++){ | |
for(int j = 0; j < this.data[0].length; j++){ | |
product[ i ][ k ] += data[ i ][ j ]* matrix2 [ j ][ k ]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean isInside(Point pt){ | |
int intersections = 0; | |
int in=0; | |
for(int i=0; i < this.edges.length; i++ ){ | |
if (edges[i].isLeft(pt)) intersections++; | |
if (edges[i].belongsToLine(pt) && !edges[i].isVertical() | |
&& pt.getY() <= edges[i].upperLimit() && pt.getY() >= edges[i].lowerLimit()) in++; | |
} | |
if(intersections==0 && in==1){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public String toString(){ | |
String a_s = String.format("%.1f", a); | |
String b_s = String.format("%.1f", b); | |
if (b>0) b_s = "+"+b_s; | |
else { | |
if(a==1){ | |
if(b!=0) | |
return "y = x "+b_s; | |
else |
NewerOlder