method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
220a01aa-1008-4af3-bbc2-9fa45fca6b55
6
public static final String colorToHex(Color color) { String colorStr = "#"; // Red String str = Integer.toHexString(color.getRed()); if (str.length() > 2) throw new Error("invalid red value"); else if (str.length() < 2) colorStr += "0" + str; else colorStr += str; // Gre...
d1e2ae0d-372c-4d97-baf5-9632d9b64e55
0
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("CarPhysics"); sb.append("{movingObject=").append(movingObject); sb.append(", solidObject=").append(solidObject); sb.append('}'); return sb.toString(); }
058b58d0-e4e3-448a-ba96-578dc913cb61
9
@SuppressWarnings({ "unchecked", "rawtypes"}) public String require(String id) throws FileNotFoundException{ String uri = loaded.get(id); if(uri != null){ return uri; } else { Map<String, Map> map = this.getMap(id); Map<String, Map> res = map.get("res"); ...
f9c0eb3d-5179-4f28-8fd3-65e8405d94b1
5
public void createAlias(final Name o, final String name) throws DataException { assert (o != null): "Supplied object is null"; assert (name != null): "Supplied name is null"; E obj; try { obj = (E) o; } catch (ClassCastException e) { throw new AssertionError("Type covariance error"); } final String ...
b4f8203f-8e8d-42e5-a5b1-4457f1bc1205
8
private void checkFinished() { int[] sums = new int[8]; // Sum rows, columns and diagonals sums[0] = this.board[0] + this.board[1] + this.board[2]; sums[1] = this.board[3] + this.board[4] + this.board[5]; sums[2] = this.board[6] + this.board[7] + this.board[8]; sums[3] = this.board[0] + this.board[3] ...
0a90e796-d1cc-415a-839b-35de1dcbb0ee
8
static JavaMembers lookupClass(Scriptable scope, Class dynamicType, Class staticType, boolean includeProtected) { JavaMembers members; ClassCache cache = ClassCache.get(scope); Hashtable ct = cache.classTable; Class cl = dynamicType; for (;...
9be67ba9-369d-49bf-87f9-5f5ea4c25d44
7
public String removeBlocks(String completeCode) { int depth = 0; String blockContents = ""; char[] charList = completeCode.toCharArray(); completeCode = ""; for(char c : charList) { if(c == '{') { depth++; if(depth > 1) { ...
b1b74287-e2cc-4003-b8d9-9419fa31f5b2
8
public int minimumTotal(ArrayList<ArrayList<Integer>> triangle) { int out = 0; int min; if (triangle == null || triangle.size() == 0) return out; int tLevel = triangle.size(); out = triangle.get(0).get(0); ArrayList<Integer> candidate = new A...
0c2f6b7a-f1b6-4905-97c4-07dd281f6d6e
0
public void setLeft(IntBTNode newLeft) { left = newLeft; }
5a7f8428-84a5-4609-8e70-41cb31b29f80
0
public ProcessedCell getNextCell(){ return nextCell; }
7912c1e1-77cc-44b7-aa6e-f4ef2c7dbda9
1
@Override public void operate(FlowProcess flowProcess, BufferCall<TupleEntry> bufferCall) { // get the group values for the current grouping TupleEntry group = bufferCall.getGroup(); // get the current argument values for this grouping Iterator<TupleEntry> arguments = bufferCall.get...
3064bc4e-c730-4faa-b115-4aa28d01deb4
2
private void dfs(Graph G, int v) { marked[v] = true; adjCount[v]++; for (int w : G.adj(v)) if (!marked[w]) dfs(G, w); }
893667d3-10ae-4d49-9394-4c8e077ccce3
6
public SetExecutor getSetExecutor(Class locatorClass, Object identifier, Class arg) { final Class<?> clazz = locatorClass; final String property = (identifier == null ? null : identifier.toString()); // 尝试一下bean处理 if (property != null) { PropertySetExecutor pExecutor = new P...
ba68b51c-c1cc-4714-bc61-6116892ea84c
4
@Override public double reValue(double x, double y) { if (g == 0) { value = x; word = "x"; } else if (g == 1) { value = y; word = "y"; } else if (g == 2) { value = y + x; word = "y+x"; } else if (g == 3) { value = y * x; word = "y*x"; } return value; }
fa9375dd-4263-4c10-a3e7-1ad1abc340d1
2
public void disable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (!isOptOut()) { configuration.set("opt-out"...
0ea22bdd-4ed2-480f-874f-3101545f1d78
5
public static void main(String[] args) { Scanner s = new Scanner(System.in); String palin, newPalin; boolean isPalin = true; newPalin = ""; System.out.println("Please enter a text that may or may not be a palindrome: "); palin = s.nextLine(); ...
941684a4-227a-4068-81be-a2b3de9b2a3c
2
private static ColorCode string2ColorCode(String s) throws Exception { ColorCode[] values = ColorCode.values(); for (ColorCode c : values) { if (s.compareTo(c.toString()) == 0) return c; } throw new Exception(); }
45d4ea80-ebac-4434-84e9-d1d7d76139db
1
public void nuevo(Usuario usuario) throws SQLException { PreparedStatement sentencia = null; String sentenciaSql = "INSERT INTO " + Constantes.TABLA + " (" + Constantes.NOMBREPC + ", " + Constantes.IP + ", " + Constantes.NOMBRE + ", " + Constantes.CONTRASENA + ") VALUES (?, ?, ?, ?)"; sentencia = conexion.pr...
8ef03fae-d27e-4b83-a536-31a09430e682
9
@SuppressWarnings("rawtypes") private String reaplaceObject(ExcelSheetVo sheet, int colIndex, int rowIndex) { ArrayList colList = (ArrayList) sheet.sheetData.get(colIndex); String value = (String) ((ArrayList)sheet.sheetData.get(colIndex)).get(rowIndex); String linkExcelName = (String) colList.get(ExcelConst.LI...
cef6622c-9649-40b4-a3e1-f06e55b34f28
0
@Override public void buildSauce() { pizza.setSauce("hot"); }
6d44d515-b586-4ed3-913f-2b7dfd49b54c
0
public Iterator<City> iterator(){ return cityMap.values().iterator(); }
6c413390-e17c-4585-8f68-d3a906f7f293
1
public double abs(double x){ if(x<0){ return -x; }else{ return x; } }
dab70040-9926-4e75-9730-5f21768d56a8
0
@Override public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; super.paintComponent(g2d); Draw(g2d); }
d45682d1-6189-439f-aae6-8ac9d50994cf
3
int bfs( Long rootId ) { int numOfNodes = 0; Queue<Long> q = new LinkedList<Long>(); q.add(rootId); while( !q.isEmpty() ) { numOfNodes ++; Long id = q.poll(); if( adjacencyList.containsKey(id)) { for (Long childId : adjacencyList....
1fd70faf-6eb7-405d-accb-3419e7c5ee4e
4
@Override public void run() { short ret = MsgAnalyzerCmnDef.ANALYZER_SUCCESS; // TODO Auto-generated method stub while (!exit.get()) { try { synchronized(this) { wait(); // Wait for the signal, the thread should be created first // Parse each data from the serial port ret = MsgAnalyze...
6acc8e47-4f67-49d2-b0c2-e2f170720f19
3
private static boolean isLeapYear(int year){ if (year%4==0 && year%100!=0){ return true; } else if (year%400 == 0){ return true; } return false; }
d2001c60-c728-4a60-aa5d-9a1231eef927
0
public void show() { ((DocumentSettingsView) GUITreeLoader.reg.get(GUITreeComponentRegistry.JDIALOG_DOCUMENT_SETTINGS_VIEW)).configureAndShow(this); }
00fadc96-3e85-4692-8e20-e87d32446088
7
public void tick(PlayField field) { ticks++; float lastX = x; xVel = xVel + xAcc / 10.0F; yVel = yVel + yAcc / 10.0F; x += xVel; if(x < width / 2) { x = width / 2; } if(x > Game.WIDTH - width / 2) { x = Game.WIDTH - width / 2; } y += yVel; xVel = xVel / friction; yVel = yVel / friction;...
5a752633-ce4f-44f9-b6bb-1c030fea1ceb
1
public String getInt(String[] args){ if(args!=null & args[0].length()>0){ return String.valueOf(df.getNumberBetween(Integer.parseInt(args[0]), Integer.parseInt(args[1]))); } else{ return String.valueOf(df.getNumber()); } }
552a6253-b9dc-4fe1-b0de-3e0f072098a4
3
public PriorityQueueTest() { queue = new PriorityQueue<>(new Comparator<Double>() { @Override public int compare(Double o1, Double o2) { if (o1.doubleValue() > o2.doubleValue()) { return 1; } else if (o1.doubleValue() < o2.doubleValue(...
72d58abf-468f-4e1d-8d8b-167cf2ff796f
8
public void actionPerformed(ActionEvent e){ //PopupMenu listener if ("Add".equals(e.getActionCommand())) addObjective(); else if ("Remove".equals(e.getActionCommand())){ removeObjective(); addBranchToList(); } else if ("Delete".equals(e.getActionCommand())){ ...
ef688b34-3f90-44d4-a2af-6d4fb1464f7c
9
@Deprecated private List<PFPAd> getTopReviewedPlaces(RequestBean request, Document doc, Set<String> listingsToIgnore, int requiredSize) throws CitysearchException { log.info("PFPProxy.getTopReviewedPlaces: Begin"); List<PFPAd> pfpAds = null; if (doc != null && doc.hasRootElement(...
a66559db-24f0-4759-902a-e82bf3d0d83b
7
public void keyPressed(KeyEvent e) { float cx, cy; switch (e.getKeyCode()) { case KeyEvent.VK_MINUS: cx = view.getCenterX(); cy = view.getCenterY(); view.setWidth((int)(view.getWidth() / 1.1)); view.setHeight((int)(view.getHeight() / 1.1)); view.setCenterPosition(cx, cy); break; case KeyEvent...
a74fd373-a61a-411f-b9ec-3a2f66ab4078
6
private void readObject(ObjectInputStream in) throws IOException { int keys=in.readInt(); entitiesByDepth=new HashMap<Integer,ArrayList<Entity>>(); for(int i=0;i<keys;i++) { int key=in.readInt(); ArrayList<Entity> entities=new ArrayList<Entity>(); try { int size=in.readInt(); for(int a=0;a<...
90b16170-beeb-46fa-b9d1-e1d473151dbc
1
@Override public int hashCode() { int hash = 0; hash += (ssn != null ? ssn.hashCode() : 0); return hash; }
e76e69b2-2060-466c-bb85-43f0c6162231
6
public void attach(String type, Observer o) { switch(type) { case "TENSION": TensionListeners.add(o); break; case "SPEED": CableSpeedListeners.add(o); break; case "TORQUE": TorqueListe...
96347874-e5f7-4206-8413-fc5488577298
6
public boolean pickAndExecuteAnAction() { if (!marketBills.isEmpty()){ for (Market market : marketBills.keySet()){ ProcessMarketBill(market, marketBills.get(market)); marketBills.remove(market); return true; } } synchronized(bills){ for(Bill iBill : bills){ if(iBill.state == BillState.pendi...
5b33733c-41f4-437d-a6e4-9f34a28bba3f
8
public int getFitness(){ int totalValue = 0; int totalSize = 0; for(int i = 0; i < chromasome.length; i++){ if(chromasome[i] == 1){ totalValue += Constants.items.get(i).value; totalSize += Constants.items.get(i).size; } } this.itemSize = totalSize; int sizeOver = 0; if(totalSize > Constants....
6fe71dad-e8af-4ef3-bc8d-471efdf92b31
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { final boolean ifnecessary=((commands.size()>1)&&(commands.get(commands.size()-1).equalsIgnoreCase("IFNECESSARY"))); final Room room = CMLib.map().roomLocation(mob); if(CMLib.flags().isStanding(mob)) ...
4a076592-2863-4fcc-9733-c3a92bf19d6b
9
void setParameterNames(MethodSymbol sym, Type jvmType) { // if no names were found in the class file, there's nothing more to do if (!haveParameterNameIndices) return; int firstParam = ((sym.flags() & STATIC) == 0) ? 1 : 0; // the code in readMethod may have skipped the firs...
f88e961d-57df-463a-94a2-980bbb00e7de
6
@Override public final void handleCommand(ISender sender, String commandString) { String[] words = commandString.split("[ ]"); String commandName = words[0].toLowerCase(); String[] arguments = new String[words.length - 1]; // Copy the arguments over and leave the command name out System.arraycopy(words, 1,...
1cf86866-7de2-4f55-99bc-1658974ba94d
7
private int[] merge(int[] leftArray, int[] rightArray) { int mergedLength = leftArray.length + rightArray.length; int[] mergedArray = new int[mergedLength]; int leftIndex = 0; int rightIndex = 0; while (leftIndex + rightIndex < mergedLength) { // There are still items to be merged if (leftIndex < le...
18616bc3-d110-43b5-af9f-8801d1ac16ed
3
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
77809cbf-4d27-4c82-98b0-51e562783f61
4
public char getNextChar() { try { //Leemos un caracter y seteamos a nuestra variable currentChar de objeto setCurrentChar((char) pr.read()); //Sumamos 1 al caracter en la línea setNumeroDeCaracterEnLinea(getNumeroDeCaracterEnLinea()+1); ...
8d5b42cd-07fa-4252-8e80-bb55884a209f
9
public Integer readInteger() throws IOException { int x = readByte(); if (isNil(x)) { return null; } else { int ret; if ((x & (1 << 7)) == 0) { // positive fixnum stores 7-bit positive integer // +--------+ // |0XXXXXXX| // +--------+ ret = x & 0x7f; } else { if ((x & 0xe0) == ...
d77cf358-e290-4f4a-b565-c5531d19aeb2
3
public void setTrue(int time) { if(time == Time.DAY) { dayPhase = true; } else if(time == Time.DUSK) { eveningPhase = true; } else if(time == Time.NIGHT) { nightPhase = true; } }
ace4f96b-0d40-4f67-b206-ec7a83e8310b
1
public void testWith2() { Partial test = createHourMinPartial(); try { test.with(null, 6); fail(); } catch (IllegalArgumentException ex) {} check(test, 10, 20); }
46f8ac88-9d43-47ce-b4ad-71596457c205
8
static void BFS() { HashMap<Integer, Boolean> hm = new HashMap<Integer, Boolean>(); HashMap<Integer, Integer> ht = new HashMap<Integer, Integer>(); Queue<Integer> q = new LinkedList<Integer>(); hm.put(0, Boolean.TRUE); for (int i = 1; i < P; i++) { hm.put(i, Boolean.F...
e69d2a69-422a-4e42-ae4d-baf4817c6973
9
protected void sendBidAndAds() { bidBundle = new AdxBidBundle(); /* * */ int dayBiddingFor = day + 1; /* A fixed random bid, for all queries of the campaign */ /* * Note: bidding per 1000 imps (CPM) - no more than average budget * revenue per imp */ double rbid = 10000.0; /* * add...
864b68a3-76af-4ba6-9c3f-fe4ffa0bf2cb
0
@Override public String toString() { return getDescription(); }
73557f39-97b7-4245-b50f-e6afa36bdede
1
private static char getChar(final String signature, int pos) { return pos < signature.length() ? signature.charAt(pos) : (char) 0; }
ab8bb74c-0864-45cd-b3b1-fcd7d8f7e56d
3
@Test public void IngredientTest() { ArrayList<Keyword> ingredient = new ArrayList<Keyword>(); ingredient.add(loadKeyword(174)); //tomato try { DialogTest.currentDialog.updateState(ingredient, null, null); } catch (WrongStateClassException e) { //never Reached } assertTrue(DialogTest.currentDialog.ge...
73fe8849-3329-4ffc-8ab0-ca276e3edf9b
1
public void addListener(PluginListener<T> listener) { Validate.notNull(listener, "Listener cannot be null."); Validate.isTrue(!listeners.containsKey(listener.getClass()), "Listener cannot already exist!"); listeners.put(listener.getClass(), listener); if (registered) listener...
33c0871b-829d-41e9-b615-981d53c85353
2
private void updateParticlePositions() { for(int i = 0; i < position.length; i++){ for(int k = 0; k < position[i].length; k++){ position[i][k] = position[i][k] + velocities[i][k]; } } }
0cd1fb2c-6dca-4514-a88d-9cff030eac5b
0
public int getStartLineNumber() { return startLineNumber; }
9a8cba8d-2edd-4d84-907f-914913123936
8
public static void changeClass(int studentNum, int periodNum1, int periodNum2) { Course course1; Course course2; //Sets course if(periodNum1 == 1) { course1 = StudentInformationSystem.studentList.get(studentNum - 1).getCourse1(); } else if(periodNum1 == 2) { course1 = StudentInformationSyst...
9b4268af-cb5e-4d93-bb7b-0965e928432c
6
public static int getMaxNumInQueue(String qType) { if (maxNumInQueue.containsKey(qType)) return maxNumInQueue.get(qType); ArrayList<QueueInfo> list = queuesInfoMap.get(qType); int max = 0; int timeAvg = 0; int maxTime = 0; Iterator<QueueInfo> it = list.iterato...
238b34a4-54c7-4a55-9b9b-d2e3cbee9ca9
8
public int getLengthOfMaxBitonicSubArray(int[] a) throws IllegalArgumentException { if (a == null || a.length == 0) { throw new IllegalArgumentException(); } /* * Keep track of sequence lengths: * (1) from low to high: check a[i] <= a[i + 1] condition * (2) from high to low: check a[i] >= a[i - 1...
1897bdd7-1bde-49e9-a8e6-35451b87b15b
4
public Basefont(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "color": color = Color.parse(this, v); break; case "face": face = Face.parse(this, v); break;...
49d63e79-c1f8-40e6-9cd8-769dbf84b221
5
private String[] getPlayerNames() { String[] playerNames = new String[10]; Scanner inFile = Sudoku.getInputFile(); System.out.println("\n\t---------------------------------------------------------------"); System.out.println("\t Enter a list of names of those who will b...
c4958dac-0af2-4643-a68c-9b4f6de6d6e9
2
public void sort(int[] inputArr) { if (inputArr == null || inputArr.length == 0) { return; } this.array = inputArr; length = inputArr.length; quickSort(0, length - 1); }
18f6f038-c0be-473b-af2f-83409dae0d00
0
public BumonComboBox() { setupItems(); setupHandler(); }
079f547b-5fcb-48bc-9497-930693166007
2
private void setupNoRandPartB() throws IOException { if (this.su_ch2 != this.su_chPrev) { this.su_count = 1; setupNoRandPartA(); } else if (++this.su_count >= 4) { this.su_z = (char) (this.data.ll8[this.su_tPos] & 0xff); this.su_tPos = this.data.tt[this.su...
5ba25a1f-ed08-4f9a-8052-44f91cf7e3b3
4
public void beginRound(){ // Get new peer to talk to Peer peer = peerList.getNextPeer(); if (peer == null) return; // Abstract the link from the peer Link link = connect(peer); if (link == null) return; //System.out.println("Sending to: " + peer.hostname + " " + link.remoteHost); for (int i=0; i<me...
1dca3c20-d8dc-4ec1-b147-54525a68cb66
1
public List<University> universityList() throws SQLException{ UniDatabaseManager dm = new UniDatabaseManager(); String sql = "select * from university;"; ResultSet rs = dm.sqlQuery(sql); List<University> uList = new ArrayList<University>(); while (rs.next()){ int universityId = rs.getInt("id"); St...
c33afe53-e5a1-496b-868f-97fc31799b52
0
public void setFunTerminal(String funTerminal) { this.funTerminal = funTerminal; }
a161297a-112a-4908-b048-853c086008cb
3
public void startTurn(int day, core.Player player) { this.player = player; System.out.println("startTurn"); statusGold.setText(""+player.getResource(core.ResourceType.GOLD)); statusOre.setText(""+player.getResource(core.ResourceType.ORE)); statusWood.setText(""+player.getResource(core.ResourceType.WOOD));...
dc3ae52d-a770-4b74-a673-3d61e65289ff
7
private void initElements(String title, int size, Director director, boolean editable) { // labels lName = new JLabel("Name"); lForename = new JLabel("Vorname"); lFamilyname = new JLabel("Nachname"); lNationality = new JLabel("Nationalität"); lBirthday = new JLabel("Geburtstag"); lMovie = new JLabel("Filme...
c8718429-c53b-42cf-8ffa-895898bd12b8
9
static double[] f(int p,int ant,boolean ws){ if(p==N)return new double[]{1.0,ws?1.0:0.0}; if(mem[p][ant+1][ws?1:0]!=null)return mem[p][ant+1][ws?1:0]; double a=0,b=0; for(int i=0;i<=K;i++) { double[] s=f(p+1,i,ws&&(ant==-1||abs(ant-i)<=1)); a+=s[0]; b+=s[1]; } return mem[p][ant+1][ws?1:0]=new doub...
1f4cf99a-e6ef-4289-b156-422c42f3e080
8
void assignment() { colormap = new int[colors]; colors = 0; root.colormap(); int pixels[][] = this.pixels; int width = pixels.length; int height = pixels[0].length; Search search = new Search(); // convert to indexed co...
7c74a830-1947-47e2-9922-e949d682572a
8
public int getHeight(String text) { DisplayList displayList = null; if (displayListCaching) { displayList = (DisplayList)displayLists.get(text); if (displayList != null && displayList.height != null) return displayList.height.intValue(); } int lines = 0; int maxHeight = 0; for (int i = 0; i < text.le...
5044bee2-389e-41a4-aa9a-8fc43c7434c0
9
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void setDamageMulti(EntityDamageByEntityEvent event) { // We are only interested in these three damage types if (event.getCause() != DamageCause.ENTITY_ATTACK && event.getCause() != DamageCause.PROJECTILE && event.getCause() != DamageCa...
9665757a-d8f4-4093-bbef-fa431565bc71
9
private void parseNodeGroup(String key, String value) { switch(key) { case "Geometry": node.geometry = parseVector3f(value); break; case "BulkMaterial": node.bulkMaterial.add(parseMaterial(value)); break; case "AnisoCarcassConductivityMult": node.anisoCarcassConductivityMult = parseVector3f(value...
e8a474be-e70c-4dfd-bfdb-bce9785f5b0a
8
public void updateEnemies( ) { for ( int i = 0 ; i < enemyList.size( ) ; i ++ ) { Enemy ene = enemyList.get( i ); ene.move( ); if ( ene.isDead( ) ) { ene.setAlpha( ene.getAlpha( ) - 0.0005f ); float enemySpeed = ene.getSpeed( ); if ( enemySpeed > 0f ) enemySpeed -= 0.2f; else enemySpeed = 0...
e6c43242-08c8-45a9-822c-fa4eb9b8e408
9
private int getRepresentationByteCountPerColumn(int representation, int byteLength) { switch (representation) { case REPRESENTATION_TIME: return 8; case REPRESENTATION_INT_HEX: case REPRESENTATION_INT_DEC: case...
fe70a6fb-a2fe-4225-8ca5-e1a8db18e3f9
8
public InputStream _openInputStream(String fileName) throws IOException { Log.log(Log.IO, "open stream: " + fileName); fileName = concatPath(documentBase, fileName); // System.out.println ("concatenated: "+fileName); if (isUrl(fileName)) { //System.out.println(...
9a7b77bc-d16b-425f-937a-5f31a2c33303
6
public static Cons inheritDescriptionPropositions(Vector arguments, Description description, Object [] MV_returnarray) { { KeyValueMap mapping = KeyValueMap.newKeyValueMap(); { PatternVariable v = null; Vector vector000 = description.ioVariables; int index000 = 0; int length000 = vect...
99f0b53d-59ae-4366-aa2c-6f9a94468199
4
private boolean is_in(Vector<Identifier> parent, Vector<Identifier> child) { int pi = 0; int ci = 0; while (true){ if (parent.get(pi).equals(child.get(ci))) { ci++; pi++; }else { pi++; ...
cdbefbd2-3599-45dd-9eb6-351ed34c01a2
4
public void sendInfo(CommandSender sender) { sender.sendMessage("Name: " + getName()); if (plugin.getWorlds().get(getWorldName()).isLoaded()) { sender.sendMessage("Position: " + Util.getLocationString(getLocation())); } else { sender.sendMessage("Position: World " + getWorldName() + " is not loaded!"); ...
1b95689d-df3b-4c6c-8d83-17840893c796
4
private void gameFloop(){ serverMessage = communicator.recive();; if(serverMessage.startsWith("init")){ onReceiveInit(serverMessage); } if(serverMessage.startsWith("deal")){ onReceiveDeal(serverMessage); } if(serverMessage.startsWith("uv")){ onReceiveUv(serverMessage); } if(serverMessage.sta...
cfc320ef-da9c-45c5-be49-b7d552af0ec5
5
public DataConnectionPool(int poolsize, String driver, String db, String uname, String pw) throws SQLException { this.dataBase = db; this.userName = uname; this.password = pw; this.pool = new ArrayList<ConnectionWrapper>(); if (driver != null) { try { // this is here for compatibility with drive...
dfe9d5f2-e645-40f2-8dae-8b2e71046f3b
2
public void gravaInteressesDeProfessoresPorDisciplinasEmArquivo( String nomeArquivo) throws IOException { BufferedWriter gravador = null; try { gravador = new BufferedWriter(new FileWriter(nomeArquivo)); for (Professor professores : this.professores) { gravador.write(professores.getMatricula() + "\n")...
d96fe032-8c54-448d-8766-6d5cd6542d3a
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!(affected instanceof MOB)) return true; final MOB mob=(MOB)affected; // when this spell is on a MOBs Affected list, // it should consistantly prevent the mob // from trying to do ANYTHING except sleep if(msg.amISour...
78e4a39c-b2e1-4f4f-aee4-8a6f4f97a8cf
0
public HelpAction() { super("Help...", null); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_SLASH, MAIN_MENU_MASK)); }
7c38228e-c789-4673-b682-b6297b6b416c
5
@Override public boolean onMouseDown(int mX, int mY, int button) { if(button == 0 && mX > x && mX < x + width && mY > y && mY < y + height) { Application.get().getHumanView().addScreen(ResearchScreenFactory.create()); return true; } return false; }
24a0836f-bc44-4639-9985-4c1932f937a5
5
public Reward getRand(){ int arrSum = getArrSum(rewards); Reward result = null; if(arrSum <= 0){ return result; } if(rewards != null && rewards.size() > 0){ for(int i=0;i<rewards.size();i++){ Random random = new Random(); i...
8780096d-aab0-4226-8d77-0c32f071d058
4
public int OpenPort(String portName) { if(portOpened && portName.equals(GetLastPort())) return 0; if(PortExists(portName) == false) return 0; ClosePort(); Log("Connecting to "+portName+"..."+NL); // open the port serialPort = new SerialPort(portName); try { serialPort.openPort();// Open...
855b3fca-8d87-4066-87d3-8d1727accf8d
7
public void checkDegenerate() { if (size() > 1) { MyPoint min = (MyPoint) get(0), next = min; for (int i = 1; i < size(); i++) { Object element = get(i); if (element instanceof MyPoint) { if (((MyPoint) element).x <= min.x) { next = min; min = (MyPoint) element; } else if (((M...
0805eb1b-a8cc-42ee-b842-1e2789fd290c
2
public void testPropertyCompareToMilli() { LocalTime test1 = new LocalTime(TEST_TIME1); LocalTime test2 = new LocalTime(TEST_TIME2); assertEquals(true, test1.millisOfSecond().compareTo(test2) < 0); assertEquals(true, test2.millisOfSecond().compareTo(test1) > 0); assertEquals(true...
b43060f2-58be-4bbc-a61f-3317b3bccfd0
0
@Before public void setUp() { }
89c42ff9-6c3d-464a-b98c-86bab1864ce4
7
public void keyChange(int keyCode, boolean pressing) { int pressed = 0; if(keyCode == KeyEvent.VK_W) pressed = W; if(keyCode == KeyEvent.VK_A) pressed = A; if(keyCode == KeyEvent.VK_S) pressed = S; if(keyCode == KeyEvent.VK_D) pressed = D; if(keyCode == KeyEvent.VK_SP...
89b9798b-98fd-42e2-b1dc-c72b544aa453
7
public void updateCuboidObstacleFace(char axis, float center, float corner) { if (obstacleIndexAndFace[0] < 0 || obstacleIndexAndFace[1] < 0) return; if (highlightPlane == null || !(selectedObstacle instanceof Cuboid)) return; Cuboid c = (Cuboid) selectedObstacle; Planes planes = ((ExtendedFrameRenderer) ...
2c7a6068-5647-4fce-9ae3-762fb8e91687
2
protected void draw(Graphics2D drawScreen) { if (currentState != GameLayerState.HIDDEN) { // Draw visible children directly added to the layer for (IDrawable gameObject : getVisibleDrawable(drawableList, getX(), getY())) { gameObject.draw(drawScreen, (int) (getX() - viewPort.getX()), (int) (getY() - viewPor...
5fe82dcf-9f96-491a-b9f8-506442f9e3bd
7
private boolean someBricksInTheFrame(int i, int j, int length, int height) { return i==11 && j<6 || i==12 && j<6 || i>=length-6&&j<10 || j>=height-9&&i<7 ; // || i==5 }
a3067155-018f-4ae5-81a2-69fa29302dcf
3
public void run(){ long lastTime = System.nanoTime(); double delta = 0; double ns = 1000000000 / 60; long timer = System.currentTimeMillis(); while(running){ long now = System.nanoTime(); delta += (now - lastTime) / ns; lastTime = now; while(delta >= 1){ delta--; update(); ups++; } ...
36333b18-f963-479c-b784-885cce4435b0
7
private ColumnMapping.Column nextColumnInfo() { int start = pos; nextComma(); String colInfo = sqlSelect.substring(start, pos++); colInfo = colInfo.trim(); String[] split = colInfo.split(" "); if (split.length > 1) { ArrayList<String> tmp = new ArrayList<String>(split.length); for (...
62698f2d-8456-4b18-ac52-60569bd2b6cf
4
private void encode(long value) throws VLQNegativeException { if (value<0) throw new VLQNegativeException(); int numRelevantBits = 64 - Long.numberOfLeadingZeros(value); int numBytes = (numRelevantBits + 6) / 7; if (numBytes == 0) numBytes = 1; byte[] bytes = new byte[numBytes]; for (int...
c2320fa7-4c3e-454b-be2c-0321d66ca3de
3
protected PDFGlyph getGlyph(char src, String name) { if (name == null) { throw new IllegalArgumentException("Glyph name required for Type3 font!" + "Source character: " + (int) src); } PDFObject pageObj = (PDFObject) charProcs.get(name); if (pageObj == nu...
40407d00-652b-4959-86a8-e7b721c84854
8
void getColumnNumbers(String[] splitHeader) { gazLatC=0; for (int it=0;it<dataColumns;it++){ for (int iter=0;iter<params.latColumnNames.length;iter++){ if (Pattern.matches(params.latColumnNames[iter].toLowerCase(). replaceAll("\\s+", ""), splitHeader[it].toLowerCase().replaceAll("\\s+"...
1825617e-735e-430b-b59e-3ebb9368ca8b
9
public static ListNode addTwoNumbers(ListNode l1, ListNode l2) { if (null == l1 && null == l2) return null; ListNode result = new ListNode(0); ListNode temp = result; boolean flag1 = null == l1; boolean flag2 = null == l2; int carry = 0; while (l1 != null || l2 !=...