method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3be4b1dd-be0c-4d25-af10-f611fef42cee
0
public Sun(){ setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal()); setColor(ColorRGBA.White.set(1.6f, 1.6f, 1f, 0f)); this.setName("Sun"); }
95381cbc-47f5-4962-8f71-aaa2bcac6fd0
6
public void stop() { for (Player p : players) { if (p != null) { p.disconnect(); } } if (discoveryThread.isAlive()) { discovery.close(); } if (server != null && !server.isClosed()) { try { server.close(); } catch (IOException e) { } } }
e3f186a0-58bc-4cf3-b0d2-ba5e34f83cfa
9
private SocketFace getSocket(byte[] data, int off, int len) throws SocketException { if (mSocket != null) { return mSocket; } if (mClosed) { throw new SocketException("Socket is closed"); } long timeout = mTimeout; long start; ...
d3c44658-3a2d-4c90-a2ef-569b84d300fe
3
public void verify() throws VerifyException { try { doVerify(); } catch (VerifyException ex) { for (Iterator i = bi.getInstructions().iterator(); i.hasNext();) { Instruction instr = (Instruction) i.next(); VerifyInfo info = (VerifyInfo) instr.getTmpInfo(); if (info != null) GlobalOptions.err....
b5ed056c-36d9-43a4-ab6d-6e5aac106ad0
3
public void updateControls() { if(pModel.getProperty(PRP_MODE).equals(CMD_PLAYBACK_MODE)) { massInput.setEnabled(false); radiusInput.setEnabled(false); xCord.setEnabled(false); yCord.setEnabled(false); vx.setEnabled(false); vy....
ca290aeb-cc7f-4fcb-b4ed-f6be50fd4d8a
9
public static HTTPRequest mergeRoomFields(final HTTPRequest httpReq, Pair<String,String> setPairs[], Room R) { final Hashtable<String,String> mergeParams=new XHashtable<String,String>(httpReq.getUrlParametersCopy()); final HTTPRequest mergeReq=new HTTPRequest() { public final Hashtable<String,String> params=m...
bdf47104-7462-4092-b7a2-cf872db788de
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { int quantity = 1; Player target; if (args.length == 0) { sender.sendMessage(ChatColor.RED + "/spawnhead [username] <quantity> <player>"); return true; } if (!args[...
553c33c8-edca-4248-95b2-9de62937981a
2
public void close() throws IOException { if (!this.stack.empty()) { throw new InvalidObjectException("Tags are not all closed. " + "Possibly, " + this.stack.pop() + " is unclosed. "); } if (thisIsWriterOwner) { this.writer.flush(); ...
bb85d54e-a676-4280-800d-6df30385469e
3
@Override public void setAccounting(Accounting accounting) { accounts=accounting==null?null:accounting.getAccounts(); accountTypes=accounting==null?null:accounting.getAccountTypes(); projects=accounting==null?null:accounting.getProjects(); }
dda6b10f-3dd4-4366-9c2e-f2d797a7eaee
1
public StartRenderer() { try { Start3 = ImageIO.read(new File(Main.loc + "/Textures/Game.png")); } catch (Exception e1) { JOptionPane.showMessageDialog(null, new File(Main.loc + "Textures/Game.png").getAbsolutePath(), "UNABLE TO LOAD IMAGES",JOptionPane.ERROR_MESSAGE); } }
403b8445-c2f2-4f2c-9e11-7543f563351b
9
private ArrayList<Sentence> caseOne(String endGoto,int startIndex,HashMap<String,String> cases){ ArrayList<Sentence> ls = new ArrayList<Sentence>(); for (int i = startIndex; i < this.senList.size();) { Sentence s = this.senList.get(i); //if (s.getName().equals("goto") || s.getName().equals("switch_goto")) ...
9ba8b83f-34c3-4100-aa18-8cdc2ba31906
6
private BoundingBox calculateBoundingBox(Cluster center, Direction direction) { if (Direction.CENTER == direction) { return center.getBoundingBox(); } BoundingBox oldBoundingBox = center.getBoundingBox(); double oldWidth = oldBoundingBox.getWidth(); double oldHeight = oldBoundingBox.getHeight(); GeoPo...
2bec2f59-6a0b-45c7-ae97-254f60786f5f
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; }
b6c37996-e45a-44b3-b2b6-2866342e24af
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Vertex)) return false; Vertex other = (Vertex) obj; if (key == null) { if (other.key != null) return false; } else if (!key.equals(other.key)) return false; r...
59de1203-d678-4554-842a-6c10173f2ba3
6
private GameState gunnerDay(GameState state, Card card, boolean output) { Color faction = card.getFaction(); String log = ""; //First, we pay the gunner log = log + Faction.getPirateName(faction) + " paid "; int payment = 0; if(state.getPlayer(faction).getGold() > 3) { payment = 3; } ...
8c79cc53-7587-4c23-ae2a-843783bf6578
2
@Test public void test() { Question1 it = new Question1(); for (int b = 0; b < 10; b++) { Question1NumGenerator g = new Question1NumGenerator(1, b); for (int i = 1; i < 10000; i++) { int aa = g.next(); int bb = it.largestLable(i, b); ...
86d72fe5-dc8b-4181-99f3-687147b38b1c
0
public Card(String cardRank, String cardSuit, int cardPointValue) { rank = cardRank; suit = cardSuit; pointValue = cardPointValue; }
b22ef032-aa66-4d1f-8e87-c36521c24981
8
private int addNeighbours(Point target, List<Point> list){ int count = 0; if (target.y - 2 >= 0) if (this.maze[target.x][target.y - 2] == true) {list.add(new Point(target.x, target.y - 1));count++;} if (target.y + 2 <= this.length - 2) if (this.maze[target.x][target.y + 2] == ...
27509fa0-4f65-44e7-9234-89eb624cf027
3
public LogisticClassifier() { // option value for gradient descent gd_iteration = 20; if (CommandLineUtilities.hasArg("gd_iterations")) gd_iteration = CommandLineUtilities.getOptionValueAsInt("gd_iterations"); gd_eta = .01; if (CommandLineUtilities.hasArg("gd_eta")) gd_eta = CommandLineUtilities.g...
21f2369d-2f3d-42b7-a54e-d2c878d665a0
3
public List<Effect> getEffectsOnPosition(Position position) { if (!validPosition(position)) throw new IllegalArgumentException("The given position isn't valid!"); List<Effect> posElements = new ArrayList<Effect>(); for (Effect effect : effects) { if (effect.getPosition().equals(position)) posElement...
90c4782c-8dcd-4575-a95b-4a1187e95a03
2
public static MobilityEnumeration fromValue(String v) { for (MobilityEnumeration c: MobilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
0eeb091f-e571-42e4-9d0f-1d319287aae3
4
@Test public void popsByHeapRules() { for (int i = 1; i < 16; i++) heap.insert(i); heap.pop(); int[] ar = new int[heap.size()]; for (int i = 0; i < heap.size(); i++) ar[i] = i + 1; ar[0] = 2; ar[1] = 4; ar[3] = 8; ar[7] = 15...
b068159c-4397-4a7a-a909-36d6aba1d1fa
2
public Boolean isStaff( Player p ) { if ( isAdmin( p ) || p.hasPermission( "iNations.staff" ) ) return true; return false; }
101d0e2f-a049-4845-8000-4650187d8fda
6
public int lengthOfLastWord(String s) { int i =0; if(s==null || s.length() == 0) return 0; while(s.charAt(s.length()-1) == ' '){ if(s.length()-1 <= 0) break; s = s.substring(0, s.length()-1); } while(i<s.length()){ i...
90325d52-466a-4a69-b241-58cdba848aab
8
public String[] compileAssembler(String text) { opcodeTable.clear(); addOpcode(); String[] lines = text.split("\\r?\\n"); String[] maschin = new String[lines.length]; for (int i = 0; i < lines.length; i++) { String line = lines[i]; String[] args = line.split(" "); if (args.length == 0) continue; i...
402c2a7d-3ed3-47cd-8e05-9b79757dc790
9
public static void loadModelTowers(){ File file = new File("resources/saves/towersSave.txt"); GameData.modelTowers = new ArrayList<Tower>(); try{ Scanner loadScanner = new Scanner(file); while(loadScanner.hasNext() && GameData.modelTowers.size() < 7){ Tower tower = new Tower(); String barrel...
65062272-2173-471b-90bf-48b8b82f5841
2
public void push(QWidget widget) { if (layout.currentWidget() == null || layout.currentWidget().getClass() != widget.getClass()) { layout.addWidget(widget); layout.setCurrentIndex(layout.count()-1); } }
2846e583-b6d6-496d-91a6-18232b60ae70
3
public void onBlockRemoval(World var1, int var2, int var3, int var4) { byte var5 = 2; for(int var6 = var2 - var5; var6 <= var2 + var5; ++var6) { for(int var7 = var3 - var5; var7 <= var3 + var5; ++var7) { for(int var8 = var4 - var5; var8 <= var4 + var5; ++var8) { var1.not...
41318cf7-58f1-4a07-bd1a-f5ec56f29e75
2
public void setGravity(boolean gravity) { GRAVITY = gravity; if(gravity) { if(gravityThread == null) { Runnable gravityJob = new GravityJob(this); gravityThread = new Thread(gravityJob); gravityThread.start(); } } else { gravityThread = null; } }
b46096ca-7bbf-45ab-a157-d9cc194a73dd
6
public void act() { if(isAtEdge() && checkLoadingState()){ //MiniGame2 w = (MiniGame2) getWorld(); //w.removeFromList(index); getWorld().removeObject(this); return; } if(atTruckStop()) { return; } ...
b3a9a8f4-b9fd-4af1-9377-d9baf3818610
4
Arc[] split( int offset ) throws MVDException { Arc[] arcs=null; // handle simple cases first if ( offset == 0 || offset == dataLen()) { arcs = new Arc[1]; arcs[0] = this; } else if ( parent == null ) { if ( children == null ) arcs = splitDataArc( offset ); else arcs = splitParent( of...
42c277a1-915c-4712-8ada-99c1d0b4d9ec
9
public void clickUpdate(Point p) { //bit messy but C'est la vie. if (p.y >= (pickY-20) && p.y <= (pickY+20) ) { //kinda near the axis? if (Math.abs(pick1 - p.x) < Math.abs(pick2 - p.x)) { //move picker 1, it's closer if (21 > p.x) { pick1 = 21; } else if ((20+256) < p.x) { pick1 = (20+256); ...
ca09a3cf-c884-4d72-90ba-4228fba34c1a
4
private ArrayList<MapTile> CalculateTowerRange(int x, int y, int radius) { ArrayList<MapTile> area = new ArrayList<>(); Comparator<MapTile> compareDistance = new TileRangeComparator(x + 0.5, y + 0.5); for (int i = Math.max(x - radius, 0); i < Math.min(x + radius + 2, map.getPixels().length); i++...
c57653b1-3a47-41c2-b71b-1cd6582c2868
9
public String getDirectionTowards(Location otherLoc) { int xDist = x - otherLoc.getX(); int yDist = y - otherLoc.getY(); if(xDist > 0) { if(yDist > 0) { return SOUTH + WEST; } else if(yDist < 0) { return NORTH + WEST; } else { return WEST; } } else if(xDist < 0) { if(yDist > 0) { ...
04667170-e4b9-4f9f-b491-afe464c07977
2
public Map<String, Double> splitWord(String line) throws IOException{ Map<String, Double> fileMap = new HashMap<String, Double>(); Analyzer analyzer = new IKAnalyzer(true); StringReader reader = new StringReader(line); TokenStream ts = analyzer.tokenStream("", reader); CharTermAttribute term = ts.getAttribute...
d5e498f2-5131-4446-b734-dbcafc52aa17
6
public static Tile GRASS() { if (random.nextInt(100) == 0) { return GRASS_FLOWER; } else if (random.nextInt(100) == 0) { return GRASS_POPPY; } else if (random.nextInt(6) == 0) { return GRASS2; } else if (random.nextInt(6) == 0) { return GRASS3; } else if (random.nextInt(6) == 0) { return GRASS...
ce47c4c4-c5d8-4e8c-ac39-f0acc813b4cc
2
public void simpleCornerElimination() { int size = _smooth_path.size(); Path new_path = new Path(); new_path.add(_smooth_path.start()); for (int i = 1; i < size - 1; i++) { Point p1 = _smooth_path.get(i - 1); Point p2 = _smooth_path.get(i + 1); //System.out.println("DIST from " + p1 + " to " + p2 + " =...
d11d8b80-8c98-4209-8b2c-e436d0894b93
7
public static void Abstractor(){ while(myList.size() > 37){ double minSigValue = Double.MAX_VALUE; PointStorage minSigPoint = null; int index; ListIterator iterator = myList.listIterator(); // Saves the points of the ...
fa4b19c6-b4b0-4213-a4bd-2c85aa2d0227
6
final int[][] getTriangleGroups() { anInt1854++; int[] groupCount = new int[256]; int maximumGroup = 0; for (int triangle = 0; ((Model) this).polygons.length > triangle; triangle++) { int group = (((ModelPolygon) ((Model) this).polygons[triangle]).tGroup); if (group >= 0) { groupCount[group]++; if (ma...
709d918e-58cf-430f-bb52-680554efae24
5
@Override public int hashCode() { int tId; if (userId == 0) { tId = 33; } else { tId = userId; } int tFirst; if (firstName == null) { tFirst = 41; } else { tFirst = firstName.length(); ...
7e109cf6-4357-4a11-849d-6a74b24bfbb2
8
protected void addCommandJournalsVar(final HTTPRequest httpReq, final String index, final StringBuilder str) { final String name=httpReq.getUrlParameter("COMMANDJOURNAL_"+index+"_NAME"); final String mask=httpReq.getUrlParameter("COMMANDJOURNAL_"+index+"_MASK"); if((name!=null)&&(name.trim().length()>0) &&(!na...
934e7003-67e8-4a17-8c2c-95662ce191c6
6
public XMLOrderImporter(File XMLFile){ MesController myController = new MesController(); ProductDAO proDAO = new ProductDAO(); OrderDAO ordDAO = new OrderDAO(); Order myOrder = new Order(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = null; try { ...
11fd9ccc-1120-49e7-a6fb-00054d016719
0
public void preInit(FMLPreInitializationEvent event) { }
4d92cc7c-d095-4d0c-873f-e8b195796a01
1
@Override public void hoistDepthChanged(OutlinerDocumentEvent e) { if (e.getOutlinerDocument() == Outliner.documents.getMostRecentDocumentTouched()) { calculateEnabledState(e.getOutlinerDocument()); } }
ec265685-38ae-42f1-85ac-39d2b88d8bd5
3
public boolean isVariableLocked(int index) { for (Transaction t: locks.keySet()) { ArrayList<Lock> lockListT = locks.get(t); for (Lock lock: lockListT) { if(lock.getIndex()==index) { return true; } } } return false; }
f7081cc8-ff65-4551-92e3-899f502708a7
5
public void keepItem3() { for(int i = 0; i < playerItems.length; i++) { int highest = 0; int value = (int)Math.floor(GetItemShopValue(playerItems[i]-1, 0, i)); if(value > highest && playerItems[i]-1 != keepItem && playerItems[i]-1 != keepItem2 && playerItems[i]-1 != -1) { highest = value; keepItem3 =...
bbf6076b-d6a3-46b3-a766-e9dbd63e2297
7
public static void runMainMenu() { // Track the menu start time so that buttons aren't clicked accidentally menuStartTime = Sys.getTime(); try { // While the program isn't told to leave the main menu while (!exit && !goToCouchMenu && !goToInstructions && !goToAbout) { // If the display is not visible (...
9e91fa98-f3bb-4678-a4cb-6cb3e5bd9fcb
0
@Test public void testDraw() { // first its assumed to be default: assertNotNull(_underTest.draw()); // set the draw-output, test changed draw-functionality: _underTest.setDrawOutput(Output.Paper); assertEquals(Output.Paper, _underTest.draw()); _underTest.setDra...
d2117975-a79a-4ade-8db0-92665c7993cf
9
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((address == null) ? 0 : address.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((facebook == null) ? 0 : facebook.hashCode()); result = prime * ...
185e02d2-c1fd-4770-9fbe-5baa74f12164
6
@Override public String getColumnName(int columnIndex) { switch (columnIndex) { case 0: return "Game ID"; case 1: return "Map size"; case 2: return "Turn time"; case 3: return "Extra turn"; case 4: return "Pl...
acf16b2a-3061-4b80-9514-515d3b2cf1ee
5
public static boolean isSubstring(String a, String b) { if(a == null || b == null || a == "" || b == "") return false; String temp = a + a; if(temp.contains(b)) return true; return false; }
f656d588-51c6-4457-bfc8-28fc21ba6806
3
private void showMainMenu() { System.out.println("\n---------------------------------------"); System.out.println("Please select an option :"); System.out.println("1. Library contents overview."); System.out.println("2. Add a new item."); System.out.println("3. Stop the applicati...
3dc27ca2-0809-4b64-976d-fa93ccf968b9
7
boolean valid(Graph G) { return G.getEdgeWeight(1, 0) == 1&& G.getEdgeWeight(1, 2) == 3 && G.getEdgeWeight(2,4) == 1 && G.getEdgeWeight(3, 4)== 2 && G.getEdgeWeight(3, 6) == 3 && G.getEdgeWeight(7, 6) == 2 && G.getEdgeWeight(7, 8) == 4 && G.getEdgeWeight(4, 5) == 3; }
6ff59ada-cf3f-440a-9d9a-f69e79b603ab
0
public String getColor() { return myColor; }
d83846bb-cf2f-4d1f-b120-616cf7646a07
9
public void broadcastMessage() { Player[] players = Bukkit.getOnlinePlayers(); Random rand = new Random(); ConfigurationSection conf = getConfig().getConfigurationSection( "messages" ); Map<String, Object> msgs = conf.getValues( true ); String broadcast = ""; if ( msgs.size() > 0 ) { int choi...
afd30557-4d74-413a-9345-dee3a55fc208
5
@Override public void putAll(Map<? extends K, ? extends V> m) { for(Map.Entry<? extends K, ? extends V> me : m.entrySet()) { this.put(me.getKey(), me.getValue()); } }
966b3e95-9666-4058-8bc3-36bfb603cb9d
5
@Override public Void doInBackground() { String response; try { HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); urlConn.setDoOutput(true); urlConn.setDoInput(true); try { ...
a47d5ca5-ea33-4b9a-9b41-c6522f570983
4
private List<Integer> findSharedUsers(int movie1, int movie2) { List<Integer> sharedUsers = new ArrayList<Integer>(); HashSet<Integer> movie1Raters = usersByMovie.get(movie1); HashSet<Integer> movie2Raters = usersByMovie.get(movie2); // Return empty list if one user didn't rate any movies if (movie1Raters ==...
67066529-6beb-4d7e-b00d-210331f9d244
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 lo...
bdf3d3ec-6186-44c7-b5f0-3b755c651c46
4
public void saveConfig() { FileConfiguration c = this.gm.getConfig(); String orderString = ""; Level lvl = this.level; while (lvl != null) { orderString = orderString + lvl.Name; c.set(this.arenaName + ".level." + lvl.Name + ".neededPoints", Integer.valueOf(lvl.neededPoints)); c.se...
cd7b7f48-d1b2-4c61-84ad-08090bf71707
7
private int resolveUnit(String unit) { if(unit.equalsIgnoreCase("second")) { return TimeAxisUnit.SECOND; } else if(unit.equalsIgnoreCase("minute")) { return TimeAxisUnit.MINUTE; } else if(unit.equalsIgnoreCase("hour")) { return TimeAxisUnit.HOUR; } else if(unit.equalsIgnoreCase("day")) { retur...
dc7886b4-da65-4ed9-bf6f-50872c29c61a
2
public boolean equals(Object other) { if (!(other instanceof Resource) || (other == null)) return (false); return (compareTo((Resource) other) == 0); }
2e5d07f9-843d-4c52-969a-e104a5059b36
6
public void softDrop() { Boolean ableToMove = true; for (Block b : currentTetromino.getBlocks()) { if ((b.getMapIndexY() == boardSizeY) || (tetrisMap[b.getMapIndexX()][b.getMapIndexY() + 1] == 1)) { ableToMove = false; } } if (ableToMove) { for (Block b : currentTetromino.getBlocks()) { ...
467ef994-6e8b-4ba0-8d54-55341421f6ec
9
@Override int afterName() throws IOException { int n = in.next(); switch (n) { case ' ': case '\t': case '\r': case '\n': in.back(); String ws = parseWhitespace(in); if (!isIgnoreWhitespace()) { set(JSONEventType.WHITESPACE, ws, false); } return AFTER_NAME; case '/': in.back(); S...
a5db1564-87a7-4c45-875a-94deff9265ec
3
@SuppressWarnings("unchecked") public void addResource(Object arg) { if (arg == null) { throw new ComponentException("No resource string provided."); } if (arg.getClass() == String.class) { l.add((String) arg); } else if (arg instanceof Collection) { ...
fe9b8957-ac2b-4508-92d3-2e73ab63105c
9
public ArrayList<Integer> spiralOrder(int[][] matrix) { // Start typing your Java solution below // DO NOT write main() function ArrayList<Integer> res = new ArrayList<Integer>(); int m = matrix.length; if (m < 1) return res; int n = matrix[0].length; if (n < 1) return res; int round = Math.min((m...
0abe8e5c-6179-44fc-8e9d-d0e5cdfd0de4
0
@Override public String getEmail() { return super.getEmail(); }
466f3401-77d4-43d5-9d9a-189f1b051cfe
5
public HashMap<Team, List<Player>> getPlayers(){ HashMap<Team, List<Player>> players = new HashMap<Team, List<Player>>(); players.put(Team.RED, new ArrayList<Player>()); players.put(Team.BLUE, new ArrayList<Player>()); for(Player p : Bukkit.getOnlinePlayers()){ if(p.getLocation().distance(point) <= radius...
15b26a8b-c078-446e-b5b9-fff5bb591375
7
public void simulatePeer() { Random random = new Random(); int selectedFileId = random.nextInt(Main.MAX_NO_OF_FILES) + 1; int selectedActionIndex = random.nextInt(Main.MAX_NO_OF_ACTIONS); PeerAction selectedPeerAction = PeerAction.values()[selectedActionIndex]; String selectedAc...
6ab61250-16dc-4c3e-9206-81686ed977ab
6
private boolean DL(String palabra){ switch(palabra){ case "(": return true; case ")": return true; case "[": return true; case "]": return true; case "{": return true; ...
4dc5ee29-d44f-4b61-bd73-cfd0f13153d2
0
void flip() { Vertex temporary = this.start; this.start = end; this.end = temporary; }
a0b8f5cc-9282-4699-b556-33b0495c3798
1
private boolean jj_2_49(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_49(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(48, xla); } }
af0dbc24-2298-4da7-a0ee-569841510a1c
2
@Override public void mouseReleased(MouseEvent e) { // Make sure zoom area isn't a ridiculously small size if (zoomArea != null) { // Make sure zoom area isn't a ridiculously small size Dimension size = zoomArea.getSize(); ...
ea785dc3-e83f-4e76-8238-43401933ef41
0
public String getStepThrough() { return stepThrough; }
e7c4d387-bcc0-402c-bbb4-0385cb4168a9
7
@Override public boolean isInWilderness(Physical P) { if(P instanceof MOB) return isInWilderness(((MOB)P).location()); else if(P instanceof Item) return isInWilderness(((Item)P).owner()); else if(P instanceof Room) { return (((Room)P).domainType()!=Room.DOMAIN_OUTDOORS_CITY) &&(((Room)P).dom...
865b7e4f-cee5-4ce8-923e-670c355e8322
8
public boolean displayModesMatch(DisplayMode m1, DisplayMode m2) { //resolution, bitdepth, refreshrate if (m1.getWidth() != m2.getWidth() || m1.getHeight() != m2.getHeight()){ return false; } if (m1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && m2.getBitDepth() != DisplayM...
0727f317-e0ca-4017-8404-b366e28b78c5
3
private Collection<? extends Long> notIn(FiniteSequence<Long> factors, List<Long> result) { List<Long> copy = new LinkedList<Long>(result); List<Long> toAdd = new LinkedList<Long>(); while (factors.hasNext()) { Long x = factors.next(); if (!copy.remove(x)) { ...
38acba9f-ce6a-42dc-965f-371c52a2b388
0
public void setDescription(String description) { this.description = description; }
c90170ef-337d-4b6a-af05-30d1cb3cceda
8
public int getCostByDemand(int demand) { int result = CostFunction.MAX_COST; if(costByDemandMap.containsKey(demand)){ result = costByDemandMap.get(demand); } else { int[] demands = getDemands(); int i = 0; while(i < demands.length){ if(demands[i] < 0 && demands[i] > demand){ result = costByDe...
28093d26-b7dc-4d05-bd77-3ff06747ea5b
5
public String flagsToString() { String s = "["; s += (isSyn()) ? "SYN " : " "; s += (isPsh()) ? "PSH " : " "; s += (isFin()) ? "FIN " : " "; s += (isRst()) ? "RST " : " "; s += (isAck()) ? "ACK " : " "; return s.trim() + "]"; }
3d71bc77-5812-4c2e-bb3a-efa1a76752e6
4
private void checkBoardDimension(int row, int col) { rowBoard=row; colBoard=col; if (row>10)rowBoard=10; if (row<6)rowBoard=6; if (col>10)colBoard=10; if (col<4)colBoard=4; }
0f18c77d-ec59-483b-9689-174f8c1f9fb8
5
private boolean skipTo(String toFind) throws IOException { outer: for (; pos + toFind.length() <= limit || fillBuffer(toFind.length()); pos++) { if (buffer[pos] == '\n') { lineNumber++; lineStart = pos + 1; continue; } for (int c = 0; c < toFind.length(); c++) { ...
d6b3fbee-f5de-4d6b-8502-e059084b94ff
6
public static void drawFilledAlphaPixels(int x, int y, int w, int h, int color, int alpha) { if (x < startX) { w -= startX - x; x = startX; } if (y < startY) { h -= startY - y; y = startY; } if (x + w > endX) { w = endX - x; } if (y + h > endY) { h = endY - y; } int alphaValue = 256 ...
f0c2a438-ef10-44c1-aaa3-c591734d055f
2
@Test public void testClientQueueCounts() throws LuaScriptException { String jid1 = addJob(); String jid2 = addJob(); String jid3 = addJob(UUID.randomUUID().toString(), "another-queue"); // Pop job to simulate worker popJob(); List<Map<String, Object>> queueDetails = _clientQueues.counts(); for (Map<S...
98848df7-793f-45c3-8362-47d1c00d22fe
8
protected void initVerifiers(int currVerSet) { int currVerifierSet ; if (currVerSet >=0 && currVerSet < NO_OF_LANGUAGES ) { currVerifierSet = currVerSet ; } else { currVerifierSet = nsPSMDetector.ALL ; } mVerifier = null ; mStatisticsData = null ; if ( currVerifierSet == nsPSMDetector.TRADITI...
3f0e0567-444a-42d9-81a8-3245064be640
0
public void lanchFrame(){ initial(); this.setLocation(400,300); this.setSize(GAME_WIDTH,GAME_HEIGHT); this.setBackground(Color.GREEN); this.setTitle("TankWar"); this.addWindowListener(new WindowAdapter(){ @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); this.s...
1431005b-e395-4044-a756-75ba18abe235
8
private Monitor() { JFrame guiFrame = new JFrame(); //make sure the program exits when the frame closes guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.setTitle("ThermRonStat GUI"); guiFrame.setSize(300, 250); //This will center the JFrame in the midd...
f457d374-ffd7-48e3-a4b9-a7dcaf085133
6
public void testSearchForColony() { Game game = getStandardGame(); Map map = getCoastTestMap(plainsType, true); game.setMap(map); Player dutchPlayer = game.getPlayer("model.nation.dutch"); Player frenchPlayer = game.getPlayer("model.nation.french"); Tile unitTile = map.g...
35fcd2e1-fdc1-41bc-bb34-330da8ca0fd6
9
private static void addToMap(File file, HashMap<String, HashMap<String, Integer>> countMap, String level) throws Exception { String name = file.getName().replace("standardReport_for_Sample_", "").replace(".txt", "") .replace("_to16S", "").replace("standardReport_for_", ""); String[] splits = name.split(...
211bb62a-c006-470e-a6bf-34e1dd0bd094
3
@Override public void parse() throws IllegalArgumentException { try { setEncoding(Encoding.getEncoding(buffer[0])); } catch (IllegalArgumentException ex) { // ignore the bad value and set it to ISO-8859-1 so we can continue parsing the tag setEncoding(Encoding.ISO_...
80b5168f-1efb-4e35-b4c5-8c7dfb0b94f5
0
@Override public String toString() { return "This is OverrideTest !"; }
76a9f285-1103-4994-a17c-8d4457c5cb0e
2
public EntradaBean get(EntradaBean oEntradaBean) throws Exception { try { oMysql.conexion(enumTipoConexion); HiloBean oHiloBean = new HiloBean(); UsuarioBean oUsuarioBean = new UsuarioBean(); oEntradaBean.setTitulo(oMysql.getOne("entrada", "titulo", oEntradaBean...
bdcc8270-7293-4374-82de-6b3276f19bc1
9
private ZuseBinaryFloatingPoint24Bit divisor(ZuseBinaryFloatingPoint24Bit A, ZuseBinaryFloatingPoint24Bit B, boolean[] s) { boolean[] Af = A.getExp().getCopiedBoolArr(); boolean[] Ag = B.getExp().getCopiedBoolArr(); boolean[] Bf = A.getMan().getCopiedBoolArr(); boolean[] Bg = B.getMan().getCopiedBoolArr(); ...
2a38db75-ca29-4107-a49c-58ab26b60454
7
@Override public void changedUpdate(DocumentEvent arg0) { try{ if(Integer.parseInt(textRow.getText()) < 1){ JOptionPane.showMessageDialog(this, "Rows need to be higher than 0!"); textRow.setText("10"); } }catch(NumberFormatException e){ JOptionPane.showMessageDialog(this, "All Fields need to...
1b604042-afe2-47e3-be46-bd9e703e44a8
6
@Override public Class<?> getColumnClass(int columnIndex){ Class type = String.class; switch (columnIndex){ case 0: type = Integer.class; break; case 1: type = String.class; break; case 2: type = String.class; break; case 3: type = String.class; break; case 4: typ...
289e96cf-3158-479e-aae8-06b7d298b22e
8
public boolean movimientoCorrecto(Movimiento m, int color) { boolean correcto = true; if (tablero[m.fila][m.columna] != 0) correcto = false; else { return (direccionCorrecta(m.fila, m.columna, -1,-1,color) || direccionCorrecta(m.fila, m.columna, -1,0,...
8327f1fe-9ba9-4995-87a5-20137794e1f1
3
public static int createTexture(String name, BufferedImage image) { if (!ProjUtils.isPowerOf2(image.getWidth()) || !ProjUtils.isPowerOf2(image.getHeight())) { System.out.println(name + " texture must have dimension values of a power of 2"); System.exit(1); } int[] pixels ...
cfc5b995-d60a-4782-ab12-fef7df393737
7
public String able(int a, int b, int c, int d) { LinkedList<Integer> queue = new LinkedList<Integer>(); int s = a * 10000 + b; queue.add(s); while (!queue.isEmpty()) { int ss = queue.removeFirst(); int aa = ss / 10000; int bb = ss % 10000; ...
684f4468-d2c6-44b0-b9a5-72030e0c4265
5
@SuppressWarnings("unchecked") public void setPackages(List<Package> packages) { String serverAddress = "localhost"; Element packagesElement = root.getChild("packages"); if (packagesElement == null ) { packagesElement = new Element("packages"); root....
1cfe9035-568a-49a3-b803-ffff9d20ad22
5
public static boolean isNeeded(String entryText) { /* * If 'stack' is zero at the end of the method: * The lastTime point to * the end of "Nituach Dikduki" section. * The open curly bracket equals * to the close curly bracket. */ int stack = 0; NituachDikduki....