method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
28227e94-633d-42e3-9fed-ec17058b67d9
6
void read(AlgReader reader) { compileCommand = null; source = reader.getValue(name, "path").trim() + reader.getValue(name, "source").trim(); if (source.startsWith(AlgReader.undefined) || source.startsWith(AlgReader.empty)) { //setting.setLocked(false); setString(""); ...
92e90d8d-4e30-42b6-a45d-594d2feaa945
9
public String addBinary(String a, String b) { // Note: The Solution object is instantiated only once and is reused by each test case. if(a==null || b==null || a.length()==0 || b.length()==0) return null; int carry = 0; int i = a.length()-1, j = b.length()-1; StringBuf...
c2882cb3-71c2-46a4-af4e-a47e38885757
9
public Helper(BinaryFunction<? super G, ? super H, ? extends T> f, BinaryFunction<? super L, ? super R, ? extends G> g, BinaryFunction<? super L, ? super R, ? extends H> h) { this.f = f; this.g = g; this.h = h; }
8f668a0e-2c9b-4c36-9bb6-85a532b171fc
8
@Then("the data file should be updated with the \"(.*)\" statistics$") public void correctStatistics(String state) { if(state.equals("initial")) { currentSavedIndex=menu.getCurrentSavedIndex(); SavedGame[] games = tetris.getSavedGames(); for(int x=0;x<games.length;x++) System.out.println(games[x]....
ceb7724c-2d5a-4156-81d9-94e041e3da3f
3
public void transferAllCardTypeTo(Deck d, String type) { ArrayList<card> tmp = new ArrayList<card>(); for(card c : deck) { if(c.getType().equals(type)) { //lazy fix d.addCard(c); tmp.add(c); } } ...
c5bbc6c9-5e7d-4967-b29c-25d8ec5d131c
6
public void draw(Graphics2D g2){ sortStateLock.lock(); try{ int deltaY = component.getHeight()/values.length; for(int i=0; i < values.length; i++){ if(i<=rangeTo && i>=rangeFrom){ //highlight partition range g2.setColor(Color.BLUE); if(i==pivotPos) //highlight pivot g2.setColor(Color....
122a242e-dfbd-40d6-9bc4-143869dcc9a5
3
public ArrayList<BodyPart> getAllBodyparts() { ArrayList<BodyPart> bodyparts = new ArrayList<BodyPart>(); for(BodyPart u : allHeads){ bodyparts.add(u); } for(BodyPart u : allBodys){ bodyparts.add(u); } for(BodyPart u : allLimbs){ bodyparts.add(u); } return bodyparts; }
c9315493-2d60-4070-b114-ea3136f635dd
1
@Override public Object get(final String key) { Object result = doGet(key); if (result != null) { return result; } HighLevelCacheCallback callback = new HighLevelCacheCallback() { @Override protected Object doInCache(Cache cache) { return cache.get(key); } }; result = callback.process(hi...
9f8bbd9d-f41c-49fd-9aaf-d19320c42436
0
public void deleteItemFromLayer(PathItem pi) { this.ditems.remove(pi); }
17e273b4-bdb1-4ba3-abfb-d01540f2b50c
0
public static void main(String[] args) throws Exception { Sender sender = new Sender(); Receiver receiver = new Receiver(sender); ExecutorService exec = Executors.newCachedThreadPool(); exec.execute(sender); exec.execute(receiver); TimeUnit.SECONDS.sleep(10); exec...
f29070e9-498e-4109-8512-e0279f38dcb4
9
public static <T> CriteriaQuery<Long> getCriteriaCount(Class<T> clazz, CriteriaBuilder cb, Object instance, Object instanceInterval, Map<String, OP> filterMap, Map<String, OR> sort, List<String> group) { /** * Query result */ CriteriaQuery<Long> q = cb.createQuery(Long.class); /** * From */ ...
5174910e-8981-4fc8-af21-75accf04a4cd
9
public int find(int[] a, int[] b, int[] c) { int value = 0; if (a.length == 0) return 1; int[] aNext = new int[a.length - 1]; int[] bNext = new int[b.length - 1]; int[] cNext = new int[c.length - 1]; int[] allOnes = new int[a.length - 1]; for (int i = 0; i < a.length - 1; i++) { aNext[i] = a[i + 1];...
4d812b8a-a017-4950-90cc-94af0e35cf6a
0
public void SetNumebrOfPackets(int packets) { NumberOfPackets = packets; NDarray = new int[NumberOfPackets]; }
83dbfda5-e614-4904-911b-60214985f2e1
8
protected void writeEncoded(Writer writer, String str) throws IOException { for (int i = 0; i < str.length(); i += 1) { char ch = str.charAt(i); switch (ch) { case '<': writer.write('&'); writer.write('l'); write...
f97da0d3-76bf-4b9d-b49c-314e7fc43e3a
5
public int tryNextToken(Symbol symbol) { int code = combinedPattern.recognise(symbol, 0); if (code == PATTERN_ENDED || code == TOKEN_APROVED) { PatternComponent lookup = combinedPattern.getLookUp(); if (code == PATTERN_ENDED && lookup instanceof LanguagePattern) { LanguagePattern lp = (LanguagePattern) lo...
fd9b53c1-2d7b-4108-bc88-32e5fd72d429
1
public void createPlayerPanels(JPanel gameInfo) { Font playerFont = new Font("Helvetica", Font.BOLD, 20); JPanel panelScores = new JPanel(new GridLayout(8,1)); panelScores.setBorder(new EmptyBorder(0, 40, 0, 0)); panelScores.setBackground(Color.gray.darker()); int i; for (i = 0; i < playerScores.length; i++...
056f1eea-dcd6-4efc-bbc5-1e7882dc1ff9
7
private void formatPartitionsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_formatPartitionsButtonActionPerformed if (jList1.getSelectedValuesList() == null || jList1.getSelectedValuesList().isEmpty()) { logger.log(Level.ERROR, "No partition was selected! Please select a pa...
6d393ecf-0b9f-4e72-93d6-2c42b7937458
2
public static void main(String[] args) { ArrayList apples = new ArrayList(); for (int i = 0; i < 3; i++) apples.add(new Apple()); // Not prevented from adding an Orange to apples: apples.add(new Orange()); for (int i = 0; i < apples.size(); i++) ((Apple) apples.get(i)).id(); // Orange is dete...
012b6cff-2276-4d84-a73a-3582a9101d86
2
public static boolean isChannel(String str) { int c; return (str.length() >= 2) && ((c = str.charAt(0)) == 35 || c == 38); }
45384bca-4bd0-4aac-877f-73b6ba588706
5
@Test public void testRollbackOrder1() throws InvalidProcessStateException, ProcessExecutionException, ProcessRollbackException { // all components do require rollback // define names String nameParent = "P"; String nameChild1 = "C1"; String nameChild2 = "C2"; String nameChild3 = "C3"; String nam...
7e0ce344-4c75-4660-9b56-aa53a3e804b1
6
public void autenticacionUsuarioLogin(AutenticacionVO authVO) throws ReporteJasperException{ try { if(properties!=null&&authVO!=null){ if(properties.getProperty("urllogueo")!=null&&authVO.getUsername()!=null&&authVO.getPassword()!=null){ authVO...
ab8372f7-2d2b-491c-9f6d-4609edc87ed2
8
private void drawEdgeShadow(Graphics g, int startX, int endX, int y, boolean cornerStart, boolean vertical, Color backgroundColor) { if (startX + (cornerStart ? 0 : shadowSize + shadowBlendSize) >= endX) return; g.setColor(getShadowColor(backgroundColor)); for (int i = ...
f87d5548-4c13-42e6-b177-bbb2b8951963
0
private PriorityEnum(int val) { this.value = val; }
6b3d832b-5836-4cfd-9f10-a82dccfb298a
2
private int[] buildArray(int[] arr, int deleted) { int[] result = new int[arr.length - 1]; for (int i = 0, j = 0; i < arr.length; ++i) if (i != deleted) { result[j++] = arr[i]; } return result; }
138c7958-324d-44ba-91be-74278b304c2e
5
private HashMap<GameState, String> allActionsWithTreasures(GameState state, Card card, int time) { Color faction = card.getFaction(); Loot Lbag = state.getBoard().getLoot(state.getDay()); HashMap<GameState, String> choiceSet = new HashMap<GameState, String>(); for(String s : Treasure.allTreasures()) { if(...
f5701105-8108-41d7-9740-e3912fa3db00
3
public void deleteCourseById(Scanner a_scan, Student s1) { for (int i = 0; i < test.getStudentList().size(); i++) { if (s1.equals(test.getStudentList().get(i))) { int a_courseId = scanInId(a_scan); Course a_course = findCourse(a_courseId, s1); if (a_course != null) { test.getStudentList().get(i)....
9e4d54d4-f44c-41c0-bf82-592ced493684
4
public void move(int xa, int ya) { if (xa != 0 && ya != 0) { move(xa, 0); move(0, ya); return; } if(!moved) { moved = true; } if (!collision(xa, ya)) { x += xa; y += ya; } }
c2547b03-f22c-4bde-9b26-01699245f538
1
public void insertRow(Object[] newData, int row) { if (newData.length != columns) throw new IllegalArgumentException("Data length is " + newData.length + ", should be " + columns + "."); data.add(row, newData); fireTableRowsInserted(row, row); }
8020ac42-c3f5-491e-8873-75659422a9ab
1
private int generateMeetingId() { // Generates a random 6 digit integer as the ID number. int newId = (int)(Math.random()*999999); // Then checks to see if this number is already in use recursively. if(getMeeting(newId) != null) { return generateMeetingId(); } else {...
4461c8de-ec45-45ff-ac9b-e0838d2d86aa
8
public String Judge(String menuOption) { String PrintContent = null; ArrayList<Book> bookArrayList = bookList.CreateBookList(); ArrayList<Movie> movieArrayList = movieList.CreateMovieList(); if(menuOption.equals("help")){ PrintContent = HelpPrintContent(CreateMenuOptions());...
94dcc942-d945-4c95-b5ea-911573026ad1
9
static private int jjMoveStringLiteralDfa0_0() { switch(curChar) { case 40: return jjStopAtPos(0, 14); case 41: return jjStopAtPos(0, 15); case 44: return jjStopAtPos(0, 17); case 59: return jjStopAtPos(0, 16); case 67: return jjMoveString...
046e0e6d-d870-44f0-8f65-fc72d95e2f42
3
private void updateCommentIndicator() { // [srk] same protection added to updateColors // make sure node is not null if (node == null) { return ; } // end if if (node.getCommentState() == Node.COMMENT_TRUE) { iComment.setPropertyInherited(false); iComment.setProperty(true); } else if (node.g...
d77a7f8e-fdad-41be-b700-3fb0a82ebd93
3
public List getPreviousElements(int count) throws IteratorException { int i = 0; Object object = null; LinkedList list = new LinkedList(); if (listIterator != null) { while (listIterator.hasPrevious() && (i < count)) { object = listIterator...
cc141c27-bbca-477b-9fd7-86380a5023ef
6
public List<Token> getTokensInRange(int start, int end){ int startIndex = 0; int endIndex = 0; Iterator<Token> it = tokens.iterator(); while (it.hasNext()){ Token token = it.next(); if (token.getStartOffset() >= start || token.getEndOffset() >= start){ endIndex = startIndex ...
4abc9bde-99d3-49ba-a87e-6cb07f6aecef
9
public boolean equals(final Object a, final Object b) { if ((a == null) || (b == null)) { return a == b; } if (a.getClass().isArray()) { if (!b.getClass().isArray()) { return false; } if (a.getClass().getComponentType() != b.getClas...
a12c5c76-77ef-401f-9a24-0f5d0605642f
6
@Override public void paintComponent(Graphics g) { super.paintComponent(g); //paint the chess board g.drawImage(_bg, 0, 0, null); //paint the selector if (_drawSelector && !_board.emptyAt(_selectorX/Cell.SIZE, _selectorY/Cell.SIZE)) { g.drawImage(_selector, _selectorX, _selectorY, ...
2fbf182c-1f39-4f23-8f21-2d669fb6fb0a
1
private final static byte[] read(InputStream is, int count) throws IOException { byte[] bytes = tbytes; if (count > tbytes.length) { bytes = new byte[count]; } is.read(bytes, 0, count); return bytes; }
aa7b83b8-1b4f-441e-a4a7-a0f36053f276
1
public ActionListener createActionListener(final String trigger) { return new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Command command = map.get(trigger); if (command == null) return; com...
0f14dcdc-884a-4a5e-aa37-1654773f926f
4
static TreeNode findNode(Tree tree, Object nodeDatum) { if (tree == null) { return null; } TreeNode node = findNodeOneLevel(tree.getRoot(), nodeDatum); TreeNode nextNode = tree.getRoot(); if (!(node instanceof TreeNode)) { List children = nextNode.getChildren(); for (Iter...
331d902d-6aab-4b86-bc78-293859355949
5
public void drawImageString(JGEngineInterface eng, String string, double x, double y, int align, String imgmap, int char_offset, int spacing,boolean pf_relative) { ImageMap map = (ImageMap) imagemaps.get(imgmap); if (map==null) throw new JGameError( "Font image map '"+imgmap+"' not found.",true ); if (align...
25b84f84-7654-4ed9-864a-d2b4b0a80695
1
public ResultSet retrieveMatches(){ try { cs = con.prepareCall("{call returnHostNames()}"); rs = cs.executeQuery(); } catch (SQLException e) { e.printStackTrace(); e.getMessage(); } return rs; }
72ef73b6-9532-4815-98ae-e1665caa418a
0
public Map<String, Object> valuesWithPropertyNames( ValueVisitor defaultVisitor) { return values(1, defaultVisitor); }
1833c63b-f25d-44a2-93bc-e3b36a783263
3
public static void saveObjectives() { String output ="savedata/"+idString+".objectives"; try { PrintWriter fout=new PrintWriter(new FileWriter(output)); if(VERSION.equals("Peaches")) fout.println("PDAE"+idString); else fout.println("CDAE"+idString); //Game Vars for (boolean anO...
57df333a-02ff-491e-bde6-8a2b2a055a15
0
public void setAnimating(boolean animating) { this.animating = animating; }
f8a07f24-3afb-4e9c-8851-237a1394145f
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; ...
d07c00bb-fab4-4891-91fc-d9055af70135
3
public KDNode loadNode(long filePos) throws IOException{ // Si esta en memoria principal if(elements.containsKey(filePos)){ improvePriority(filePos); return elements.get(filePos); } // Si no esta en memoria principal... // se supone que numOfElements no ...
faf2d2b0-d8dc-44cf-93a5-5b65f3eeb1f2
2
private static File getOutputDir() { File file = new File(properties.getProperty("usecase.outputdir") + "/class"); if (!file.mkdirs() && !file.exists()) { throw new RuntimeException("Fail to create output directory at " + file); } return file; }
20211d2a-097f-4f1e-a9dc-ed9c25a910e3
5
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.black); g2d.setFont(new Font("Trebuchet MS", Font.BOLD, 144)); g2d.drawString(chrod, getWidth()/2 - g2d.getFontMetrics(...
d754406f-312e-46d6-917d-2e39d721fab4
7
public boolean find(T[] values) { synchronized(lock) { if(values==null || values.length==0) { System.out.println("Insert item is empty..."); return false; } TrieNode<T> currNode = root; for(int i=0;i<values.length;i++) { T current = values[i]; if(current == null) { System.out.prin...
bb6eedac-5a36-47ae-9974-c8ab0e0c7431
4
public boolean isXBlocked(int x, int y, int width, int height, float moveX) { // If there is no movement in x direction. if (moveX == 0) { return false; } // Calculates the correct x, depending on the move direction. int xindex1; if (moveX < 0) { xindex1 = (int) Math.floor(x / getDimension()); } el...
0eccd6a5-9916-4720-a0da-a6dc286e76c0
7
public void renderTile(int xp, int yp, Tile tile) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < tile.sprite.SIZE; y++) { int ya = y + yp; for (int x = 0; x < tile.sprite.SIZE; x++) { int xa = x + xp; if (xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break; if (xa < 0) xa...
1334530e-70cf-4b53-aae7-880a0ef6a30d
5
public String encode(String plain) { char[] pt=build_keyed_alphabet(p_key,26,0); int period=v_key.length(); String v_key_u=v_key.toUpperCase(); char[][] ct_table=new char[period][26]; for(int i=0;i<period;i++) { char first_c=v_key_u.charAt(i); char[] ct_line=build_keyed_alphabet(h_key,26,0); ...
570790bf-3b02-46e8-8b69-f749071ae6ba
8
@Override public String healthText(MOB viewer, MOB mob) { final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints())); if(pct<.10) return L("^r@x1^r is raging in bloody pain!^N",mob.name(viewer)); else if(pct<.20) return L("^r@x1^r is covered in blood.^N",mob.name(viewer))...
1501c8c9-b879-4668-a4e1-e966355409a9
2
public Boolean compareService(String request, String service){ return MyStringUtil.isBlank(request) ? false : (request.startsWith(service) || request.endsWith(service)); }
b43813c5-b1b6-4544-8df8-f7d36e744c1a
8
public int run() { int nextScreen = BROWSE_PRODUCTS; reset(); boolean finishedHere = false; while (!finishedHere) { updateCategories(); updateSortBy(); listProducts(); draw(); String option; try { option = getInput(); if (option.equals("h")) { sortByHighest = true; curPa...
0c9c0682-75f5-4872-b5ff-98e80ded1e43
7
protected void keyTyped(char par1, int par2) { serverName.textboxKeyTyped(par1, par2); serverAddress.textboxKeyTyped(par1, par2); if (par1 == '\t') { if (serverName.isFocused()) { serverName.setFocused(false); serverAddress.set...
b188255c-7711-44a0-9290-1bf1c1b31b14
7
private static void postRest(String endpoint, String payload, boolean isViaRouter){ try { URL url = new URL(endpoint); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRe...
edf542bf-be56-496b-9b52-d6134da08531
3
@Override public void paintComponent(final Graphics g) { // Check if we have a running game super.paintComponent(g); g.setColor(this.getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); if (this.model != null) { // Draw all tiles by going over them x-wise and y-wise. for (int i = 0; i < this....
3dd632e2-5f96-4195-9df7-8e8bd3c1b8eb
8
public static boolean NTclassDecl() throws IOException { boolean success = true; success = ErrorRecovery(NonTerminal.classDecl); switch (lookahead) { case CLASS: if (!match(TokenType.CLASS)) success = false; if (!match(TokenType.ID)) success = false; if (!match(TokenType.LBRACE)) success = ...
474e0839-061c-4c6f-be0c-816033a2bb25
4
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("pause")){ game.stopGame(); } else if(e.getActionCommand().equals("restart")){ game.stopGame(); if(game.isEnabled()){ if(JOptionPane.showConfirmDialog(this, "Are you sure you want to restart the game?", "Resta...
dbdc1f02-2a53-4810-a8b4-e959add4a093
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { BossReport frame = new BossReport(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
3d9834ad-2cf4-443b-8261-45eb370b3edd
0
public boolean getLiveStatus() { return isLive; }
16aa6dad-a0e8-4d41-b191-eb204f6394e7
6
public void insertBefore(HTreeNode nodeAfter, HTreeNode nodeBefore){ /* Check if any of the nodes are null. */ if (nodeAfter == null || nodeBefore == null || getHeadNode() == null) return; /* Checks if nodeAfter is head, if so, nodeBefore is inserted as new head. */ if (getHeadNode().equ...
3687d7a8-e673-4962-bfe2-216e719a3720
2
public boolean equalsExpr(final Expr other) { return (other != null) && (other instanceof NegExpr) && ((NegExpr) other).expr.equalsExpr(expr); }
e0f0157b-554a-4293-a892-1f5fee8d43ad
2
public void test_09() { int nmerSize = 32; String seqStr[] = { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // , "caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" // Prepend 'c', append 'g' }; SuffixIndexerNmer<DnaSequence> seqIndex = new SuffixIndexerNmer<DnaSequence>(new DnaSubsequenceComparat...
7c987d7b-367e-4aea-9316-aad527f38a69
3
public String consumeElementSelector() { int start = pos; while (!isEmpty() && (matchesWord() || matchesAny('|', '_', '-'))) pos++; return queue.substring(start, pos); }
ff159993-8542-4ed1-b285-cf27a8ad9e35
9
private JComponent createButtonBarsPanel(String helpTag, boolean sizeLocked) { MigLayout lm = new MigLayout("nogrid, fillx, aligny 100%, gapy unrel"); JPanel panel = createTabPanel(lm); // Notice that the order in the rows below does not matter... String[][] buttons = new String[][] { {"OK"}, {"No", "...
71ebc6c1-6d49-4679-92d0-03ccd646d91a
8
public int getBlockTextureFromSideAndMetadata(int par1, int par2) { if (par1 == 0) { return Block.planks.blockIndexInTexture; } int i = getDirection(par2); int j = Direction.bedDirection[i][par1]; if (isBlockFootOfBed(par2)) { if (j =...
0588ad90-8b8c-433a-bd7e-d4840dd7aa06
7
public void begin() { OUT_IChatListener = (IChatListener) MyxUtils.getFirstRequiredServiceObject(this, msg_IChatListener); if (OUT_IChatListener == null) { System.err.println("Error: Interface com.pla.chatsys.IChatListener returned null"); return; } OUT_IFileWriter = (IFileWriter) MyxUtils.getFirstRequire...
cdbe5930-6232-46db-ba92-b676a6eab306
4
public static <T> T createObject(AdapterBase adapter,ObjectRowMap cache, HashMap<String, Object> map, Class<T> resultClass,ConnectionWrapper cw,String tableName, Long dbId) throws SQLException { try { if (ObjectTools.isDatabasePrimitive(resultClass)) { return resultClass.cast(map.get(Defaults.VALUE_CO...
ceda6afd-4eca-4f4d-93fe-e765fbc1cee8
3
protected Map<String, String> parsePromotionPropertiesLine(String pLine) throws ExParser { //Call superclass method to attempt to parse properties Map<String, String> lProperties = super.parsePromotionPropertiesLine(pLine); if(lProperties != null){ //Additional validation - Check for mand...
a39ab085-38a8-404c-b3e5-bf78ff131f26
0
public void setModifyDateGmt(Timestamp modifyDateGmt) { this.modifyDateGmt = modifyDateGmt; }
290d6137-7493-4251-afaf-0459087ce5e8
9
@SuppressWarnings("deprecation") private void evalZeroState() { if (otherThread == null) { graph.defaultWindow(); graph.setNotification(""); ArrayList<String> vars = new ArrayList<String>(); vars.add(input4Box.getText()); ...
609b94f0-25ec-4b6c-b238-1d0a35419a8d
0
@Override public String toString() { return "PersonModel [name=" + name + ", region=" + region + ", isme=" + isme + ", isvip=" + isvip + ", rank=" + rank + ", rank_display=" + rank_display + ", innerno=" + innerno + ", exp=" + exp + ", title_type=" + title_type + ", region_id...
111a48b2-7de7-411b-b381-fe61d3f71b6d
8
void createJava3dObject(int loadBehaviors) { Matrix4d mat = new Matrix4d(); mat.setIdentity(); // Set the node's transform matrix according to the first frame // of the object's motion LwsFrame firstFrame = motion.getFirstFrame(); firstFrame.setMatrix(mat); debugOutputLn(VALUES, "Light transform = " + mat); Tra...
a75f44b6-5c97-4713-9588-00200e31d195
0
public void setUser(String user) { this.user = user; }
84c19eae-9810-42f2-9035-6e7924a1746f
8
public void resize(int x, int y) { JShot.debug("resize"); switch (resizePosition) { case TOP | LEFT | CORNER: this.startX = x; this.startY = y; break; case TOP | RIGHT | CORNER: this.endX = x; this.startY = y; break; case BOTTOM | RIGHT | CORNER: this.endX = x; this.endY = y; ...
c8d3bf39-2a9c-48e7-90f9-3da9e3ba5333
2
private static String FormatTimeStamp(String timestampstr){ String tmpstr=timestampstr; if (timestampstr.length()<10){ for(int i=0;i<10-timestampstr.length();i++){ tmpstr = "0" + tmpstr; } } return tmpstr; }
29fc1d8c-e56a-47e1-b910-769142e360fc
2
public String getUTF8(int i) throws ClassFormatException { if (i == 0) return null; if (tags[i] != UTF8) throw new ClassFormatException("Tag mismatch"); return (String) constants[i]; }
1ab8a602-ebf6-4a5a-8aee-162f775f61f7
3
public PacketHandler(Protocol protocol, ProtocolConnection connection) { this.connection = connection; List<PacketInfos> infos = protocol.getPacketInfos(); for (PacketInfos packetInfo : infos) { if (packetInfo.isReceivable()) { try { String packetN...
1118885c-ceb3-4bdb-82f4-f7fbb50c6f39
5
@Override public void init() { super.init(); int l = 0; int m = 0; // get the row information super.initRowCol(); short s = ByteTools.readShort( getByteAt( 4 ), getByteAt( 5 ) ); ixfe = s; // get the long // get the long fpnum = ByteTools.eightBytetoLEDouble( getBytesAt( 6, 8 ) ); setIsValueF...
a6aa6cb4-e679-4a8a-9f30-772f25aa9523
6
public boolean ApplyDead() { if (IsDeadTimer == false) { actionAmount++; actionTimer = 0; ResetAttack(); ResetAttackNPC(); pEmote = 2304; IsDeadTimer = true; ApplyDead(); specialAttacks(); specialAttacks2(); specialAttacks3(); specialAttacks4(); specialAttacks5...
c5e159e0-0f13-4e43-9ef4-6f2f786d19f2
6
public ListNode rotateRight(ListNode head, int n) { if (head == null || head.next == null || n == 0) { return head; } ListNode tail = head; int len = 1; while (tail.next != null) { len++; tail = tail.next; } int shift = n % le...
a609bb11-9d54-4140-a500-7e00deacee44
8
public ArrayList<Integer> generateBlackPawnDestinations( int position ) { ArrayList<Integer> destinations = new ArrayList<Integer>(); if ( !hasPieceMoved( pieceAt( position ) ) && squareEmpty( position - 16 ) && squareEmpty( position - 32 ) ) { destinations.add( position - 32 ); } if ( !squareEmp...
49437ad1-85d1-498a-930c-0e195751a83d
8
public ClosingWindow() { initComponents(); if (SystemTray.isSupported()) { tray = SystemTray.getSystemTray(); //<editor-fold defaultstate="collapsed" desc="Menu"> PopupMenu menu = new PopupMenu(); MenuItem exitMenuItem = new MenuItem("Exit"); e...
474679ab-0263-47e3-883c-ee4c3ddc01a2
3
public static <T> Class<? extends Gen<T>> getStandardGenerator(Class<T> forClass) { @SuppressWarnings("unchecked") Class<? extends Gen<T>> genClass = (Class<? extends Gen<T>>) STD_GENERATORS.get(forClass); return genClass; }
dc3783cc-1309-4c05-8346-6508884dc82e
7
public void printAmicableNum(int size){ int sum[] = new int[size+1]; //init sum[i]=1 O(n) for (int i = 0; i <= size; i++) { sum[i] = 1; } /* *预处理,预处理是logN(调和级数)*N。 *@litaoye:调和级数1/2+1/3+1/4......的和近似为ln(n), *因此O(n*(1/2+1/3+1/4......))=O(n*ln(n))=O(N*log(N))。 */ for (int i = 2; i+i <= size;...
936b9edf-beda-4099-9d72-83387991a1b3
4
public List<Material> findMatchMaterials(Material originalMaterial){ List<Material> materialsTemp=new ArrayList<Material>(); for (Material material : materials) { if(material.getXunhao().equals(originalMaterial.getXunhao())){ if(material.getTidaixiangmuzu().equals(originalMaterial.getTidaixiangmuzu())){ ...
2c179c4f-aea2-4de1-a021-cc527c4671c7
1
private void playKaboom() { try { AudioInputStream audioIn = AudioSystem.getAudioInputStream(Game.class.getResource("kaboom.wav")); Clip clip = AudioSystem.getClip(); clip.open(audioIn); clip.start(); } catch (Exception e){ System.out.p...
23ba1620-e7c3-487d-9f5a-610c537509d6
9
public void cheat() { if (!isCheating) { isCheating = true; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { if (cells[i][j].getIsAMine()) { for (GameEventHandler gameEvent : gameEventList) { gameEvent.buttonUpdate(i, j, ButtonImage.MINE_NORMAL); } } } ...
241aea84-401e-495e-933f-a902065526be
0
public void setSumbitIp(String sumbitIp) { this.sumbitIp = sumbitIp; }
073350e7-7520-4ebd-a34f-b39833fc9fce
2
private int getLastRollMaxResult() { Iterator<Roll> it = historical.iterator(); int total = 0; Collection results = it.next().getRollResult(); while (it.hasNext()) { results = it.next().getRollResult(); } Iterator<Integer> it2 = results.iterator(); whi...
743c0066-4380-403c-9dca-a8f56d5867fe
5
public void keyPressed(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_UP){ me.setMoveUp(true); } if(e.getKeyCode() == KeyEvent.VK_DOWN){ me.setMoveDown(true); } if(e.getKeyCode() == KeyEvent.VK_LEFT){ me.setMoveLeft(true); } if(e.getKeyCode() == KeyEvent.VK_RIGHT){ me...
21f736fd-ba96-4e5b-8f35-7a60e6ac8a33
4
private Vector processRs(ResultSet rs, String key, String typeKey, ObjectNode parent, String type) throws Exception { Vector ret = new Vector(); while(rs.next() && build) { String name = rs.getObject(key).toString(); String databaseType = typeKey == null ? null : rs.getObject(typeKey).toStri...
e5345a8e-a55c-4fe5-bb3d-2a8e81a2a8fb
3
private boolean verify_OUT_Hierarchy(boolean conclusion, Set<Node> toVerifyOutNodes, Set<Node> verifiedOutNodes) { final Iterator itr = toVerifyOutNodes.iterator(); Node cur = (Node) itr.next(); toVerifyOutNodes.remove(cur); if (verifiedOutNodes.contains(cur)) { conclusion =...
1dfeffe5-b65d-4333-8dcd-886bdb1e1668
5
private void AddAllUniforms(String shaderText) { HashMap<String, ArrayList<GLSLStruct>> structs = FindUniformStructs(shaderText); final String UNIFORM_KEYWORD = "uniform"; int uniformStartLocation = shaderText.indexOf(UNIFORM_KEYWORD); while(uniformStartLocation != -1) { if(!(uniformStartLocation != 0 ...
0f6d670d-070a-4e79-9474-6ac7f984ebdf
3
@Override public void run() { String rawData = null; try { rawData = new String(packet.getData(), "UTF-8"); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { rawData = rawData.trim(); String colorRGB = rawData.split(...
cac5c66f-fb05-46f6-b3bb-4fa685f59f7f
4
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try{ for (User user : Users.getInstance().getUsers()) { if (user.getPseud...
c7c99d05-fcc0-41ab-8ef6-aa773dd289d6
5
private void ComputeHashActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComputeHashActionPerformed try { File spath = new File(jComboBox2.getSelectedItem().toString()); long diskSize = spath.getTotalSpace(); System.out.println("Disk size: " + diskSize + " o...
5731d21c-9ee6-465a-88a0-d8dd2c24f7ce
0
public static void main(String[] args) { BasicTextEncryptor textEncryptor = new BasicTextEncryptor(); textEncryptor.setPassword("P6 EPPM"); String myEncryptedText = textEncryptor.encrypt("psix$PROD1"); System.out.println("myEncryptedText=" + myEncryptedText); String plainText = textEncryptor.decrypt(myEncr...