method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2d111f29-5803-4079-9ec9-e415abdb446f
4
public void reactToLight(Light.LightStatus lightStatus, double currentTime){ calcCurrentState(currentTime); P.p("Current position: "+position); P.p("Reacting to lightStatus: " + lightStatus); switch(lightStatus){ case GREEN: P.p("lightStatus is green"); if(saved != null && !saved.exited) { ahead ...
5795a19a-9a82-424e-b30e-cf725704fffc
2
public static int[][] one2two(int[] one, int w, int h) { int[][] two = new int[h][w]; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { two[i][j] = one[i * w + j]; } } return two; }
896f9590-c077-44ba-a0b3-006579c33017
1
@SuppressWarnings("unchecked") public E peek() { if (count == 0) return null; return (E) elements[head]; }
d720df64-905b-410b-8eb6-6a8ef271b5f2
8
public boolean checkProjectileCollision(GameActor proj, GameActor other) { // currently we are only interested in collision between a projectile and another type of actor if(proj == null || other == null) { return false; } PhysicsComponent projPC = (PhysicsComponent)proj.getC...
50ae5643-7cd1-4a20-ba9a-33faa8b87207
8
public static Stella_Object access_retrieval_Slot_Value(retrieval self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Plsoap.SYM_PLSOAP_TARGET_MODULE) { if (setvalueP) { self.targetModule = ((module)(value)); } else { value = self.targetModule; } ...
851c3b94-a256-4296-aa3e-9c7306154299
4
public void run(int maxSteps, double minError) { double[] output; int i; double error = 1; //for (i = 0; i < maxSteps && error > minError; i++) { // Train neural network until minError reached or maxSteps exceeded for (i = 0; error > minError; i++) { ...
917162c2-c603-4fa9-9bb4-c6596f370ce7
4
public static String makeSegText(String[] units, Boolean[] stresses, Boolean[] segmentation) { StringBuilder out = new StringBuilder(); // Connect all but the last unit with the right connection, then add on // the final one for (int i=0; i < units.length - 1; i++) { out.append(units[i]); if (stresses[...
9a74c59c-6c41-4c38-b5a4-0f69fb8a6ac7
6
public static boolean getPlayerInfo(String[] args, CommandSender s){ //Various checks if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if yo...
2b984682-3e9b-467e-8c4e-7237fee62587
4
public ArrayList<Location> getPossibleMoves(Chessboard boardToCheck, Location pieceLoc) { ArrayList<Location> possibleMoves = new ArrayList<>(); Chessboard chessboardCopy = new Chessboard(boardToCheck); Tile[][] tileBoardCopy = chessboardCopy.getBoard(); //Piece pieceToCheck = tileBoardCopy[pieceLoc.getRow()][...
188b8c67-c4f3-4236-879b-d56347065d5d
2
public void reset(){ for (int i = 0; i < 3; i++){movementX [i] = 0; movementY[i] = 0;} hasMovement = false; if (tileId < 2){ tileId = 0; } refresh(); }
85cc225c-3ebe-4426-9f23-9a95ce3ad9dc
2
public Field getField(int stepNumber){ if (stepNumber >= MIN_NUMBER_OF_STEPS && stepNumber < MAX_NUMBER_OF_STEPS){ return history[stepNumber]; } else{ return getCurrentField(); } }
6c48d5ae-8c87-42f1-8a6c-6523d639828f
5
int time_seek(float seconds){ // translate time to PCM position and call pcm_seek int link=-1; long pcm_total=pcm_total(-1); float time_total=time_total(-1); if(!seekable) return (-1); // don't dump machine if we can't seek if(seconds<0||seconds>time_total){ //goto seek_error; ...
709e652e-5236-40fe-8079-45d2177b9b7f
0
@Override public int attack(double agility, double luck) { System.out.println("I tried to do a special attack but I haven't set it so I failed at this turn..."); return 0; }
32880c1a-e98f-4978-9254-82c555efe37c
1
public boolean setUsertileImageFrameWidth(int width) { boolean ret = true; if (width <= 0) { this.usertileImageFrame_Width = UISizeInits.USERTILE_IMAGEFRAME.getWidth(); ret = false; } else { this.usertileImageFrame_Width = width; } setUserti...
255fd95e-2b6d-4201-91e9-da3b4015a073
7
@Override public Coup genererCoup(Plateau etatJeu) { //Algorithme repris de l'énoncé du TP Noeud meilleurCoup = null; ArrayList<Position> positionsPossibles = etatJeu.etatId(0); Joueur j; for (Position p : positionsPossibles) { Coup cCourant = new Coup(this.id, p)...
6d1e882e-139a-4152-9885-1b6c3bd55d23
5
public boolean collisionDepl(int x, int y) { int Dx = pieceCourante.x + x; int Dy = pieceCourante.y + y; for (int i = 0; i < 4; i++) { int test = Dx + pieceCourante.Cases[i].getX(); int test2 = Dy + pieceCourante.Cases[i].getY(); if ((test > largeur - 1) || (...
4b0b7c87-ea65-4299-8ce6-624141372d16
4
public Vector<Integer> getLeaders() { Vector<Integer> leaders = new Vector<Integer>(); int leaderY = Integer.MAX_VALUE; for (int t=0; t<turtles.length; t++) { int tY = turtles[t].getY(); if (tY < leaderY) { leaders.clear(); leaders.add(t+1)...
e192cbbe-8360-416c-b85d-98aae249b446
4
@Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub switch (e.getKeyCode()) { case KeyEvent.VK_S: { downPressed=false; } break; case KeyEvent.VK_W: { upPressed=false; } break; case KeyEvent.VK_D: { rightPressed=false; } ...
3dbe3e58-91d6-47ef-b581-6284405ce747
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> alread...
3bc56e97-5afb-42c7-b073-0154f8791541
3
private TreeNodePageWrapper searchListForPageWrapperOrCreateNew(List<TreeNodePageWrapper> list, AbstractPage page) { if (list == null) return new TreeNodePageWrapper(page, (DefaultTreeModel) tree.getModel()); for (TreeNodePageWrapper element: list) if (element.page.url.equals(page.url)) return element; re...
5abd4e6e-75b0-4eef-840f-9ecbe908794a
8
public boolean delete(Object value) { Node node = search(value); if (node == null) { return false; } Node deleted = node.getSmaller() != null && node.getLarger() != null ? node.successor() : node; assert deleted != null : "deleted can't be null"; Node replac...
64112ba6-969e-459f-a0c3-33152c71ad04
8
private boolean isPointsInTriangle(int a, int b, int c, int[] verts) { Point2D pa = points[verts[a]]; Point2D pb = points[verts[b]]; Point2D pc = points[verts[c]]; final double e = 1e-6; double abcSquare = square(pa,pb,pc); for (Point2D pd : points) { // если точки совпадают if (pd.equals(pa) || pd.eq...
f8c9536e-a38e-488f-8d51-b2a3f7eb95a8
5
@Override public void setActiveForTask(int id_task, Boolean active) { try { connection = getConnection(); ptmt = connection.prepareStatement("UPDATE Task_executors SET active=? WHERE id_task=?;"); ptmt.setBoolean(1, active); ptmt.setInt(2, id_task); ...
72fa8b44-527b-445c-bd81-15a1e6379311
5
public void init() { buildMenu(); //make a split panel splitPanel = new HorizontalSplitPanel(); splitPanel.setSizeFull(); splitPanel.setSplitPosition(25, Sizeable.UNITS_PERCENTAGE); splitPanel.setLocked(false); splitPanel.setVisible(true); //make a tree as the first component webpageTree = new Tr...
dedd1b16-35ad-488b-ba80-ae2850d79045
8
static public void main(String args[]) { double x, y; Random rand = new Random(); String firstLetter = "STNH"; String secondLetter = "ABCDEFGHJKLMNOPQRSTUVWXYZ"; double sumx, sumx2; int nsum; OSGB osgb = new OSGB(); osgb.setErrorTolerance(0.0001); nsum = 0; sumx = sumx2 = 0.0; for (int i = 0; ...
6102878f-f671-4f44-8968-d7ede11377fc
4
@Override public void deserialize(Buffer buf) { int limit = buf.readUShort(); titles = new short[limit]; for (int i = 0; i < limit; i++) { titles[i] = buf.readShort(); } limit = buf.readUShort(); ornaments = new short[limit]; for (int i = 0; i < li...
a4930491-e8d9-43a3-b9cd-808632ab9874
0
public void setBodypart(BodyPart b){ this.bodypart = b; }
f462e30a-4370-43ef-98b2-8c83fd51925b
6
private void btnAgregarHMPMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnAgregarHMPMouseClicked HMP h = new HMP(); h.setIdAula(Integer.parseInt(String.valueOf(this.cmbAulaHMP.getSelectedItem()))); h.setIdGrupo(Integer.parseInt(String.valueOf(this.cmbGrupoHMP.getSelectedItem())...
4e1b37a0-a118-441c-bd0d-7d029f51d6cc
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Term other = (Term) obj; if (field == null) { if (other.field != null) return false; } else if (!field.equa...
999e5e59-e195-478d-a071-b92b9de6bc98
6
private RsToken quotedString() throws RsParsingException { int value; StringBuffer sbuff; sbuff=token.getStringBuffer(); while(true){ value=nextChar(); // check for special characters if(value=='\"'){ token.setType(RsToken.TT_STRING); return to...
a34ed9e1-a7ef-4398-96ce-32989f81cd49
0
public int getPlayerScores(){ return playerScores; }
8a2e8794-4bfa-4316-8e30-e6c8a104dd91
8
private Ingredient createIngredient(String name, double amount) { switch (name) { case "avocado": return new Avocado(amount); case "crab": return new Crab(amount); case "eel": return new Eel(amount); case "rice": return new Rice(amount); case "salmon": return new Salmon(amount); ...
2006fc74-dd49-4da5-95ab-cf76a835f936
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(msg.targetMinor()==CMMsg.TYP_ENTER) { if(msg.target()==this) { final MOB mob=msg.source(); if((mob.location()!=null)&&(mob.location().roomID().length()>0)) { ...
5f86a441-d817-4570-b034-7f0ff9cc2b28
4
public void showProducts(int rol){ ArrayList<beansProducto> listaProductos; listaProductos = ManejadorProductos.getInstancia().listaProductos(); if(listaProductos.size() >= 0){ for(beansProducto producto : listaProductos){ if(rol == 1){ mostrarProducto(producto); }else{ if(producto.getExisten...
a883da22-e5c0-46d3-b90e-a8bb6a520749
8
public static String InventoryToString (Inventory invInventory) { String serialization = invInventory.getSize() + ";"; for (int i = 0; i < invInventory.getSize(); i++) { ItemStack is = invInventory.getItem(i); if (is != null) { String seria...
f1bd0daf-0fea-4863-a01f-0b3cac9979c1
7
private void populateStage() { String iconFile; switch (type) { case ACCEPT: iconFile = "Dialog-accept.jpg"; addOKButton(); break; case ERROR: iconFile = "Dialog-error.jpg"; addOKButton(); ...
6e12b000-de8f-43a2-b298-96c81b26b702
1
private void addFictitiousInterval() { if (intervals.size() == 0) { throw new IndexOutOfBoundsException("There must be at least one interval to add fictitious one"); } // TODO take mass of the QWs for the fictitious layer // intervals.add(0, new MatterInterval(0, 0, 0, ...
be51ab3d-b044-4ab6-a53b-42526b9b1f0b
4
public void findStaffOnProject(Project project){ try{ SetOfUsers staffOnProject = new SetOfUsers(); ResultSet staffResults = null; Statement statement; statement = connection.createStatement(); staffResult...
7baef751-ee03-4560-9fbb-8c417e92d251
3
public void walkDown() { face = 2; if (!(y == Realm.WORLD_HEIGHT - 1) && !walkblockactive) if (!Collision.check(new Position(x, y), face)) { y += walkspeed; setWalkBlock(walkblocktick); } }
e9b7e84b-9903-46c6-9ea3-e8559787ded6
7
private static Day parseCalendarDay(int dayOfWeek) { switch (dayOfWeek) { case Calendar.SUNDAY: return SUN; case Calendar.MONDAY: return MON; case Calendar.TUESDAY: return TUE; case Calendar.WEDNESDAY: ...
e49a147d-2f67-46e0-a623-5fc35854ee4c
2
private boolean isPassable(Point p) { if (zoneState[((int) p.x)][((int) p.y)] == TileState.PASSABLE_OPAQUE || zoneState[((int) p.x)][((int) p.y)] == TileState.PASSABLE_TRANSPARENT) { return true; } return false; }
7b356d22-63c7-4df5-9b96-8b37230b83d3
5
@Override public void encode(Object bean, CodedOutputStream output) throws ConverterException { try { Collection collection = (Collection) field.get(bean); for (Object obj : collection) { if (obj != null) { ByteArrayOutputStream bout = new ByteArra...
a98431bf-5b18-4cb4-8534-5b51db463244
1
private boolean jj_3_61() { if (jj_scan_token(MINUS)) return true; return false; }
e3365415-f9e5-40b3-9262-f5c68644168d
6
@Override public String getColumnName(int column) { String name = "??"; switch (column) { case 0: name = "Name"; break; case 1: name = "Size"; break; case 2: name = "Status"; ...
f9aabb2b-5a52-4223-b264-266913c7105a
6
public static synchronized void runInSecurity(SecurityManager m,final Runnable task,int millisecondsTimeOut){ final SecurityManager old=System.getSecurityManager(); final SecurityManager delegate=m; final boolean[]allows={false}; System.setSecurityManager(new SecurityManager() { public void checkPe...
6c652e64-d58d-4052-9a07-3733f181a23b
2
public static void main(String[] args) { //Buffer to read the contents from the file. ByteBuffer buffer = ByteBuffer.allocate(100); //The file to read the contents from. Path path = Paths.get("/home/tests/test.txt"); //Creating the asynchronous channel to the file which allows...
83780951-2234-4f27-9a2f-32b3476a05cf
1
@Override public boolean next() { return dataSet != null ? dataSet.next() : false; }
b5e4f69b-a36d-4506-aa34-a9cbda60346d
7
@Override public Boolean value(final Double a, final Double b) { if (a == null || b == null || Double.isInfinite(a) || Double.isNaN(a) || Double.isInfinite(b) || Double.isNaN(b)) return false; double denominator = Math.max(Math.abs(a), Math.abs(b)); ...
17c0320f-21fc-4b6d-a2e5-04579070b008
5
private void removeClass(String name) { Class<?> clazz = classes.remove(name); try { if ((clazz != null) && (ConfigurationSerializable.class.isAssignableFrom(clazz))) { Class<? extends ConfigurationSerializable> serializable = clazz.asSubclass(ConfigurationSerializable.class...
aab8605e-133f-468b-869a-3d8b014a0475
3
private void waitForThread() { if ((this.thread != null) && this.thread.isAlive()) { try { this.thread.join(); } catch (final InterruptedException e) { this.plugin.getLogger().log(Level.SEVERE, null, e); } } }
22d86d5b-54f7-4b93-94cb-dfaae33265b6
1
public List getObjects(String HQLQuery) { List lista = null; try { Query q = cx.createQuery(HQLQuery); lista = q.list(); } catch (Exception e) { } return lista; }
4cc1a234-1147-4532-b8cf-ede7371a524e
3
public void run() { setName("DB Cleanup"); Logger.log("Running Cleanup..."); try { for (ResultSet rs : activeResults.keySet()) clean(rs); for (PreparedStatement ps : activeStatements) forceClean(ps); DB_CONN.close(); } catch (Throwable t) { } Logger.log("Cleanup Done."); }
4b51822c-afcf-4510-a970-e95ab907841b
2
public Pickable(String value, int x, int y) throws SlickException{ this.x = x * Play.TILESIZE; this.y = y * Play.TILESIZE; this.value = value; if(!value.equals("exit")){ Image[] pSprites = new Image[8]; Image spriteSheet = new Image("res/powerups/" + value + ".png"); for(int i = 0 ; i < pSprites.len...
679cf147-3ce5-472e-90a6-78d07d3566e4
8
public boolean equals(Object other) { if (other instanceof Pair) { Pair<A,B> otherPair = (Pair<A,B>) other; return (( this.first == otherPair.first || ( this.first != null && otherPair.first != null && this.first...
17eeb406-6a2d-4ac2-918a-ba7b444834be
0
public Date getDataRegistrazione() { return dataRegistrazione; }
3e842e24-fb2b-47c7-b900-24c112dcc3c8
5
public void ticking() { if (t.Ring()) { destroy(); } else { x += xVel; y += yVel; setBounds((int) x, (int) y, width, height); } for (int i = 0; i < w.tiles.length; i++) { for (int j = 0; j < w.tiles[0].length; j++) { if (this.intersects(w.tiles[i][j]) && w.tiles[i][j].solid) { d...
55176d58-869f-4e22-b908-fccd5722b387
1
private void fillFundamentalData(float[] values, float[] rawData) { for (int k = 0; k < 82; k++) { values[k] = rawData[k]; } values[82] = rawData[172]; values[83] = rawData[173]; values[84] = rawData[174]; // values[85] = values[40] / values[41]; // pet/pef assumed lower is better: // under 1 especi...
563f22e1-c48c-49fb-b538-ef31850fac84
8
static String getQuadrantXY(String v, String h) { int hor = Integer.valueOf(h); int vert = 1; if (v.equals("b")) { vert = 2; }else if (v.equals("c")) { vert = 3; }else if (v.equals("d")) { vert = 4; }else if (v.equals("e")) { vert = 5; }else if (v.equals("f")) { vert = 6; }else if (v.e...
6cabc68c-9c44-4a69-a3f8-72e511f4563e
6
public Player checkDiagsWin(){ if (field.getCell(0,0).getPlayer()!= null && field.getCell(0,0).getPlayer() == field.getCell(1,1).getPlayer() && field.getCell(0,0).getPlayer() == field.getCell(2,2).getPlayer()) { return field.getCell(0,0).getPlayer(); }else if...
18a54d7c-6ee5-4a04-ad0e-c8c8950fdb7d
3
@Override public void close () throws IOException { if ( isClosed() ) { return; } super.close(); this.impl.close(); if ( this.boundEndpoint != null ) { NativeUnixSocket.unlink(this.boundEndpoint.getSocketFile()); } try { Ru...
a101ac3d-d9c8-4dc1-b0c5-b21eed6ea3a1
7
@Override public void onPlayerJoin(PlayerJoinEvent event) { String player = event.getPlayer().getName(); // Alert player of any new sale alerts if (plugin.showSalesOnJoin == true){ List<SaleAlert> saleAlerts = plugin.dataQueries.getNewSaleAlertsForSeller(player); for (SaleAlert saleAlert : saleAlerts) { ...
907ec6c2-f246-491a-a313-ed99c877ea6a
0
@Override public void run() { //Set console cheat. }
dc3cad8b-af80-44dd-b7ac-c79c71b614f0
2
public synchronized void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if (keyCode >= 0 && keyCode < KEY_COUNT) { currentKeys[keyCode] = true; } }
269bee88-62b0-4d7d-85a1-73b365dd38b1
8
private void addNewSymbols() { addSymbol(new Operator("+", 20, true) { @Override public String execute(final Integer a, final Integer b) { return String.valueOf(a + b); } @Override public String execute(Integer a) { // TODO Auto-generated method stub return null; } }); addSymbol(ne...
95911b25-81b4-4e42-b78a-cd0e6fa8708c
9
public final ChannelBuffer getArchivePacketData(int indexId, int archiveId, boolean priority) { byte[] archive = indexId == 255 ? Cache.STORE.getIndex255() .getArchiveData(archiveId) : Cache.STORE.getIndexes()[indexId] .getMainFile().getArchiveData(archiveId); if (archive == null || !priority) r...
0dd66645-3e28-4642-b595-8cdd1aa14d7c
8
@Override public void visitBaseType(final char descriptor) { switch (descriptor) { case 'V': declaration.append("void"); break; case 'B': declaration.append("byte"); break; case 'J': declaration.append("long"); b...
af728e6c-4cd3-4658-8065-b84c01ea2bbd
5
public void update() { timeStatic++; if(timeStatic >= 9200) timeStatic = 0; if(timeStatic >= type.getSpawnTime()) { currentParticle++; if(currentParticle >= particles.size()) { currentParticle = 0; } Particle p = particles.get(currentParticle); if(!p.spawned) { p.xx = random.nextInt((x + sp...
a003cd68-72e9-4a25-9bcc-ce96f20da678
9
private void onRead(SocketChannel sc) { try { if (this.ioHandler == null) { logger.error("未绑定ioHandler"); return; } Object msg=null; IoHandler handler = this.ioHandler; IoSession session = socketChannelSessionMap.get(sc); if(this.socketEnum==NioSocketEnum.SERVER){ msg=handler.onRead(sc);...
745e635e-8b6f-45f8-a1c1-79a070e79e20
2
public void close() { parent = null; logQueue = null; if (children.size() != 0) { for (CogLog child : children) child.close(); children.clear(); } }
bf27094e-c07f-4322-99d6-fc6d1ad56371
7
private LocationProfile parseToProfile(Document document, String contextPath) throws CitysearchException { LocationProfile response = null; if (document != null && document.hasRootElement()) { Element locationElem = document.getRootElement().getChild(LOCATION); if (locationElem != null) { response = ne...
3604d9dd-c646-4344-b287-75dbac85d720
2
public static void main(String[] args) { // TODO Auto-generated method stub jpcap.NetworkInterface[] devices = JpcapCaptor.getDeviceList(); for (int i = 0; i < devices.length; i++) { //print out its name and description System.out.println(devices[i]); System.out.println(i+": "+devices[i].name + "...
f43ac34b-54ba-41af-81ab-d4df6ff87ac9
2
private PreparedStatement buildInsertStatement(Connection conn_loc, String tableName, List colDescriptors) throws SQLException { StringBuffer sql = new StringBuffer("INSERT INTO "); (sql.append(tableName)).append(" ("); final Iterator i = colDescriptors.iterator(); while (i.h...
9b3d9b28-254a-4efe-8bbc-fbb1b99e699e
7
@Override public List<FullMemberRecord> getFullMemberList() { final List<FullMemberRecord> members=new Vector<FullMemberRecord>(); final List<MemberRecord> subMembers=filterMemberList(CMLib.database().DBReadClanMembers(clanID()), -1); for(final MemberRecord member : subMembers) { if(member!=null) { ...
196fa778-b59c-4690-9fcd-2f7887481bee
2
private boolean handleSelectionRollover(SelectionRolloverDirection direction) { for (SelectionRolloverListener listener : selectionRolloverListeners) { if(listener.selectionRollingOver(direction)) return true; } return false; }
9b168589-9aaa-45ec-9d3a-5176617be217
4
@Override public void move(Excel start, Excel finish) { if (start.getX() == begin.getX() && start.getY() == begin.getY()) { begin = finish; setColoredExes(); } if (start.getX() == end.getX() && start.getY() == end.getY()) { end = finish; setColoredExes(); } }
d1bd58b2-bdae-4043-91d4-662af56d22bc
7
private static int asInt(Object obj){ if(obj == null){ return 0; }else if(obj instanceof Number){ return ((Number)obj).intValue(); }else if(obj instanceof Character){ return ((Character)obj).charValue(); }else if(obj instanceof Boolean){ return ((Boolean)obj).booleanValue()?1:0; }else if(obj insta...
ebc6caa8-7856-47b8-acad-92a3ecca0cac
7
public void addMessage(InetAddress source, InetAddress destination, String body, long timestamp, boolean private_msg) { PaneTab selectedTab = null; if (destination.equals(this.client.getOwnUser().getIP())) { if (getTab(source) != null || AddIncomingTab(source)) { selectedTab = getTab(source); } } i...
55bf51f2-5ff9-4447-8949-c417644b0304
3
public static String waitAnswer(){ while(true){ try { String input = reader.readLine(); if(input.matches("(^[a-h][1-8]$)|(^[9][9]$)|(^[0][0])$")) return input; else{ Printer.invalidInput(); co...
7c125111-9915-44cc-99ec-aebcf9cd3b53
7
public static void hexToBin(String slovo) { StringBuffer s = new StringBuffer(4 * slovo.length()); String[] table = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001"}; for (int i = 0; i < slovo.length(); i++) { switch (slovo.toLowerCase().charAt(i)) { case ...
8bbe55d8-6c37-4f20-8625-f907f99f4eef
5
public String getContent(String name) { if (name.equals("l_graph")) { return player.graph.getTypeString(); } else if (name.equals("l_program")) { return player.model.program.getString(); } else if (name.equals("l_running")) { String s = player.getSendSpeedStri...
2c2a4557-bbd7-4f65-a966-d3833b5a6cd6
9
@Override public void valueChanged(ListSelectionEvent event) { if (gui.connected & firstloaded & !event.getValueIsAdjusting()) { if (!settingRow) { settingRow = true; if (event.getSource().equals( mainTablePane.getListSelectionModel())) { for (TablePane reference : referenceTable) { try {...
97c928d9-d859-4bad-aec8-4abb6742a36e
1
@Override public int hashCode() { int hash = 3; hash = 11 * hash + (this.name != null ? this.name.hashCode() : 0); return hash; }
3a929c29-43ed-4830-bc7c-6ae7444560c9
4
public void listenSocket() { long deltaTime = System.currentTimeMillis() - lastDataTime; if(!this.socket.isClosed() && deltaTime<TIMEOUT) { int currentBytesAvailable = 0; try { currentBytesAvailable = inputStream.available(); } catch (IOException e) { ...
f8df0117-2222-4f5d-ab98-69c1dab2b375
5
public boolean match(ItemStack item) { if (getId() != null && getId() == item.getTypeId()) { if (dataId == 0 || dataId == item.getDurability()) { return true; } } Material mat = Material.getMaterial(name); return (mat != null && mat.getId() == ite...
bee38a89-ed65-449b-95a1-ab0cda2da93e
6
public static void main(String[] args) throws Exception { String baseFilename = args[0]; int nShards = Integer.parseInt(args[1]); String fileType = (args.length >= 3 ? args[2] : null); /* Create shards */ FastSharder sharder = createSharder(baseFilename, nShards); shard...
a735680c-cec6-451e-b062-d7835b9fac1f
5
public UpdateTimeCheck() { try { in=new BufferedReader(new FileReader(new File(Main.SAVEFILES[0]))); String line; while((line=in.readLine())!=null){ if(line.contains(TIMEMARK)){ // System.out.println(line); regexMatcher=timeregex.matcher(line); if(regexMatcher.find()){ updatetime=rege...
6284b902-0781-449a-8c91-be542f83d931
3
public boolean isValidElementContent() { boolean isValid=true; for(FtanValue value: values) { if(!(value instanceof FtanString) && !(value instanceof FtanElement)) { isValid=false; break; } } return isValid; }
c2e2ea4e-ad2c-471a-a8f7-259ac00bc3f7
5
public String toShortString() { switch (this) { case IssuerSecurityDomain: return "ISD"; case Application: return "App"; case SecurityDomain: return "SeD"; case ExecutableLoadFiles: return "Exe"; case ExecutableLoadFilesAndModules: return "ExM"; } return "???"; }
b6794c4e-9fa5-4e87-8159-3a8eaaca0abd
6
public void emulateStep() { String code = (String) view.getMemoryTable().getValueAt(programCounter, 0); if (code.equals("") && !code.equals("0000")) { getBearing(); code = (String) view.getMemoryTable().getValueAt(programCounter, 0); } if (!code.equalsIgnore...
6ef13454-0b49-4ae2-9cd0-b43d7ea15fd2
3
public void setManPage(String manPage) { ManPage page = ManPage.HELP; if (manPage != null && !manPage.isEmpty()) { try { page = ManPage.valueOf(manPage.toUpperCase()); } catch (IllegalArgumentException e) { page = ManPage.HELP; } ...
ede3fc26-93e6-4675-9ec6-acb09fad5334
2
final void process(Socket clnt) throws IOException { InputStream in = new BufferedInputStream(clnt.getInputStream()); String cmd = readLine(in); logging(clnt.getInetAddress().getHostName(), new Date().toString(), cmd); while (skipLine(in) > 0){ } OutputSt...
86b5f822-6a3d-49cb-a927-f3980addb955
8
private static String getArgs(Class<?> s) { if (s.isArray()) { return "array."; } String t = s.getName().toLowerCase().replace("java.lang.", "").replace("java.util.", ""); switch (t) { case "long": case "int": case "double": ...
b0327dd3-92a7-4e0f-a0fc-25f8c3458d88
9
private void routeReplyReceived(RREP rrep, String senderNodeAddress) { //rrepRoutePrecursorAddress is an local int used to hold the next-hop address from the forward route String rrepRoutePrecursorAddress = ""; //Create route to previous node with unknown seqNum (neighbour) if(routeTableManager.createForwardRo...
57339940-7cfd-47d0-b0e3-56d17dc4d198
4
public ArrayList<Sijainti> viereisetSijainnit() { Sijainti keski = sijainti(); ArrayList<Sijainti> viereiset = new ArrayList<Sijainti>(); for(int y = -1; y <= 1; y++) for(int x = -1; x <= 1; x++) if(x != 0 || y != 0) viereiset.add(new Sijainti(kes...
1bf6b083-c2a9-4a5c-971c-83e5a807742c
4
private void calculateEnabledState(Document doc) { if (doc == null) { this.tree = null; if (this.isVisible()) { attPanel.update(this); } } else if (doc.getTree() != this.tree) { this.tree = doc.getTree(); if (this.isVisible()) { attPanel.update(this); } } }
c861c315-cef7-4d00-acd6-fecc271c1100
4
private void funcionmedicamentosFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_funcionmedicamentosFieldKeyTyped // TODO add your handling code here: if (!Character.isLetter(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar())) ...
b8c601e1-9f40-4e9d-9155-e38ab01aee3f
1
public static <E> ArrayList<E> newArrayList(E... objects){ ArrayList<E> list=new ArrayList<E>(); for (E e : objects) { list.add(e); } return list; }
2731c03d-1c8f-4a2e-bcc8-f1360cbdbddd
9
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((buildingI!=null)&&(!aborted)) { if(messedUp) { if(activity == CraftingActivity.MENDING) messedUpCrafting(mob); else if(activity == CraftingA...
688d2bce-bc08-43a1-89b1-2cc784ce51ed
4
private Node normaliseRightResidualPath() throws MVDException { Node arcTo = arc.to; arc.to.removeIncoming( arc ); if ( rightSubArc != null ) { arcTo.addIncoming( rightSubArc ); arcTo = new Node(); arcTo.addOutgoing( rightSubArc ); } if ( rightSubGraph == null ) { if ( arcTo != graph.end ) ...
14bf2541-0f36-475f-9f12-bf1fd23bf9a2
3
public static URL extractJarFileURL(URL jarUrl) throws MalformedURLException { String urlFile = jarUrl.getFile(); int separatorIndex = urlFile.indexOf(JAR_URL_SEPARATOR); if (separatorIndex != -1) { String jarFile = urlFile.substring(0, separatorIndex); try { return new URL(jarFile); } catch (Malf...