method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
124b566f-9971-4f8a-a48b-f1a4502b0fff
8
public void initDBConnection() { try { if (connection != null) return; System.out.println("Creating Connection to Database..."); Class.forName("org.sqlite.JDBC"); connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH); if (!connection.isClosed()) System.out.println("...Connection es...
312f73b3-934d-4f9b-b775-25c11e819419
0
public static void main(String[] args) { CalcFrame calcFrame = new CalcFrame(); calcFrame.menuFrame(); }
aef2a268-663e-40a5-93e3-598a3990d55b
9
public void parse_bill(String data_bill){ data_bill="p"+data_bill; isBill=false; //Service.WriteLog(data_bill); try { MyBill b = MyBill.valueOf(data_bill); switch (b) { case p020307810246090000000000: isBill=true; ...
d50c994a-bd85-4476-b836-284bc1115a87
2
public static Entreprise SelectEntrepriseById(int id) throws SQLException { String query = null; Entreprise entreprise = new Entreprise(); ResultSet resultat; try { query = "SELECT * from ENTREPRISE where ID_ENTREPRISE=? "; PreparedStatement pStatement = Connect...
183e2d75-946e-45d9-b112-5becfc06465d
6
public static void render(String msg, int x, int y, int color, float scale, boolean outline, Screen screen){ if(x == -1) x = (int) ((screen.width / 2) - ((msg.length() / 2) * (SPACING * scale))); if(y == -1) y = (int) ((screen.height / 2) - (SIZE * scale)); if(msg == null) System.err.println("Could not draw fo...
ebb0a9f7-bf94-439e-aedd-079d4cc53338
2
public static void convertPointFromScreen(Point pt, Component component) { while (component != null) { pt.x -= component.getX(); pt.y -= component.getY(); if (component instanceof Window) { break; } component = component.getParent(); } }
fe318c3f-3199-4f74-8410-3eeb54d49871
9
public double classifyInstance(Instance instance) throws Exception { double result; double[] dist; int index; switch (m_CombinationRule) { case AVERAGE_RULE: case PRODUCT_RULE: case MAJORITY_VOTING_RULE: case MIN_RULE: case MAX_RULE: dist = distributionForInstance(ins...
60cdd59f-5af6-4933-a6f8-e3bae3a51cb1
7
private void drawTile(int x, int y, TileType type, Graphics g) { /* * Because each type of tile is drawn differently, it's easiest * to just run through a switch statement rather than come up with some * overly complex code to handle everything. */ switch(type) { /* * A fruit is depicted as a sm...
0a0ec154-56d0-4624-8868-6bbe1f08de89
9
public void paintComponent(Graphics g) { g.setColor(Colors.lightgrey); g.fillRect(scale, scale, length * scale, width * scale); g.drawImage(field, scale, scale, length * scale, width * scale, board); for (int x = 0; x < width; x++) { for (int y = 0; y < length; y++) { ...
50d776d7-6937-45c2-8426-5e05f1cd8598
4
@Override public boolean run(Camera camera, FrameBuffer buffer){ boolean doLoop; doLoop = true; adapter = new AdapterPhysics(world); long ticks = ticker.getTicks(); if (ticks > 0) { //рассчитываем все силы и считаем новые местоположения объектов ...
2feacd08-cc77-4a91-b264-1e304bc9cf80
1
public float getUser_dailyRatio() { float ratio = (float)getUser_point_win()-(float)getUser_point_lost(); int nbdays = getUser_numberOfDay(); if(nbdays>0) ratio /= (float)nbdays; return ratio; }
05e3f46d-6576-413b-9eef-b4e98ee3befc
4
private static int getMonitorExitSlot(StructuredBlock stmt) { if (stmt instanceof InstructionBlock) { Expression instr = ((InstructionBlock) stmt).getInstruction(); if (instr instanceof MonitorExitOperator) { MonitorExitOperator monExit = (MonitorExitOperator) instr; if (monExit.getFreeOperandCount() ==...
1ea9c148-7969-43d3-8f4e-7a2a6cc5a266
4
public String getAccountNumber() { for (int i = 0; i < 9; i++) { if (i == 0) { accountNumber = numbers[i].toString(); } else { accountNumber += numbers[i].toString(); } } if (amountOfPossibleNumbers > 1) { getMultipleAccountNumbers(); } if (possibleAccountNumbers.length == 1) { account...
b8726406-fe9b-4bdc-b62e-723092b1710f
3
public static void removeNode(Node n){ // remove the outgoing connections from neighbor to this nodes // TODO: This is really expensive! Can't we have a better data structure? // The problem so far is the 'getRandomNode' method Enumeration<Node> nodeEnumer = nodes.getNodeEnumeration(); while(nodeEnumer....
23eab19f-b8b5-4c85-b45c-21ce115bdefb
7
public boolean isIsomorphic( Graph other ) { Node current,otherCurrent; NodeQueue q = new NodeQueue(); NodeQueue otherQueue = new NodeQueue(); q.push( graph.start ); otherQueue.push( other.start ); current = graph.start; int numArcs = 0; otherCurrent = other.start; while ( !q.isEmpty() && !otherQueue...
c1fe7c03-33f9-42b5-b3c6-7dcede53fae5
2
public boolean deleteLink(int posicion) {//deletes the link on the position of the parameter if (posicion >= 0 && posicion <= links.getLength()) {//if position is in a valid range. links.remove(posicion);//deletes from links list the element of that position actual_links--;//reduces vari...
4dc7b6de-fcf8-43f4-b5c4-f8b774fea979
2
private void addStatisticsDisplayChoiceListener( final JComboBox<String> fieldsForStats) { fieldsForStats.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int index = fieldsForStats.getSelectedIndex(); if (index == 82 && !averageDividend.isSelected(...
ef03098b-212c-4538-b17d-859de34d4538
1
protected static String processGreek(String text) { text = text.replace("יוונית|", ""); String arr[] = text.split("\\|"); if (arr.length >= 2) { text = "<span data-transliterationLanguage=\"grc\">" + arr[1] + "</span>) <span lang=\"grc\">" + ar...
03e13868-d93a-4b7b-aa5b-362187896497
9
public BufferedImage getApplicationIconImage() { if (isMac()) { try { Class<?> nsDataClass = Class.forName("com.apple.cocoa.foundation.NSData"); Class<?> nsImageClass = Class.forName("com.apple.cocoa.application.NSImage"); Object application = getNSA...
744b82b4-8058-4501-a249-142dc1d0df48
5
public int compareTo(Object obj) { if (!(obj instanceof CmapSubtable)) { return -1; } CmapSubtable cms = (CmapSubtable) obj; if (platformID < cms.platformID) { return -1; } else if (platformID > cms.platformID) { ...
0c092cdc-d4e6-4d99-9cf3-34512f81424b
7
public void setIndent(int indent, boolean relative) throws RuntimeException { if (indent == 0 && !relative) { this.indentString = baseIndentString; } else if (indent > 0) { char[] ind = new char[indent]; Arrays.fill(ind, ' '); String offset = this.indentString.copyValueOf(ind); if ...
1a73c353-2a5d-4f50-b8d8-e716bc707518
7
public TwoWordContextModel(File file) { super(file); wordTypes = new HashSet<String>(); Scanner scanner = null; try { scanner = new Scanner(file); } catch (FileNotFoundException e) { System.out.println("Error occured with: "+ file.getAbsolutePath()); System.out.println("Program will exit"); e.prin...
92f9df02-40af-4c77-997c-c0c941ae264f
2
public QuestionDAOImpl(){ q = null; try { FileInputStream fileIn = new FileInputStream("question.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); q = (Question) in.readObject(); in.close(); fileIn.close(); }catch(IOExcept...
e34fc866-5a7a-47b5-a0b2-e56e50f57ff2
3
public static void prev() { try { if(currentPlayback != null && prevTrack != null) { setCurrentTrack(prevTrack); play(); } } catch (MediaException e) { System.out.println("Invalid media type."); } }
1ff2d3ab-db7c-401f-adec-9da14b303440
4
private int theNumberOfMaterialIsAvailableForThisDay(Loan loan, GregorianCalendar calendar) { int quantity = this.getStock().getQuantity(loan.getName()); for (Loan l : this.getStock().getLoans()) { if (l.getName().equals(loan.getName())) { if (0 >= l.getStart(...
dda7d47e-3562-45e8-bc34-b046e6c715e0
8
public void testAddResponses() throws Exception { Responses rsps=new Responses(10, true); System.out.println("rsps = " + rsps); assert !rsps.isDone(); for(int i=0; i < 5; i++) rsps.addResponse(new PingData(addrs[i], true, names[i], phys_addrs[i]), false); System.out.p...
7ced12e7-01cb-4d5f-bf96-845630e5be8d
2
protected String removeJavaScriptProtocol(String source) { //remove javascript: from inline events String result = source; Matcher matcher = eventJsProtocolPattern.matcher(source); if(matcher.matches()) { result = matcher.replaceFirst("$1"); } if(generateStatistics) { statistics.setPreservedSize...
59d3164f-4582-4ca9-ab11-8ce4c8a0d949
5
private static void registerPluginForMimeType(String[] indexFiles, String mimeType, WebServerPlugin plugin, Map<String, String> commandLineOptions) { if (mimeType == null || plugin == null) { return; } if (indexFiles != null) { for (String filename : indexFiles) { ...
0b2325a3-8e11-4080-ab3b-ab8f40338d69
8
public void setDigitalizacion(int muestreo_1, int muestreo_2, int [] LUT){ int i = 0; int j = 0; int avanceJ = 0; int avanceI = 0; int pixel_i = 0; int pixel_j = 0; int muestreo_original_1 = muestreo_1; int muestreo_original_2 = muestreo_2; boolean visitado = false; Color color; for( ; i < muestr...
b74cc279-ab5a-4f7e-aa84-2be3b35011c2
9
private static final Object number(CharacterIterator it,StringBuilder buf) { int length = 0; boolean isFloatingPoint = false; buf.setLength(0); char c = it.current(); if (c == '-') { buf.append(c); c = it.next(); } length += addDigits(it,c,buf...
9947d7fe-ae65-4968-a38c-650a1cf98172
1
public static void exportImageAsSpreadSheet(SegmentedImage image, String oName){ Workbook wb = new HSSFWorkbook(); dumpImageToSheet(image, wb); try{ FileOutputStream out = new FileOutputStream(oName + ".xls"); wb.write(out); out.close(); } catch (Exception e){ e.printStackTrace(); } }
fdfa0576-3e8c-415d-85d8-9539b06970fc
2
public ProxiedPlayer getClosestPlayer(String player) { String name = player.toLowerCase(); for (ProxiedPlayer data : plugin.getProxy().getPlayers()) if (data.getName().toLowerCase().startsWith(name)) { return data; } return null; }
a2c52e4d-6bfd-4181-a4ce-ba616267c5b3
9
public final static boolean compareStringArraysIgnoreCase(final String[] A1, final String[] A2) { if(((A1==null)||(A1.length==0)) &&((A2==null)||(A2.length==0))) return true; if((A1==null)||(A2==null)) return false; if(A1.length!=A2.length) return false; for(int a1=0;a1<A1.length;a1++) { if(!A1...
807f5d5f-346d-4405-8a36-3b62fe921ee0
8
public FileLineTO readFileLine() throws FileNotFoundException { FileLineTO fileLineTo = null; FileTO fileTo = null; LineTO lineTo = null; if (filenamePointer < 0) { if (filenameList.length > 0) { filenamePointer = 0;...
f2ee9d13-5377-4ff1-9f29-f4167669e716
5
private TorrentInfoSection ( long pieceLength, List<Sha1Hash> pieceHashes, boolean priv, String baseDir, List<TorrentFileInfo> files, Sha1Hash hash, String name) { if ((baseDir == null | hash == null | name == null) || pieceHashes.contains(null) || files.contains(null)) { throw n...
e9b8c903-9337-4e07-b1f7-0e9a2f5ff39a
3
@Override public Object nextElement() { if (!hasMoreElements()) {return null;} endIndex = text.indexOf(match,startIndex); if (endIndex == -1) { endIndex = text.length(); } String token = text.substring(startIndex,endIndex); startIndex = endIndex + matchLength; if (startIndex >= text.length())...
bb2f93d9-17ec-4b47-a68c-cf8413234483
7
private void UpdateNomeEquipamento() { //ler o nome String nomeEquipamentoUpdate = jTextFieldNovoNomeEquipp.getText(); boolean jaExiste = false; if (nomeEquipamentoUpdate.equals("")) { JOptionPane.showMessageDialog(null, "DEVE preencher o campo do Nome", "CAMPO OBRIGATÓRIO"...
bcfc9d4d-4841-465c-b033-66a3eeb0890f
0
public int getyNopeus() { return yNopeus; }
ec857b28-a48e-4ec8-a428-35e4cef144cb
0
@Test public void testGetResting() throws IOException { System.out.println("getResting"); AntBrain b = new AntBrain("cleverbrain1.brain"); Ant instance = new Ant(b,true,0); int expResult = 0; int result = instance.getResting(); assertEquals(expResult, result)...
e8264885-feee-45c1-b039-b54f4b6b1e98
4
@Override public Object getValueAt(int i, int i1) { SimpleMeal retrievedSimpleMeal = mealList.get(i); switch (i1) { case NAME_COLUMN: return retrievedSimpleMeal.getName(); case CALORIES_COLUMN: return retrievedSimpleMeal.getCalories(); ...
e3c10ff4-42bc-4ca4-b4eb-e2025dd946fe
3
void createPassAutPage() { composite = new Composite(shlNewAccount, SWT.NONE); composite.setLayout(new FormLayout()); Label lblBeforeCreatingA = new Label(composite, SWT.NONE); FormData fd_lblBeforeCreatingA = new FormData(); fd_lblBeforeCreatingA.left = new FormAttachment(0, 10); fd_lblBeforeCreatingA....
0f1eca09-1e17-45ae-adb2-e06d69caaf5c
0
public Auction(String title, String duration, String auctionType, String desc, String img, String lowPrice, String startPrice, String buyout, String delivery, Account seller, String category, String time) { titleInt = title; durationInt = duration; auctionTypeInt = auctionType; descInt = desc; i...
ff2cd98d-8def-47db-adf6-fcd3dd103c96
8
private JButton generateBut() { JButton but = new JButton( new ImageIcon(((new ImageIcon(this.getClass().getResource( "/Image/icon.jpg"))).getImage()).getScaledInstance(150, 130, java.awt.Image.SCALE_SMOOTH))); but.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ...
a1a30ffd-12bb-42cc-b5bc-1e15fc5770a8
6
public String getClassString(ClassInfo clazz) { String name = clazz.getName(); if (cachedClassNames == null) /* We are not yet clean, return the full name */ return name; /* First look in our cache. */ String cached = (String) cachedClassNames.get(name); if (cached != null) return cached; int pkg...
d3e11c54-3b38-48f2-9b8c-4040a5138714
7
public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); Map<Character, Integer> w = new HashMap<>(); //'Q', the rook — as 'R', the bishop — as'B', the knight — as 'N', the pawn — as 'P', the king — as 'K'. // the queen's weight is 9, ...
bc425aea-1655-4909-ad9d-1481b4eae1fd
2
private final boolean doublec(int j) { if (j < 1) return false; if (b[j] != b[j-1]) return false; return cons(j); }
ec6ebb5c-9c8f-489c-88fe-f50357fc51cc
1
public void render() { BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); requestFocus(); return; } activeComponent.render(screen); Graphics g = bs.getDrawGraphics(); g.drawImage(image, 0, 0, getWidth(), getHeight(), null); g.dispose(); bs.show(); }
57476628-5883-4298-ac18-e930ace78ef5
4
public static boolean canJump(int[] A) { int max = 0; for (int i = 0; i < A.length; i++) { if (max < i) return false; if (max >= A.length - 1) return true; if (i + A[i] > max) max = i + A[i]; } return false; }
ea750881-cae9-40bb-b7ef-ecc145e3c3dc
3
@Override public void render(final Graphics g) { Image drawImage = ImageUtils.rotateImage(img, Math.toDegrees(rotationAngle)); int width = drawImage.getWidth(null); if (engineLeft) g.drawImage(ImageUtils.rotateImage(ImageLoader.ship_engine_left, Math.toDegrees(rotationAngle)), pos.x() - width / 2, pos.y...
78ad8557-ef70-41f1-9cdd-61864c0774b6
9
public Result find(List<DBItem> searchOn){ File xml = new File("Databases/" + name + ".xml"); SAXBuilder builder = new SAXBuilder(); boolean findAll = searchOn == null ? true : false; try{ Document document = (Document) builder.build(xml); Element rootNode = document.getRootElement(); Res...
566620ad-bc98-4d00-867d-7310e2b27fb8
5
public void reissueWithResponse( long challenge, StopWatch watch ) { HttpURLConnection conn = null; try { byte[] encrypted_response = null; Signature signer = Signature.getInstance("SHA1withRSA"); signer.initSign(keys.getPrivate()); signer.update(ByteManip.ltob(challenge+1)); encrypted_respon...
2b58b432-450a-49af-89dc-04cf38194460
7
public SoundBuffer readAll() { if( module == null ) { errorMessage( "Module null in method 'readAll'" ); return null; } // Check to make sure there is an audio format: if( myAudioFormat == null ) { errorMessage( "Audio Format null ...
42702e1c-3725-48ab-aa72-5c47926fda00
1
public void testClient() { CameraClientThread cameraClient = new CameraClientThread(); cameraClient.start(); PathinfoThread pathinfoThread = new PathinfoThread(); pathinfoThread.start(); try { pathinfoThread.join(); cameraClient.join(); } catch (InterruptedException e) { // TODO Auto-generate...
88d9f797-b9ad-4642-ab8c-1a385c098d68
4
@Override public String toString() { StringBuilder sb = new StringBuilder(); // start cell tag sb.append( "<" ); sb.append( tagName ); if ( className !=null && className.length()>0 ) { sb.append( " class=\"" ); sb.append( className ); ...
1f62c30f-e65e-4124-bb97-f72946e96f18
8
double getNiceLower( double ovalue ) { // Add some checks double gridFactor = 1.0; double mGridFactor = 1.0; double gridStep = this.gridStep; double mGridStep = this.labelStep; while ( gridStep < 10.0 ) { gridStep *= 10; gridFactor *= 10; } while ( mGridStep < 10.0 ) { mGridStep *= 10; ...
f2ea4df7-685e-4b99-ae8e-36e21f49c243
6
private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) { if(transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for(int i=1,n=curLine.length ; i<n ; i+=3) { byte r = curLine[i]; by...
412569b6-1197-4290-9de1-c538a42e626d
4
public void populatePuzzle(String filename) throws IOException{ FileReader fr; BufferedReader buff; try{ fr = new FileReader(filename); buff = new BufferedReader(fr); String line = buff.readLine(); //one line in the file per row in the...
d423de26-b155-4c15-8e1b-e3f94cec2452
0
public InetSocketAddress getSocketAddress() { return this.address; }
977bc371-e3aa-4d5d-abf8-e3312249e7b4
1
public void stopCreatingCollection() { if (creatingCollection) { screenManager.removeImageButton("Add File"); screenManager.removeImageButton("Set Key"); screenManager.removeImageButton("Save Collection"); cp5.getController("enter collection name").setVisible(false); } creatingCollection = false; }
8c5b0c67-78c9-40ed-bf54-65078bbfeaab
9
public void doit_wait() throws JRexecException { if(thread!=null) return; // ?? try { write(); byte[] b=new byte[1]; in.read(b, 0, 1); byte[] buf=new byte[1024]; if(b[0]==0){ // success while(true){ int len=in.read(buf, 0, buf.length); if(len==-1) break; //...
7c006fd8-5d5b-49dd-ae36-d32c13c1d51a
4
private void makeGrassRandom() { for (int i = 0; i < mapWidth; i++) { for (int k = 0; k < mapHeight; k++) { if (map[i][k] == Tile.grass) { boolean generateTile = new Random().nextBoolean(); if (generateTile) map[i][k] = Tile.grass2; } } } }
d61ec20c-d23d-4c2b-938a-f00c706221e3
8
public static String inferDriverClassName(String url) { return match(url, name -> { switch (name) { case "h2": return "org.h2.Driver"; case "hsqldb": return "org.hsqldb.jdbc.JDBCDriver"; case "sqlite": return "org.sq...
dd7a3eb0-a4a4-46d0-a5b9-dd3ab9283e55
7
private void balanceReplicas() throws Exception { int formerSize = replicas.size(); int numMembers = members.size(); List<Future<Object>> futureResponses = new ArrayList<>(); while (replicas.size() > (formerSize +1) * (numMembers - 1) / numMembers) { SignalInfo sInfo2; BlockingQueue<SignalInfo> list; ...
ff6bf049-726c-4224-bf25-5afdc0d0eb67
6
private void checkEnemies() { GameActor a = getOwningActor(); PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent"); WeaponsComponent wc = (WeaponsComponent)a.getComponent("WeaponsComponent"); float cx = pc.getX(); float cy = pc.getY(); ...
4215a2c5-fc82-4391-8985-3dd1e171f5e0
0
public void writetoLocale(){ LoadLocaleConstants myLocale = new LoadLocaleConstants(); myLocale.writetoProperties(); }
28d4c133-692d-4574-946c-3a7868edac2e
3
public boolean titelErwerben( int indexTitel, int gold, ArrayList<Land> laendereien ) { // ist bereits König if ( this.titel.getTitel( this.indexTitel ).equals( "Koenig" ) ) { return false; } int titelKostet = titel.getGold() * indexTitel; // Titelkosten int benoetigteLaender = titel.getLandmin(...
1530a5c3-ba08-41ab-9ecc-7928ccf0d509
2
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb = sb.append(this.indiceDeRegla).append(". ("); for (int i = 0; i < this.causantes.size(); i++) { String s = this.causantes.get(i); sb = sb.append(s); if ((this.causantes.size...
adf94fc3-76ed-42bf-ab09-df88b8fd8d4a
8
final public void LetExp() throws ParseException {/*@bgen(jjtree) LetExp */ SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTLETEXP); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(LET); Variable(); jj_consume_token(EQUAL); Expression(); ...
210531f2-857f-4e21-adb6-1a5b357aedb6
5
private void generateElementsRankHints(PrintStream out) { Multimap<String, Element> rankMap = new Multimap<String, Element>(); for (Element element : repository.elements()) { String rank = element.getStyle("rank"); if(rank!=null) { rankMap.add(rank, element); ...
e48936d3-ba24-47d4-9932-753c19e78322
3
public ArrayList<Outbreak> createOutbreaksFromFile(String filename) throws IOException { ArrayList<Outbreak> myOutbreaks = new ArrayList<Outbreak>(); boolean useRandomLocation = false; try { CSVReader reader = new CSVReader(new FileReader(filename), '\t'); String[] nextLine; while ((nextLine = reader.rea...
7467cba0-67e4-4683-b793-e4d04b0b4f45
5
private static int calculateFactor(double value) { int factor = 0; while (true) { if (factor == MAX_PRECISION - 1) { break; } double temp = value * pow(factor); if (temp >= MAX_VALUE.base) { break; } if (temp == (long) temp) { if (temp == (long) (temp / 10) * 10) { factor-...
3170101a-74d2-4a7d-bdc9-a5884fade44a
8
public void DBReadFollowers(MOB mob, boolean bringToLife) { Room location=mob.location(); if(location==null) location=mob.getStartRoom(); final List<MOB> V=DBScanFollowers(mob.Name()); for(int v=0;v<V.size();v++) { final MOB newMOB=V.get(v); final Room room=(location==null)?newMOB.getStartRoom():loc...
a1bf3a35-57b5-44ef-abe9-fd357c210e1c
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { if(!mob.isMonster()) { boolean quiet=false; if((commands!=null) &&(commands.size()>1) &&(commands.get(1).toUpperCase().equals("QUIET"))) { quiet=true; } if((mob.isAttributeSet(MO...
f995c39a-0894-464a-a16d-b3e217306aca
9
public boolean setEntriesSet(int row, boolean withBlocks) { entriesSet++; if (withBlocks && blocks != null) { if (blocks.size() == 1) { blocks.get(0).increaseEntriesSet(row); } else if (blocks.size() > 1) { ArrayList<Integer> indeces = new ArrayList<Integer>(); ...
5fd5bd9f-ecab-40e8-a0e8-ece3bd6dfe84
3
public void RemoveListener() { if (UI.instance != null && UI.instance.menugrid != null && action.length > 1) UI.instance.menugrid.listeners.remove(action[1]); }
a249dffe-ab9b-4d93-8b13-d53edae99d28
4
public void validate(Object param, Object value) { if (param instanceof String) { isLessThanEqualsToString((String) param, value); } else if (param instanceof Integer) { isLessThanEqualsToInteger((Integer) param, value); } else if (param instanceof Boolean) { throw new IllegalArgumentException(); } els...
9a3e8e75-67ee-4f0e-8d9a-e69b80b66bf3
8
public Set<Map.Entry<Double,Short>> entrySet() { return new AbstractSet<Map.Entry<Double,Short>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TDoubleShortMapDecorator.this.isEmpty(); } ...
5a4a55c5-c804-4886-99d0-26b644d45746
7
public Point3f findPointOnPlane(char direction, int x, int y, float c) { if (tempMatrix4f == null) tempMatrix4f = new Matrix4f(); tempMatrix4f.setIdentity(); tempMatrix4f.invert(transformManager.matrixTransform); float xa = 0, ya = 0, za = 0; if (pmin == null) pmin = new Point3f(); pmin.set(transformM...
2680ed53-08cb-485a-b774-e198d139040b
5
public void applyTerrain(Terrain terrain, Card card, boolean inverse) { MonsterCard mc = null; if (MonsterCard.class.isInstance(card)) { mc = MonsterCard.class.cast(card); if (terrain.favors.contains(mc.type)) { if (inverse) mc.bonus -= 500; else mc.bonus += 500; } else if (terrain.unfavo...
18504b16-1f02-4c3c-9b52-ca816b6730c8
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=(givenTarget instanceof MOB)?(MOB)givenTarget:mob; if(target.fetchEffect(ID())!=null) { target.tell(L("You are no longer automatically detecting traps.")); target.delEffect(m...
1b5d0217-fb89-4fbd-b4e8-44a3861664d8
9
public static void saveCategory(Target target) { String s = target.getNewTopic(); String s1 = target.getNewThat(); boolean flag; if(s == null) flag = false; else if(s.trim().length() == 0 || s.equals("*")) flag = false; else ...
6ec8990c-0317-4518-9aa2-b72b8162fb19
7
public void addGateComponent(Component gateComponent) { flowLayoutGatesPanel.add(gateComponent); if(flowLayout) { flowLayoutGatesPanel.revalidate(); flowLayoutGatesPanel.repaint(); } else { Component[] components = nullLayoutGatesPanel.getComponents()...
829ee00a-3515-43e2-8b9e-dcc5124d6c41
9
public void analyseRecord(int id, byte[] record) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(record); DataInputStream dis = new DataInputStream(bis); long trip_stamp = dis.readLong(); dis.readUTF(); dis.readByte(); // should be 0xFE long ts = dis.readLong(); if (collectedR...
8cb3df65-764a-4565-94b0-1022392db755
4
public static void findYearDefects(Scanner ifile2, String defectYear) { int fieldCount = 0; int fieldsPerRecord = 2; String defectCount = ""; /* defect count listed for a given year */ String defectYearCount = ""; /* the defect count listed for defectYear */ boole...
c60d03ab-609b-4cbf-bd7f-5c2026cb2563
8
private void updateBonds(State xcurr) { double pb = 0; int x = 0; int y = 0; for (int i = 0; i < _dim; i++) { for (int j = 0; j < _dim; j++) { coord: for (int k = 0; k < 1; k++) { if (k == 0) { //Spin...
d77c7ff7-8175-42a7-b7a8-c612251483a0
8
public String[] parseCounterExampleWithChangeVariablesFromTrace(PreferenceMetaData pmd) throws FileNotFoundException, IOException { Set<String> variablesTrueInOutcome = new HashSet<String>(); BufferedReader reader = new BufferedReader (new FileReader(pmd.getCounterExampleFile())); String nextLine; try{ ...
67402f52-80de-4685-80bb-e37242aa58e9
8
private void remove() { for(int i = 0; i < entities.size(); i++) { if(entities.get(i).isRemoved()) { entities.remove(i); } } for(int i = 0; i < projectiles.size(); i++) { if(projectiles.get(i).isRemoved()) { projectiles.remove(i); } } for(int i = 0; i < particles.size(); i++) { if(partic...
12113fcf-badb-4103-96fa-abcfa43f8480
7
public void stayAboard(Rider R) { final Room rideR=CMLib.map().roomLocation(rideable); if((rideR!=null) &&((CMLib.map().roomLocation(R)!=rideR) ||(R.riding()!=rideable))) { if(R.riding()!=null) R.setRiding(null); if(CMLib.map().roomLocation(R)!=rideR) if(R instanceof Item) rideR.moveItemT...
807e597e-d546-4ae7-9d56-47925c6fed8d
5
@Override public boolean activate() { //Inv full final boolean valid = workLeft(); if ((valid && (GraniteMiner.curState == GraniteMiner.Status.NONE))) { GraniteMiner.curState = THIS_STATE; } else if (!valid && (GraniteMiner.curState == THIS_STATE)) { GraniteM...
577b0f01-de3a-4f19-b185-2d4f48131668
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Card card = (Card) o; if (value != card.value) return false; return true; }
ede80111-dc0e-44ea-9508-d8e8d3707c3e
8
private static String[] tokenize(String parOut) { List<String> tokens = new ArrayList<String>(); int current = 0; int length = parOut.length(); String token = new String(""); while (current < length) { char nextChar = parOut.charAt(current++); if (nextChar == '(') { if (!token.isEmpty()) { tokens...
6c793522-2145-4b18-bb63-6ecea99b5575
8
private static ArrayList<ArrayList<Double>> collect_initial_conditions(String grid_file_address,FwyNetwork fwy) throws Exception { // create the list of initial densities to test ArrayList<ArrayList<Double>> all_ic = new ArrayList<ArrayList<Double>>(); try { // read grid points ...
46432e13-ae7a-4c32-b4f1-3cfe3f775e98
6
public boolean acceptOffer(Request RequestX){ float cost = RequestX.getUnitPrice()*RequestX.getAsset(); String assetType = RequestX.getAssetType(); if(RequestX instanceof BuyRequest){ if((this.getAsset(RequestX.getAssetType())-RequestX.getAsset())<0){ //popup...
1b7f1143-89fc-462b-9e1d-8a8768d66bfa
5
public BEValue bdecodeBytes() throws IOException { int c = this.getNextIndicator(); int num = c - '0'; if (num < 0 || num > 9) throw new InvalidBEncodingException("Number expected, not '" + (char)c + "'"); this.indicator = 0; c = this.read(); int i = c - '0'; while (i >= 0 && i <= 9) { // Th...
2238eb3b-8763-47b5-9612-51c6b01fd28b
6
public void produceGoods() { new Thread("produkcja: " + this.getName()) { public void run() { while(population > 0) { consumeGoods(); if(isShoudProduce()) { for(Stock s : warehouse.storedGoods.values()) { Stock.StockType type = s.getType(); if(warehouse....
f58b4487-6848-485b-a063-c44d9b90976d
3
public int findMove(int index, int offset, int player) { int nextIndex = index + offset; if (indexIsOutOfBounds(nextIndex)) return INVALIDMOVE; else if (boardArray[nextIndex] == OPEN) return nextIndex; else if (boardArray[nextIndex] == opponent(player)) return findMove(nextIn...
772c4059-2567-4e96-9c94-a528647909b9
3
private static void setAtribute(String row, Data d) { if (startWith(row, ATTRIBUTE)) { String data = pureData(row, ATTRIBUTE); Matcher m = null; if ((m = getMatcher("'([\\w0-9\\-_]+)'\\s+\\{(.*)\\}", row)).find()) { d.addAttribute(m.group(1), m.group(2).replaceAll("[\' ]", "") .split(",")); d....
9d5b1eea-b8f3-4edb-99bf-028ce48e0c73
9
public void addToConversation(Message input) { //Adding a single person to a conversation if (input.getCode() == 601) { if (Conversations.containsKey(input.ConversationID)) { Conversations.get(input.ConversationID).AddUser(input.User); GUI.updateConvoUsers(inp...
013fca1d-5ece-4d76-a18a-dadf88808aae
3
@Override public void caseAParanthesisHexp(AParanthesisHexp node) { inAParanthesisHexp(node); if(node.getRPar() != null) { node.getRPar().apply(this); } if(node.getExp() != null) { node.getExp().apply(this); } if(node.getLPa...
b944a936-a449-4b1b-8760-a110a77e64f3
1
public String getAttributeFirstVal(String asName) { String lsVal = null; Attribute laAttr = getAttribute(asName); if (laAttr != null) { lsVal = laAttr.getVal(); } return lsVal; }