method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7efc6db8-23e2-487b-a173-28bed27d99ec
9
private static void keyAction(String actionString) { if (controlsActive) { if (actionString.equals("Fire")) { session.player.setFiring(true); } else if (actionString.equals("SpaceReleased")) { session.player.setFiring(false); } else if (actionS...
ee14a8af-1a45-42b6-a351-05a5cfc3d3f5
6
public int Edit_Data(ProfileInfo DataObj) { //System.out.println("ProfileDAO.Edit_Data()"); int res = 0; ProfileInfo profileObj = null; String sql = "UPDATE profile SET Profile_Name=?, Video_Width=?, Video_Height=?, Video_FPS=?, Video_Bitrate=?, Video_Preset=?, Audio_Codec=?, Audio_Bitrate=?, Audio_SampleRat...
177ed502-d7ea-4964-aa75-a6724a2a2cb7
3
@Override public void put( ByteBuffer out, Object v ) { if (v == null) { out.put( Compress.NULL ); } else { out.put( Compress.NOT_NULL ); try { for (int i = 0; i < fields.length; i++) ...
ab094fc9-1079-49d3-af81-02f66014c6d0
4
public static void rectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) { throw new IllegalArgumentException("half width must be nonnegative"); } if (halfHeight < 0) { throw new IllegalArgumentException("half height must be nonnegative")...
8e94855c-62dd-4356-bc70-1b24ffd8a07a
0
@Override public void addServerStopListener(ServerStopListener listener) { serverStopListenerList.add(ServerStopListener.class, listener); }
cd3cbeac-3a23-4731-9f86-dfd9e712eb91
1
private String generateFinalKey(String in) { String seckey = in.trim(); String acc = seckey + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; MessageDigest sh1; try { sh1 = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } return Base64.encodeBytes(sh...
ecd768c4-e529-439e-8b15-400d3ccffd29
5
public Boolean asBooleanObj() { try { if (isNull()) { return null; } else if (isBoolean()) { return (Boolean) value; } String check = asString(); if (check == null) { return null; } else if (isTrue(check)) { return Boolean.TRUE; } else { return Boolean.FALSE; } } catch...
40f16736-0a17-41f4-81da-c636dcfab1a0
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof XYZ)) { return false; } XYZ other = (XYZ) obj; if (x != other.x) { return false; } if (y != other.y) { return false; } if (z != other.z) { re...
ffa7c037-96ab-4cf6-8358-95b57517fe80
6
public static void writeValue( Object thing, OutputStream os ) throws IOException { if( thing instanceof byte[] ) { writeByteString( (byte[])thing, os ); } else if( thing instanceof Number ) { writeNumberCompact( (Number)thing, os ); } else if( Boolean.TRUE.equals(thing) ) { os.write(BE_TRUE); } else i...
30ac25ea-ea54-4c43-8a66-5304c10b2904
4
public void setGehRichtung(String richtungsbefehl) { if(richtungsbefehl.contains("nord")) { _gegangeneRichtung = "nord"; } else if(richtungsbefehl.contains("ost")) { _gegangeneRichtung = "ost"; } else if(richtungsbefehl.contains("süd")) { _gegangeneRichtung = "süd"; } else if(richtungsbefe...
5823d5cf-e323-4948-8ddb-4ea7e11cd7a1
4
private int decodeResponse(String challenge, String string) { if (string.length() > 100) { return 0; } int[] shuzi = new int[] { 1, 2, 5, 10, 50 }; String chongfu = ""; HashMap<String, Integer> key = new HashMap<String, Integer>(); int count = 0; for (int i = 0; i < challenge.length(); i++) { Stri...
5711bdd4-5c1c-4156-84bd-969466756781
1
public boolean matches( Class<?> clazz ) { return Modifier.isFinal( clazz.getModifiers() ); }
3f38801e-e77a-4794-8df5-6b915c28686b
3
public void addEdge( Vertex<T> v1, Vertex<T> v2 ) { v1Pos = getVerticesIndexFor( v1 ); v2Pos = getVerticesIndexFor( v2 ); if ( v1Pos == -1 || v2Pos == -1 ) { throw new IllegalArgumentException( "vertex not found" ); } // avoid adding duplicate edges if ( this.adjMatrix[v1Pos][v2Pos] == 0 ...
db44f91f-f222-4a5c-af29-c8e6a5686fa9
2
public boolean setNbCoupMax(int nvNbCoupMax){ if(nvNbCoupMax >= MIN_NB_COUPS && nvNbCoupMax <= MAX_NB_COUPS){ Integer coupMax = nvNbCoupMax; propriete.setProperty("nb_coups", coupMax.toString()); return true; } else{ return false; } }
17d1afdc-71a0-40a0-bd48-34624885e5df
8
public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception { if (splitted[0].equalsIgnoreCase("removeeqrow")) { int lol = 4; if (splitted.length == 2) { lol = (Integer.parseInt(splitted[1]) * 4); } for (int i = 0; i ...
08efbba6-77a8-4606-b7e5-d69935925933
5
@Override public void execute() throws MojoExecutionException, MojoFailureException { // Override OpenCms Environment with Base OpenCms Zip Url if (this.getBaseOpenCmsZipUrl() != null) { this.setOpenCmsEnvironmentZipFile(this.getBaseOpenCmsZipUrl()); } // Execute OpenCms init super.execute(); try { ...
c1bcab43-d674-4a99-b67f-6e3fec0e85b3
3
public void go_up(){ if( this.direction != Tank.direction_up) this.direction = Tank.direction_up ; else{ if(this.location_y - this.speed >= 0 && ifCanWalkInThisDirection()) { this.location_y -= this.speed ; ifGetProps(); } } }
a8371cb5-7822-4f7a-84be-442dd42c6c3f
5
protected BufferedImageWithFlipBits scale( Getter<BufferedImage> populator, int width, int height ) throws ResourceNotFound { assert width != 0; assert height != 0; BufferedImage original = getOriginal(populator); ensureMetadataInitialized(original); final int dx0, dy0, dx1, dy1; if( width < 0 ) { dx0 = -w...
da425da0-4001-471e-9707-df0d93cbbbad
3
public static void rotate90CCW(int[][] image) { if(image.length != image[0].length) { throw new IllegalArgumentException("The matrix must be square."); } double n = image.length; int f = (int)Math.floor(n/2); int c = (int)Math.ceil(n/2); // r...
ab735eb9-1890-4d81-ae06-8007e9695ec9
0
public void setSsn(String ssn) { this.ssn = ssn; setDirty(); }
a58e7572-60d7-44d6-881b-0acb4fb94194
0
public DaedricWarAxe() { this.name = Constants.DAEDRIC_WAR_AXE; this.attackScore = 15; this.attackSpeed = 18; this.money = 1800; }
0ab6dba8-9cb7-4d80-b356-2945e617ccdc
8
public PrimitiveOperator combineRightNLeftOnMin(PrimitiveOperator other) { boolean[] newTruthTable = new boolean[8]; newTruthTable[0] = truthTable[((other.truthTable[0]) ? 2 : 0) | 0]; //000 newTruthTable[1] = truthTable[((other.truthTable[2]) ? 2 : 0) | 1]; //001 newTruthTable[2] = truthTable[((o...
b8671266-1468-473a-bd23-bdec4213707c
0
@Test public void edgeReturnsCorrectVerticesWhenFlipped() { Vertex v = new Vertex(0); Vertex u = new Vertex(0); Edge e = new Edge(v, u); e.flip(); assertEquals(e.getStart(), u); assertEquals(e.getEnd(), v); }
1d3a4fe4-2d1e-4512-af84-e0a3ce57b155
9
private void initialize() { // Used for saving on pressing Ctrl-Enter and cancelling on escape KeyAdapter keyAdapter = new KeyAdapter() { @Override public void keyPressed(KeyEvent ev) { if ((ev.getKeyCode() == KeyEvent.VK_ENTER) && ((ev.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()...
8e5dc264-ea82-4f53-994e-70f34c0380f1
4
public boolean updateScheduleRequest(Sport sport) { String request = null; switch(sport) { case NBA: case NHL: request = "http://api.sportsdatallc.org/" + sport.getName() + "-" + access_level + sport.getVersion() + "/games/" + season + "/" + season2 + "/schedule.xml?api_key=" + sport.getKey(); Eleme...
65c1b4c7-7306-479d-8828-1b6efdca9078
6
public void addCreatureToWorld(final int creatureType, final Grid g) { Thread creatureWatcher = new Thread(new Runnable() { @Override public void run() { Random ra = new Random(); if (creatureType == SIMPLE_AGENT) { while (g.getSimpleCreaturesAmount() < nSimpleCreaturesInWorld) { // Manage...
39d234c5-fbcc-4cc8-83c6-140e1b0581bf
0
public Integer getMemory() { return this.memory; }
ea4f7af8-83f8-42dd-afee-2230edf29ffa
2
public List<Trip> getTripsByUser(User user) throws UserNotLoggedInException { List<Trip> tripList = new ArrayList<Trip>(); User loggedUser = getLoggedUser(); if (loggedUser != null) { if (user.isFriendWith(loggedUser)) { tripList = getTripList(user); } return tripList; } else { throw new UserNot...
1134486f-1f6f-421e-93e8-ac0db1a73737
3
@SuppressWarnings ( { "unused", "resource" } ) @Test public void testWriteJournalLarge () throws Exception { if ( this.socketAddress == null ) { return; } try ( AFUNIXSocket sock = connectToServer() ) { System.err.println("Client running"); ...
d12190ca-5b7e-4dc7-a975-d8edbdd7d94f
6
public boolean exist(char[][] board, String word) { if (word.length() == 0) { return true; } int row = board.length; if (row == 0) { return false; } int col = board[0].length; boolean[][] visited = new boolean[row][col]; for (int ...
a7d1bcc6-0c10-459c-9d06-2d745dd2d600
3
private int brute(T[] a) { int inversions = 0; for (int i = 1; i < a.length; i++) for (int j = i - 1; j >= 0; j--) if (SortHelper.less(a[i], a[j])) inversions++; return inversions; }
97104670-543e-4ac3-8dd7-32f77f3cd47a
9
@Override public ByteBuffer get(String path) throws IOException { if (path.startsWith("/crc")) { return fs.getCrcTable(); } else if (path.startsWith("/title")) { return fs.getFile(0, 1); } else if (path.startsWith("/config")) { return fs.getFile(0, 2); } else if (path.startsWith("/interface")) { re...
2eb3fe66-7af5-4cec-9340-f17b2965eeb7
6
public void draw(Graphics g, double mx, double my) { g.setColor(Color.BLACK); if(held && mx < 90.0) { g.drawString("Angle: "+calcAngle(mx,my), (int)(x+10.0), 440); g.drawLine((int)mx, (int)my, (int)x, 400); double tempAngle = calcAngle(mx, my); double tx = x; double ty = 400.0; // Check if...
c47ce4c8-efcf-412a-ae14-639a0c8ffcc0
0
public long getPacketDelay() { return _packetDelay; }
4acbecd9-622b-4896-9a36-ef2f5b9a8d54
3
private static String formatToLength(String base, int length) { if (base == null) { throw new NullPointerException(); } String ret = ""; for (int i = base.length(); i <= length; i++) { ret += " "; } ret += base; if (base.length() - 1 > le...
d216690d-85f7-4c65-ae59-11384dbe8d1f
0
public Insertar() { initComponents(); }
533bbd03-f672-491a-b187-dba4bca26010
6
public void detectLang() { if (loadProfile()) return; for (String filename: arglist) { BufferedReader is = null; try { is = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "utf-8")); Detector detector = detectorFactory.crea...
73e7679d-7e40-4a09-97f6-5aa05279c747
2
public void visitIntInsn(final int opcode, final int operand) { mv.visitIntInsn(opcode, operand); if (constructor && opcode != NEWARRAY) { pushValue(OTHER); } }
ab4a0946-66c9-4798-af6b-a470c069b039
0
public void setCipherData(CipherDataType value) { this.cipherData = value; }
b6a8e106-8b5a-4be1-9e30-65228a843346
7
public Field(int dimension, int[] fieldSize, int countInRowForWin) throws NotImplementedException { this.dimension = dimension; this.countInRowForWin = countInRowForWin; switch (dimension) { case 2: d2Field = new int[fieldSize[0]][fieldSize[1]]; for (i...
279729eb-3606-48c8-b894-ed549a4cbc2e
4
private void sendRPC() { OpCode code = receivedRPC.getRPCOpcode(); if (code.equals(OpCode.PING_REQUEST)) { handlePingRequest(receivedRPC); } else if (code.equals(OpCode.FIND_NODE_REQUEST)) { handleFindNodeRequest(receivedRPC); } else if (code.equals(OpCode.FIND_VALUE_REQUEST)) { handleFin...
ff4436e9-75e4-4706-ae8a-059058dec1cd
8
@Override public void run() { try { gate.await(); } catch (InterruptedException | BrokenBarrierException e) { e.printStackTrace(); } isAtWork = true; if(theBusiness.timer.getTimeOfDay() >= arrivalTime) { System.out.println(theBusiness.timer.getCurrentTime() + " " + ...
3aff790a-5d2c-41b9-88a0-211e85f52033
2
@Override public void actionPerformed(ActionEvent e) { int confirmation = JOptionPane.showConfirmDialog(null, "Are you sure to delete card?", "Confirmation", JOptionPane.YES_NO_OPTION); if (confirmation == JOptionPane.YES_OPTION) { try { Connection conn; S...
395da3e3-9f3f-4bd2-af05-a54a52f3a129
2
public RepositoryHandler(String repositoryURL, String repositoryUsername, String repositoryPassword, int repositoryType) { this.repositoryUsername = repositoryUsername; this.repositoryPasword = repositoryPassword; this.repositoryType = repositoryType; this.repositoryURL = repositoryURL; ...
1e3e6e7d-f536-40aa-ba8b-0298388a49d6
5
public static void ex15(){ System.out.println("Taula de qualificacions del alumnes: "); System.out.println("Alumne\tConeptes (60%)\tProcediments (30%)\tActitud (10%)\tFinal"); int c=0, p=0, a=0; float f=0; DecimalFormat df=new DecimalFormat("0.00"); for(int i=0; i<25; i++){ c=(int)(Math.random()*11); p=(in...
f671f41b-502b-4e7f-8d63-f438a9ba9251
2
public double standardDeviation_of_ComplexRealParts() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } double[] re = this.array_as_real_part_of_Complex(); double standardDeviation = Stat.stand...
d7197588-2ebe-4d93-811e-ecbe4b51b2de
6
public void learnUnlabeledData(FrameSet unlabeledData, String partitionStyle, int partitionOption, double convergenceThreshold, double alpha){ double previousDistance = Double.MAX_VALUE; this.alpha = alpha; boolean converged = false; List<FrameSet> batches; while(!converged){ System.out.print...
c916453a-c12f-4589-9d02-096c9c801f8e
6
private void checkCollisions() { // Collision between ball and left paddle if (paddles[0].collide(ball)) { if (ball.getXSpeed() < 0) { changeBallTrajectory(true); } } // Collision between ball and right paddle if (paddles[1].collide(ball)) { if (ball.getXSpeed() > 0) { changeBallTrajectory...
c2421f6e-3f4d-406e-867e-3674fdf1d06f
4
@Test public void testWrongUser() throws Exception{ AccessControlServer server = new AccessControlServer(1935); server.start(); SpotStub spot = new SpotStub("139",1935); spot.start(); SpotStub security = new SpotStub("security",1935); security.start(); s...
480bdb36-98de-499f-a65d-57a5a55711d7
5
public RC4(final byte[] seed) { if (seed.length < 1) { throw new IllegalArgumentException("RC4 Key too short (minimum: 1 byte)"); } if (seed.length > 256) { throw new IllegalArgumentException("RC4 Key too long (maximum: 256 bytes)"); } for (int i = 0; i < 256; i++) { this.s[i] = i; } for (int i = 0; i ...
cd4276ca-8823-41b1-abcd-8cc492618323
1
public List findByProperty(String propertyName, Object value) { log.debug("finding Problem instance with property: " + propertyName + ", value: " + value); try { String queryString = "from Problem as model where model." + propertyName + "= ?"; Query queryObject = getSession().createQuery(queryString)...
503f0619-139d-46f1-90bf-455869cdf92e
4
public void updateList() { for (int i=0;i<parent.window.nbSongsInList;i++) { if (parent.tracksManager.tracksList.size()>i+listOffset) { Track thisTrack = parent.tracksManager.tracksList.get(i+listOffset); if (thisTrack.getId()==parent.tracksManager.currentTrack) getSpecificCell("edit", i).setValue...
03b5e402-a25d-4080-9d4b-c6b71a0978ca
0
public void setUserInput(int[] n) { userInput = n; }
b08e6d66-cf36-44f2-a95a-52917feaec6c
9
@Override public ArrayList<Chromosome<T>> update() { if(chromoPool.size() % (settings.getInt("GAmkIII.popDivision") * 2) != 0) { throw new RuntimeException("Gene pool size (" + chromoPool.size() + ") is not dividable by " + (settings.getInt("GAmkIII.popDivision") * 2)); } ...
a39464d1-65a7-4b36-9533-5aae51c58a75
1
@Override public V get(K key) { int i = findEntry(key); if (i < 0) return null; return bucket[i].getValue(); }
0b972e8e-b24d-4004-ab69-61cb0f8cdb61
8
public VoidValue visitDefine(DefineComponent c) { addLeadingComments(c); String name = c.getName(); SourceLocation location = c.getSourceLocation(); Annotation annotation = makeAnnotation(c); if (name == DefineComponent.START) { if (!si.isIgnored(c)) { Pattern body = c.ge...
16b21def-ce36-4a04-be98-35903dcfc112
3
public ReleaseType getLatestType() { this.waitForThread(); if (this.versionType != null) { for (ReleaseType type : ReleaseType.values()) { if (this.versionType.equals(type.name().toLowerCase())) { return type; } } } ...
f68807cc-a4ec-449a-b165-f90458537196
8
private String getHelp(String ind) { boolean found = false; String help = ""; try { int index = Integer.parseInt(ind); for(Command leaf : currentMenu.getCommands()) { if(leaf.getIndex() == index) { help = "[" + leaf.getDesc() + "] " + leaf.getHelp(); found = true; } } for(CmdMenu nod...
e3bbc6e8-7708-438d-884f-3a9d76f6e1c6
7
@Override public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException { TypeOracle typeOracle = context.getTypeOracle(); JClassType type = typeOracle.findType(typeName); if (type.isAbstract() && type.isInterface() == nul...
8907c1fc-7d23-43d1-a8a6-885605c18363
7
public void updatePtgs() { if( expression == null ) // happens upon init { return; } byte[] rkdata = getData(); int offset = 15 + cch; // the start of the parsed expression int sz = offset; int sz2 = rkdata.length - (offset + cce); cce = 0; // add up the size of the expressions for( int i = 0; i...
e37fdce8-8920-41ac-be37-d87d5b8ad47a
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
43c22906-211b-4db3-b851-1a57e3f416ae
4
@Override public void appendTo(Appendable out) { try { boolean needComma = false; out.append('{'); for (Map.Entry<String, Object> entry : mMap.entrySet()) { if (needComma) { out.append(','); } else { needComma = true; } out.append(Json.quote(entry.getKey())); out.append(':'); ...
3fcb2552-8951-40f0-830a-9906f5d65584
6
private SplayNode<K> search(K data) { if (data == getRoot().data) { return this.root; } else { SplayNode<K> padre = null; SplayNode<K> hijo = this.root; while ((hijo != null) && (hijo.data != data)) { if ((Integer)data < (Integer)hijo.data) { ...
355148b7-9ddd-4345-bd91-513d17300b0f
4
private MenuItem prompt() throws IOException { int option; while (true) { display(); BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String line = input.readLine(); try { option = Integer.parseInt(line); if (option >= 0 && option < this.menuItems.size()) { ret...
887fb299-b9c6-44a4-894a-73a130cfbdba
2
public boolean noticeUser(String user, String msg) { boolean success = true; String[] msgSplit = msg.split("\n"); for(int i=0;i<msgSplit.length;i++){ if(!sendln("NOTICE " + user + " :" + msgSplit[i]) ) { success = false; } } return success; }
1c73599f-626a-4332-8aee-7e7eef203f51
8
protected void applyShadow(BufferedImage image) { int dstWidth = image.getWidth(); int dstHeight = image.getHeight(); int left = (this.shadowSize - 1) >> 1; int right = this.shadowSize - left; int xStart = left; int xStop = dstWidth - right; int yStart = left; ...
9a0802dc-2b78-4b66-b182-cd3b7ee49514
9
public void refreshFields(){ this.removeAll(); GridBagConstraints pCon = new GridBagConstraints(); traceBox = new SubPanel(getTopLevelContainer()); intBox = new SubPanel(getTopLevelContainer()); deriveBox = new SubPanel(getTopLevelContainer()); GridBagConstraints bCon = new GridBagConstraints(); ...
76a10ba7-583a-477a-a787-a2b5677b1efe
1
public <T> void put( CapabilityName<T> name, T capability ){ if( capability == null ){ capabilities.remove( name ); } else{ capabilities.put( name, capability ); } }
f6897a9b-40db-4f3b-ade8-c1b2be12678c
9
private void updateComponents(boolean inserted) { Map<Class, Object> map = new HashMap<Class, Object>(); for (Element i : elementFlow) { content = (AbstractDocument.LeafElement) i; enum3 = content.getAttributeNames(); synchronized (enum3) { while (enum3.hasMoreElements()) { name = enum3.nextElemen...
b9019f48-cfd3-4bf4-a5a5-e59356a502c7
4
static private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch(curChar) { cas...
0e689624-a9cf-4177-951b-dc1b74700dcf
0
public String getAddressType() { return addressType.get(); }
31442987-a7bb-4284-84d1-56c89338d0ee
6
public static Description instantiateExternalVariables(Description self, KeyValueMap bindings) { if (!(bindings.emptyP())) { { Object old$Evaluationmode$000 = Logic.$EVALUATIONMODE$.get(); Object old$Queryiterator$000 = Logic.$QUERYITERATOR$.get(); try { Native.setSpecial(Logic.$EVA...
3c2bed70-204d-4a7a-ab6d-fa80bed99c08
1
public String tcp2String(Packet packet) { TCPPacket tcpPacket = (TCPPacket) packet; //Creates a tcpPacket out of the received packet EthernetPacket ethernetPacket = (EthernetPacket) packet.datalink; //Creates a ethernet packet to get the ether layer stuff methodData += src_macInEnglish = ethernetPacket.getS...
4d2d6d1a-70e2-4bf1-9052-601d9139a063
6
final void da(int i, int i_636_, int i_637_, int[] is) { float f = ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5681) + ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5662) * (float) i + (((Class101_Sub1) ((SoftwareToolkit) this).aClass101...
a9066bf2-580c-4da5-8a3c-877b28fd39ce
6
@Override public void addDevice(Device device) { Connection conn = null; PreparedStatement st = null; try { conn = OracleDAOFactory.createConnection(); st = conn.prepareStatement(INSERT_DEVICE); int id_prev = device.getIdPrev(); if (id_prev == -1) { st.setNull(1, Types.INTEGER); } else { s...
5f364825-fa40-483f-8764-be1e82203aad
5
private PairNode<T> compareAndLink(PairNode<T> first, PairNode<T> second) { if (second == null) { return first; } if (compare(second.element, first.element) < 0) { second.prev = first.prev; first.prev = second; first.nextSibling = second.leftChild...
dfa386c5-9a7d-4812-9733-ebb9c811d2b9
7
public boolean inside(int ax,int ay,int aw,int ah,int bx,int by,int bw,int bh) { return ((ax > bx && ax < bx+bw) && (ay > by && ay < by + bh) && (ax + aw > bx && ax + aw < bx + bw) && (ay+ah > by && ay+ah < by+bh)); }
6417496c-3258-4c68-80fe-648673e7be61
0
public void setIssueNo(String value) { this.issueNo = value; }
dea70034-63c3-4e36-bf8c-b09e77f78afb
7
@Override public boolean equals(Object obj) { if(this == obj) return true; // this ensures that they both belong to the same switch if(!super.equals(obj)) return false; if(!(obj instanceof VirtualPort)) return false; ...
e701ee04-d09c-43e3-a142-1444c375bfb3
0
public ModUserLoginEvent(Player player) { this.player = player; }
1b5db228-1380-4cef-9783-dc283d3ab60f
6
public ArrayList<Node> generateER(int n,double p){ int linkCounter = 0; int v = 1; int w = -1; double r; long start = System.currentTimeMillis(); Random gen = new Random(); ArrayList<Node> nodes = new ArrayList<Node>(); Link link; for(int i=0;i<n;i...
26552793-164f-457c-b68a-3c864e0f2f71
4
boolean exactlyEqual(DsDef def) { return dsName.equals(def.dsName) && dsType.equals(def.dsType) && heartbeat == def.heartbeat && Util.equal(minValue, def.minValue) && Util.equal(maxValue, def.maxValue); }
be893d29-4cde-47f3-a730-b8be07965d63
8
public static int countNeighbours(boolean [][] world, int col, int row){ int total = 0; total = getCell(world, col-1, row-1) ? total + 1 : total; total = getCell(world, col , row-1) ? total + 1 : total; total = getCell(world, col+1, row-1) ? total + 1 : total; total = getCell(world, col-1, row ) ? total + 1...
d62ce794-3495-45fc-b588-813318214ff8
5
public static void printMatrix(Object[][] M) { // Calculation of the length of each column int[] maxLength = new int[M[0].length]; for (int j = 0; j < M[0].length; j++) { maxLength[j] = M[0][j].toString().length(); for (int i = 1; i < M.length; i++) maxLength[j] = Math.max(M[i][j].toString().length(), ...
88d05b14-e592-460c-81eb-9eacabb991e5
8
private final void checkoutBand() { final NoYesPlugin plugin = new NoYesPlugin("Local repository " + this.repoRoot.getFilename() + " does not exist", Main.formatMaxLength(this.repoRoot, null, "The directory ", " does not exist or is no git-repository.\n") + "It can take a while to create it. Conti...
5a7bbf7d-e120-43b3-bc1f-59a0434eb4cc
2
public void setKilpienergia(double energia){ if (-50 <= energia && energia <= 100){ this.kilpienergia = energia; } }
b7f1409e-cc21-4c7f-8be7-1a15bfa29de1
4
public void setup(Plugin p) { this.p = p; if(!p.getDataFolder().exists()) p.getDataFolder().mkdir(); cfile = new File(p.getDataFolder(), "ezPermissions.yml"); if(!cfile.exists()) { try { cfile.createNewFile(); } catch (Exception e) { e.printStackTrace(); } } config = YamlConfiguration.load...
a4e4b9a2-6b3a-4597-8dca-4d679c1f76dc
5
public Database() { if (Misc.is(Constants.DatabaseType, new String[] { "sqlite", "h2", "h2sql", "h2db" })) { this.driver = "org.h2.Driver"; this.dsn = ("jdbc:h2:" + Constants.Plugin_Directory + File.separator + Constants.SQLDatabase + ";AUTO_RECONNECT=TRUE"); this.username = "sa"; this.pas...
964760d2-d581-4b59-b821-d25afb2c0688
7
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true) public void onBreak(BlockBreakEvent event) { if(!event.getBlock().getWorld().getName().equals(p.getWorld())) return; Player player = event.getPlayer(); Location loc = event.getBlock().getLocation(); Chunk c = loc.ge...
dc79dcf1-9828-4a24-a356-1af8962bda9f
9
private void dispatchHotkeys(GameContainer c) throws SlickException { Input input = c.getInput(); if (input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) { bodies.insert(new Body(input.getMouseX() * scale, input.getMouseY() * scale, 0, 0, 1e19, 1e4)); } if (input.isKeyPressed(Input.KEY_R)) { in...
564160ea-61fd-4f26-9deb-b4f494e60a3b
6
@EventHandler public void WolfMiningFatigue(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.MiningF...
fde25fd1-c8c9-4fa9-9526-5444ad592b3f
7
*/ public void spaceVertical(FastVector nodes) { // update undo stack if (m_bNeedsUndoAction) { addUndoAction(new spaceVerticalAction(nodes)); } int nMinY = -1; int nMaxY = -1; for (int iNode = 0; iNode < nodes.size(); iNode++) { int nY = getPositionY((Integer) nodes.elementAt(iNode)); if (nY < nM...
2dde16b7-5fef-44a5-874f-b785c94530ce
8
private RubiksCube doRotate(Rotation aDirection, Face aFace, int offset, int tlCubieIdx, int trCubieIdx, int brCubieIdx, int blCubieIdx, int topCubieIdx, int rightCubieIdx, int bottomCubieIdx, int leftCubieIdx) { // cube's are immutable so we need to return a new cube state. byte[] toReturn = new byte[20]; ...
8e69b575-c9f2-4063-a38e-04b89d47908b
7
public static void main(String[] args) throws IOException { SSPPBuildManager manager = new SSPPBuildManager(); if (args.length != 3) { LOG.info("Usage: java SSPPBuildManager CIUrl tempFolder formalBuildFolder"); System.exit(0); } else { CI_URL = args[0]; ...
310720bb-6d81-4f27-b298-c708a9f2eaa5
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
3e15d7f2-86da-4e7c-b9f2-db735a65faf4
8
@Override public void remove(Integer[] ids) throws DaoException { if ((ids == null) || (ids.length < 1)) { return ; } PooledConnection connection = null; PreparedStatement pStatement = null; try { connection = (PooledConnection) cp.takeConnection(); StringBuffer query = new StringBuffer(NewsD...
0949816f-8e39-4a09-8c72-c11b347ad6dc
1
private static String FormatInt(String value) { if (value.length() == 1) { return "0" + value; } else { return value; } }
52a86ec5-6280-44f5-89a5-c14def6b3b96
9
private java.util.ArrayList<Element> findImplementations(String base){ java.util.ArrayList<Element> elements = new java.util.ArrayList<Element>(); NodeList Schemas = getSchema(); for (int i=0; i<Schemas.getLength(); i++ ) { Node node = Schemas.item(i); String typeName =...
4395560b-343e-4e4f-9520-7bf3d732c535
9
int[] mergeObjects(List<Detection> detections, ArrayList<Detection>[][] grid, HashMap<String, Double> sizeInformation) { long startTime = System.nanoTime(); int num_groups = 0, num_excess = 0; double ra_cell_size = sizeInformation.get("ra_cell_size"); double dec_cell_size = sizeInformat...
ddcc4bf9-bdd5-436f-bfff-44debd96fe96
2
@Before public void setUp() throws Exception { File f = new File(tmpFilename); if (f.exists()) if (!f.delete()) throw new IOException("Can't delete cache file for testing\n"); f = null; }