method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
28dea02d-2849-434f-a8ff-4602a7ec72d5
4
public static String toString(JSONObject o) throws JSONException { StringBuffer sb = new StringBuffer(); sb.append(escape(o.getString("name"))); sb.append("="); sb.append(escape(o.getString("value"))); if (o.has("expires")) { sb.append(";expires="); sb.ap...
9de70056-5db0-48a8-b6ea-82bf9bfc9523
3
private Map<Integer, Raum> erzeugeIDZuordnungen(List<XmlRaum> xmlList, List<Raum> list) { Map<Integer, Raum> idNameZuordnung = new HashMap<Integer, Raum>(); for(XmlRaum xmlRaum : xmlList) { for(Raum r : list) { if(r.getId() == xmlRaum.getID()) { idNameZuordnung.put(r.getId(), r); } ...
c4b179fc-cdc3-4d6c-b361-9b47d0a8f010
3
private static boolean allCaps(String word) { for (int i = 0; i < word.length(); i++) { if (word.charAt(i) < 65 || word.charAt(i) > 90) return false; } return true; }
57cee351-e49a-4cb1-9fa6-2d9e19dc8e19
4
public static boolean allCaps(String str){ boolean retVal = true; if(str != null){ for(int i = 0; i < str.length(); ++i){ if(!(Character.isLetter(str.charAt(i)) && Character.isUpperCase(str.charAt(i)))){ retVal = false; } } } return retVal; }
782392ac-341c-41a1-8361-efb80cd6ada9
2
int maxcds(Gene gene) { int max = 0; for (Transcript tr : gene) if (tr.isProteinCoding()) max = Math.max(max, tr.cds().length()); return max; }
95554a25-5ddd-451b-a2ac-e2ae92212cab
6
private static void storeResult(List<Cluster> clusters, String resultFilename) { if(clusters == null){ return; } Collections.sort(clusters); Map<Integer, AtomicInteger> sizeCount = new TreeMap<Integer, AtomicInteger>(); int counter = 0; try (Writer writer = new BufferedWriter(new FileWriter(resultFile...
2463921c-e5b0-46d3-9ea3-524fd179c7f3
4
public Command getCommand() { String inputLine = ""; // will hold the full input line String word1; String word2; System.out.print("> "); // print prompt BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { ...
f5c8acdb-1061-4bb3-b726-ee2db3282c54
6
public void ge_alloc_array(TextArea area,String var,String type,String prefix){ for(int i=0;i<gt.type_table.type_name.size();i++) { if(gt.type_table.type_name.get(i).toString().equals(type)) { if(gt.type_table.type_rederence.get(i).toString().equals("integer") ||...
32cbac4b-0a80-4102-9e7c-413241056a6b
0
public void destroy() { removeAll(); renderer = null; }
58670c06-4bce-4bbf-ada7-b7eb63f5a3c3
4
/* */ public static void deployment() /* */ { /* 16 */ Random r = new Random(); /* 17 */ Unit leader = (Unit)squadUnits.get(0); /* 18 */ for (int i = 1; i < squadUnits.size(); i++) /* 19 */ switch (i) { /* */ case 1: /* 21 */ ((Unit)squadUnits.get(1)).setBestPosX(leader.getX...
d022ba14-3b44-4eba-8d25-2a0befa9a9e1
8
private static String sanitizeKey(String Key,int mode){ int len = Key.length(); if (len==0){ String sanitizedKey = ""; for (int i=0; i<len; ++i){ int val = Key.charAt(i); swit...
54a48d7b-3929-4338-93b3-44dde476d3a3
9
public Matrix _inverseSide() { /** * If the matrix has been augmented, solve so that the unaugmented * portion is an identity matrix. Currently appears to be unable to * handle zero entries - quite a problem if you ask me! */ if (augmented != null && rows == cols) { Matrix matrix = duplicate(); fo...
f9fa281d-493f-49f9-88fd-9dfdf31b391c
2
public static void printCodes(node rootN, StringBuffer prefix) { //Makes the prefix codes for the characters node n = (node)rootN; if(n.l == null && n.r == null){ System.out.println(n.val + "\t" + n.frequency + "\t" + prefix); strNode a = new strNode(); a.original = n.va...
1c2f903f-8928-444c-8ad0-9049d6b385ea
6
private void CityPointer() { if (bld!=-1) { if (oldx != x || oldy !=y) { Game.builds.get(bld).health = Game.builds.get(bld).maxhealth; } Game.builds.get(bld).Locked = false; } bld = -1; for (int i = 0; i < Game.builds.size(); i++) { if (Game.builds.get(i).x==x && Game.builds.get(i).y==y) { ...
09764805-6544-45b6-8e75-05f6835b5adb
1
protected void checkKey(K key) throws InvalidKeyException { if (key == null) throw new InvalidKeyException("Null key"); }
84da5789-66a1-465d-afca-995ae7c47e2b
0
public int getCount() { return this._count; }
ae5f878a-96c2-46be-9ba2-00743a8c9173
9
@Override public void mousePressed(MouseEvent e) { Frame selected = getSelectedFrame(); if(selected==null) return; if(e.getButton() == MouseEvent.BUTTON3) { if(parent.isSettingOffsetDirectly()) { handleEditOffset(selected, e); } if (parent.isSettingOffsetWithRelativePos()) { freeOff...
3a6e38e6-c4e8-4399-ad40-dba008bec995
5
public void addEntity(Entity e) { if(entities.contains(e)) entities.remove(e); if(e instanceof EntityPlayer && !players.contains(e)) { for(int i = 0;i<loadedPlayers.size();i++) { if(((EntityPlayer) e).username.equals(loadedPlayers.get(i).username)) { e.readFromChunk(loadedPlayer...
9b2096ea-860c-43bf-b85b-06f899e7922c
5
private int jjMoveStringLiteralDfa12_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 11); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 11); } switch(curChar) { case 57: return jjMoveStringLiter...
b4c79620-cd42-47d3-83a2-1d2d59719967
2
public List postOrder() { if ((postOrder == null) || (edgeModCount != postOrder.edgeModCount)) { buildLists(); } return postOrder; }
91bcb1c1-0bcf-4747-b90f-781cbaa19461
5
URL getImgURL(String path){ URL newURL = getRes(path); boolean failed = true; if (newURL != null) { try { if ((new File(GUI.class.getResource(path).toURI())).isFile()) { failed = false; } else{ newURL = null; ...
263636ca-b799-4dbd-9ecc-5e43a11cc18b
6
public void startSound() { if (!isPlaying) { isPlaying = true; bitNumber = new Random().nextInt(9); thread = new Thread() { AudioFormat af; SourceDataLine sdl; @Override public void run() { ...
0041524a-04db-40fd-b520-534414f4ce1e
5
public ListNode rotateRight(ListNode head, int n) { if(n == 0 || head == null) return head; int size =0; ListNode step = head; ListNode last = head; while(step != null){ last = step; size++; step = step.next; } n = ...
81e2724c-dcdd-4931-be49-93d9d372fb5d
7
public static Cons yieldArrayDimensionsTree(ParametricTypeSpecifier arraytype) { { List dimensions = arraytype.specifierDimensions; Cons result = Stella.NIL; if (dimensions == null) { return (null); } { Stella_Object dim = null; Cons iter000 = dimensions.theConsList; ...
ed93761f-35ba-4cb4-b4bc-28241956c095
0
public String getPhone() { return Phone; }
696aa7c6-b67a-4678-8014-d86707a694e0
1
@Transactional public Task createTask(Integer journalId, String name) { Journal journal = journalsDao.getById(journalId); if (journal == null) { throw new RuntimeException("No such journal"); } Task task = new Task(); task.setName(name); task.setJournal(j...
6d6d3f30-14c1-469f-a1e2-32efeba19351
0
public void init() { setSize(gameWidth, gameHeight); }
844b041e-04b3-48dc-b038-4896d460ec42
3
private void load() { try { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); NodeList moveList = doc.getElementsByTagName("advance"); for ...
476c8b4f-f5c8-4f18-a535-0254ef7470b2
7
private void reAllign2(int deletedRow) { Tile[][] newGrid = grid; for (int j = GRID_HEIGHT - 1; j > -1; j--) { for (int i = 0; i < GRID_WIDTH; i++) { System.out.println(i + " " + j); if (j > deletedRow && j < GRID_HEIGHT) { //newGrid[i][j] = grid[i][j]; } else if (j > 0 && j < del...
b1cede5a-5c8a-44ec-aa07-639c94de53f2
0
public Automaton getAutomaton() { return automaton; }
642dc122-d4ed-406d-bb44-4587583e2350
3
final public void Default_logical_value() throws ParseException { /*@bgen(jjtree) Default_logical_value */ SimpleNode jjtn000 = new SimpleNode(JJTDEFAULT_LOGICAL_VALUE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { if...
eea6695b-0bac-4fb5-8df9-e6b1a05168d5
0
@Override public void display(UserInterface ui) { ui.signalNeedToDisplayFunction(); }
14980e56-578b-45bc-8723-acd4d25eddee
9
public void connect() throws IOException { StreamEventListener[] listeners = getStreamEventListeners(); try { if(filename == null || "".equals(filename)) throw new IOException("No filename was given"); if(filename.indexOf("..") >= 0) throw new IOException("Relative paths are not allowed"); if(path ...
1840d14c-c481-4e3a-b617-13aabe1a0400
1
@Override public Buildable create(Object name, Object value) { if (name.equals("calibration")) { this.calibration = new Calibration(); return calibration; } else { throw new IllegalArgumentException(name.toString()); } }
d2e8a7fb-b328-4657-9705-07b2b80eed9d
2
public void onEnable() { Logger log = this.getLogger(); this.saveDefaultConfig(); WikiSearchConfig config = new WikiSearchConfig(this.getConfig()); boolean configInvalid = false; String serviceName = config.getUrlShortenerName(); Map<String, String> apiCredentials = config.getUrlShortenerApiCredential...
e7857bab-a0f5-4328-bf05-77b2c7fed7e1
7
protected void handleCacheRequest(Address sender) { int view_size=view != null? view.size() : 0; if(view_size == 0) return; for(Address addr: view.getMembersRaw()) { if(Objects.equals(addr, sender)) continue; String logical_name=NameCache.get(a...
0a188f89-2341-4ac1-afd3-b49260d18ead
4
public static void main(String args[]) throws RemoteException, NotBoundException, MalformedURLException { String myId = args[0]; MyClient me = new MyClient(myId); ServerInterface server = (ServerInterface) Naming.lookup("rmi://localhost/chat"); ...
80efa229-bedd-404b-a003-a323f7e4d386
3
private void normalizeDataset() { //for each attr of the dataset for(int i = 0; i < dataset[0].getNumAttr(); i++) { //gets the min for every entry double min = 0; for(int j = 0; j < dataset.length; j++) { min = Math.min(dataset[j].getAttr(i),min); } for(int j = 0; j < dataset.length; j+...
ba822549-d866-45a6-8a4a-26a08110b8d7
0
public JCheckBox getjCheckBoxVisiteurs() { return jCheckBoxVisiteurs; }
5ed63b11-f4f1-4f1d-81c4-35016ccaa076
8
public boolean isConstantValueOfTypeAssignableToType(TypeBinding constantType, TypeBinding targetType) { if (this.constant == Constant.NotAConstant) return false; if (constantType == targetType) return true; if (constantType.id==targetType.id) return true; if (constantType.isBaseType() && targetType.i...
06c8863f-542a-40ef-849d-5e914aaff607
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BeerEntity that = (BeerEntity) o; if (id != null ? !id.equals(that.id) : that.id != null) return false; return true; }
df5f29ea-be69-433b-8f38-df4b728a5485
3
protected boolean allowScreenOrPrintRenderingOrInteraction() { // Based off of the annotation flags' Invisible and Hidden values if (getFlagHidden()) return false; if (getFlagInvisible() && isSupportedAnnotationType()) return false; return true; }
837e5349-f9c0-4dfa-92f3-5bb2830f835f
1
static String cast(Class c) { if (c.isPrimitive()) { return ""; } return "(" + c.getCanonicalName() + ")"; }
1b0439b3-e5c9-47bc-aa67-1fa3a1b639a8
4
private void semanticCheck(String id) { if (getFunction(id) == null && getVariable(id) == null) throw new NoSuchIdentifierException(id); if (statId.isFunction()) checkArgumentsIfExist(id); else if (!getTypeOfVariable(id).isOfSameType(statId.getType())) generateException(); }
de4e6a48-1f92-43a7-a983-0f67c9601834
8
public boolean ru_play( int i, int j, int val ){ int nval = -val; int i1 = i-1; int j1=j+1; while( i1>=0 && j1<values[0].length && values[i1][j1] == nval ){ i1--; j1++; } if( i1>=0 && i1+1 < i && j1<values[0].length && values[i1][j1] == val ){ ...
ce6c95ff-8312-4920-b929-aa63bfecca57
9
public static Configuration makeConfiguration(ClassLoader classLoader, String className) { if (className == null) { className = configurationClass.getClass().getName(); } try { Class theClass; ClassLoader loader = classLoader; if (loader == null) {...
20c00713-8b38-4452-97d0-b4c28149b24e
0
@Override public boolean isInfrastructure() { return false; }
8418937d-01bb-4d04-ba98-407df23a7fc0
2
public static String formatVersion(String version) { String result = ""; result = (version.startsWith("v") || version.startsWith("V")) ? version.substring(1, version.length()) : version; return result.trim(); }
c88764c6-b14c-4442-b3fb-530db0caba24
6
public static void triangleAsum(int x[][]) { int sumr = 0, sumc[], sumd1 = 0, sumd2 = 0; sumc = new int[x[0].length]; for (int i = 0; i < x.length; i++) { sumr = 0; System.out.print("\n "); for (int j = 0; j < x[i].length; j++) { if (i <= j) { System.out.print(x[i][j] + " "); sumc[j] = su...
8e4c08c1-cde2-477a-9089-abbb68ca3cf3
7
private void writeAttributeType(Object unknownAttributeType, final PrintWriter writer, final int textDepth) { final String initialBlanks = createEmptyString(textDepth); if(unknownAttributeType instanceof ConfigurationString) { // zeichenkette schreiben final ConfigurationString string = (ConfigurationString...
4054fe68-3af8-4665-bc88-2b21d80e47f1
5
private void circleMove() { try { long oldTime; double timeOffset; while (true) { if (time - lastBlinkedTime >= BLINKED_TIMEOUT) { lastBlinkedTime = time; isBlinked = !isBlinked; } if (...
1b2694bb-8d9a-483f-a05d-f24f18c757f4
8
static final void method2431 (int i, int i_56_, Class348_Sub42_Sub13 class348_sub42_sub13, int i_57_, int i_58_, int i_59_, int i_60_, AbstractToolkit var_ha, int i_61_, int i_62_, int i_63_, int i_64_) { try { if (i_62_ < 111) aShortArrayArray10246 = null; if (i_63_ < i_57_ && i_57_ < i_58_ + i_63_ ...
7bfe8046-7921-47ba-827f-8094f4b13a17
8
public static int isBalanced(Bus bus) { ArrayList<Bus> buses = separateByRoute(bus.getRoute()); int index = buses.indexOf(bus); if((index != -1 && index < (buses.size() - 1))) { Bus nextBus = null; for (int i = index; i < buses.size() - 1; i++) { if(buses.get(++i).getState()) { nextBu...
e59d1ad3-8d16-4eec-a255-58d02dce4d15
6
static final void method1757(int i, int j, boolean flag) { if (~i != ~Class117.anInt1861) { Class27.anIntArray504 = new int[i]; for (int k = 0; ~i < ~k; k++) { Class27.anIntArray504[k] = (k << 12) / i; } Class117.anInt1861 = i; Class11...
1e952697-4d2e-4098-94a3-1f28b6f47280
2
@Override public int compareTo(Player player) { if (this.getBestScore() > player.getBestScore()) { return 1; } else if (this.getBestScore() < player.getBestScore()) { return -1; } else { return 0; } }
41e903e8-898e-4ef8-bb3c-898e334adbe8
7
public URI getStorageURI(URI manifestURI) throws StagingException { log.debug("getting storage URI for {}", manifestURI); URI result = null; List<StagingArea> possible = new ArrayList<StagingArea>(); // look through the staging areas, see if id matches above for (StagingArea area : this.getAllAreas().values()...
8998fc25-110f-483c-9b21-27e1b3c5d34a
6
public boolean isSubtree(TreeNode root1, TreeNode root2) { if (root1 == null && root2 == null) { return true; } if (root1 != null && root2 == null) { return true; } if (root1 == null && root2 != null) { return false; } boolean isSubtree = isSubtreeHelper(root1, root2); return isSubtree; }
93e86fd8-4af0-476e-a828-f71f7b57724a
3
public static String formatTime(Long time) { if (time == null) { return "N/A"; } long secondInMillis = 1000; long minuteInMillis = secondInMillis * 60; long hourInMillis = minuteInMillis * 60; long dayInMillis = hourInMillis * 24; long elapsedDays = time / dayInMillis; time = time % dayInMillis; l...
40eaf107-925a-443c-96c3-351a32fdee96
5
private boolean isSubtreeHelper(TreeNode root1, TreeNode root2) { if (root1 != null && root2 != null) { if (root1.info == root2.info) { return (isSubtree(root1.left, root2.left) && isSubtree( root1.right, root2.right)); } else { return (isSubtree(root1.left, root2) || isSubtree(root1.right, ...
42992091-48bc-4734-a0f9-e01da4d7c70e
0
public String getExtension() { return extension.get(); }
863c5fa1-5bb6-45f3-9719-3da453bc53c4
5
public String draw(){ plugin.reloadConfig(); if(plugin.getConfig().getConfigurationSection("tickets") == null){ return null; } Set<String> participants = plugin.getConfig().getConfigurationSection("tickets").getKeys(false); if(participants == null || participants.size() < 0){ return null; }else{ //...
010da56a-17c5-4620-a893-ac46c60acc7d
7
public int minDepth(treeNode curRoot) { if (curRoot == null) return 0; if (curRoot.leftLeaf == null && curRoot.rightLeaf == null) return 1; if (curRoot.leftLeaf != null && curRoot.rightLeaf != null) { int minLeft = minDepth(curRoot.leftLeaf); int minRight = minDepth(curRoot.rightLeaf); return mi...
2ba7576b-de32-4ef2-8bd7-eb0cc83be715
8
final public BigDecimal Term() throws ParseException { BigDecimal i ; BigDecimal value ; value = Primary(); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TIMES: case DIVIDE: ; break; default: jj_la1[3] = jj_gen; break label...
a32548fa-bb72-498e-ae00-9578076606a2
2
protected double convertTo(Unit otherUnit){ if(!otherUnit.getClass().isInstance(this.unit)) { throw new RuntimeException("You can't convert " + this.unit + " to " + otherUnit); } if(this.unit == otherUnit) { return this.value; } return unit.convertTo(this....
4e2302b1-613e-4579-9071-a178061c02f1
9
public static File transform(Target target, Type type) throws TransformException { String conditional = target.getCondition(); if(!StringUtils.isBlank(conditional)){ Condition c = Context.getCondition(conditional); if(c == null){ throw new TransformException("Condition [" + conditional + "]...
8e1c2f8d-28b2-46d3-afa7-ffb4cfbc8749
5
public BufferedImage getImage() { BufferedImage i; if(Board.getInstance().getGravity() == 1) { i = (imageStatus == 1) ? image : imageRunning; if(getMidair()) i = imageJumping; } else { i = (imageStatus == 1) ? imageR : imageRunningR; if(getMidair()) i = imageJumpingR; ...
73104f86-b2b2-4972-a84e-822e5d99c1d3
3
public boolean setWeights(double[] weights) { if (weights == null) { return false; } // check whether the value of weights are correct for (int i = 0; i < weights.length; i++) { if (weights[i] <= 0) { System.out.println(nam...
21ac4456-c0db-4508-8f0b-c27e270a6907
4
private void readFile(File diffMapperFile) { try { BufferedReader reader = new BufferedReader(new FileReader(diffMapperFile)); String[] title = reader.readLine().split("\t"); String line; while((line = reader.readLine()) != null) { String[] value = line.split("\t"); for(int i = 0; i < title.le...
ece947d1-7e36-47af-ae54-d69a689cec45
2
public void setGravity(boolean gravity) { GRAVITY = gravity; if(gravity) { if(gravityThread == null) { Runnable gravityJob = new GravityJob(this); gravityThread = new Thread(gravityJob); gravityThread.start(); } } else { gravityThread = null; } }
473eddaf-4622-4952-a143-e3c9f15d1a61
1
public void init() { //set Frame position setLocation( (Toolkit.getDefaultToolkit().getScreenSize().width-getSize().width) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height-getSize().height) / 2 ); //setup label for customer or employee edit if ("C...
b021a291-5481-47e6-93fc-25e3081ea2a8
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the...
aa7b2bd7-58f4-4e5e-84d8-42aa01d9b3c4
9
public final static Entry<String,Integer> getStringFollowedByNumber(final String str, final boolean romanOK) { final String codeStr; final Integer number; if((str==null)||(str.length()<1)) { codeStr=str; number=null; } else { int dex=str.length()-1; if(!Character.isDigit(str.charAt(dex))) ...
2f31094d-fe18-41a2-8a46-a565d2ba377e
9
public final GramaticaAst.literal_return literal() throws RecognitionException { GramaticaAst.literal_return retval = new GramaticaAst.literal_return(); retval.start = input.LT(1); Object root_0 = null; GramaticaAst.int_literal_return int_literal124 =null; GramaticaAst.char_l...
f8fda856-3f7a-4085-837e-d8f9ae6032e2
2
@Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; Room otherRoom = (Room) other; return this.name.equals(otherRoom.name); }
55a19be4-4ec2-4e93-bda8-cf9b949358ef
4
public void triangulate (FaceList newFaces, double minArea) { HalfEdge hedge; if (numVertices() < 4) { return; } Vertex v0 = he0.head(); Face prevFace = null; hedge = he0.next; HalfEdge oppPrev = hedge.opposite; Face face0 = null; for (hedge=hedge.next; hedge!=he0.prev; ...
7a2c366a-9ee2-49e4-ba63-3043af79d472
3
@EventHandler public void itemMove( InventoryMoveItemEvent e ){ if( e.getItem() != null ){ if (String.valueOf(e.getItem().getItemMeta().getLore()).contains("Smeltery I")) { if( e.getDestination().getType() == InventoryType.ANVIL ){ e.setCancelled(true); ...
884d8367-2585-420c-a6a4-cefe314d6094
2
private int high() { return (isInclusiveHostCount() ? broadcast() : broadcast() - network() > 1 ? broadcast() -1 : 0); }
e37f804e-5dfa-4690-a176-3ec026518c0a
1
private void piirraEste(Graphics graphics, Este este) { if (este.getTyyppi() == EsteenTyyppi.KUOLO) { /** * Kuolonpalikka VILKKUU 30 kertaa sekunnissa! >:( */ graphics.setColor(new Color(255 * System.currentTimeMillis() / 30 % 2, 0, 0)); } else { ...
59d020df-4341-44bb-ab3e-bbecf956f124
6
public static void addUpdateDzien(int ID) { boolean flaga=true; for (int i=0 ; i<DniUpdate[0] ; i++) { if(ID==DniUpdate[i+2]) { flaga=false; break; } } if(flaga) { // Count ArraySize if (DniUpdate[0]+2 >=DniUpdate[1]) { int[] tempArray = new int[DniUpdate[1]]; for (i...
349a2c0a-cb0d-4847-9475-d7e712b1bd02
4
public void sinkShipOnTimer(){ // sequence to sink a ship if(sunkShip){ if(sinkingShips.size() != 0){ for(int i = 0; i<sinkingShips.size(); i++){ if(sinkingShips.get(i).getSunk() == true){ sinkingShips.remove(i); ...
c2e462f7-d434-4286-9220-d60fde1c8768
4
private void setupColours() { if (currentTheme != null && currentTheme[0] != null && currentTheme[1] != null && currentTheme[2] != null) { Color background = currentTheme[0]; Color highlight = currentTheme[1]; Color inner = currentTheme[2]; getContentPane().setBackground(background); menuBar.setColour(...
7bbd7d86-ce33-4bcd-9e29-a08400d6be75
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { new Main(); } catch (Exception e) { e.printStackTrace(); } } }); }
17a85aad-d573-4961-b5ce-87dd0dd37a8e
3
public Principal authenticate(String username, Object credentials, Request request) { if (credentials instanceof String) { Principal p = CommunityDAO.get().authenticate(username, (String) credentials); if( logger.isLoggable(Level.FINER) ) { logger.finer("OurHashRealm authenticate(), got principal: " + ...
7309ee3f-7176-48ae-b45a-fdad0cf83e4b
1
private int root(int i){ while(i!=id[i]) i = id[i]; return i; }
81038b58-b36e-4481-8bb8-02ef54c24478
3
public Node<Integer> removeDup2(Node<Integer> head) { if (head == null) return null; int checker = 0; Node<Integer> p = head; int val = p.data - 0; checker |= (1 << val); while (p.next != null) { val = p.next.data - 0; if ((checker & (1 << val)) != 0) { p.next = p.next.next; } else { ch...
27765bd1-35d0-4dab-b1f9-a5f0fe587ec2
6
public String insertarPrograma(String codigo, String nombre, String nivel, String numCreditos) { //<editor-fold defaultstate="collapsed" desc="insertarPrograma()"> if (!nombre.isEmpty() && !codigo.isEmpty() && !nivel.isEmpty() && !numCreditos.isEmpty()) { Programa programa = new Programa(); ...
8994e32b-6138-410e-8998-9e29dd2576bc
9
public ArrayList<SongBean> translateToSongs(Document doc) { boolean validResult = false; NodeList SongNodes = doc.getElementsByTagName("songList"); ArrayList<SongBean> Songlist = new ArrayList<SongBean>(); for(int i=0;i<SongNodes.getLength();i++){ validResult = false; Node n = SongNodes.item(i); ...
258de4ce-2b7c-43be-a235-0bd31c2be1bd
0
public String getSuccess() { return success; }
38fc334a-de60-4f84-a341-42709970d7ce
4
public void init(int mode, byte[] key, byte[] iv) throws Exception{ String pad="NoPadding"; //if(padding) pad="PKCS5Padding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; System.arraycopy(iv, 0, tmp, 0, tmp.length); iv=tmp; } if(key.length>bsize){ tmp=new...
a3a28583-cf48-455a-9c5d-6cba6f91b061
6
public int nom(Model model){ int methodepasheritee = this.operation.size(); int methodeheritee = 0; for(Generalization g : model.getGeneralization()){ for(String str : g.getArrayIdent()){ if(str.equals(this.identifier)){ Classe parent = this.getClasseByModel(model, g.getIdentifier()); methodehe...
4ea3a2ad-97c8-4e34-a827-604f16552068
3
public void setLogLevel(final String name) { Level level; try { level = Level.parse(name); } catch (final Exception e) { level = CustomPlugin.DEFAULT_LOG; this.getLogger().warning("Log level defaulted to " + level.getName() + "; Unrecognized java.util.logging.Level: " + name + ";...
29097f71-19d5-486f-bed0-a8e53e77163e
1
float[] getBandFactors() { float[] factors = new float[BANDS]; for (int i=0, maxCount=BANDS; i<maxCount; i++) { factors[i] = getBandFactor(settings[i]); } return factors; }
4e87c66b-28cb-42f3-b5f9-d81c8216d091
0
public void setIsBlueLayer(boolean isBlueLayer) { this.isBlueLayer = isBlueLayer; }
5eb69812-a5a3-45c5-bc74-eb112471f909
4
public void run() { printJump(); try { String s = Utils.getString("guild_challenge/index"); int i = s.indexOf("var flashvars = {"); i = s.indexOf("var flashvars = {", i + 1); i = s.indexOf("var flashvars = {", i + 1); s = s.substring(s.indexOf("guild_id:", i + 1)); s = s.substring(0, s.indexOf('...
2cae995f-fd09-49c0-bc51-216921056c72
7
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); ServletContext ctx=getServletContext(); String l1=ctx.getInitParameter("l1"); String l2=ctx.getInitParam...
aef0aa9d-913b-4298-8072-ce9541326493
6
@Override public double unsafe_get(int row, int col) { if( row != 0 && col != 0 ) throw new IllegalArgumentException("Row or column must be zero since this is a vector"); int w = Math.max(row,col); if( w == 0 ) { return a1; } else if( w == 1 ) { ...
07584039-5b29-485d-ae4a-af8de7823bfa
7
public void runCommand(String cmdMessage) { String[] parts = cmdMessage.split(" "); // List<String> preArgs = new ArrayList<String>(); //Not an empty command if(parts.length > 0) { int bestMatchAmount = 0; String[] bestMatchString = null; for(String[] possibility : commands.keySet()) { ...
ac9b5376-5d48-454c-835c-e1e74246847c
1
public void addKill(final Block block, final Kill kill) { if (SSAPRE.DEBUG) { System.out.println(" add alias to worklist=" + kill.expr + " " + kill); } final int blockIndex = cfg.preOrderIndex(block); kills[blockIndex].add(kill); killsSorted[blockIndex] = false; }
88773d06-3c50-4b93-b1c5-1121f1bffb1c
3
@RequestMapping(value = {"/search"}, method = RequestMethod.GET) public String search(@RequestParam(value = "name", required = false) String name, @RequestParam(value = "page", required = false) Integer page, Model model) { if (name == null) { name = ""; } if (page == null) { ...
886abf19-7771-48fd-a669-2a6513dc09b6
9
private ParseTree parseSet(final StringParseReader expression, final boolean inverted ) throws ParseException { final List<ParseTree> setNodes = new ArrayList<ParseTree>(); int currentChar = expression.read(); boolean requireRangeValue = false; PARSE_SET: while (currentChar >= 0) { if (fo...