method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
69202a62-17cc-4050-8e39-3eed6a95f5fa | 9 | private static String solve(int Gp, int Gc, int Gf, int N, int[][] foods) {
int itr = (int) Math.pow(2, N); // number of iterations required
for (int mask = 0; mask < itr; mask++) {
int GpSum = 0, GcSum = 0, GfSum = 0;
for (int i = 0; i < N; i++)
if ... |
99208527-4f3f-4b2d-a366-9b869699a681 | 6 | boolean setAs(String to_search) {
if(parents.size() == 0) {
if(name.equals(to_search))
return true;
ClassMeta c = EntityMeta.getDependencyTo(id);
if(c == null || !c.name.equals(to_search))
return false;
else {
return true;
}
}
else {
for(int i = 0; i < parents.size(); ++i) {
... |
790419ef-7ccf-4368-892a-4fcce17c9759 | 5 | public boolean validarLicencia(LicenciaConductor licencia, Persona p, EntityManager manager) {
boolean resultado = false;
if (licencia != null) {
if (manager.find(LicenciaConductor.class, licencia.getNumero()) != null) {
resultado = true;
System.out.println("N... |
89e193e9-8d84-446f-b346-29290cca5418 | 5 | @Override
public void setBloc(BlocService b, int i, int j) {
if(!(0<=i && i<super.getNombreColonnes() && 0<=j && j<super.getNombreLignes()))
throw new PreConditionError("unboud i or j");
checkInvariants();
super.setBloc(b, i, j);
checkInvariants();
if(!(super.getBloc(i, j)==b))
throw new PostConditionE... |
48b2ea39-0a2f-463e-8258-5279ad5ab1ce | 9 | public void loadPuzzle(String difficulty)
{
File file;
if(difficulty.equals("Easy"))
{
file = new File("easy16x16.txt");
}
else if(difficulty.equals("Medium"))
{
file = new File("medium16x16.txt");
}
else if(difficulty.equals("Hard"))
{
file = new File("hard16x16.txt");
}
else
{
fil... |
7f126899-8aa2-44f7-ab18-b2ac2ca4e4af | 2 | public static String[] removeDuplicateStrings(String[] array) {
if (SpringObjectUtils.isEmpty(array)) {
return array;
}
Set<String> set = new TreeSet<String>();
for (String element : array) {
set.add(element);
}
return toStringArray(set);
} |
4dbf7f2e-e015-4cab-85b9-7674c398ccf8 | 0 | public void setPcaPosId(BigInteger pcaPosId) {
this.pcaPosId = pcaPosId;
} |
94e03dcf-ecd8-4621-8c93-fbf86258f6d5 | 1 | public PlanBoeseBeute(JSONObject object) throws FatalError {
super(object, "BoeseBeute");
if (PlanBoeseBeute.list == null) {
PlanBoeseBeute.list = new OpponentList();
}
} |
8652daf9-b813-41c6-9c65-eb38477911a9 | 5 | @After
public void tearDown() {
userInput = null;
nlgResults = null;
dmResults = null;
//deleting new userData
File newFile = new File("resources/files/UserData/" + userDataCount + ".json");
userDataCount++;
while(newFile.exists()) {
// System.out.println("deleting");
newFile.delete();
newFile... |
5c78563e-ddca-4297-8d85-a81bd29f6a8d | 6 | public static void main(String... args) {
// Get params for Rubiks Cube size
int size = 3;
if (args.length != 0) {
try {
size = Integer.valueOf(args[0]);
}
catch (NumberFormatException e) {
System.out.println("Bad parameter format : you must provide a numeric size for the Rubik's Cube");
}
}... |
f8fc43d9-76f6-4ebb-9454-9242c5542a42 | 1 | public static void main(String[] args)
{
In in = new In(args[0]);
try
{
Digraph g = new Digraph(in);
System.out.println(args[0] + " \n" + g);
Digraph dg = new Digraph(g);
System.out.println("Duplicate graph of the above\n" + dg);
System.out.println("Reversed graph of the above\n" + g.reverse(... |
76673c09-2d78-4009-82a3-dba8b013a0d2 | 9 | public static void main(String[] args){
LinkedList<Integer> testResults = new LinkedList<Integer>();
LinkedList<Integer> actualValues = new LinkedList<Integer>();
if (args.length > 0){
if (args.length == 1){
System.out.println(isQuestion(args[0]));
System.out.println(questionContent(args[0]));
} els... |
28ce5163-7931-4dbb-bff0-277ffb00f107 | 1 | public void write5bytes(long n) throws IOException {
long b0 = n & 0xff;
long b1 = (n & 0xff00) >> 8;
long b2 = (n & 0xff0000) >> 16;
long b3 = (n & 0xff000000) >>> 24;
long b4 = (n & 0xff00000000L) >> 32;
if (le) {
write(b0); write(b1); write(b2); write(b3); write(b4);
} else {
write(b4); write(b3)... |
3aef26c0-f3df-4eed-9725-134fc16de350 | 8 | private void handleMimePart(BufferedReader reader) throws IOException {
// Since we just shifted to a new section we want to read in the headers to determine which section it is.
String headerLine;
boolean stopParsingHeaders = false;
while ((headerLine = reader.readLine()) != null && !st... |
261b01b1-0515-44b2-8f91-2c425adbc7d5 | 3 | String toStringVcfInfo(Collection<String> strs) {
// Sort strings
ArrayList<String> list = new ArrayList<String>(strs);
Collections.sort(list);
// Add the all
StringBuffer sb = new StringBuffer();
for (String str : list)
if (!str.isEmpty()) sb.append(str + ",");
if (sb.length() > 0) sb.deleteCharAt(s... |
6940877b-b5d4-42fd-91bf-29ac284ac71c | 0 | public int getWidth() {
return width;
} |
62fecf40-527f-42c8-b05b-e78d26c2067f | 3 | private String compareToAll(String possibleKw) {
ArrayList<Keyword> keywordList = (ArrayList<Keyword>) dictionary.getKeywordList();
String mostProbableKeyword = "";
int shortestDistance = 100;
for(int i = 0; i < keywordList.size(); i++) {
Levenshtein levenDistance = new Levenshtein(... |
5e30781a-6165-4fcc-9f81-06bd54928adc | 0 | public void setMessage(String message) {
this.message = message;
} |
f2eb0f02-8c35-4169-9925-881ff05aaaf4 | 4 | public void start() {
if (this.tracker == null || !this.tracker.isAlive()) {
this.tracker = new TrackerThread();
this.tracker.setName("tracker:" + this.address.getPort());
this.tracker.start();
}
if (this.collector == null || !this.collector.isAlive()) {
this.collector = new PeerCollectorThread();
... |
51ed40c4-dc01-4317-a11f-4396139b3d1f | 0 | public Color getDefaultColor() {
return defaultColor;
} |
ef11ccd6-b206-4080-b336-8cfef1e0a2ed | 9 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BonsHotels other = (BonsHotels) obj;
if (quotaFixa == null) {
if (other.quotaFixa != null)
return false;
} else if (!quotaFixa.equals(other.quotaFi... |
ca2bda1e-7f86-4c2f-9857-919f23107c47 | 6 | public boolean canAcceptTrade() {
TradeOffer offer = serverModel.getTradeOffer();
//If there is not an offer don't consider further
if (offer != null) {
Player receiver = serverModel.getPlayers().get(serverModel.getTradeOffer().getReceiver());
//For the trade, need to check offer, any positive (I thi... |
b53263d6-58c2-4386-9b69-8083056d9547 | 7 | static public String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String s = Double.toString(d);
if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
... |
2f3fbd32-36f3-40ce-a8e8-14c42f5aef5b | 3 | public void run() {
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input;
while(Util.ServerRunning && (input=br.readLine())!=null){
Stream.PutString(input);
}
br.close();
}catch(IOException i... |
8c7b149b-cc58-4c04-bdf0-43d507834d4f | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof MovableEntity))
return false;
MovableEntity other = (MovableEntity) obj;
if (dead != other.dead)
return false;
if (multiplier != other.multipl... |
8a231c2c-62e0-4c0a-9028-3b0eac26265e | 5 | public void addUsed(int localSlot) {
if (usedLocals.get(localSlot))
return;
usedLocals.set(localSlot);
if (dependent instanceof StackLocalInfo)
((StackLocalInfo) dependent).enqueue();
else if (dependent instanceof JSRTargetInfo)
((JSRTargetInfo) dependent).addUsed(localSlot);
else if (depend... |
8489e586-5f67-48f4-9e0b-1956e4bb20c6 | 8 | private boolean checkCommands(String command)
{
String sCommand;
if (command.startsWith("/"))
{
sCommand = command.substring(1);
}
else
{
sCommand = command;
}
List<String> aliases;
for (DNCCommands cmd : DNCCommands.values())
{
if (cmd.getName().equalsIgnoreCase(sCommand))
{
... |
c088f17f-cecc-4e0d-ae15-bcb018e0ce7b | 2 | private static void test_abs(TestCase t) {
// Print the name of the function to the log
pw.printf("\nTesting %s:\n", t.name);
// Run each test for this test case
int score = 0;
for (int i = 0; i < t.tests.length; i += 3) {
int exp = (Integer) t.tests[i];
int arg1 = (Integer) t.tests[i + 1];
int arg... |
1a33f310-191d-4b0b-add5-e45f2e280c27 | 7 | public int[][] addTownAreas(int[][] newBlockArray, int[] wg, BlockManager bm, int numTownAreas, int townSize, int minX, int maxX){
Game.loadingText = "Building a Cabin";
EIError.debugMsg("addTownAreas Start", EIError.ErrorLevel.Notice);
//build start town
for(int x = 0; x < townSize; x++... |
4b3ca8e0-fc95-4d68-9040-107997dbd110 | 0 | public void setAlive(boolean alive) {
this.alive = alive;
} |
06a1135c-66dc-4c5f-9cc9-0f1d10a70dad | 5 | private static boolean checksumValid(File libPath, List<String> checksums)
{
try
{
byte[] fileData = Files.toByteArray(libPath);
boolean valid = checksums == null || checksums.isEmpty() || checksums.contains(Hashing.sha1().hashBytes(fileData).toString());
if(!vali... |
f555fd59-e30f-4e2c-928e-cde99795b632 | 4 | public Iterator<Field> getGreedy(Field f) {
PriorityQueue<Field> greedy = new PriorityQueue<>(8);
this.updateBoard(f.x, f.y, false);
//add next fields
for(int i = 0; i < springer.length;i+=2)
{
int newX = f.x+ springer[i]; //x position of next jump point
int newY = f.y+ springer[i+1];
if(fi... |
d63076eb-6206-4dc9-beba-1a8b49439fc2 | 4 | private void updateGlunStatus() {
String text = this.glGlun.getText();
String allowedCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/_-";
if(text.length() == 0) {
this.glGlunStatus.setText("<html>Enter your GL_GLUN. It is <b>case sensitive.</b></html>");... |
2b45b3af-ad1c-4a5d-bd4c-2da3e5e53a91 | 5 | private boolean readGZIPFile(String fileName)
{
boolean success = false;
BufferedReader reader = null;
try
{
FileInputStream file = new FileInputStream(fileName);
GZIPInputStream gz = new GZIPInputStream(file);
reader = new BufferedReader(new Inpu... |
cf990ff4-1885-4fa2-821e-829abcc7f323 | 4 | public void go_bottom()
{
if(order.length()>0)
{
if(Idx!=null)
{
Idx.goBottom();
go_recno( Idx.found ? Idx.sRecno : reccount+1 );
}
else
{
Cdx.goBottom();
go_recno( Cdx.found ? Cdx.sRecno : reccount+1 );
}
}
else go_recno( reccount );
} |
6d85caec-5f03-489f-a191-09790a2089f8 | 9 | public static String doFormat( String format, Calendar cal ) throws IllegalArgumentException {
int fidx = 0;
int flen = format.length();
StringBuilder buf = new StringBuilder();
while(fidx<flen) {
char fch = format.charAt(fidx++);
if(fch!... |
2d6bbfad-fa1a-48e6-a295-50e7c6e9aeec | 6 | @EventHandler(priority = EventPriority.HIGHEST)
public void blockPlace(BlockPlaceEvent event)
{
Player player = event.getPlayer();
if (player.hasPermission(Permissions.PERM_ADMIN))
return;
String username = player.getName();
Chunk chunk = event.getBlock().getChunk();
if (!CP.getWGInstance().canBuild(p... |
48c70c76-a11f-46f7-98f5-5d288c019508 | 1 | public static System getSystem(String name) {
System system = null;
if(listSystems.containsKey(name)) {
system = listSystems.get(name);
}
return system;
} |
f26411a4-6335-4ee3-824d-97bebc4aab84 | 1 | @Override
public void setVisible(boolean visible) {
if (visible) {
Main main = (Main) super.getTopLevelAncestor();
cancel.setVisible(main.hasMatch());
}
super.setVisible(visible);
} |
d70a05fd-8ca9-48f4-ba57-281c4fefef30 | 8 | @Override
public void buildFloralComposition(String fileName) throws DAOException {
FileInputStream inputStream = null;
XMLStreamReader reader = null;
try {
inputStream = new FileInputStream(new File(fileName));
reader = factory.createXMLStreamReader(inputStream);
... |
6cf403e8-b643-4b26-9ee0-b0fcf4b03add | 1 | public static boolean initialize(File file)
{
try
{
mStream = new PrintWriter(new FileOutputStream(file, true));
return true;
}
catch(IOException e)
{
return false;
}
} |
c86c0032-6b83-4baa-a384-971e494c1226 | 3 | public static boolean isRightLinearProductionWithVariable(
Production production) {
if (!isRestrictedOnLHS(production))
return false;
String rhs = production.getRHS();
/**
* if only one variable on rhs and it is last char on rhs.
*/
String[] variables = production.getVariablesOnRHS();
if (variable... |
05d660d1-a048-4151-9869-84251c3e52b8 | 8 | public static void loadFusions(File fin) {
YamlConfiguration config = YamlConfiguration.loadConfiguration(fin);
Set<String> keys = config.getConfigurationSection("type").getKeys(false);
Set<String> keys2 = null;
Iterator<String> iterator = keys.iterator();
Iterator<String> iterator2 = null;
String s;
Stri... |
5a6497e7-849c-48f2-9ec1-025801624b93 | 3 | private void jButton_OutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OutActionPerformed
try {
OpenTransactionAccount otAccount = new OpenTransactionAccount();
String basket = otAccount.showBasket(jTextField_ServerID.getText(), jTextField_NymID.getText(), jTe... |
a86d753c-6ee0-4477-b0bd-9d5379b4c604 | 6 | public static Protagonista buildProtagonista(ClassePersonagem classe, JSONObject jsonObject) {
Protagonista protagonista = null;
switch(classe) {
case ANAO:
protagonista = new Anao(jsonObject);
break;
case BARBARO:
protagonista = new Barbaro(jsonObject);
break;
ca... |
cbc24d00-65bf-4e4f-9c7b-35df936f4aeb | 5 | @Override
public void parseCommandLine(CommandLine line)
{
if ( line.hasOption("resolution") )
{
String[] parts = line.getOptionValue("resolution").split("x");
if ( parts.length == 2 )
{
try
{
mResoWidth = Integer.parseInt(parts[0]);
mResoHeight = Integer.parseInt(parts[1]);
}
... |
f2dc38b7-d818-491b-859e-963d68982479 | 6 | public void mouseReleased(MouseEvent evt) {
if (mousein == 1 && evt.getSource()==newspaper){
showNewspaper();
}
if (mousein == 2 && evt.getSource()==map){
showMap();
}
if (mousein == 3 && evt.getSource()==close){
setVisible(false); //you can't see me!
dispose(); //Destroy the JFrame objec... |
1ce1d94a-3c63-4f54-ba59-ef386c76b19c | 8 | private void construirPuntosDeAlcance(Tablero tablero){
for (int i = this.posicion.obtenerX() - this.alcance; i <= this.posicion.obtenerX() + this.alcance; i++) {
for (int j = this.posicion.obtenerY() - this.alcance; j <= this.posicion.obtenerY() + this.alcance; j++) {
if( ( (i >= tablero.getInicioDeColumnas()... |
a50ada22-2c3e-488f-bcf2-6ab09db206a3 | 9 | public static void main(String[] args) {
try {
GpxFile gpx = GpxFile.ReadGPXFile(new File(args[0]));
System.out.println(gpx.toString());
} catch (FileNotFoundException ex) {
Logger.getLogger(GPXView.class.getName()).log(Level.SEVERE, null, ex);
} catch (XMLStreamException ex) {
Logger.getLogger(GPXVie... |
c1f6fbfb-98c1-45c7-ad64-20d2fe310ed7 | 9 | private static void handleGetCommand(final String nick, final String args)
{
if(!Conf.config.getProperty("enable-get", "true").equals("true")) {
Cmd.sayToPlayer(nick, "get is disabled.");
return;
}
int count = 64;
int id = 0;
final String[] parts = args.split(" ", 2);
if(parts.length == 2) {
int tmp = 0;
... |
2875f5b7-a466-4be0-8727-7a483cb2d032 | 9 | @Override
public boolean uploadImage(BufferedImage image, String filename, String fileType)
{
if (mClient == null && !connect())
{
return false;
}
if (mClient != null)
{
try
{
if (!ImageIO.write(image, fileType, new File(filename)))
{
System.err.println("Could not save the image to di... |
e265a301-0e45-41aa-9951-2c9419fc6385 | 3 | public static BufferedImage get(String filename){
//If the image already exists then return
if(images.containsKey(filename)){
return images.get(filename);
//Else load the image and return
}else{
try{
//Loads the image
File file = new File(Constants.ASSETS+ File.separatorChar +filename);
if(fil... |
b95961ce-a881-444a-a581-938a7775f0ff | 6 | public String[] getDownloadSN(){
String[] result = null;
if(sncalendars!=null && sncalendars.keySet().size()>0){
result = new String[sncalendars.keySet().size()];
}
else return null;
int index=0;
for(String sn: sncalendars.keySet()){
if(sncalendars.get(sn)!=null && sncalendars.get(sn)[1]!=null)
re... |
81979773-f3d0-4eb6-a522-e1c5beecba9d | 1 | public void visitTree(final Tree tree) {
final ListIterator iter = tree.stmts().listIterator(
tree.stmts().lastIndexOf(previous));
if (iter.hasPrevious()) {
final Stmt p = (Stmt) iter.previous();
check(p);
}
/*
* Object prev = iter.previous(); if (prev instanceof LocalExpr)
* check(prev);
*... |
73cc9bdd-776e-4f2f-afba-987706eb231c | 7 | public void updateDisplays() {
seat1Label.setText(model.getSeat(1).toString());
seat2Label.setText(model.getSeat(2).toString());
seat3Label.setText(model.getSeat(3).toString());
seat4Label.setText(model.getSeat(4).toString());
seat5Label.setText(model.getSeat(5).toString());
... |
8174b780-b7f9-4481-acc5-637694f62071 | 5 | static int dateDiff(int type, Calendar fromDate, Calendar toDate, boolean future) {
int diff = 0;
long savedDate = fromDate.getTimeInMillis();
while ((future && !fromDate.after(toDate)) || (!future && !fromDate.before(toDate))) {
savedDate = fromDate.getTimeInMillis();
fromDate.add(type, future ? 1 : -1);
... |
ec535240-cc98-404b-9c5b-2cfa7d57fb7e | 8 | public void actionPerformed(ActionEvent e) {
JButton button = (JButton) e.getSource();
Dimension size = button.getSize();
int labelX = label.getX();
int labelY = label.getY();
int buttonX = button.getX();
int buttonY = button.getY();
int buttonPosX = buttonX / size.width;
int buttonPosY = buttonY / si... |
0f26d14d-3792-46f0-b639-96af850fcc0d | 7 | public void run()
{
TcpConnection.field_74469_b.getAndIncrement();
try
{
while (TcpConnection.func_74462_a(field_74501_a))
{
boolean flag;
for (flag = false; TcpConnection.func_74451_d(field_74501_a); flag = true) { }
... |
33efb406-c4e1-49f3-a57a-e5edb13fae27 | 6 | @Override
public int compareTo(Bookmark data) {
//return (Long.parseLong(getTimestamp()) <= Long.parseLong(data.getTimestamp()) ? - 1 : 1);
if (this.userID < data.getUserID()) {
return -1;
} else if (this.userID > data.userID) {
return 1;
} else {
if (!this.timestamp.isEmpty() && !data.timestamp.isEmp... |
38076d80-b499-4f88-8729-77821f2d4996 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
0cb0ed26-bf15-46d8-ba82-e6f498f923bb | 7 | public boolean getBoolean(String key) throws JSONException {
Object o = get(key);
if(o==null) return false;
if (o.equals(Boolean.FALSE) ||
(o instanceof String &&
((String)o).equalsIgnoreCase("false"))) {
return false;
} else if (o.equals(Bool... |
88ae9fcd-8d89-4b0e-a47d-d90ed02fd38b | 0 | private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// On vide le dossier img
File del = new File("img");
delRecursif(del, true);
}//GEN-LAST:event_formWindowClosing |
92b77bf5-adae-4882-b343-b2b695627993 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
94eafabc-4252-4650-9eba-edd8f96eb3dc | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} |
61e3d013-69d1-45ad-ab64-2021264ceba7 | 8 | public void putAll( Map<? extends K, ? extends Float> map ) {
Iterator<? extends Entry<? extends K,? extends Float>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends K,? extends Float> e = it.next();
this.put( e.getKey(), e.getValue() );
... |
3719e7d2-4935-47b6-92dc-8cf66c0afa30 | 9 | public void addLink(int fromID, int toID, String cardinality, String name) {
// add the link
linkData.add(new LinkData(fromID, toID, cardinality, name));
// find the name of the class the link is coming from and index of the
// class the link is going to
String fromName = "";
int toIndex = 0;
for (int i =... |
bb5ce673-ecb1-4799-998f-4f0248637861 | 8 | protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call = super._createCall();
if (super.maintainSessionSet) {
_call.setMaintainSession(super.maintainSession);
}
if (super.cachedU... |
917f9ae5-a30d-4631-8535-e3b70089683d | 2 | @Override
public boolean accept(File f) {
return (f.isDirectory()) || (f.getAbsolutePath().toLowerCase().endsWith(".ab") && f.getAbsolutePath().toLowerCase().contains(device.getSerial().toLowerCase()));
} |
2e2e4564-c931-4496-b7ba-770c62c274d0 | 2 | private boolean giveForum(){ // Donne une ressource au forum (si le villageois est sur la bonne case) retourne Vrai s'il a reussit , faux sinon.
if (this.curent.objet instanceof Forum){
Forum b ;
b = (Forum) this.curent.objet;
b.addStock();
this.quantite --;
if (this.quantite <1){
this.plein = fal... |
64773670-a53f-4837-9c2e-12d9be65c9ef | 7 | @Override
public List<Campus> Buscar(Campus obj) {
String sql = "select a from Campus a";
String filtros = "";
if(obj != null){
if(obj.getId() != null){
filtros += "a.id = " + obj.getId();
}
if(obj.getNome() != null){
... |
064cf9f8-daed-4697-bb13-ff999bfa65d7 | 7 | @Override
public void run() {
Scanner sc = new Scanner(System.in);
while (true) {
int choice;
while (true) {
showMenu();
try {
String input = sc.next();
choice = Integer.parseInt(input);
... |
8fed65a9-e150-4f56-a7fd-5e1d9c864cb9 | 1 | @Test
public void testPutTrackingID()throws Exception{
Tracking tracking = new Tracking("whatever");
tracking.setId("539fc1d68a6157923f0a9284");
tracking.setTitle("another title");
Tracking tracking2 = connection.putTracking(tracking);
Assert.assertEquals("Should be equals ... |
a0083713-d7b1-4221-90e8-3b31cadedcaa | 7 | public static void showDialog(final Object obj) {
if (obj == null)
return;
EventQueue.invokeLater(new Runnable() {
public void run() {
if (obj instanceof Atom) {
createDialog((Atom) obj).setVisible(true);
}
else if (obj instanceof RBond) {
createDialog((RBond) obj).setVisible(true);
... |
4e6bf90a-15dd-46f3-83af-de48462df9ab | 4 | public void maulSpec()
{
if(IsAttackingNPC && playerEquipment[playerWeapon] == 4153)
{
setAnimation(1667);
actionTimer = 4;
SpecDamgNPC(30);
DDS2Damg = true;
DDStimer = 1;
resetAnimation();
teleportToX = absX;
teleportToY = absY;
... |
cfdc974a-31d5-4c29-9fa6-eca8e64c6e1a | 0 | protected void initDefaultCommand() {
setDefaultCommand(new TankDrive());
} |
931cd80d-208e-495d-9d4d-64444774ac3d | 6 | public Animal[][] getSurrounding(Animal animal) {
if (animal == null) {
return null;
}
// Scan entire Grid for animal
for (int i = 0; i < grid.length; i++) {
for (int j = 0; i < grid[0].length; j++) {
if (animal.equals(grid[i][j])) {
// Animal found, get surrounding
Animal surroundingGri... |
e38f59c3-1f8b-4418-9136-cc48ddb35d07 | 1 | private static void createDoubleParameters()
{
doubleArray = new double[PARAMETERS];
for (int i = 0; i < PARAMETERS; i++)
{
double doubleValue = i * 10.1;
doubleArray[i] = doubleValue;
}
} |
616dcda3-9517-457e-8a11-94d919e3f769 | 6 | public static void main(String[] args) {
try {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
File configFile = new File(ClassLoader.getSystemResource(runXMLAUTHORITY).getFile());
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConf... |
47b2b94d-a16d-4352-8a40-f9375a8340af | 8 | public int getBlockTextureFromSideAndMetadata(int par1, int par2)
{
if (par1 == 0)
{
return Block.planks.blockIndexInTexture;
}
else
{
int var3 = getDirection(par2);
int var4 = Direction.bedDirection[var3][par1];
return isBlockF... |
51c000a5-a80b-49be-97a2-ff12f6337d34 | 3 | public void createBookSql(String ver) throws ParseException, IOException {
StringBuilder sb = new StringBuilder();
sb.append("-- \n");
sb.append("-- generated by 2nd2go.org\n");
sb.append("-- \n\n");
// Charset charset = Charset.forName("US-ASCII");
Charset charset = Chars... |
93c97aee-75e7-4d44-a48a-e82b3a313675 | 5 | public VerifyInfo initInfo() {
VerifyInfo info = new VerifyInfo();
int pos = 1;
int slot = 0;
if (!mi.isStatic()) {
String clazzName = ci.getName().replace('.', '/');
if (mi.getName().equals("<init>"))
info.locals[slot++] = Type.tType("N" + clazzName + ";", null);
else
info.locals[slot++] = Typ... |
05efdda8-3f7f-402f-bd1b-878c084f8228 | 5 | private void processFileAttrRequest(Sim_event ev)
{
if (ev == null) {
return;
}
int requesterID = -1;
int size = 0;
FileAttribute attr = null;
try
{
Object[] obj = (Object[]) ev.get_data();
if (obj == null) {
... |
b06f4bb9-b8fe-4544-bcd3-c5e2dbc90031 | 3 | @Override
protected void read(InputBuffer b) throws IOException, ParsingException {
VariableLengthIntegerMessage vLength = getMessageFactory().parseVariableLengthIntegerMessage(b);
b = b.getSubBuffer(vLength.length());
long length = vLength.getLong();
if (length < 0 || length > Options.getInstance().getInt("p... |
08a4ac50-42c4-4260-81f0-1e202ccc1135 | 1 | public static void listSalariesOrder(EntityManager entityManager) {
TypedQuery<Employee> query = entityManager.createQuery(
"select e from Employee e order by e.salary desc",
Employee.class);
List<Employee> resultList = query.getResultList();
entityManager.close();
for (Employee employee : resultList)... |
97be027a-a4d8-4765-ad55-c55afbb9aeec | 6 | public void createPlayersProjectile(int x, int y, int offX, int offY, int angle, int speed, int gfxMoving, int startHeight, int endHeight, int lockon, int time) {
synchronized(c) {
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
Player p = Server.playerHandler.players[i];
if(p != null) {
Client person =... |
a622cd0e-c63f-4f99-88fb-a89e7a2989cc | 3 | public void open() {
Display display = Display.getDefault();
createContents();
shlWAU.open();
shlWAU.layout();
//
shlWAU.addListener(SWT.Close, new Listener() {
public void handleEvent(Event event) {
System.out.println("Interrompendo threads...");
try{
mapMgr.close();
... |
22e555f3-7888-48b9-9086-982da410efc2 | 4 | public void delete() {
TextGrid.DataGridCel cel;
TextGrid.DataGridCel nextCel;
cel = grid.getCel(currentRow + rowOffset, currentCol + colOffset);
if (currentRow + rowOffset == numberOfRows - 1) {
nextCel = grid.getCel(currentRow + rowOffset, currentCol
+ ... |
e98b1f74-f365-4928-bac1-28be51e3fab0 | 4 | public static String getExtractor(LinkedList<String> parts) {
String tmp = next(parts);
if (tmp == null)
return null;
if (tmp.equals("array")) {
return getArrayExtractor(parts);
}
parts.addFirst(tmp);
String baseExtractor = getStreamExtractor(parts);
if (baseExtractor == null)
return null;
Stri... |
f0e84f54-1ab5-489a-acda-f205e6ffc37a | 2 | public static int getIntegerParameter(String key) throws CorruptConfigurationEntryException {
key = key.toLowerCase();
if(parameters.containsKey(key)) {
try {
return Integer.parseInt(parameters.get(key));
} catch(NumberFormatException e) {
throw new CorruptConfigurationEntryException("The entry '" + k... |
40989444-b0f9-462f-8dbe-ba28e7755764 | 3 | public int inserir(Loja l){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, l.getNome());
... |
5b1a8599-7879-4e8d-b704-6a77025e6a98 | 7 | public int korasiDamage(Client o) {
double hitMultiplier = random.nextDouble() + 0.5;
int damage = (int)(calculateMeleeMaxHit() * hitMultiplier);
if(damage > 750) {
damage = 20;
}
if (o != null && o.curseActive[c.curses().DEFLECT_MAGIC] && System.currentTimeMillis() - o.protMageDelay > 1500)
damage = (... |
af40705d-f7dc-45d6-9d0d-263385e42927 | 6 | public static void main(String[] args) {
final int GOAL = 3;
int count1 = 0, count2 = 0;
Coin coin1 = new Coin();
Coin coin2 = new Coin();
while (count1 < GOAL && count2 < GOAL) {
coin1.flip();
coin2.flip();
Syste... |
2d8217f6-13d8-42d6-8679-c71caf610118 | 5 | public void run()
{
// on mac os x 10.5.x, when i run a 'sudo' command, i need to write
// the admin password out immediately; that's why this code is
// here.
if (sudoIsRequested)
{
//doSleep(500);
printWriter.println(adminPassword);
printWriter.flush();
}
BufferedReade... |
d6a647c6-a1cf-4cfb-9c32-567c365102a8 | 8 | public static void main(String[] args)
{
try
{
String fname = "Assignment04.txt";
Scanner scnr = new Scanner(new File(fname));
// read initial data from file
int numCities = scnr.nextInt();
int numFlights = scnr.nextInt(... |
223988d2-eb67-4458-847e-59f2cf5a10eb | 5 | public InputListener keyRotateListener(String id)
{
if (id.equals("analog"))
return new AnalogListener()
{
@Override
public void onAnalog(String name, float value, float tpf)
{
if (name.equals(MAP_ROTATE))
rotateBoardCam(value * (isShiftPressed ? -1 : 1));
}
... |
a06fb027-2341-4015-89ca-cd40890b56ab | 2 | public int getAnzahlLaender(Fraktion f) {
int res = 0;
Iterator<Land> it = iterator();
while(it.hasNext()) {
if(it.next().getOwner().equals(f)) {
res++;
}
}
return res;
} |
2c0b411d-ad84-4c9d-86cd-a7d1d7a2c030 | 4 | @Override
public void service(HttpServletRequest
request, HttpServletResponse response)
throws ServletException, IOException {
String url = request.getPathInfo();
IContext context = createContext(request, response);
IAction action = router.find(url, context);
properties.put("context", request.getCon... |
a23147ef-bc48-441f-b5d5-45047b838745 | 0 | public ArrayList<Account> pay(Account buyer, Account seller, String amount){
buyer.pay(amount);
seller.receive(amount);
ArrayList<Account> accounts = new ArrayList<Account>();
accounts.add(seller);
accounts.add(buyer);
return accounts;
} |
7c725935-97ee-425b-8c58-36a62ed48a4e | 8 | private void conectar(){
Properties configuracion = new Properties();
try {
configuracion.load(new FileInputStream("configuracion"));
} catch (FileNotFoundException e) {
defecto(configuracion);
} catch (IOException e) {
e.printStackTrace();
}
try {
// para Mysql
if(configuracion.... |
6733675e-a043-4885-9cb6-ff90a84a01cd | 6 | public static String fixName(String user)
{//System.out.println("fixName");
String username = user;
for (int i = 0; i < username.length(); i++)
{//System.out.println("fixName username: " + username + "; username.charAt(" + i + "): " + username.charAt(i));
if (username.charAt(i) == ' ' || username.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.