method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cb52bcfd-aef0-4c7a-af5f-d2304d33a3e8
2
public static String generateString(SkillData sd, int index) { StringBuilder sb = new StringBuilder(); String name = SKILL_NAMES[index]; sb.append(Misc.capitalize(name) +": "); sb.append(Skills.getRealLevel(index) + "(+" + sd.level(index) + ") "); sb.append("Experience: " + Misc.formatNumber(sd.experience(ind...
bb38d728-1f3e-48d6-8d2a-f0fc3192affc
4
private void calc(TreeNode node, StringBuilder builder) { builder.append(node.val); if(node.left == null && node.right == null) { sum += Integer.valueOf(builder.toString()); return; }else{ if(null != node.left){ calc(node.left, builder); builder.deleteCharAt(builder.len...
f9252690-65fc-4775-a30d-7330ca5894e6
0
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("MovingObject"); sb.append("{position=").append(position); sb.append('}'); return sb.toString(); }
9cd6a6b1-72fc-4765-b932-ea1dd4ea7d21
1
public void mobs(Boolean mode){ if (mode != null){ mobs = mode; }else{ mobs = true; } }
1096eaaa-f488-483d-a302-5da57e52856a
6
public void addAnswers(List<Kanji> kanjis) { switch (Settings.AsResponsePropose) { case MEANING: for(Kanji kanji : kanjis) { MeaningButton b = new MeaningButton(kanji); b.addEventListener(this); panel.add(b); } break; case KANJI: for(Kanji kanji : kanjis) { KanjiButton b = new KanjiBu...
d944513c-4221-4f30-8a76-c26f57fa7534
1
public void testWithFieldAdded_nullField_nonZero() { YearMonth test = new YearMonth(2004, 6); try { test.withFieldAdded(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
3d2d801c-92e2-47df-913b-239c113cf23f
7
public void delete(Integer searchKey) { int i; ArrayList<SkipListsNode> update = new ArrayList<SkipListsNode>(); SkipListsNode x = header; for(i=topLevel; i>-1; i--) { while(x.forwards.get(i).key.compareTo(searchKey) < 0) x = x.forwards.get(i); update.add(0, x); } x = x.forwards.get(0...
c62b83c5-669a-4c4e-b50f-423adee5946e
8
public static boolean decompress(File compressed, File decompressTo) throws IOException { if (compressed.getName().endsWith(".rar")) { throw new UnsupportedOperationException("Cannot extract rar yet, file: " + compressed.getAbsolutePath()); } ProcessBuilder builder = null; if (compressed != null && compresse...
7939a4cc-1d78-4653-84e0-170fe30aadda
4
private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed // TODO add your handling code here: String nombre = StringValidation.validaTexto(tfOrigen.getText()); if (nombre != null) { try { Origen origen = new...
4d4b966d-d72a-4af3-88f9-d625cbbbf0cb
9
private byte[] put(String filename, byte[] file, boolean isFirstRun) { //System.out.println("put entrance"); this.fs.getGs().getMembershipList().setMaster(); //if you are the master you need to shard the file and send a call to the //other servers to save the file this.fs.getGs().getMembershipList().setSucces...
f82bd4e9-05d5-4402-a21e-f30dfd503796
2
private void drawChunk(int x, int z, MapCanvas canvas, Byte palette) { for (int xo = 0; xo < 16; xo++) { for (int zo = 0; zo < 16; zo++) { canvas.setPixel(x + xo, z + zo, palette); } } }
5706b450-b093-456c-87de-71b1936a0e31
1
public Collection domFrontier(final Block block) { if (domEdgeModCount != edgeModCount) { computeDominators(); } return block.domFrontier(); }
57fc2568-5fe9-428c-adaf-96664644d8ad
4
public void encode() { Color[] colorArray = secretToColorArray(); int colorCounter = 0; for (int yScroll = 0; yScroll < currentImg.getHeight(); yScroll += this.heightMod) { for (int xScroll = 0; xScroll < currentImg.getWidth(); xScroll += this.widthMod) { if (colorC...
59dd01c5-895f-413d-b990-b4450ae0693e
8
public void mouseMoved(MouseEvent me) { int inc = ANG_WD / 4; int hity = 0; int y = getHeight() / 4; for (int i = 0; i < 4; i++) { if (me.getY() > (i * y) && me.getY() < (i + 1) * y) { hity = (3 - i) * inc; break; ...
df637bb9-e960-40f7-9721-eb77f3013f1b
8
@Override public void execute(CmdOptions options) { Project project = new Project(options.params[0]); File output; if(options.output != null) { output = new File(options.output); } else { output = new File("."); } if(options.volume == null) { } else { for(Volume v: project.getVolumes()) { ...
2e77a6b6-b911-4081-a676-130d371dad8c
5
public void validate() throws ConfigurationException { // LATER: Do better. Unlocalized strings which show up in the UI. checkSet(mListenPort, "Listen Port"); checkSet(mFcpHost, "FCP Host"); checkSet(mFcpPort, "FCP Port"); checkSet(mFproxyPrefix, "Fproxy Prefix"); //mAllo...
4ffb84a0-c33a-4c33-87b8-96e75c79aac4
3
protected static String classURL(Class<?> clazz) { String singleURL = singleClassURL(clazz); if (singleURL.charAt(singleURL.length() - 1) == 's' || singleURL.charAt(singleURL.length() - 1) == 'h') { return String.format("%ses", singleClassURL(clazz)); } else { return String.format("%ss", singleClassURL(claz...
9b318621-bb5e-46b2-837f-02fa80ead6ee
9
public void visit_dup_x2(final Instruction inst) { // 0 1 2 -> 2 0 1 2 // 0-1 2 -> 2 0-1 2 db(" dup_x2"); if (Tree.USE_STACK) { saveStack(); final StackExpr s2 = (StackExpr) stack.pop1(); final Expr[] s01 = stack.pop2(); if (s01.length == 2) { // 0 1 2 -> 2 0 1 2 final StackExpr[] s...
4a88e2c5-e80b-4284-9e6d-bd49f94b9707
4
public Image getImage(double zoom) { if (image == null) return null; final int zoomedWidth = (int) (getWidth() * zoom); final int zoomedHeight = (int) (getHeight() * zoom); if (scaledImage == null || scaledImage.getWidth(null) != zoomedWidth || scaledImage.g...
d81f82bc-472a-4a36-a8a4-877df48b1ad2
0
public GameUpdater(UpdateFrame frame){ this.frame = frame; }
17dfe249-9c0f-42c8-8037-b9ef96ffa7f6
3
public String getParameter(int i) { if (parameters == null) initParameters(); --i; if (i >= 0 && i < parameters.length) return parameters[i]; else return ""; }
e18fe17a-8483-467c-8701-28a5077224d1
9
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jifConstancia = new javax.swing.JInternalFrame(); jpConstancia_Registro = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); txtComite_Constancia = ne...
81202a2c-f18f-4af6-9e21-6b527e49dca4
8
public static double getSimNaive(ItemNode a, ItemNode b) { double d = 0, m1 = 0, m2 = 0; Iterator<RateNode> it1 = a.getVector().iterator(); Iterator<RateNode> it2 = b.getVector().iterator(); RateNode t1 = null, t2 = null; while(it1.hasNext() && it2.hasNext()) { if (t1 == null) { t1 = it1.next(); t2...
ffd07236-f332-4698-8f9f-0c749746cfa4
2
private static int getSubTypes(int types) { int result = 0; for (int i = 0; i < NUM_TYPES; i++) { if (((1 << i) & types) != 0) result |= subTypes[i]; } return result; }
fa43eabc-db08-401a-b953-7e644342650c
9
private void HandleUnit(Base unit) { unit.Pathing(); if (unit.raider && unit.bld!=-1) {//Finds, moves, and captures a building if the unit can capture it. if (Game.builds.get(unit.bld).owner != unit.owner) { unit.action(unit.x, unit.y); Game.player.get(unit.owner).selectx = unit.x; Game.player.get(un...
45a5dc36-cb43-4eb1-a330-3584344a67c5
6
public void play() { currPlayer = player1; //Game on gameState[0] = 1; while (gameState[0] != 2) { // We make the players take turns until either wins or they draw // Make the current player do a turn System.out.println(currPlayer.getName() + "'s move.."); currPla...
8c900bf2-1f93-4b9a-876d-73265cfb664b
0
private static String generateSessionId() { return EncodeUtil.md5(String.valueOf(idGeneratorHelper++)); }
7bc91254-b8f5-495a-a32f-7167656fa61d
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Movement other = (Movement) obj; if (!(this.box.equals(other.box)&& other.box.equals(this.box))) { ...
6b876b49-13fc-4930-baf1-3bf98df8ead1
7
@Override public void undo() throws CannotUndoException { super.undo(); if (selectedManipulable instanceof Part) { Shape shape = selectedManipulable.getShape(); if (shape instanceof TransformableShape) { TransformableShape s = (TransformableShape) shape; s.rotateBy(-rotationAngle); if (s instance...
d0bfe1ba-5305-4507-8e9b-46020c1870b9
7
@Override public void finish() { ArrayList<EdgeRoom> edge_rooms = new ArrayList<EdgeRoom>(); edge_rooms.add(new EdgeRoom(RoomSide.EAST, eastmost_room)); edge_rooms.add(new EdgeRoom(RoomSide.NORTH, northmost_room)); edge_rooms.add(new EdgeRoom(RoomSide.WEST, westmost_room)); edge_rooms.add(new Edge...
425bb62b-dd43-4513-9bdd-767502403d4d
9
public static void main(String[] args) { Scanner invoer = new Scanner(System.in); boolean opnieuw = false; String antwoord; do { System.out.print("Geef een natuurlijk getal: "); if(invoer.hasNextInt()) { int lucasGetal = invoer.nextInt(); lucasReeks(lucasGetal); System.out.print("\nNogmaals...
8746e38f-1930-42a9-9893-a772a0f0980c
2
public static void main(String[] args){ int i =21; while(true){ if(hasRemainder(i)){ i++; continue; }else{ System.out.println(i); break; } } }
2dc54e70-b8f6-4dd5-8c8f-b6e9383ef4b3
7
synchronized void removeTimeouts() { long sysdate = System.currentTimeMillis(); List<String> toBeRemoved = new LinkedList<String>(); for (String sessionKey : formAuthener.allowed.keySet()) { Long lastAccess = formAuthener.allowed.get(sessionKey); if (lastAccess == null || sysdate > lastAccess + formAut...
dfa19bb1-1dc2-4c4a-bd84-abd50fe982dc
7
public String addHelp(String n1, String n2) { if(n1.length() == 0 && n2.length() == 0) { return new String(new CharNode('0')); } if(n1.length() == 1) { int one = n1.charAt(0) - 48; int two = n2.charAt(0) - 48; String toReturn = new String(new CharNode((char)((one + two)%10 + 48))); toReturn.insert(...
ae6d3ac6-a2d0-4731-a312-3c572c630713
0
public Transition[] getSelectedTransitions() { return (Transition[]) selectedTransitions.toArray(new Transition[0]); }
6d88759e-77d3-4f97-b646-34cb9c21d99a
0
public String getName() { return name; }
2cb87949-a3f6-4d18-9d17-afbc289d8699
0
private ArrowButtonPanel() { super(); ActionListener buttonListener = new ButtonMoveListener(); this.setLayout(new GridLayout(3, 3)); // grid layout this.setPreferredSize(new Dimension(75, 50)); // set size /* Create the arrow buttons */ up = new BasicArrowButton(SwingConstants.NORTH); down = ...
0432e434-d734-4095-a516-17eda71ec32b
4
public static void printOutOffres() { System.out.println("================================ONF.java"); for (String region : m_tblEmplois.keySet()) { System.out.println("Key : " + region + " Size : " + m_tblEmplois.get(region).size()); for(E...
94fb111e-d88f-40d4-a2fb-df905d4bb827
7
public String toStringFile() throws UnInitializatedException { if (this.generators == null || this.loads == null) { if (debug >= 3) { String dmethod = Thread.currentThread().getStackTrace()[2].getMethodName(); String dclass = Thread.currentThread().getStackTrace()[2]....
af4f9f35-ab1b-4cf4-ab30-ff57f6ba1132
4
@Override protected void onTextMessage(CharBuffer charBuffer) throws IOException { String message = charBuffer.toString(); if ("west".equals(message)) { snake.setDirection(Direction.WEST); } else if ("north".equals(message)) { snake.setDirectio...
ffc691d5-814f-4f65-a844-8c88a2e73ede
8
public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof Type)) { return false; } Type t = (Type) o; if (sort != t.sort) { return false; } if (sort == OBJECT || sort == ARRAY) { ...
161d5f8d-ed35-4251-a26e-f87f924e01ac
8
@EventHandler public void punchWool(PlayerInteractEvent event) { CTFTeam team = null; TeamPlayer player = null; for (CTFTeam t: Teams){ for (TeamPlayer p: t.getTeamPlayers()){ if (p.getPlayer().equals(event.getPlayer())){ player = p; team = t; } } } if (player == null){ ...
686887b3-f472-4f9a-8ec8-ef17fb396c94
7
@Override protected void receiveBroadcast(String data, InetAddress address) { // See if the packet holds the right message if (sr.getServerComm() != null && data.startsWith(DISCOVERY_QUESTION)) { broadcastServerInfo(); } else if (sr.getServerComm() == null && ...
8d8eadfa-6aea-4d31-a376-422d0ced3428
1
private boolean validateChosenMove(int index, int player) { if (indexIsOutOfBounds(index)) return false; ArrayList<Integer> validMoves = this.getValidMoves(player); return validMoves.contains(index); }
985c6653-7341-41c7-8873-1d572a94f2a6
9
public void go() { FileWriter fw = null; try { File dir = new File(dirname); fw = new FileWriter(output); BufferedWriter bw = new BufferedWriter(fw); File[] fa = dir.listFiles(new EndsWithFilter(extension)); for (File f : fa) { String name = f.getName(); int start = name.indexOf(separato...
729d1694-192f-4fa8-8b4a-2654031a5432
8
private void btOrdenarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOrdenarActionPerformed btOrdenar.disable(); try { String modo = "Dados de origem ordenado"; String arq; arq = System.getProperty("user.dir")+"\\arquivos\\saidaOrdenada.txt"; ...
609838f9-42dd-4b3e-bbe5-76479cc57957
5
public static void main(String[] args) { int secretNumber; Scanner input = new Scanner(System.in); int guess; int answer; int num = 1; do { secretNumber = (int)(Math.random() * 999 + 1); System.out.print("Guess a number: "); guess = input.nextInt(); System.out.printf("Your guess is...
40ed2e7e-8d0c-4c8d-bc28-bc4ce7c0a3e8
2
public ArrayList<Location> getEmptyAdjacentLocations(Location loc) { ArrayList<Location> locs = new ArrayList<Location>(); for (Location neighborLoc : getValidAdjacentLocations(loc)) { if (get(neighborLoc) == null) locs.add(neighborLoc); } return l...
5325af14-bfc8-423f-8691-ad97650fe255
4
public void render(Graphics g) { if (!isDirty) { int xPos = indicatorManager.mapToPanelX(mapX); int yPos = indicatorManager.mapToPanelY(mapY); //flip the yPos since drawing happens top down versus bottom up yPos = indicatorManager.getPHeight() - yPos; ...
9791ab97-84e7-47c9-96c4-e014db08a19e
5
public <T> java.util.Map<java.lang.String,T> getBulk(Collection<String> keyCollection, long timeoutMiliSec) throws TimeoutException, com.quickserverlab.quickcached.client.MemcachedException { Map<java.lang.String,T> objectList = null; try{ Future <Map<String, Object>> f = getCache().asyncGetBulk(keyCollectio...
2d61730d-97b2-43d1-b64f-a4b09982acd7
0
StopSeedingTask(Client client) { this.client = client; }
467c6cf4-ef02-4126-be0a-c946ac5de25a
6
@Override public void keyPressed(KeyEvent e){ if (e.getKeyCode() == KeyEvent.VK_UP) { palkki2.setNopeus(-2); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { palkki2.setNopeus(2); }if(e.getKeyCode() == KeyEvent.VK_W){ if(peli.getClass()==kPeli.getClass()){...
fb554f38-a70d-4e51-9004-c114d186398b
2
public void printStack(Stack<Integer> stack) { Stack<Integer> tmpStack = new Stack<Integer>(); // pop all and print while (!stack.empty()) { int cur = stack.pop(); System.out.println(cur); tmpStack.push(cur); } // put it back while (!tmpStack.empty()) { stack.push(tmpStack.pop()); } }
6c143c6b-f925-4a77-9293-c5dccf36d48a
3
@RequestMapping(method = RequestMethod.POST) public String processForm(@Valid LoginForm loginForm, BindingResult result, Model model) { try { if (result.hasErrors()) { return "login"; } boolean isValid = loginService.isValidPassword(loginForm.getUserName(), loginForm.getPassword()); if (isValid...
6b5710ef-6e73-4e5b-ab89-114ec8417513
9
private void createImageNode(String tag,Attributes attrs) { textOut(); Stack<Element> st=new Stack<Element>(); String tg=_elemStack.peek().getTagName(); while (tg.equals("b") || tg.equals("i") || tg.equals("u")) { st.push(_elemStack.pop()); tg=_elemStack.peek().getTagName(); } Element img=_html.cre...
7ec0ec8f-46bb-4f19-aaeb-9713ac578f35
3
public PathPattern(T target, String text, boolean named, int defaultHttpMethods) { this.target = target; this.named = named; if (text == null) { return; } String[] items = text.split(";"); if (items.length > 1) { httpMethods = HttpMethods.parse(...
4de08ed3-6863-4f9e-9090-504053521fc1
3
public DialogNewGraph(GraphType graphType, boolean force) { panel.setLayout(new GridLayout(4, 2, 5, 5)); panel.add(new JLabel("Type ")); choose.setSelectedIndex(graphType.ordinal()); choose.addActionListener(this); if (force && graphType != GraphType.any) ...
bdc69fe1-f60e-4fb2-bb84-ecfb2a2b2b83
8
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUpdateActionPerformed // TODO add your handling code here: try { boolean check1 = txtMember_First_Name.getText().equals("") || txtMember_sur_Name1.getText().equals("") || txtMember_Mobile_Number.getText().equals("")...
29aa7984-24fe-411f-aa40-a593142726e2
3
public void init(int mode, byte[] key, byte[] iv) throws Exception{ String pad="NoPadding"; byte[] tmp; if(key.length>bsize){ tmp=new byte[bsize]; System.arraycopy(key, 0, tmp, 0, tmp.length); key=tmp; } try{ cipher=javax.crypto.Cipher.getInstance("RC4"); SecretK...
39f8b438-a2e2-4b6c-ae87-d3a4410e5a67
6
@EventHandler public void WolfRegeneration(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getWolfConfig().getDouble("Wolf.Regenera...
9c83ee3f-2f55-486a-96cb-5f121388aa9d
8
private void decodeCurrentPacket() { int samples; // Check that the packet is a audio data packet etc. if(jorbisBlock.synthesis(joggPacket) == 0) { // Give the block to the DspState object. jorbisDspState.synthesis_blockin(jorbisBlock); } // We need to know how many samples to process. ...
924893b2-cebd-43b8-aca5-db563980de7f
9
public final SymbolraetselASTNormalizer.redraw_return redraw() throws RecognitionException { SymbolraetselASTNormalizer.redraw_return retval = new SymbolraetselASTNormalizer.redraw_return(); retval.start = input.LT(1); CommonTree root_0 = null; CommonTree _first_0 = null; Commo...
b686fadc-5006-498c-8c7a-9d696361eb90
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final DataTimestamp other = (DataTimestamp) obj; if (this.ts != other.ts && (this.ts == null || !this.ts.equals...
88b0a2b3-05e8-46fa-866c-bd0143f4b287
8
public void wideReveal(int row, int col){ if(! isValidCell(row, col) ){ throw new IllegalArgumentException("Out of game bounds."); } if(! gameCell[row][col].isRevealed()){ return; } // wideReveal only executes if there's exactly N flags in 3x3 grid // when it executes, // reveal ...
af9826dc-6e3c-46db-9242-de76e137abe1
4
public static String byte2String(byte buf[], int offset) { int pos = offset; for(; offset < buf.length; offset++) if(buf[offset] == 0) break; if(offset > pos) offset--; else if(offset == pos) return ""; int len = (o...
f759d554-250b-49a2-be4d-ec6e19c954f5
8
protected void setupNewGame(){ //Semi test code: Get the opponent (AI, Human) NewGameDialog ngd = new NewGameDialog(this); //make modal dialog NewGameBundle ngb = ngd.getGameSetup(); int player1 = ngb.getPlayer1(); //this code will execute after the dialog box closes (modal) if (player1 == -1) { //use...
5bf029c3-856a-44bb-b616-0676a2e1d2d3
2
@Override public int matches( S sequenceA, int indexA, S sequenceB, int indexB, int count ) { for (int i = 0; i < count; i++) { if (sequenceA.charAt( indexA + i ) != sequenceB.charAt( indexB + i )) { return i; } } return count; }
0f5ccca3-686a-4f74-8f48-4e6d8ba5cb57
3
public static String getStackTrace() { String s = ""; StackTraceElement[] list = Thread.currentThread().getStackTrace(); if(list.length <= 2) { return ""; // no stack trace } for(int i=2; true; i++) { s += list[i].toString(); if(i >= list.length - 1) { break; } s += "\n"; } return s; }
cdc9b9da-71a7-46e7-95de-a0c4a0957350
8
public static void runhelper(String num, String path, String mode){ try{ File filepath=new File(path);//where the required file locates. if (!filepath.exists()){ filepath.mkdirs(); } File downloadpath=new File(filepath.getAbsolutePath()+"\\downloadfile_com"+num);//where the file downloaded from DUT lo...
77d28491-3b9f-4361-95d6-285636f55122
6
public static House getRandomHouse(double widthMin, double widthMax, double lengthMin, double lengthMax, int floorsMin, int floorsMax) { if (widthMin > widthMax){ throw new IllegalArgumentException( "w...
e4f330f8-07a5-42bc-996d-1d9632f14a20
0
public double getWrapWidth() { return wrapWidth.get(); }
09684749-976f-49b1-ba1f-366df9af3779
3
private void createConnection() { try { ConnectionProperties properties = new ConnectionProperties(); Class.forName(DRIVER_NAME); // Create a connection to the database String url = DRIVER_URL.replace("{DB}", properties.getDatabase()); connection ...
1cf1eaf8-7f60-4abf-82bf-393b6b8160dd
9
public void draw(Graphics2D g){ g.setFont(font); if (onAsk){ g.setColor(Color.WHITE); g.drawString("Would you like to save?", 10, 50); if (onYes){ g.setColor(Color.GREEN); g.drawString("Yes", 10, 100); g.setColor(Color.WHITE); g.drawString("No", 45, 100); } else{ g.setColor(Color...
0128cbb6-a77a-454f-96f3-972572654436
2
public static void drawBezierCurve(Graphics g, Curve curve) { List<Point> points = curve.getPoints(); Color color = curve.getColor(); for (int i = 1; i < points.size(); i++) { Point p0 = points.get(i - 1); Point p1 = points.get(i); drawLine(g, (int)p0.getX(), (int)p0.getY(), (int)p1.getX(), (int)p1.getY(...
366a729b-e941-4810-98d1-f59521374352
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((affected!=null) &&(affected instanceof MOB) &&(msg.amITarget(affected)) &&(msg.targetMinor()==CMMsg.TYP_DAMAGE) &&(!msg.amISource((MOB)affected)) &&(CMLib.flags().isAliveAwakeMobile((MOB)affected,true)) &&(msg.tool() i...
a0e0d91b-4ab1-4a6b-b261-a7477ec53eff
2
public boolean addMapObject(MapObject mapObject){ int positionX=mapObject.getPositionX(); int positionY=mapObject.getPositionY(); if (mapObjectGrid[positionX][positionY]==null && characterGrid[positionX][positionY]==null){ mapObjectGrid[positionX][positionY]=mapObject; return true; } else return...
5a6828b1-4899-49a6-b22f-fad590aaf96b
0
public void addPeriod(Period per) { this.periods.add(per); }
9aec05c6-4d7e-4684-8d6f-950006dc7494
4
public final void alert(BlockPlaceEvent ev) { final int xx = (int) ev.getBlock().getLocation().getX(); final int yy = (int) ev.getBlock().getLocation().getY(); final int zz = (int) ev.getBlock().getLocation().getZ(); final String block = ev.getBlock().getType().toString(); final Player name = ev.getPlayer(); ...
143f4363-edb8-4c9a-b9ed-fa0a3f9479b7
0
private void doSetActive(boolean value) { final ReentrantLock l = lock; l.lock(); try { active = value; } finally { l.unlock(); } }
1be8c570-cfae-4dbe-b917-56fe63578b98
9
protected LoginResult charcrEmailEntered(final LoginSessionImpl loginObj, final Session session) { final boolean emailPassword=((CMProps.getVar(CMProps.Str.EMAILREQ).toUpperCase().startsWith("PASS")) &&(CMProps.getVar(CMProps.Str.MAILBOX).length()>0)); final boolean emailReq=(!CMProps.getVar(CMProps.Str.EMAIL...
5ac1fe31-fba4-4e66-8c7e-c34607adda60
8
protected void scanData() throws Exception { while ((! this.reader.atEOF()) && (this.builder.getResult() == null)) { String str = XMLUtil.read(this.reader, '&'); char ch = str.charAt(0); if (ch == '&') { XMLUtil.processEntity(str, this.reader, this.entityResolver); ...
b45acaa7-8e7b-4f47-8e1f-dc708a83a941
5
public void specialOpen(){ if (!isOpen) return; if (bombsBeingRevealed && getValue() != 9){ return; } if (markIndex > 0){ return; } getModel().setPressed(true); getModel().setEnabled(false); isOpen = true; chooseIcon(true); if (canSpecialOpen()) theGame.openSurrounding(xPos, yPos); }
88c6f30c-3c86-4764-8fea-fa205527ce69
2
private void reiniciar() { lblSalarioBase.setText("0.0"); lblPeligrosidad.setText("0.0"); lblTransporte.setText("0.0"); lblVestuario.setText("0.0"); lblAntiguedad.setText("0.0"); lblComunes.setText("0.0"); lblDesempleo.setText("0.0"); lblFP.setText("0.0");...
13210746-be39-4ed3-8bf2-5fc91779adca
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LotHistoryObjectImp that = (LotHistoryObjectImp) o; if (!arg.equals(that.arg)) return false; if (!author.equals(that.author)) return false; ...
0de53ac8-df9c-4adc-848c-639415faa28c
9
public static void main(String[] args) { int[] arr = { 10, 22, 23, 54 }; //旧式写法 for (int i = 0; i < arr.length; i++) { System.out.println(arr[i]); } System.out.println("--------------------------"); //新式写法 增强的FOR循环 for(int element: arr) { System.out.println(element); } String[] arr1...
8993cc2d-ca44-4177-a2e8-ac8f3bb3e7e1
8
static public void awaitOn(Condition c) { MultithreadedTestCase thisTestCase = currentTestCase.get(); if (thisTestCase != null && thisTestCase.failed) throw new RuntimeException("Test case has failed"); if (skipNextWait.get()) { skipNextWait.set(false); return; } try { c.await(3, TimeUnit.SECO...
c4f039c2-f225-4cb1-ae46-7d5c4e8064e3
8
public static Object getDefaultValue(String typeSig) { switch (typeSig.charAt(0)) { case 'Z': case 'B': case 'S': case 'C': case 'I': return new Integer(0); case 'J': return new Long(0L); case 'D': return new Double(0.0); case 'F': return new Float(0.0F); default: return null; } }
3aaf8901-6d7a-4841-b046-349e1aa25b0d
8
@SuppressWarnings("unchecked") private void loadClassifier(File modelDirectory, String modelPrefix) throws JChunkerException { ObjectInputStream classifierInputStream = null; try { classifierInputStream = new ObjectInputStream(new FileInputStream(new File(modelDirectory, modelPr...
6d47294d-895f-420d-8a5c-6d81b447a929
9
public void actionPerformed(ActionEvent event) { if (event.getSource() == south) { game.processCommand(new Command("go", "south")); update(getGraphics()); text.setText(game.currentRoom.getLongDescription()); add(text, BorderLayout.NORTH); } else if (event.getSource() == north) ...
676d4d4c-6925-40c3-a525-9fb5b0ecf719
4
public void setValueAt(Object value, int row, int column) { if (row < 0 || row > this.rows.size() || column < 0 || column > this.getColumnCount()) { return; } Vector<Object> r = this.rows.elementAt(row); r.setElementAt(value, column); }
c855b87c-7836-47ba-af88-bb5fbe45aef4
9
@Override public List<ChessPosition> getTargetPos(ChessPosition current) { List<ChessPosition> pos = new ArrayList<ChessPosition>(); int x,y,upBound,lowBound,leftBound,rightBound,value; int dx[] = {0,2,2,-2,-2}; int dy[] = {0,2,-2,2,-2}; int cdx[] = {0,1,1,-1,-1}; int cdy[] = {0,1,-1,1,-1}; ChessPosition...
0eeed3b5-e1f3-477d-866f-b7e54cca84c6
2
public void disconnect(Tile t){ if (t == null){ throw new IllegalArgumentException("Can't disconnect null"); } if (t == tile1){ tile1 = null; } else { tile2 = null; } setChanged(); //this is so observers can detect if it is stranded, and remove it if they like notifyObservers(); }
9edd38fa-d9f6-4489-923e-83e2f137cfda
1
public double calculateExpectedBlockedOvershootCosts(AbstractStochasticLotSizingProblem problem, AbstractStochasticLotSizingSolution solution) throws ConvolutionNotDefinedException, SolvingInitialisiationException { AbstractLotSizingPeriod[] periods = problem.getPeriods(); double[] periodOvershoot = calcul...
3963e171-7a5c-4275-9a3f-cf53e20a3fbd
1
private void showMenu() { System.out.println(); System.out.println(header); System.out.println(" --------------------"); for (int i = 0; i < menuItems.length; i++) { System.out.println(String.format("" + (i + 1) + ": " + menuItems[i])); } System.out.println(...
efa3cf09-13d2-4f4a-af4c-8cdcf1bb5c1d
7
public static double evaluatePrecision(int k, HashMap<String, HashMap<Integer,Double>> relevance_judgments, String path){ double value = 0.0; try { BufferedReader reader = new BufferedReader(new FileReader(path)); int RR = 0; ...
2b456722-1415-4227-9634-e63c67151d6b
8
public static void loadLookAndFeel() throws ClassNotFoundException { LookAndFeel laf = UIManager.getLookAndFeel(); if (laf == null) { return; // never null } ClassLoader cl = laf.getClass().getClassLoader(); if (cl == null) { return; // null for system cla...
50fd8bd9-b246-4abe-9333-3bb38d700e1b
0
void hide() { lblDate.getScene().getWindow().hide(); }
4a7f0631-2fc3-4270-b489-84db20b215b9
6
public void run() { Scanner sc = new Scanner(System.in); int choice; do { System.out.println(); printMenu(); choice = sc.nextInt(); switch (choice) { case 1: createReservation(); break; case 2: removeReservation(); break; case 3: checkReservation(); break; case 4: ...
a1d796e3-455b-48a8-9092-649462273499
1
public void update(long deltaMs) { totalElapsedTime += deltaMs; //sinceLastSpawn += deltaMs; updateEnemyPool(); if(currentSequence != null) { currentSequence.update(deltaMs); } //if(sinceLastSpawn >= spawnDelay) { //spawn...
640754f5-11ad-4057-a4f7-31bfef399cd8
0
public ConnectionInfo(long idConnection, long creationTime, long idleTimeout, long lastAccessTime, long lastReceiptTime, String remoteIP, int remotePort) { this.idConnection = idConnection; this.creationTime = creationTime; this.idleTimeout = idleTimeout; this.lastAccessTime = lastAc...