method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1d33814c-2ee0-4165-948b-39a9d729f8f1 | 6 | void createColorAndFontGroup () {
super.createColorAndFontGroup();
TableItem item = new TableItem(colorAndFontTable, SWT.None);
item.setText(ControlExample.getResourceString ("Item_Foreground_Color"));
item = new TableItem(colorAndFontTable, SWT.None);
item.setText(ControlExample.getResourceString ("Item_B... |
ff0fc785-8267-4591-be4d-020d80d896b4 | 8 | public void method390(int i, int j, String s, int k, int i1) {
if(s == null)
return;
aRandom1498.setSeed(k);
int j1 = 192 + (aRandom1498.nextInt() & 0x1f);
i1 -= anInt1497;
for(int k1 = 0; k1 < s.length(); k1++)
if(s.charAt(k1) == '@' && k1 + 4 < s.length() && s.charAt(k1 + 4) == '@') {
int l1 = get... |
8d3f7af8-1c99-49f5-ba84-b4862ccb59cc | 9 | @Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_ESCAPE || (keyCode == KeyEvent.VK_C && e.isControlDown())) {
System.out.println("Shutting Down...");
Model.setState(new ExitState());
} else if (keyCode == forwardKey) {
Model.setCameraMovementZ(-1)... |
5676d1d3-b4b0-4e90-9683-0d8acaf670e5 | 1 | public void removeAllRows() {
Row[] rows = mRows.toArray(new Row[0]);
mSelection.deselect();
mSelection.setSize(0);
notifyOfRowsWillBeRemoved(rows);
mRows.clear();
for (Row element : rows) {
element.setOwner(null);
}
notifyOfRowsWereRemoved(rows);
} |
12b818b5-37fa-4dd6-8d65-059e7f8925c6 | 0 | public int getType() {
return type;
} |
74046b00-f781-41cb-9a04-8823acd98562 | 3 | @Override
public void configureWithRandomizeDNA() {
int[] initialDNA = dna.clone();
List<Integer> dna2 = new ArrayList<Integer>();
do {
for (int i = 0; i < boardLength; i++)
dna2.add(i);
Collections.shuffle(dna2);
for (int i = 0; i < boar... |
dcfe3d5e-e23e-4bfa-95f2-4f11848a1e67 | 6 | public boolean newClienteAction(String tipo_documentacion, String numero_documentacion, String nombre, String apellido, String direccion, String deuda) throws SQLException, EmptyFieldException {
boolean res;
conn = ConexionBD.getInstance();
if(tipo_documentacion.... |
b02a939f-f3c7-4304-a7b5-e94aff105c94 | 5 | public void start(final Session session) throws OpenShiftSSHOperationException {
if (localAddress == null || localAddress.isEmpty()) {
throw new IllegalArgumentException("Cannot enable port-forwarding from an undefined local address");
}
if (localPort == -1 ) {
throw new IllegalArgumentException("Cannot ena... |
8f42167f-aa14-4a67-a72b-0e36369dcd47 | 3 | public void tradePokemon()
{
tWin=new TradeWindow();
while(!CONNECTED)
{
}
while(CONNECTED)
{
repaint();
try
{
Thread.sleep(10);
}
catch(Exception ignored){}
manageTime();
tWin.tradeLogic();
}
} |
cf131d0f-2124-4de9-8482-100e8fd00d2b | 5 | public static void afficher_tableau(Vector<Vector<String>> data)
{
for(int i=0;i<data.size();i++)
{
for(int j=0;j<data.get(i).size();j++)
{
if(i==0 || j==0)
System.out.print(data.get(i).get(j)+"\t");
else
{
... |
583b18e2-180b-400d-ac44-8111b9fe2dd7 | 2 | private String AddByBit(String str1, String str2)
{
StringBuffer sumBuffer = new StringBuffer();
for(int i = 0; i < str1.length(); ++i)
{
if(str1.charAt(i) == str2.charAt(i))
{
sumBuffer.append("0");
}
else
{
sumBuffer.append("1");
}
}
return sumBuffer.toString();
} |
1019cdd6-3fc7-47e7-a3b0-593890627b04 | 8 | private java.util.List<CMFile> sortDirsDown(CMFile[] files)
{
final Vector<CMFile> dirs=new Vector<CMFile>();
final HashSet<CMFile> dirsH=new HashSet<CMFile>();
CMFile CF=null;
for(int v=files.length-1;v>=0;v--)
{
CF=files[v];
if((CF.isDirectory())&&(CF.exists()))
{
int x=0;
while(x<=dirs.s... |
b35ce9a7-3d1a-4e0a-bd35-300bb9cc530d | 3 | 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... |
632c980a-8b36-4bed-a33c-3a1bd74e3290 | 3 | public Auto getAuto(int id){
Auto a = new Auto();
try {
this.leesDatabase();
output = statement.executeQuery("SELECT * FROM auto WHERE auto_id =" + id);
String kenteken = output.getString("kenteken");
String merk = output.getString("merk");
int bouwjaar = output.getInt("bouwjaar");
String type = o... |
fce44ebf-57d3-46e1-87d4-f77d58de2d7a | 0 | public String adminDeleteProduct() {
this.adminFacade.deleteProduct(this.id);
return this.goToAdminProductsList();
} |
1a4d8711-31df-4e30-aaf0-5bf6908c2d8d | 0 | protected void drawSelectionBox(Graphics g){
g.drawRect(mySelectionBounds.x, mySelectionBounds.y, mySelectionBounds.width, mySelectionBounds.height);
} |
fd1d6597-e119-4b07-b598-d457a5a50d65 | 5 | private int numPatients() {
int count = 0 ;
for (Mobile m : inside()) if (m instanceof Actor) {
final Actor actor = (Actor) m ;
if (! actor.health.conscious()) count++ ;
else if (actor.health.injuryLevel() > 0) count++ ;
else if (actor.isDoing(SickLeave.class, null)) count++ ;
}
... |
96b74940-ed0c-4fe5-9476-7ac7d42ebfd3 | 2 | public void addItemToArticle(Article article) {
Session session = HibernateUtil.getSessionFactory().openSession();
try {
session.beginTransaction().begin();
session.save(article);
session.getTransaction().commit();
} catch (Exception ex) {
ex.print... |
8dc78a39-69ed-42e7-bca5-386a9674bdd4 | 7 | public static void main(String[] args) throws Exception {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
st = new StringTokenizer(in.readLine());
int left = 0;
int right = readInt() - 1;
int position = readInt() - 1;
char[] slogan = readString().toCharArray(... |
5dc6e3cc-4374-4536-9c45-520e945f28a2 | 5 | void headerShowToolTip (int x) {
String tooltip = headerGetToolTip (x);
if (tooltip == null || tooltip.length () == 0) return;
if (toolTipShell == null) {
toolTipShell = new Shell (getShell (), SWT.ON_TOP | SWT.TOOL);
toolTipLabel = new Label (toolTipShell, SWT.CENTER);
Display display = toolTipShell.getDispl... |
df5455b0-8b70-4f7c-af74-490b1e0006e0 | 9 | public static String process(Metadata question){
String answer = "";
Match match = MatchUtil.readMatch();
if(question.getType().equals("text")){
boolean isJoin = false;
if(question.getContent().startsWith("参加-")){
isJoin = true;
}else if(question.getContent().startsWith("join-")){
isJoin = true;
... |
d57894ec-5d89-4a53-9501-c7b9af7c96e4 | 4 | @Override
public boolean containsStringArray(String name) {
JOSObject<? , ?> raw = this.getObject(name);
if(raw == null) return false;
if(raw.getName().equalsIgnoreCase(STRING_ARRAY_NAME)) return true;
return false;
} |
56bfb8ec-0932-40ef-992e-1e14d9272397 | 4 | public static void switchPanelStatus(String name){
if( name.equals("sceneCreate") ){
Game.PANEL_STATUS = Game.PANEL_STATUS_SCENE_BUILD;
}else if(name.equals("mainPanel")){
Game.PANEL_STATUS = Game.PANEL_STATUS_MAINPANEL;
}else if( name.equals("sceneChose")){
Game.PANEL_STATUS = Game.PANEL_STATUS_SCENE... |
8ae5c2a8-b552-42a4-8abe-b879e82c7256 | 5 | private void saveAsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAsButtonActionPerformed
// Mettre à jour le document d'après le contenu du textarea
setDocumentFromTextArea();
// Lire nom du fichier
String _fileName = (String) JOptionPane.showInputDialog(
... |
5ede3bb3-c1fe-4f2f-a3d5-64fa011e0876 | 3 | public void AccessPublishService()
{
System.out.println("---------------------------------------------------------------");
System.out.println("AccessPublishService started... ");
try
{
String serviceURL = PublishServiceUrl;
com.aquarius.Publish.AquariusPublishService aqPublishService =
new com.aqu... |
1bc2e0ee-4b24-40c5-a04b-8515d705b248 | 9 | public void run() {
while (active) {
int mod = timeElapsed % 7;
switch(mod)
{
case 0:
log.info("info level log.");
break;
case 1:
log.config("config level log.");
break;
case 2:
log.warning("warning level log");
break;
case 3:
log.fine("fine level log");
break;
... |
634547f8-2559-4687-941b-5a5ddf25ce07 | 3 | public boolean canMove(Point point) {
boolean canMove = true;
for(Agent a : _agents) {
if (a.position.x == point.x && a.position.y == point.y) canMove = false;
}
return canMove;
} |
77ac59d9-f1cf-48be-9d5f-b2230e085639 | 1 | private void onStatStateChanged(Stat newStat) {
for (StatProcessorListener listener: listeners) {
listener.onStatStateChanged(newStat);
}
} |
7624a7f2-d446-4936-b877-c59732f84327 | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
38805c36-6e8e-4494-b851-018b70d2d5cc | 2 | public OrgaEinheit getOrgaEinheitZuidOrgaEinheit(int idOrgaEinheit){
ResultSet resultSet;
OrgaEinheit rueckgabe = null;
try {
resultSet = db
.executeQueryStatement("SELECT * FROM OrgaEinheiten WHERE idOrgaEinheit = '"
+ idOrgaEinheit + "'");
if(resultSet.next())
rueckgabe = new OrgaEinheit(re... |
61b657c9-57a6-44a0-b37b-1afc5e40223c | 0 | public void setFirstName(String firstName) {
this.firstName = firstName;
} |
eb7e3774-814e-44f6-8235-292551152d0d | 8 | public void paintStuff(Graphics g)
{
switch(Screen)
{
case "start1":
renderer.startRenderer.renderStart1(g);
break;
case "start2":
renderer.startRenderer.renderStart2(g);
break;
case "start3":
renderer.startRenderer.renderStart3(g);
break;
case "menu":
renderer.menuRenderer.render(g... |
7a5b5039-69a9-47c8-a91d-25ac0165968d | 9 | public boolean move(Location from, Location to) {
///If from BearOff During Configure call, allow
if(isConfigureMove(from, to)){
moveDuringConfigure(from, to);
return true;
}
//ADDED
//If move is the reverse of a move previously made during this turn, allow.
Move m = new Move(from,to)... |
be742a10-90f2-475b-bd2a-8add9925e3f2 | 7 | public Enumeration getFieldNames()
{
return new Enumeration()
{
int i=0;
Field field=null;
public boolean hasMoreElements()
{
if (field!=null)
return true;
while (i<_f... |
316cc692-19fa-46f7-8fd7-eca33b0cf8f3 | 7 | public static Parameter getParameter(int index) throws IndexOutOfBoundsException {
if (index == -3) { return new LocationParameter(); }
else if (index == -2) { return new ElementTypeParameter(); }
else if (index == 0) { return new StringParameter(); }
else if (index == 1) { return new In... |
50c76efd-4cbf-43e5-b805-a518aad06fed | 0 | @Override
public boolean stopCellEditing() {
isPushed = false;
return super.stopCellEditing();
} |
32f89616-b3c8-40e3-a5cb-012b8e121d5f | 7 | public HtmlNodeLink AnalysisHTML(String content, String tagname) {
String dataInTag = content;
HtmlNodeLink hList = new HtmlNodeLink();
try {
while (dataInTag.indexOf(tagname) != -1) {
int prefix = checkPrefixTagIndex(dataInTag, tagname);
if (prefix ==... |
cbf33c82-e043-4c2f-ad74-660524955a54 | 7 | private static void tryToSetEnvironment(String file)
throws FileNotFoundException, IOException, Exception {
BufferedReader input = new BufferedReader(new FileReader(file));
String line = input.readLine();
short size = Short.parseShort(line);
if (size > 50) {
input.close();
throw new Exception("Tamanho... |
535dbb50-e522-4d91-be3c-6ae46ffdb9df | 2 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource()==cancelButton) {//cancel button
//Exam exam=new Exam();
//exam.setVisible(true);
//this.dispose();
examPanel.setVisible(false);
examPanel.getParent().remove(examPanel);
... |
1fa7abfd-c1c8-46b4-a09d-0a0e4b6cda85 | 3 | public static void spy(final String inputFilePath) throws IOException{
MemoryBasedCobweb multiThreadSpider = new MemoryBasedCobweb();
File leavesFile = new File(inputFilePath);
FileReader leavesFileReader = new FileReader(leavesFile);
BufferedReader br = new BufferedReader(leavesFileReader);
int count = 0;... |
cc734ba6-5382-4509-9229-a42001797f8a | 5 | @EventHandler
public void onDamage(EntityDamageEvent event){
if(event.getEntity() instanceof Player){
Player player = (Player) event.getEntity();
if(On1Data.in1on1.contains(player)){
if(player.getHealth()-event.getDamage()<=0){
event.setCancelled(true);
On1Data.leave(player);
Player f = On1D... |
4fc9694d-eeb3-408f-834e-53e381cd8363 | 1 | boolean isGroovy() {
return file != null && file.getName().endsWith("groovy");
} |
85e72283-9766-4f6d-bdc1-eaf65bdd29e1 | 5 | public List<PaidVo> getUnPaidOutDetail(int cid, Date from, Date to, int uid) {
List<OutDetail> result = outDetailDao.queryOutDetail(-1, -1, cid, -1, from, to, -1, uid);
//result = selectReverseStatus(result, Constants.OUT_STATUS_PAID_ENOUGH);
//Collections.sort(result);
Collections.reve... |
42becce6-0c19-4293-a473-155588277f6c | 5 | public int getAdjacentWalls (int x, int y, int scopex, int scopey) {
int startx = x - scopex;
int starty = y - scopey;
int endx = x + scopex;
int endy = y + scopey;
int ix = startx;
int iy = starty;
int wallcounter = 0;
for (iy = starty; iy <= endy; iy++) {
for (ix = startx; ix <= endx; ix+... |
621bc131-37d7-4c3d-a60e-ac6cc6326ece | 3 | public Query limit(int limit) {
if (limit < 0) {
throw new IllegalArgumentException("limit can not be negative");
}
if (query == null || query.length() == 0) {
throw new ExcuteQueryException("wrong use of limit");
}
this.limit = limit;
return this;
} |
e8bfae3c-e9df-43dd-bd7a-76ec9cb90cff | 1 | public JSONArray getJSONArray(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof JSONArray) {
return (JSONArray)object;
}
throw new JSONException("JSONArray[" + index +
"] is not a JSONArray.");
} |
b7363e86-648a-4fef-ac67-a8d5f4f25df9 | 7 | boolean warmthSourceFoundInArea(World world, int x1, int x2, int y1, int y2, int z1, int z2, int furnace_x1, int furnace_x2, int furnace_y1, int furnace_y2, int furnace_z1, int furnace_z2)
{
boolean success = false;
for (int checkedX = x1; checkedX <= x2; checkedX++)
{
for (int checkedY =... |
a9277df9-99c5-4cd3-9f96-eb1ae6138308 | 8 | public static void main(String[] args) {
// Create .base and .test file and fill them with data
String line;
try {
File data = new File(fileDirectory + fileName + ".dat");
if (!data.exists())
data.createNewFile();
FileWriter dw = new FileWriter(data.getAbsoluteFile());
BufferedWriter dataWriter... |
c3a01083-df17-4fe4-b862-7303f0cbb336 | 9 | public JLabel getTecla(int tc) {
JLabel botao = jLabel0;
switch (tc) {
case 0:
botao = jLabel0;
break;
case 1:
botao = jLabel1;
break;
case 2:
botao = jLabel2;
break;
... |
f6bc688c-7d05-4b8b-b327-b0b62ddb9245 | 6 | public void blinkparticle() {
if (untouchable > 0) {
if (blink > 15 && blink <= 30) {
setImage(invin);
}
else if (blink >= 0 && blink <= 15) {
setImage(empty);
}
}
else if (untouchable == 0) {
getWorld()... |
0876b815-dab9-4498-8cd2-09660860daa5 | 8 | private boolean isFlush(ArrayList<Card> player) {
int spadeCounter=0;
int cloverCounter=0;
int heartCounter=0;
int diamondCounter=0;
for(Card c: player){
if(c.getSuit()=="S")
spadeCounter++;
else if(c.getSuit()=="C")
cloverCounter++;
else if(c.getSuit()=="D")
diamondCounter++;
else
hear... |
0649fd3a-43c4-41b1-a14a-5cd9dca9b369 | 8 | public String getHttpCommand() {
String ret = "";
if (this.method.equals(HttpMethod.GET)) {
ret = "GET " + this.url.getPath() + " HTTP/1.1 \r\n" + "Host: "
+ this.url.getHost() + "\r\n";
Enumeration<String> e = this.header.keys();
String field;
while (e.hasMoreElements()) {
field = e.nextEleme... |
60d35f41-2f7c-430d-8d8b-2f1a9d82b3c6 | 2 | private void evalInvokeIntfMethod(int opcode, int index, Frame frame) throws BadBytecode {
String desc = constPool.getInterfaceMethodrefType(index);
Type[] types = paramTypesFromDesc(desc);
int i = types.length;
while (i > 0)
verifyAssignable(zeroExtend(types[--i]), simplePo... |
8512092f-30c1-4161-88f2-d6545f3bfb76 | 1 | private void playAudio() {
try {
File soundFile = new File(textField.getText());
audioInputStream = AudioSystem.getAudioInputStream(soundFile);
audioFormat = audioInputStream.getFormat();
System.out.println(audioFormat);
DataLine.Info dataLineInfo = new DataLine.Info(
SourceDataLine.class, audioF... |
90667070-01d4-45b2-92fc-2bff2636c236 | 9 | public final Model getModel(String var1) {
return (Model)(var1.equals("humanoid")?this.human:(var1.equals("humanoid.armor")?this.armoredHuman:(var1.equals("creeper")?this.creeper:(var1.equals("skeleton")?this.skeleton:(var1.equals("zombie")?this.zombie:(var1.equals("pig")?this.pig:(var1.equals("sheep")?this.sheep... |
f54596f1-c95e-4c9d-bd52-48471850b7bd | 5 | public synchronized String commit(ObjectOutputStream output, ObjectInputStream input, int clientNumber) throws IOException {
String answer = "";
try {
CommitObject oldhead = (CommitObject) input.readObject();
//kijken of de vorige head op de clientside gelijk is aan de huidige head op de server
// --... |
197bd922-e943-41a6-8a20-1ad70ad14af8 | 2 | private void collideWithPlayer(Player player) {
player.decrementAction();
player.decrementAction();
player.decrementAction();
// An extra action is decremented if there is an powerfailure on that square
Position position = getGrid().getElementPosition(player);
List<Element> elements = getGrid().getElements... |
e5850c01-3474-493d-aff3-71caef26fa6e | 7 | private boolean IsValidColor(String ColorCode)
{
if(ColorCode.equals("#000000"))
{
return true;
}
if(ColorCode.equals("#0053F7"))
{
return true;
}
if(ColorCode.equals("#EA4532"))
{
return true;
}
if(C... |
a66201fd-5f0d-4e03-8d17-cebf7637a4bd | 2 | public double[][] standardizedCorrelationCoefficients(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.standardizedCorrelationCoefficients;
} |
74c8fc31-2edd-4d70-83f4-40f0d742fdaa | 4 | @Override
public JTable select(String selectedTrain) {
selection = new String[result.length][result.length];
int n = 0;
for(int i = 0; i < result.length; i++){
if(result[i][0].equals(selectedTrain)){
selection[n] = result[i];
n++;
}
}
System.out.println(n);
String[][] small_... |
e5400783-066e-4695-b959-495f77046b82 | 8 | public boolean ungetService(Bundle bundle, ServiceReference<?> ref)
{
UsageCount usage = null;
ServiceRegistrationImpl<Object> reg =
((ServiceRegistrationImpl.ServiceReferenceImpl) ref).getRegistration();
synchronized (this)
{
// First make sure that no exist... |
a4122241-58a9-4189-96ab-1de37b129e71 | 9 | private void jFileChooser1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFileChooser1ActionPerformed
if (!evt.getActionCommand().equals("CancelSelection")){
/* System.err.println("Cancel");
}
else{*/
if (this.jFileChooser1.getSelectedFile() != null){
// Fi... |
66d2758a-5ab5-4d3c-aae9-dce43a3d079d | 4 | void resetEditors (boolean tab) {
TableItem oldItem = comboEditor.getItem ();
comboEditor.setEditor (null, null, -1);
if (oldItem != null) {
int row = table.indexOf (oldItem);
try {
new String (nameText.getText ());
} catch (NumberFormatException e) {
nameText.setText (oldItem.getText (NAME_C... |
17e32ed0-649a-430b-8c25-2bd79b4bfbd4 | 9 | public static void main(String[] args) {
try {
OutputStream os = System.out;
InputStream is = System.in;
if (args.length == 2) {
os = new FileOutputStream(args[1]);
is = new FileInputStream(args[0]);
}
... |
f6f05949-85bf-432b-a34b-0bd544c060de | 0 | public String getDefaultEncoding() {
return defaultEnc;
} |
b2c37d35-3694-4ca2-9ed0-d7968095dc3c | 3 | public void handle(HttpExchange exchange) throws IOException {
System.out.println();
System.out.println("Connection Made");
String requestMethod = exchange.getRequestMethod();
if (requestMethod.equalsIgnoreCase("POST")) {
// Pre... |
5985c9e4-8c04-4b29-a934-d7cdb9bb2b6c | 5 | @Override
public boolean onMouseDown(int mX, int mY, int button) {
if(super.onMouseDown(mX, mY, button)) {
return true;
}
if(mX > x && mX < x + width && mY > y && mY < y + height) {
Application.get().getEventManager().queueEvent(new AttemptRepairEvent());
}
... |
4b2337a3-bf84-42ce-8d18-b173e4c7dd63 | 3 | private void addGensFor(DefinitionStmt u){
Value lo = u.getLeftOp();
Value ro = u.getRightOp();
if ( lo instanceof FieldRef && !(ro instanceof Constant)){
if(!ro.toString().equals("null")){
// addGen(u, lo);
addGen(u, ro);
}
}
} |
b51ed354-f9bd-4e7c-b183-490ea4d3bb53 | 5 | @Override
public void loop() {
switch (step) {
case 0:
if(Motors.movement.isMoving()){
if(Motors.ts.isPressed()){
Motors.movement.stop();
Motors.movement.forward();
reset();
step++;
}
}
else{
Motors.movement.backward();
}
break;
case 1:
if (delta()>400){
Mo... |
2306169b-1c94-4602-9467-1a06d39383b0 | 6 | public static void main(String[] args) {
for (int x = 1; x < 13; x++) {
for (int y = 1; y < 13; y++) {
if (y != 1) {
if (new Integer(x*y).toString().length() == 1) {
System.out.print(" ");
}
if (new Integer(x*y).toString().length() == 2) {
System.out.print(" ");
}
if (ne... |
6ee57fde-7daa-4e15-a6c4-ce1ce35bbd0d | 9 | @Override
public void buttonX(boolean pressed) {
if(enabled) {
if(ses2 != null) {
setFlagsFalse();
if(future != null) {
future.cancel(true);
}
}
if(pressed == true) {
xFlag = true;
dllProc.dll_keyPressed(container.xgetCurrentPreset().xgetXAssignedKeyCode());
if(... |
daf5da29-6ba8-4a76-badc-9f8b38526ce2 | 5 | public ListNode insertionSortList(ListNode head) {
if(head == null) return null;
ListNode dummy = new ListNode(head.val);
ListNode p = dummy;
dummy.next = head;
while(p.next != null){
ListNode pp = dummy;
if(p.next.val >= p.val) {
p = p.nex... |
7a4ebde5-9f6b-4357-bce5-4f70f6d9fcbf | 3 | protected void resetNeurons() {
for (List<? extends Neuron> list : this) {
for (Neuron neuron : list) {
neuron.reset();
}
}
} |
59656eb5-3198-47ec-9936-44ba4ea9de0a | 0 | public DawnguardWarAxe() {
this.name = Constants.DAWNGUARD_WAR_AXE;
this.attackScore = 11;
this.attackSpeed = 15;
this.money = 920;
} |
568891e0-aa76-4efd-92ad-6bfb1d214dbc | 5 | void clearPixelSlider_stateChanged(ChangeEvent e)
{
JSlider source = (JSlider)e.getSource();
if( !source.getValueIsAdjusting())
{
int value = (int)source.getValue();
switch( value )
{
case 0: setClearPixelColorSample( new Color(js.CLEAR_PIX... |
0429106d-a0e2-4e30-8360-e3c0290eaa94 | 7 | public static boolean isPerfect(TreeNode<Integer> t) {
if (t == null) {
return false;
}
Queue<TreeNode<Integer>> queue = new LinkedList<TreeNode<Integer>>();
/* enqueue root node */
queue.add(t);
int level = 0;
int currentLevelNodeNum = 1;
int nextLevelNodeNum = 0;
while (queue.size() != 0) {
... |
d7c8c6dd-bb13-4384-b018-471335438bf6 | 8 | public void move(){
if(direction.equals("N")){
y-= moveRate;
}else if(direction.equals("NW")){
y-= moveRate;
x-= moveRate;
}else if(direction.equals("W")){
x-= moveRate;
}else if(direction.equals("SW")){
x-= moveRate;
y+= moveRate;
}else if(direction.equals("S")){
y+= moveRate;
}else if... |
546f55d3-b4fb-455f-85c4-a0bee1ab49da | 3 | public void add(Object o) {
int nodeLoc = v.findEmpty();
if(nodeLoc == -1) {
nodeLoc = v.size();
}
v.set(nodeLoc, new Node(o, -1));
if ( last != -1 ) {
Node lastNode = (Node)v.get(last);
lastNode.next = nodeLoc;
}
last = nodeLoc;
if ( first == -1) {
first = nodeLoc;
}
size++;
} |
fbd69713-5812-4ea1-aa10-63cf16bc3bcb | 9 | public void WGLogin(String sender, String login, String hostname, Command command) {
if(command.arguments.length == 3) {
User user;
boolean exists = false;
boolean setpassword = false;
boolean loggedin = false;
for(Game game : games.values()) {
... |
2b6a6039-19d1-46bc-9b7a-c2d7ec5ccfe2 | 3 | public void update()
{
player.update();
for(Door door : doors)
door.update();
for(MedKit medkit : medkitsToRemove)
medkits.remove(medkit);
for(MedKit medkit : medkits)
medkit.update();
rounds.update();
} |
153b6810-9862-47da-9f5d-8382b9bbbdd5 | 3 | @Override
public void update()
{
if(this.world.player.nx == this.x && this.world.player.ny == this.y && !this.world.player.hasGift)
{
this.world.player.hasGift = true;
this.shouldRemove = true;
}
} |
afd46db6-c769-49fb-922e-eb5b8c16247f | 5 | private void _setFilters(Document document) {
NodeList nlist = document.getElementsByTagName("user");
if (nlist.getLength() > 0) {
Element user = (Element)nlist.item(0);
NodeList newlist = user.getElementsByTagName("filters");
if(newlist.getLength() > 0) {
Node node = newlist.item(0).getFirstChild();
... |
63b63395-d2e7-4599-94aa-dd922ed5bebb | 9 | public static void main(String[] args) {
int n = 30000;
int[] sms = new int[n + 1];
for (int a = 1; 2 * a * a <= n; a++) {
for (int b = a; 2 * a * b <= n; b++) {
inner:
for (int c = b; ; c++) {
for (int lyr = 1; ; lyr++) {
... |
cfba1e35-d4ac-442c-9ba4-244247727732 | 3 | public static void bubblesort(int[] data){
int temp;
for(int i=0;i<data.length;i++){
for(int j=data.length-1;j>i;j--){
if(data[i]<data[j]){
temp =data[i];
data[i] = data[j];
data[j] = temp;
}
}
}
} |
c0be68d5-c414-4239-b492-3babc1ce9382 | 5 | public void readAllAssets(String rootDirPath) {
// TODO clear all assets
try {
Document document = ResourceController
.readXML(rootDirPath + File.separator + "assets"
+ File.separator + "assets.xml");
NodeList assetList = document.getElementsByTagName("asset");
for (int i = 0; i < assetList.ge... |
c91eb7a7-967d-44a2-87f0-a9826a408f3c | 4 | @Override
public Point2D move() {
Point2D policemanPos = getPosition();
//this code is to prevent livelock
//live lock is possible when one policeman goes home and another one for bad guy
// in some conditions
if (shouldWait()) { return policemanPos; }
... |
b9c3a417-d860-48c1-ae4f-268e44d5a56e | 9 | @Override
public String getSheetName()
{
if( sheetname == null )
{
if( parent_rec != null )
{
WorkBook wb = parent_rec.getWorkBook();
if( (wb != null) && (wb.getExternSheet() != null) )
{
String[] sheets = wb.getExternSheet().getBoundSheetNames( ixti );
if( (sheets != null) && (sheets.... |
ac88b00f-5573-48da-93c4-df94f8adcf8e | 9 | public Object clone() {
Customer cloned = new Customer();
cloned.setCustomer_id(this.customer_id);
if (this.nric != null)
cloned.setNric(new String(this.nric));
if (this.username != null)
cloned.setUsername(new String(this.username));
if (this.password != null)
cloned.setPassword(new String(this.pas... |
f13d8876-1467-41d5-aec9-0dbe752748bc | 4 | public int compareTo(PathPattern<T> pattern) {
int sizeDiff = elements.size() - pattern.elements.size();
Iterator<Element> i = elements.iterator();
Iterator<Element> j = pattern.elements.iterator();
for (; ; ) {
if (!i.hasNext() || !j.hasNext()) {
return siz... |
a7298e11-134d-4896-ba6f-99790ceedcb5 | 8 | public void scale()
{
double[] maxValues = new double[featureCount];
double[] minValues = new double[featureCount];
for(int i = 0; i < featureCount; i++)
{
maxValues[i] = Double.NEGATIVE_INFINITY;
minValues[i] = Double.POSITIVE_INFINITY;
}
for(Instance inst : data)
{
for(int fid : inst.getFea... |
fd542e4b-0a4c-4071-a40d-a6dc5171b1e1 | 3 | static private Host maybeGetHost (String classname,USBListener startup_listener)
throws IOException, SecurityException
{
try {
Object temp;
HostFactory factory;
temp = Class.forName (classname);
temp = ((Class)temp).newInstance ();
return ((HostFactory) temp).createHost (startup_liste... |
35b7418c-8656-49bc-b8ac-67d621e7452d | 5 | @Override
public boolean hasNext() {
// set up stage for iterating on root node's children
if (currentStage.equals(IterationStage.ON_PARENT)) {
this.next = this.treeNode;
currentStage = IterationStage.ON_CHILD;
return true;
}
if (currentStage.equal... |
ab98daef-b57c-4b17-98e5-6710da3bd241 | 3 | * @param p the offset within data to start writing
* @return the number of serialised bytes
*/
private int serialiseVersions( byte[] data, int p ) throws Exception
{
int oldP = p;
if ( p + versionTableSize < data.length )
{
if ( versions.size() < 0 )
throw new MVDException( "at least one version need... |
4ae3538e-393e-4a9d-9065-eeef0125c4a5 | 7 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String data;
try {
ArrayList<FilterBean> alFilter = new ArrayList<>();
if (request.getParameter("filter") != null) {
if (request.getParameter("filterop... |
624a6362-e5e6-4218-861e-e5edfd8c70ac | 2 | public static void setDebug(int level)
{
if(level >= 0 && level <= maxDebugLevel)
debugLevel = level;
else
{
System.out.println("Invalid debug level specified (0-" + maxDebugLevel + ").");
System.exit(-1);
}
} |
69e218ed-f728-40aa-a762-5ccae0324190 | 7 | public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
System.out.println("Loaded viewphoto.java");
DBC dbc = new DBC();
User user = new User... |
7a64088d-0b4a-4794-b1ed-e0e430cddd36 | 7 | @Override
public boolean equals(Object o) {
if(!(o instanceof Reply)) {
return false;
}
Reply r = (Reply)o;
if(!this.getTime().equals(r.getTime())) {
return false;
}
if(!this.getText().equals(r.getText())) {
return false;
... |
4863af03-1413-4203-b3b0-c46f05be3695 | 0 | public long getAllThroughTime() {
return this.allThroughTime;
} |
7d4f896b-03d8-475f-8993-a519c7f570b8 | 1 | public Iterator iterator() {
return new Iterator() {
int pos = 0;
public boolean hasNext() {
return pos < count;
}
public Object next() {
return elementObjects[pos++];
}
public void remove() {
if (pos < count)
System.arraycopy(elementObjects, pos, elementObjects,
pos - 1, ... |
c61c15c9-b70f-4b54-964b-c9bfbdc0a034 | 8 | @Override
protected boolean isAnUltimateAuthorityHere(MOB M, Law laws)
{
if((M==null)
||(holdingClan.length()==0)
||(!allowLaw)
||(totalControlPoints<0)
||(!CMProps.getBoolVar(CMProps.Bool.MUDSTARTED)))
return false;
final Clan C=CMLib.clans().getClan(holdingClan);
if(C==null)
{
if(CMSecurity.is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.