method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
46a478bc-5948-4aa8-a303-2e6064b7e149
4
private boolean canMoveDiagonal(Grid grid, Position pos) { for (Element element : grid.getElementsOnGrid()) { if (element instanceof Player && ((Player) element).getLightTrail().getPositions().contains(new Position(pos.getxCoordinate() + 1, pos.getyCoordinate())) && ((Player) element).getLightTrail().get...
9de651be-84b1-4aef-aa2b-2121efe47b47
7
private boolean runChecks(){ // Check 1: Is it time to go home? if(office.getTime() >= dayEndTime){ // End the thread return false; } // Lunch time? if(office.getTime() >= lunchTime && !hadLunch){ try { long startCheck = System.currentTimeMillis(); System.out.println(office.getStringT...
8761998d-3c87-418a-93fc-42f4ed25b47c
6
@EventHandler public void WitchBlindness(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.getWitchConfig().getDouble("Witch.Blindnes...
86e4d185-a768-4948-9a5f-a8fc2fb4a90b
7
@Override public void mouseWheelMoved(MouseWheelEvent e) { double z = zoom; zoom *= Math.pow(1.1, (Client.instance.preferences.game.invertZoom ? 1 : -1) * e.getWheelRotation()); if (zoom < 0.2) zoom = 0.2; if (zoom > 5) zoom = 5; double d = zoom - z; scrollX += d * e.getX() * 2; scrollY += d * e.g...
cd3fa73d-27c6-4fce-a721-1b3750ec1a08
9
private boolean evaluateDelayClause(String str) throws InterruptedException { if (str.matches(REGEX_NONNEGATIVE_DECIMAL)) { float sec = Float.valueOf(str).floatValue(); int millis = (int) (sec * 1000); while (!stop && millis > 0) { try { Thread.sleep(millis > DELAY_FRACTION ? DELAY_FRACTION : millis...
87e31f93-8d67-4217-9897-bafbc198fb8b
8
public void dodge(int i, int j){ app.lblMessageTxt.setText("Ausweichmanöver: " + app.ObjectList.get(i).toString() + " kollidiert mit " + app.ObjectList.get(j).toString()); //Seitverschiebung if(app.ObjectList.get(i).y <= (app.ObjectList.get(j).y + app.ObjectList.get(j).height) || app.ObjectList.get(j).y <= (app.O...
63bb86b1-e927-4316-8582-1ed3c509cb8e
1
public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { //first goal is to be able to receive and process //a well formatted XML moveTwo piggybacked on a POST //this gives me a raw stream to payload of Post re...
746eb52a-7b45-4a39-b998-10730d8e31d2
1
public synchronized boolean hasRecordedIncomingPacket(Packet packet) { return (packet == null ? false : hasReceivedPacketWithSequenceNumber(packet.getSequenceNumber())); }
cb907120-8653-4b9f-a6a6-2f9d8b135a53
6
public boolean download() throws FileNotFoundException { Queue<String> needVisitPageSet = new LinkedList<String>(); Set<String> visitedPageSet = new HashSet<String>(); String ref = getValidRef(root, root); needVisitPageSet.add(ref); visitedPageSet.add(ref); while (!ne...
658cb451-dff4-4b46-99db-6ad7868b7b24
5
@Override public void actionPerformed(ActionEvent e) { if (ImportWords.getSelectedSection() != null) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileFilter(new FileNameExtensionFilter("Excel file", "xls")); int res = fileChooser.showDialog(null, "Selec...
911344c2-5078-46c1-a41a-fef375ac0e41
4
@Override public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); if (action.equals("Lijst van Quizzen")) { QuizListView view = new QuizListView(); QuizListController controller = new QuizListController(view, qCat, opdrachtCatalogus, facade); /* * QuizCreatieView vi...
560cf78c-a6fd-40b8-8bb8-772b98836f5b
1
public int getDynamicMethodClassID(Member m) { Integer id=dynIDs.get(m); if (id==null) return -1; return id.intValue(); };
4317f846-f53a-417e-92f9-b3db0c3a8257
5
public boolean move(Direction direction, StringBuffer output) throws EndGameException{ boolean hasMoved=false; if(myPosition.isCrossable(direction)){ if (myPosition.hasCharacter(direction)) { Character defender= myPosition.getCharacter(direction); if(attack(defender)){ this.myPosition=myPosition....
b88fdef7-aec5-421d-b3eb-1c0ecffb2936
2
public CPLayer getLayer(int i) { if (i < 0 || i >= layers.size()) { return null; } return layers.get(i); }
43b2eefe-d194-4981-9869-df90b8281882
4
public void tick(GameMaster game) { // update the collision box to move with the ball collisionBox.setBounds(x, y, size, size); // if it hits the LEFT wall if (x <= 0) { scoreSound(); game.player2Score++; velx = speed; } // if it hits the RIGHT wall else if (x + size >= game.getWidth()) { s...
0bd3a9e6-bb55-4438-be86-db3f551c5645
3
@EventHandler public void onSignChange(SignChangeEvent event){ if(event.getLine(0).equalsIgnoreCase("[stardoor]")){ if(!event.getLine(1).isEmpty()){ int doorID = Integer.parseInt(event.getLine(1)); event.setLine(0, "[" + ChatColor.GOLD + "StarDoor" + ChatColor.RESET + "]"); event.setLine(...
e13ec1e8-193c-48ae-ad42-fc24aaae1ecf
7
@EventHandler private void onPlayerInteractSign(PlayerInteractEvent event) { if(event.getAction() == Action.RIGHT_CLICK_BLOCK) { if(event.getClickedBlock().getState() instanceof Sign) { Sign sign = (Sign) event.getClickedBlock().getState(); if(sign.getLine(0).equals(ChatColor.BLUE + "ColoredArmor") ...
a6832e4b-ba12-45b3-a7c4-98256bd61fbc
9
String disambiguateName(String name) throws ParsingException { String[] fields = name.split("[.]"); if (fields.length == 2 && (!fields[0].equals("null"))) return name; if (fields.length > 2) throw new ParsingException("Field " + name + " is not a valid field reference."); String newName = n...
9b7db4fb-ba55-4682-a221-b3877c5ddb46
1
public void createOutro(ArrayList<String> imageList, ArrayList<String> descriptionList) { Element outroElement = doc.createElement("outro"); gameModule.appendChild(outroElement); for(int i=0;i<imageList.size();i++) { Path path = Paths.get(imageList.get(i)); Element ou...
85e31fe7-8e4a-4074-a041-82e2b4d64ab9
6
private void removeResource (int resID) { for (int j = 0; j < resList_.size(); j++) { if (((Integer) resList_.get(j)).intValue() == resID) { resList_.remove(j); if (record_) { write("Removing", resID, GridSim.clock()); ...
e8578e3a-ba73-46fc-8a54-d645de9f4212
3
public PlanKampf(JSONObject help, Object name) throws FatalError { super("Kampf"); if (name != null && name instanceof String) { idOrName = (String) name; options = new AngriffOptions(new JSONObject()); } else { try { options = new AngriffOptions(help); idOrName = help.getString("Gegner"); ...
733cc4a7-0db6-41b7-86e2-79a958360723
0
public MyBomber(int number, int bombs, Match match) throws UnknownHostException, IOException { this.number = number; this.bombs = bombs; this.match = match; this.cooldown = 0; chooseStartingTile(match, number); }
372b75bb-31d9-4b7e-942a-7ac247a272e0
3
public ArrayList searchPrice(ArrayList data) { ArrayList temp = new ArrayList(); for (int i = 0; i < data.size(); i++) { Query q = em.createQuery("SELECT t from RoomEntity t"); for (Object o : q.getResultList()) { RoomEntity p = (RoomEntity) o; i...
0a73ee7b-eec2-4e79-b7ec-8fb955e5e346
5
public IMessage crypter(IMessage clair, String key) { long d=new Date().getTime(); char[] c=new char[clair.taille()]; for(int i=0;i<clair.taille();i++) { if(clair.getChar(i)>=65 && clair.getChar(i)<=90) { c[i]=(char)(65+((clair.getChar(i)-65+13)%26)); } else { if(clair.getChar(i)>=97 && clair.get...
556275cb-fe74-49d6-8cfd-6ab111289500
6
@Override public ArrayList<UserScore> getScoreList() { PreparedStatement selectStmt = null; ArrayList<UserScore> userScoreList = new ArrayList<UserScore>(); ResultSet rs = null; try { selectStmt = getConnection().prepareStatement("select " // + " * fro...
f9b42062-e6a7-4acc-b807-c9a467429a3f
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 look and feel. * For details see http://down...
70e5bc70-aa44-4a80-81b2-ad64165ccf81
9
@Override public final boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Pair) { Pair<?, ?> other = (Pair<?, ?>) obj; return (mFirst == null ? other.mFirst == null : mFirst.equals(other.mFirst)) && (mSecond == null ? other.mSecond == null : mSecond.equals(other.mSe...
68d6a082-34d4-415a-a264-d94cc4f87644
9
public void deleteOldValues(final long now) { this.checkTime(now); final long minTime = now - this.windowLength; boolean deleted = false; while (this.size > 0) { if (this.times[this.ringTail] < minTime) { final float value = this.values[this.ringTail]; this.sum -= value; if ((this.cachedM...
1d25108e-40db-46df-a82a-2a5c1ca5a95e
4
public void addComponent(OVComponent c) { // ObjectManager.addComponent(c); if (c.getFather() instanceof OVComponent && !hasComponent((OVComponent) c.getFather())) { addComponent((OVComponent) c.getFather()); } if (model_ == null) { init(c); components_.add(c); return; } String name = c.getS...
4f9b39bb-845f-460c-b50c-9c7e3a4fe309
7
public void doShiftClick(final Well justSelected) { //if no wells are currently selected, just select all up to the selected one if (selectedWells.isEmpty()) { justSelected.getParentPlate().dispatcher.notifyAll( new IWellCmd(){ public void apply(Well conte...
42a67ca5-2023-4d10-bba1-9886ae075054
7
public int checkLockCover(int radius, int height, int volumeLow, int volumeHigh) { if (radius < 1) { System.out.println("You entered a number less than 1. Please enter a number between 1 and 8"); return -1; } if (radius > 8) { System.out.println("You entered ...
4d3e6ee0-5815-4191-bbbb-ccce0a94ddcd
1
public void removeID(int id) { if (laenderMap.containsKey(id)) { laenderMap.remove(id); } }
7c8ea648-971a-415e-96fb-b2c6aa13aee3
0
public boolean isEmpty() { return batch.isEmpty(); }
40165b5c-84e4-41e8-9ba0-7438a9c7629b
1
@Override public void updateObserver(Observer observer) { if (allNews.size() > 1) { observer.update(allNews.get(allNews.size() - 1)); } }
82621914-e515-4490-a591-5f88ac4a7018
7
synchronized Object getProperty(String returnType, String infoType, String paramInfo) { if (propertyTypes.length != PROP_COUNT * 3) Logger.warn("propertyTypes is not the right length: " + propertyTypes.length + " != " + PROP_COUNT * 3); Object info = getPropertyAsObject(infoType, paramInfo); if (...
657639bf-be65-41e6-80f7-0139f3010828
6
@EventHandler public void BlazeWeakness(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.getBlazeConfig().getDouble("Blaze.Weakness....
fd8966f1-3ea1-4c05-822a-07cb34d3dfd6
8
public void GetParamsOptimizer(int stepNo, int workflowId) throws Exception { if(stepNo > 0 && stepNo % step_threshold == 0) { //List<HashMap<String, Object>> res = DBInterface.Read(workflowId); List<HashMap<String, Object>> res = DBInterface.ReadResults(workflowId); ...
f173af19-bf1d-4ae7-9c02-0eed55eb3d6d
6
public Environment(Node node) throws MalformedURLException, XPathExpressionException { this.methods = new HashMap<String, ServiceMethod>(); this.properties = new HashMap<String, String>(); this.setRawEndpoint(Utilities.selectSingleText(node, "./@c:url", XMLLabels.STANDARD_NAMESPACES)); this.name = Utilities....
3a5e1583-0e85-4d83-bc8c-ab0119a85a18
8
public static void execSetCommand(CommandSender sender, Command command, String label, String[] args) { CommandHelper h = new CommandHelper(sender, command); if (sender instanceof Player) { if (args.length < 2) { sender.sendMessage(Message.formatMessage("/customlogin set < Prefix | Join ...
d68c1201-57d0-4656-a274-dd921c61151e
1
public double[] getScores() { double[] scores = new double[quizResults.size()]; for (int i = 0; i < quizResults.size(); i++) { scores[i] = quizResults.get(i).PercentScore(); } return scores; }
b02a5539-a7aa-41ef-a5ef-ac14ad6492bb
0
public void countHead(){ //for(int i = 0; i < m.length;i++){ //if(m[i].equals("Head")){ countH++; //} //} }
bf7a5eda-8aaf-4890-82f0-51146aa348c8
1
protected double getAngleFromSlope() { double angle = 0.0f; angle = Math.atan(slope); if (direction == Direction.LEFT) { angle += Math.PI; } return angle; }
50a9af9f-d658-4576-9bb7-d36324487eee
8
@Override public boolean onCommand( CommandSender sender, Command command, String label, String[] args ) { if ( !( sender instanceof Player ) ) { if ( args.length == 2 ) { Bukkit.getPlayer( args[0] ).teleport( Bukkit.getPlayer( args[1] ) ); } else if ( args.length == ...
c3fe425e-7844-4808-beda-b8b791b8ee41
7
void radb2(int ido, int l1, final double cc[], double ch[], final double wtable[], int offset) { int i, k, ic; double ti2, tr2; int iw1 = offset; for(k=0; k<l1; k++) { ch[k*ido]=cc[2*k*ido]+cc[ido-1+(2*k+1)*ido]; ch[(k+...
a0279277-fdab-4f88-89c3-f79ad9b11fc1
1
protected void onVerbose(String format, Object... objs) { if (verbose) { logger.info(String.format(format, objs)); } }
63b20384-8a1e-419a-8f49-b35780dc8d1e
5
static boolean agregarElementoColeccion( int posCol ){ try{ if( cols[ posCol ] instanceof ColeccionChar ) cols[ cont ].agregar( lea.next().charAt(0) ); else if( cols[ posCol ] instanceof ColeccionDouble ) cols[ cont ].agregar( lea.nextDouble() ); ...
9fc3837c-0c38-4124-8272-d2e4b8ac711f
7
public static <T extends Enum<?>> T lookup(Map<String, T> lookup, String name, boolean fuzzy) { String testName = name.replaceAll("[ _]", "").toLowerCase(); T type = lookup.get(testName); if (type != null) { return type; } if (!fuzzy) { return null; ...
43447d43-d491-47e3-8106-71966b8300a9
0
public String toString() {//print the card as a string return rank + " of " + suit + "\nPoint Value = " + (pointValue); }
e5cd9c49-17dd-4122-af69-60a8a0620f3c
4
protected static String[] getStringValuesFromPtgs( Ptg[] pthings ) { String[] returnStr = new String[pthings.length]; for( int i = 0; i < pthings.length; i++ ) { if( pthings[i] instanceof PtgErr ) { return new String[]{ "#VALUE!" }; // 20081202 KSC: return error value ala Excel } Object o = p...
c17df71b-5a9e-47ad-8cd0-033b816a5f24
6
static final Class193 method3442(int i, byte[] is, NativeOpenGlToolkit class377, int i_0_) { try { anInt9779++; if (is == null) return null; int i_1_ = OpenGL.glGenProgramARB(); OpenGL.glBindProgramARB(i, i_1_); OpenGL.glProgramRawARB(i, 34933, is); OpenGL.glGetIntegerv(34379, ...
a3a21560-dcb8-4f4b-939b-9cb015e05c67
5
public static void main(String[] args) throws FileNotFoundException{ System.out.print("Enter the input file name => "); String graphFile = stdin.next(); Graph graph = new Graph(new Scanner(new File(graphFile))); graph.buildGraph(); char option; while ((option = ge...
a9c6a704-1cf2-43ff-8ea3-8550a1af706b
0
@Before public void setUp() { TasonLuonti t = new TasonLuonti(new ArrayList<String>()); }
dd738277-0ac8-4f47-becc-a07068d88f8f
1
public boolean accept(TMConfiguration tmc){ TMState tms = (TMState) tmc.getCurrentState(); if (((TuringMachine) tms.getAutomaton()).getParent() != null) return false; //first, we check if this is a top-level state, if it is not, we cannot accept // EDebug.print("Hello World"); ...
29bf656a-10e6-46d6-a763-4039130d4a07
0
public java.io.Serializable fromDOM(Document document) { String axiom = readAxiom(document); Grammar rules = readGrammar(document); Map parameters = readParameters(document); return new LSystem(axiom, rules, parameters); }
4611befa-80d2-49d8-9733-efdf2e6f87a8
5
public void insertBefore(AnyType key, AnyType toInsert) { if(head == null) return; if(head.data.equals(key)) { addFirst(toInsert); return; } Node<AnyType> prev = null; Node<AnyType> cur = head; while(cur != null && !cur.data.equals(key)) { ...
bf164f9a-b0ab-49a6-81fd-2f6eeb253d16
3
private void initializeQueryProperties() { defaultQueryProperties.put(makeCycSymbol(":allowed-rules"), makeCycSymbol(":all")); defaultQueryProperties.put(makeCycSymbol(":result-uniqueness"), makeCycSymbol(":bindings")); defaultQueryProperties.put(makeCycSymbol(":allow-hl-predicate-transformation?"), false);...
89cdbf5a-4369-4f58-8f47-d0b6a0af1b86
2
public void update() { for (int particleIndex = 0; particleIndex < particleArray.length; particleIndex++) { if (particleArray[particleIndex] != null) { particleArray[particleIndex].update(); } } this.removeDeadParticles(); }
f63b3fa7-7839-42f9-ba0b-c8893843525f
1
@Override public void paintComponent(Graphics g){ super.paintComponent(g); preyBird.getBirdShape().render(g); for (BirdShape birdShape : birds) { birdShape.render(g); } }
8ed85463-f869-43b9-ae6b-a0fc9990e381
2
private boolean checkConnection (Connection conn) throws SQLException { if (conn == null) { log.severe("Could not connect to the database. Check your credentials in online-users.settings"); throw new SQLException(); } if (!conn.isValid(5)) { log.severe("Could not connect to the database."); ...
a43cf113-1556-4ab9-a2f7-e5fa748963a4
5
public boolean move(int direction){ if (canMove(direction)){ switch (direction){ case Standards.NORTH: yLoc--; break; case Standards.EAST: xLoc++; break; case Standards.SOUTH: yLoc++; break; case Standards.WEST: xLoc--; break; default: break; } orientation ...
eadd4dfe-fcd0-4283-a2ef-5b354e0212ff
0
public void setField1(Object field1) { this.field1 = field1; }
97d55393-53c9-41a3-b40c-cbd53ea338ba
5
public final void broadcastSmegaPacket(final MaplePacket data) { mutex.lock(); try { final Iterator<MapleCharacter> itr = nameToChar.values().iterator(); MapleCharacter chr; while (itr.hasNext()) { chr = itr.next(); if (chr.getClient()....
08bd5b73-f87d-4e51-a486-b608d18af580
3
private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed /*Compara el texto ingresado con en nombre generico de los productos almacenados en la tabla Stock Prod, * si el texto coincide, muestra los detalles del producto. ...
2f3054e5-f63c-41ee-9649-cca4fb804d15
3
private void verificarIdPrograma(Identificador id) throws IdentificadorJaDefinidoException { if(id instanceof IdentificadorPrograma){ if(idPrograma == null) idPrograma = (IdentificadorPrograma)id; else throw new IdentificadorJaDefinidoException("O identificador de programa já foi definido"); } else if...
06b83b06-f336-49ac-bff8-bfd5e2a1ee43
6
public void enablePlugin(CommandSender sender, String[] args) { if (args.length == 1) { sender.sendMessage(pre + red + specifyPlugin); return; } if ("all".equalsIgnoreCase(args[1]) || "*".equalsIgnoreCase(args[1])) { for (Plugin pl : Bukkit.getPluginManager(...
2d9959cb-f04e-4270-936a-405f874a5b1e
1
public void move(double time) { planet.move(time); for (Subject moon : moons) { moon.move(time); } }
ae9596b2-fc4e-4c87-a5d9-9d0cc842f048
3
public boolean isOutOfBounds(Entity ent){ float x = ent.getPosition().x(); float y = ent.getPosition().y(); float z = ent.getPosition().z(); if(ent.isCollidedWith(new Position(x+width/2, y, z))){ return true; } if(ent.isCollidedWith(new Position(x, y+height/2, z))){ return true; } if(ent.isCollide...
5a315f44-cb05-4598-82c1-30a8184620e2
3
public Boolean saveInboundLink(String source, String target) throws ForceErrorException { // TODO przerobić na obiekty Link long sourceID = this.getHostID(source); long targetID = this.getHostID(target); if (sourceID == targetID) { return false; } PreparedStatement prepared; try { prepared = ...
36f45319-aded-4c24-9832-0522c414aaed
9
public static void solve (double[] d, double[] e, double[] f, double[] b, double[] x) { // Verify preconditions. int N = d.length; if (N < 2) { throw new IllegalArgumentException ("Tridiagonal.solve(): d.length = " + d.length + " illegal"); } if (e.length != N-1) { throw new I...
4b4c771d-76a2-4789-bf82-e05c6434e0d0
4
private Direction getDirectionToMove() { ArrayList<Direction> crossableDirections = new ArrayList<Direction>(); Direction directionToMove; int numDirections; Set<Direction> directionSet=myPosition.getAllDirections(); //get set of all available positions to move off this tile for(Direction d: directio...
9a846bdc-3bdf-4116-8732-f1cc1eae5552
3
public boolean existeCliente(String nick, String email){ getLista g = new getLista(); ListaClientes = g.getListaCliente(); for(int i = 0;i<ListaClientes.size();i++){ if(ListaClientes.get(i).getNick().equals(nick) || ListaClientes.get(i).getEmail().equals(email)){ ...
425f2002-1143-4d03-811c-cbb3b1704bd1
1
private void autoJoinChannels() { while ( channelsToJoin.size() > 0 ) connection.joinChannel( channelsToJoin.remove(0) ); }
54983aa5-b7e3-4e61-8530-3b2bceeb26a5
6
private HashMap<PermissionFlag, Boolean> getPermissions(ChunkyPlayer cPlayer, String permString) { // Converts the flags into an EnumSet<PermissionRelationship.Flags> HashMap<PermissionFlag, Boolean> permissions = new HashMap<PermissionFlag, Boolean>(); if (permString.equalsIgnoreCase("clear"))...
f1259552-00f6-47cf-8319-b30add5f6b3a
6
public void addSubject(Short week, String subject, String audience, String professor) { SchedulerSubjectPanel panel = new SchedulerSubjectPanel(subject, audience, professor); if (week == null) subjectsPanel.add(panel); else { SchedulerSubjectPanel empty = new SchedulerSubjectPanel("-...
416b1049-19d3-4350-85ce-1f78d7d90ddb
8
private void makewt(int nw) { int j, nwh, nw0, nw1; double delta, wn4r, wk1r, wk1i, wk3r, wk3i; double delta2, deltaj, deltaj3; ip[0] = nw; ip[1] = 1; if (nw > 2) { nwh = nw >> 1; delta = 0.785398163397448278999490867136046290 / nwh; d...
0829d392-1f53-40fb-ada1-e504f90aea33
4
public boolean averageUp(int steps){ if(steps >= historySize) { steps = historySize; } int up = 0, down = 0; for(int i = 0; i < steps; ++i){ if(priceHistory.get(i) > priceHistory.get(i+1)){ ++up; } else if(priceHistory.get(i) < priceHistory.get(i+1)){ ++down; } } return up > down; }
5559c127-21eb-4a4f-bad2-f53fb3dfe4f7
9
public static String getWorkingDirectory() { String home = System.getProperty("user.home", "."); File dir; String os = System.getProperty("os.name").toLowerCase(); if (os.contains("linux") || os.contains("unix") || os.contains("sunos") || os.contains("solaris")) { dir = new File...
10f50a4f-7077-4048-ae44-3dece63f7d97
0
public void log(Level level, String message) { logger.log(level, message); }
c525b828-c79f-481b-8512-98ef4b602ffc
0
public boolean equals(City city){ return this.getID() == city.getID(); }
b81db3bc-f6f7-48f6-8386-8b374590dcf7
2
public boolean replaceAll(List<Element> newElements) { int f = 0; for(int i = 0; i < newElements.size(); i++){ f += newElements.get(i).getValue(); } if(f <= this.capacity){ this.filled = f; this.elements = newElements; return true; } return false; }
e29f36f3-7fcb-4cb4-aa0a-e50eda1aab1a
1
public boolean addModerator(String subForumId, User invoker, User moderator) { if (!invoker.hasPermission(Permissions.ADD_MODERATOR)) return false; getSubForumById(subForumId).addModerator(moderator); save(); return true; }
8bd904f9-fe7e-4439-929d-e8c8ecd00c1a
4
public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_W) w = false; if (e.getKeyCode() == KeyEvent.VK_A) a = false; if (e.getKeyCode() == KeyEvent.VK_S) s = false; if (e.getKeyCode() == KeyEvent.VK_D) d = false; }
e2915936-f673-4013-badd-c94abd4acbb2
2
private void renderBackground() { for (int i = 0; i < width * 2 + 1; i++) { for (int j = 0; j < height * 2 +1 ; j++) { gc.add(new GImage("wall.png", i * IMG_SIZE, j * IMG_SIZE)); } } }
70ccf398-819f-4f03-84f2-98f2d5a7df2f
9
public String buildUpdateFor (T entity) { StringBuilder sql = new StringBuilder(updateInstruction); Object value = null; for (Field field : columnMappings.keySet()) { String column = columnMappings.get(field); int replaceStart = sql.indexOf(":" + column); int replaceEnd = replaceStart + column.len...
b87e4b32-2087-4e38-9200-00f66aa9005c
2
private final static byte[] getDecodabet(int options) { if ((options & URL_SAFE) == URL_SAFE) { return _URL_SAFE_DECODABET; } else if ((options & ORDERED) == ORDERED) { return _ORDERED_DECODABET; } else { return _STANDARD_DECODABET; } } // end getAlphabet
aeac33fd-e8f8-462a-a94f-36a17c19a737
3
public boolean interSect(DataChunk chunk) { int len = this.start.length; for (int i = 0; i < len; i++) { if (!(this.start[i] >= (chunk.getStart()[i] + chunk.getChunkStep()[i]) || this.start[i] + this.chunkStep[i] < chunk.getStart()[i])) { return true; } } return false; }
5071693a-f912-44f6-a1c9-9859dca4ed6c
9
public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof StringDescriptor)) return false; final StringDescriptor descriptor = (StringDescriptor)o; if (myBundleName != null ? !myBundleName.equals(descriptor.myBundleName) : descriptor.myBundleName != null) return false; ...
5bdb6a1b-1d6f-498e-97bb-91b451ef37d2
8
public void run(IAction action) { List<String> files=new ArrayList<String>(); if(selection instanceof IStructuredSelection){ IStructuredSelection str=(IStructuredSelection)selection; Iterator iter=str.iterator(); while(iter.hasNext()){ Object selected=iter.next(); if(selected instanceof IResourc...
1d1805fc-6b28-4bfc-90ca-52f098d96416
9
public OBJModel(String fileName) { positions = new ArrayList<Vector3f>(); texCoords = new ArrayList<Vector2f>(); normals = new ArrayList<Vector3f>(); indices = new ArrayList<OBJIndex>(); hasTexCoords = false; hasNormals = false; BufferedReader meshReader = nu...
794f300c-a923-46d7-8377-2d5c3e5633a5
0
private void jButton1MouseMouseClicked(MouseEvent event) { ChooseFrame cf = new ChooseFrame(); cf.setTitle("ChooseOpration"); cf.getContentPane().setPreferredSize(cf.getSize()); cf.pack(); cf.setLocationRelativeTo(null); cf.setVisible(true); this.dispose(); }
612ce97c-a5e7-4541-8379-5adac75448ab
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
7557ff6a-97b5-4b9d-9032-37631d9d8a07
7
public void mouseEntered (MouseEvent e) // start showing coordinates { if ( !Active) return; if (DisplayNodeName) { GF.setLabel(LText); DisplayNodeName = false; } int x = e.getX(), y = e.getY(); x -= O + OTU; y -= O + OTU; int i = x / D, j = y / D; // determine position if (i < 0 || j < 0 || i...
30f9427c-9603-4798-aa87-48a74d81f48e
6
static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextCol...
e4197cbb-f520-45ac-ab75-316e333d2ffd
4
@Override public boolean equals(Object o) { if(o instanceof Vector4) { Vector4 v = (Vector4)o; return x == v.x && y == v.y && z == v.z && w == v.w; } return false; }
9d6955cd-7b97-44d5-819e-8f22d7f6aa02
7
public double[] distributionForInstance (Instance instance) throws Exception { if (!getDoNotReplaceMissingValues()) { m_ReplaceMissingValues.input(instance); m_ReplaceMissingValues.batchFinished(); instance = m_ReplaceMissingValues.output(); } if (getConvertNominalToBinary() && ...
94d74e94-483c-402f-b2bb-4bd039c37e5e
9
public void checking_bfs2(char[][] board, int x, int y) { Queue<Integer> xque = new LinkedList<Integer>(); Queue<Integer> yque = new LinkedList<Integer>(); xque.add(x); yque.add(y); while (!xque.isEmpty()) { x = xque.remove(); y = yque.remove(); board[x][y] = '+'; if (x > 0 && board[x - 1][y] ==...
36eecc0c-036a-4faf-adab-84bd5e9b7077
8
public int maxEnvelopes(int[][] envelopes) { if(envelopes==null) return 0; if(envelopes.length<=1) return envelopes.length; int[] aux=new int[envelopes.length]; Arrays.fill(aux,1); Arrays.sort(envelopes, new Comparator<int[]>() { @Override public int compa...
c04de752-1a8d-4a35-833a-ce38cbab8c10
2
public static boolean validCod(String cod){ if(cod.length()<5 || cod.length()>20){ return false; }else{ return true; } }
fe288221-8e9f-4208-80d0-8596dc2d0f1b
5
private static int[] findFirstDiff(BufferedImage image1, PixImage image2, int border) { if (image1.getWidth() != image2.getWidth() || image1.getHeight() != image2.getHeight()) { return new int[] { -1, -1 }; } BufferedImage bImage2 = ImageUtils.pixImage2buffe...
f6a9cac8-0ae9-4b93-9443-e214d2974f35
6
public static String stripQuotes( String str ) { if( str == null ) return null; if( str.length() >= 2 && ( ( str.startsWith("\"") && str.endsWith("\"") ) || ( str.startsWith("'") && str.endsWith("'") ) ) ) { return str.substring( 1, str.length()-1 ); } else { return str; } ...