id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
45021293-9ed1-43e7-b42b-9024eca6c4b1 | public ObjectDDLContainer(String objectType, String schema) {
this._a = new ArrayList<ObjectDDL>();
this._objectType = objectType;
//this._schema = schema;
} |
c1c83272-f2a0-48a3-b0bb-9fc880d99eef | public void add(ObjectDDL o) {
_a.add(o);
} |
83ca2f6d-f113-4a75-9085-b057212057e3 | public String elaboraFile(String outputFolder, String order, String subf) {
// Creazione del file master
String fileName = outputFolder+"/"+subf+"/"+order+"."+_objectType+".sql";
try {
if (_a.size()>0) {
FileWriter fstream = new FileWriter(fileName);
BufferedWriter out = new BufferedWriter... |
a8ca0984-50fb-4c37-8f6a-25b460f92722 | public static void main(String[] args) {
} |
a604447e-1f7a-4c1a-92a3-c3719dc37da3 | public ForbiddenAuctionOperationException() {
super("Forbidden auction operation");
} |
34d83e05-5095-4869-8fda-aaab63ef876f | public Item(String description) {
this.description = description;
} |
1778b59b-9924-4891-9b0e-66915b7e84aa | public int getId() {
return this.hashCode();
} |
6580795a-300e-49e4-8336-3e495dff4e91 | public String getDescription() {
return description;
} |
168f0624-66fc-4ce1-baf2-2fbf1b3e3bf7 | public UnauthorizedUserAccessException() {
super("User does not qualify to access data");
} |
effa51a4-0ee1-4de0-8c8d-15edb74158d2 | public Bid(User bidder, double value) {
this.bidder = bidder;
this.value = value;
} |
dae47c65-8665-4c40-b613-290fb6efda6c | protected User getBidder() {
return bidder;
} |
8bcf276d-5d8f-4830-843f-1e55f06c8314 | public double getValue() {
return value;
} |
124150c7-0e34-4d80-b08d-22ee626dfd39 | @Override
public int compareTo(Bid b) {
return (int) (value - b.value);
} |
6b6155c6-fe73-4f12-9eda-01f134d9e640 | public User(String login, String firstName, String lastName) {
this.login = login;
this.lastName = lastName;
this.firstName = firstName;
// All notification options set to true (notify) by default
notificationsOptions = new UserOptions();
} |
8968cf2b-68e1-4b15-8b73-8813556d8499 | public int hashCode() {
return login.hashCode();
} |
d2e7619e-1815-4df7-85f4-38e8c3713fa9 | public String getLogin() {
return login;
} |
84a91ebe-2bfb-44a9-a7f2-b598b985b295 | public String getLastName() {
return lastName;
} |
c725b8ba-46a5-4c51-9ad0-d36b014f5304 | public String getFirstName() {
return firstName;
} |
dc39fbe6-4fb1-4e96-b3bb-9aef14e07f66 | public UserOptions getOptions() {
return notificationsOptions;
} |
e998112e-4da3-4073-a5b5-521fb5109535 | public void bid(Auction auction, double value) {
Bid b = new Bid(this, value);
try {
AuctionManager.bid(auction, b);
} catch (InvalidBidException e) {
// TODO notify the end-user over the web
System.out.println(e.getMessage());
}
} |
aecc64f6-47dc-49ee-a0f7-0da910d34847 | public Auction makeAuction(Item item, Date endDate, double minPrice, double reservePrice) {
return new Auction(item, this, endDate, minPrice, reservePrice);
} |
a6798974-62ed-44d9-8398-92fb99c0128c | public void publishAuction(Auction au) {
try {
AuctionManager.publishAuction(au);
} catch (ForbiddenAuctionOperationException e) {
// TODO notify the end-user over the web
System.out.println(e.getMessage());
}
} |
4988378d-cb61-4d0c-8d5a-5618e9458156 | public void cancelAuction(Auction au) {
try {
AuctionManager.cancelAuction(au);
} catch (ForbiddenAuctionOperationException e) {
// TODO notify the end-user over the web
System.out.println(e.getMessage());
}
} |
2ee88ca4-d7b1-416e-9d2f-8beaaac79467 | public AuctionManager() {
auctionsContainer = new AuctionsContainer();
} |
0ee8ced1-59f1-4a82-be23-16abc5f98498 | public static void bid(Auction au, Bid b) throws InvalidBidException {
if (validBid(au, b)) {
au.setHighestBid(b);
} else {
throw new InvalidBidException();
}
} |
11124314-bbb2-4c1a-958e-82a2fb796293 | public static void publishAuction(Auction au) throws ForbiddenAuctionOperationException {
if (validAuctionPublication(au)) {
auctionsContainer.add(au);
au.setState(AuctionState.PUBLISHED);
} else {
throw new ForbiddenAuctionOperationException();
}
} |
847fd801-cade-4958-8efc-6d022916f71e | public static void cancelAuction(Auction au) throws ForbiddenAuctionOperationException {
if (auctionsContainer.hasAuction(au)
&& au.getState().equals(AuctionState.PUBLISHED)
&& !au.highestBidOverReservePrice()) {
au.setState(AuctionState.CANCELLED);
} else {
throw new ForbiddenAuctionOperationExceptio... |
622f3f94-18ed-4b13-93f7-aef8c3495951 | public static void refreshAllAuctions() {
Date now = new Date();
Auction au;
for (Iterator<Auction> it = auctionsContainer.getIterator(); it.hasNext();) {
au = it.next();
if (au.getState().equals(AuctionState.PUBLISHED)
&& au.highestBidOverMinPrice()
&& now.after(au.getEndDate())) {
au.setStat... |
56e95d2f-be70-4f04-bc94-fc2014a03da0 | private static boolean validBid(Auction au, Bid b) {
return auctionsContainer.hasAuction(au)
&& au.getState().equals(AuctionState.PUBLISHED)
&& !au.getSeller().equals(b.getBidder())
&& b.getValue() > au.getHighestBid().getValue();
} |
56b04163-c5e8-4c88-b828-17668254e94f | private static boolean validAuctionPublication(Auction au) {
return au.getMinPrice() >= 0
&& au.getReservePrice() >= au.getMinPrice()
&& au.getEndDate().after(new Date())
&& au.getState().equals(AuctionState.CREATED)
&& !auctionsContainer.hasItem(au.getItem());
} |
3d259cff-1e43-4997-bfe0-606bb994e916 | public Auction(Item item, User seller, Date endDate, double minPrice, double reservePrice) {
this.item = item;
this.seller = seller;
this.endDate = endDate;
this.state = AuctionState.CREATED;
this.minPrice = minPrice;
this.reservePrice = reservePrice;
this.highestBid = null;
this.id = Auction.numI... |
178238b5-50c9-48d5-bd21-6280d79e5374 | public int hashCode() {
return id;
} |
d24501da-fce3-4f7c-a108-1f222069f3a7 | public Item getItem() {
return item;
} |
c9c3570e-45bc-4494-bca8-aa6db141ff2d | public User getSeller() {
return seller;
} |
7c1a8878-bec0-4044-bf05-d84fe4bf4652 | public Date getEndDate() {
return endDate;
} |
80aa3e13-e4fe-41f2-b005-06409843008e | public AuctionState getState() {
return state;
} |
e956cbaf-0f9d-459e-8f9e-ff1cbb3f1f10 | protected void setState(AuctionState state) {
this.state = state;
} |
185e6324-30a2-4789-904b-b54d3e0ce8eb | public double getMinPrice() {
return minPrice;
} |
ec075538-1318-4e51-9f3a-a2ce897b603f | protected double getReservePrice() {
return reservePrice;
} |
cfd39af7-6b27-4800-b182-f64dd3aa782b | public double userGetReservePrice(User user) throws UnauthorizedUserAccessException {
if (user.equals(seller)) {
return getReservePrice();
} else {
throw new UnauthorizedUserAccessException();
}
} |
7b01b901-e61a-4ccf-b05d-07ecd029dc27 | public boolean highestBidOverReservePrice() {
return highestBid.getValue() >= reservePrice;
} |
7ee0d331-8c42-4fb9-b7a9-cfeca903811d | public boolean highestBidOverMinPrice() {
return highestBid.getValue() >= minPrice;
} |
557d926a-a219-48d2-8eb7-aaf8b407d594 | public Bid getHighestBid() {
return highestBid;
} |
f36b4865-b16f-46d6-967a-ac501fa66fa9 | protected void setHighestBid(Bid b) {
this.highestBid = b;
} |
f1286fac-7cc8-4c90-a9c9-435171402ed2 | public AuctionsContainer() {
auctions = new HashSet<Auction>();
} |
0ad4de00-7625-4805-88c7-e37b7bb06c62 | public boolean hasAuction(Auction au) {
return auctions.contains(au);
} |
3f0ed1df-5330-4b7a-abcc-87ec6ed70564 | public boolean hasItem(Item item) {
Iterator<Auction> it = auctions.iterator();
Auction au;
while (it.hasNext()) {
au = it.next();
if (au.getItem().equals(item)) return true;
}
return false;
} |
ee3bfdc3-3c5f-4422-902e-239e1ae69b15 | public void add(Auction au) {
auctions.add(au);
} |
1aeaf345-599b-4e5e-bea2-36782015a597 | public void remove(Auction au) {
auctions.remove(au);
} |
bedbd26f-1b2b-48c6-96db-6f9b68630173 | public Iterator<Auction> getIterator() {
return auctions.iterator();
} |
050402eb-7a98-4eb3-91ee-f10fafa545cb | public InvalidBidException() {
super("Invalid bid");
} |
113e565d-4876-448e-9e99-0d188d3a4501 | public UserOptions() {
this.notifyReservePriceReached = true;
this.notifyCancelledAuction = true;
this.notifyUserBidSurpassed = true;
} |
80472654-2620-47a4-ab6d-0f6ec4ad12b0 | public UserOptions(boolean notifyReservePriceReached, boolean notifyCancelledAuction, boolean notifyUserBidSurpassed) {
this.notifyReservePriceReached = notifyReservePriceReached;
this.notifyCancelledAuction = notifyCancelledAuction;
this.notifyUserBidSurpassed = notifyUserBidSurpassed;
} |
55b1c9f6-084f-4a25-8f64-465943009d27 | public boolean isNotifyReservePriceReached() {
return notifyReservePriceReached;
} |
1985dc6b-719e-447f-ab86-ab0a6dc0d6b2 | public void setNotifyReservePriceReached(boolean notifyReservePriceReached) {
this.notifyReservePriceReached = notifyReservePriceReached;
} |
06926d4c-c386-434f-9b4e-9a33e5b1a9b8 | public boolean isNotifyCancelledAuction() {
return notifyCancelledAuction;
} |
cefeeecb-555a-42b1-bb9a-41bff81c1679 | public void setNotifyCancelledAuction(boolean notifyCancelledAuction) {
this.notifyCancelledAuction = notifyCancelledAuction;
} |
542e3ce9-30bd-40bb-9286-a29303d3ab20 | public boolean isNotifyUserBidSurpassed() {
return notifyUserBidSurpassed;
} |
9f0898bb-4b61-418c-90bc-ed276d6ac321 | public void setNotifyUserBidSurpassed(boolean notifyUserBidSurpassed) {
this.notifyUserBidSurpassed = notifyUserBidSurpassed;
} |
7c46dcc3-b2b8-4a34-93f5-ebba35f5f40e | @Test
public void test() {
fail("Not yet implemented");
} |
fe506445-f837-46d6-bac6-68cb8ef7d948 | String encrypt(String plainText, String encryptionKey); |
4429ee3d-daa0-44fb-8db6-116901ea659f | String decrypt(String encryptedText, String decryptionKey); |
a530a556-30d3-49fc-90eb-6780282790d2 | AESCipher() {
} |
2a714227-cfc9-4032-994a-1fc31a89e0da | public String encrypt(final String plainText, final String key) {
validateKey(key);
Preconditions.checkArgument(!Strings.isNullOrEmpty(plainText),
"Passed in plain text cannot be null or empty.");
try {
Cipher cipher = Cipher.getInstance(ENCRYPTION_TRANSFORMATION);
SecretKeySpec speckey = new SecretK... |
32f94659-18bd-44dc-8d0c-fb1c6cbc8d47 | public String decrypt(String encryptedText, String key) {
validateKey(key);
Preconditions.checkArgument(!Strings.isNullOrEmpty(encryptedText),
"Passed in encrypted text cannot be null or empty.");
Cipher cipher;
try {
cipher = Cipher.getInstance(ENCRYPTION_TRANSFORMATION);
SecretKeySpec speckey = n... |
fb5ec3b9-ffff-412b-ad53-4dd555f48ace | private static void validateKey(String key) {
Preconditions.checkArgument(null != key,
"Passed in encryption/decryption key cannot be null.");
Preconditions.checkArgument(0 == key.length() % ENCRYPTION_KEY_FACTOR,
ENCRYPTION_KEY_LENGTH_ERR_MESSAGE);
} |
ecec24c7-3ce1-4bc4-a111-15721e4d3fc6 | private CipherFactory() {
// TODO Auto-generated constructor stub
} |
d5a856b5-f395-490d-8f1c-c45a24edfc4d | public static Cipher aesCipher(){
return AES_CIPHER;
} |
19f283e1-36e4-4cb1-9679-7ccb2653b7f8 | @Test
public void cipherTest() {
String textToEncrypt = "Text to encrypt";
String encryptionKey = "1234567890123456";
Cipher cipher = CipherFactory.aesCipher();
String encryptedText = cipher.encrypt(textToEncrypt, encryptionKey);
Assert.assertEquals(cipher.decrypt(encryptedText, encryptionKey),textToEncr... |
5523e13e-820e-4593-b70e-71551e098427 | public Config(String name)
{
File data=KillandDisguise.plugin.getDataFolder();
this.file=new File(data,name);
if(!file.getParentFile().exists())
file.getParentFile().mkdirs();
if(!file.exists())
{
try{file.createNewFile();}
catch(IOException e){}
}
config=YamlConfiguration.loadConfiguration(file... |
e42fb166-8cf3-4f00-a382-81d56b942287 | public File getFile()
{
return file;
} |
32a765ac-501d-46ce-8d1a-7eb90364084e | public FileConfiguration getConfig()
{
return config;
} |
3e55adb2-f2c6-448a-9633-1c88e228bafa | public void set(String arg0,Object arg1)
{
config.set(arg0, arg1);
try{config.save(file);}
catch(IOException e){}
} |
b622a337-1d1b-4018-96f7-bb4463794205 | public void set(Object arg0,Object arg1)
{
config.set(arg0.toString(), arg1);
try{config.save(file);}
catch(IOException e){}
} |
5d10f024-bf3f-4a6c-9a55-dfaabbc73e8b | public GerenciadorDeJogador(){
this.jogadores = new ArrayList<Jogador>();
} |
17b1184b-e0bb-4d81-90f7-bf7d7a94359a | public void salvarJogador(String nome){
Jogador jogador = new Jogador(nome);
this.jogadores.add(jogador);
} |
97490a68-0cc6-490d-90f3-72dcee602f60 | public boolean existeJogador(){
return !this.jogadores.isEmpty();
} |
d1b483a6-94b6-48a9-ac79-5622ae55da74 | public Tabuleiro(){
this.tabuleiro = new Carta[3][4];
} |
0b5f5501-9bad-42b2-8e74-518fab117815 | public Carta[][] getTabuleiro(){
return this.tabuleiro;
} |
f727dbeb-b033-4440-a72d-b3438e0f665f | public void setTabuleiro(int posicao1, int posicao2, Carta carta){
tabuleiro[posicao1][posicao2] = carta;
} |
bdd5279c-f14c-4066-9674-4cddb1c96af4 | public Carta getCartaTabuleiro(int posisao1, int posisao2){
return tabuleiro[posisao1][posisao2];
} |
701064ca-b9da-482d-a41b-89fa82ace15b | public Jogador(){ } |
5e07edb0-393b-4281-b047-8cc057a066d6 | public Jogador(String nome){
this.nome = nome;
this.numeroDeJogadas = 0;
} |
351ed581-eb22-43b4-b603-5849cf554f75 | public void setJogador(String novoNome){
this.nome = novoNome;
} |
e79055cd-7646-4933-989b-420dab157abc | public String getNome(){
return this.nome;
} |
3101a7f5-dd97-4d4e-92fb-3b9f8d5c6d3e | public void resetaNumeroDeJogadas(){
this.numeroDeJogadas = 0;
} |
33a43eb5-c994-440d-995c-14bfd886dfd0 | public int getNumeroDeJogadas(){
return this.numeroDeJogadas;
} |
0f45ff2a-94cc-4fc8-9380-4b22b513a656 | public void setArmazenaNumeroDeJogadas(int numeroDeJogadas){
this.numeroDeJogadas += numeroDeJogadas;
} |
44ee47ea-a716-4b31-886b-9d56df26d0e6 | public Ranking(){
for(int i = 0 ; i < ranking.length ; i++){
this.ranking[i] = new Jogador();
}
} |
0fdfb213-8677-4cc9-a879-c8e751ff7f3e | public void iniciarJogo() {
for(int i = 0 ; i < 3 ; i++){
for(int j = 0 ; j < 4 ; j++){
//pega a carta com o codigo
Carta carta = cartaRandom();
//mostra a posicao do tabuleiro e o codigo da carta
System.out.println("i: "+i+" j: "+j+" = " +carta.getCodigo());
//seta a carta na posicao do t... |
552087f5-f18a-42b3-a166-0355fa5b9106 | public Carta cartaRandom() {
int random = numeroAleatorio();
return new Carta(10, false, random);
} |
b020bf4b-23a8-429c-b223-955998a4ea0b | private int numeroAleatorio() {
Random randomico = new Random();
int random = randomico.nextInt(6);
if (verificarNumero(random)) {
return random;
} else {
return numeroAleatorio();
}
} |
a7bee1a2-7c52-45da-b9b5-984858140b9c | private boolean verificarNumero(int random) {
int mod = 0;
for(int i = 0 ; i < 3 ; i++){
for(int j = 0 ; j < 4 ; j++){
try {
if (tabuleiro.getCartaTabuleiro(i, j).getCodigo() == random) {
mod++;
}
} catch (Exception e) {
}
}
}
if (mod <=1 ) {
return true;
} else {
retu... |
3b976d58-a7f8-4a07-88f4-af481e99f67e | public Carta[][] getTabuleiro() {
return tabuleiro.getTabuleiro();
} |
4d1d2533-6997-4053-8ed5-f5948d105f81 | public Carta getCartaTabuleiro(int posisao1, int posisao2){
return tabuleiro.getCartaTabuleiro(posisao1, posisao2);
} |
0b592057-aea9-4cfd-a489-18bafbeb2008 | public Carta(){
this(0,false,0);
} |
4456a82d-a0c4-4ef1-bbac-02bd3e6c4315 | public Carta(int imagens, boolean virada, int id){
this.imagens = imagens;
this.virada = virada;
this.codigo = id;
} |
5aa67fbe-52ca-42a4-bfcc-9f5bf907a8a6 | public int getImagens() {
return imagens;
} |
4d0e15b2-29f0-4d4e-adce-6d1cc4d3bbb0 | public void setImagens(int imagens) {
this.imagens = imagens;
} |
696e8ff1-7793-4f1a-82f3-6ea52080381b | public boolean getVirada() {
return virada;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.