method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
31715482-e113-4a4d-a96a-636824802ce3
5
public XmlWriter endEntity() throws IOException { if (this.stack.empty()) { throw new InvalidObjectException("Called endEntity too many times. "); } String name = this.stack.pop(); if (name != null) { if (this.empty) { writeAttributes(); ...
4113e661-4fea-4aab-8b7d-03a7ba61f757
2
public DaoGenerator( Table table ) { super( table ); this.table = table; daoName = table.getDomName() + "Dao"; filePath = "src/main/java/" + packageToPath() + "/dao/" + daoName + ".java"; for ( Column column : table.getColumns() ) { if ( column.isKey() ) { ...
4da52790-1b31-47a0-b8ba-79c297ba2108
9
@Override public void run(){ try{ PrintWriter out=new PrintWriter( socket.getOutputStream(),true); BufferedReader in=new BufferedReader(new InputStreamReader(socket.getInputStream())); synchronized(this){ int count; ...
c2aee310-58fb-42f0-b855-c24e665b4be9
5
@SuppressWarnings("unchecked") public static void main(String[] args) { int len = 10; List<Holder<Integer>> lst = new ArrayList<Holder<Integer>>(len); System.out.println("List size: " + lst.size()); Random rand = new Random(); int num; System.out.print("Adding:"); ...
ce712a99-e72c-42b9-96e5-23fee7a6def7
8
public int send(Map<String, String> record) { String[] emails = record.get("email").split("[|]"); String[] telnos = record.get("telno").split("[|]"); String[] pernrs = record.get("pernr").split("[|]"); // 获得并设置接收人 Map<String, String> recieversMap = service.getRecievers(emails, telnos, pernrs); telMap ...
c982415e-4711-4c96-8443-3c385fc1f00b
5
public boolean check_Authors(){ boolean nameValid = false; int counter = 0; for (int i =0; i<authors.size(); i++){ if (!authors.get(i).getName().isEmpty() && authors.get(i).getName() != null){ counter ++; } } if (authors.size()==0){ n...
f319cf54-92aa-4407-b729-34f451afb4c3
3
private void leftRotate(RBNode x) { RBNode y = x.getRightChild(); x.setRightChild(y.getLeftChild()); if (y.hasLeftChild()) { y.getLeftChild().setParent(x); } y.setParent(x.getParent()); if (!x.hasParent()) { setRoot(y); } else if (x == x...
d5108675-6daa-4dd9-9718-60ce36b75bd5
9
static void RenderSprite(osd_bitmap bitmap, int spr_number) { int SprX, SprY, Col, Row, Height, src; int bank; UBytePtr SprReg = new UBytePtr();//unsigned char *SprReg; UBytePtr SprPalette = new UBytePtr();//unsigned short *SprPalette; short skip; /* bytes to skip before drawing ...
2b71108a-dfee-4e59-a657-d2e6b519e86f
7
private int handleStringConstant(int pos, String operand) { char c = operand.charAt(0); int num = 0; if (c == '"') { // What is the stuffing method here? for (int i = 1, n = operand.length(); i < n; i++) { c = operand.charAt(i); if (c != '"') { memory[pos] = c; pos++; num++; } } ...
a1040bc4-f558-4b37-bd72-78b766ca8fb8
7
public boolean parse(String text) { int n = 0; lex = new CompoLexical(text); LinkedList<LinkedList<Vector<Utils.Identifier>> > Table = new LinkedList<LinkedList<Vector<Utils.Identifier>>>(); LinkedList<Vector<Utils.Identifier>> row = new Li...
54bec42b-4b5a-46f6-9f8f-db642d67a0e6
9
static public String purefilename (String filename) { char a[]=filename.toCharArray(); int i=a.length-1; char fs=File.separatorChar; while (i>=0) { if (a[i]==fs || a[i]=='/' || i==0) { if (i==0) i=-1; if (i<a.length-1) { int j=a.length-1; while (j>i && a[j]!='.') j--; if (j>i+1) retu...
8f8ec01f-5ae6-4346-833f-31d2cbe6db73
8
private void readValues(Stream stream) { do { int i = stream.readUnsignedByte(); boolean dummy; if(i == 0) return; else if(i == 1) { anInt390 = stream.read3Bytes(); method262(anInt390); } else if(i == 2) anInt391 = stream.readUnsignedByte(); else if(i == 3) dummy =...
033741d7-4e3f-475b-a781-c764614263d2
6
public List<Entity> getNearestEntities(final Entity ent, double radius) { List<Entity> nearestEntities = new ArrayList<Entity>(); List<Entity> entList = core.getEntityList(); for(Entity entN : entList) { if(!entN.equals(ent) && entN.getLocation().distanceTo(ent.getLocation())<radius) { nearestEntities.add...
fbc0ba72-c3b6-4987-aa65-afb5cb485911
1
@Override public void draw(Graphics g) { // If alive, draw the fighter jet if (Alive) { g.drawImage(img1, pos_x, pos_y, width, height, null); } // If dead, draw blood else { g.drawImage(img2, pos_x, pos_y, width, height, null); } }
d3571fa4-1a16-467b-8365-81dbdedf79b6
1
public double getDefaultVolume(String soundName) { Sound sound = sounds.get(soundName); if (sound != null) { return sound.getDefaultVolume(); } return -1.0; }
c3aebd43-40d5-450f-8e72-d2871ad689a8
3
double findTSval(String[] s){ double TSval=0; boolean find=false; int i=0; while(find ==false && i<s.length){ String tmp = s[i]; if(tmp.contains("TSval")){ find=true; TSval=Double.parseDouble(tmp.substring(6)); } i++; } return TSval; }
fe55ebcc-73c3-4747-b8b4-9d2ce332c553
5
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode head = new ListNode(-1); ListNode p = head; while (l1 != null && l2 != null) { if (l1.val > l2.val) { p.next = l2; l2 = l2.next; } else { p.next = l1; ...
1b8081d4-c2b4-41b6-b1c6-886bd79a9cb1
5
private boolean shouldAddInstance(RelationInstance instance) { if(filterRelations == false){ return true; } if(instance.getArguments().size() >= 1){ for(Argument arg : instance.getArguments()){ if(arg.getArgumentType().equals("SUBJ") || arg.getArgumentType().equals("DOBJ")){ return true; } ...
89eff8d4-3dcb-49b8-847b-a231af4e0706
4
private boolean testValidProtocol(Element el, Attribute attr, Set<Protocol> protocols) { // try to resolve relative urls to abs, and optionally update the attribute so output html has abs. // rels without a baseuri get removed String value = el.absUrl(attr.getKey()); if (value.length() =...
98f250f9-5e11-4199-ae7a-fd5aeff8fd08
0
@SuppressWarnings("unchecked") public List<Osoba> getWszystkieOsoby() { return em.createNamedQuery("osoba.all").getResultList(); }
cb630724-742e-4423-b383-9dcd320152a1
9
public void mouseMoved(MouseEvent Event) { boolean needRepaint = false; if (null != this.vertexToDelete) { this.deleteVertex(this.vertexToDelete); this.selectedVertex = null; } if (null != this.movingVertex) { this.selectedVertex = null; th...
21364389-74f2-423d-a4e5-a3654ed9e55b
3
public void freePackets(){ activePacket = null; if(packetList != null) { Iterator<Packet> packetIter = packetList.iterator(); while(packetIter.hasNext()){ Packet.free(packetIter.next()); } packetList.clear(); } else { if(singlePacket != null) { Packet.free(singlePacket); singlePacket = ...
c4c144e7-1865-4279-be1d-368c6b082a94
7
public void newGame() { InitializeRandomProblem(40); lastAction = new int[6]; lastAction[ID] = -1; lastAction[TYPE] = NO_TYPE; // NO CASE. Voting Finished. lastAction[ACTION] = NEW_GAME; lastAction[X] = -1; lastAction[Y] = -1; lastAction[VALUE] = -1; lastActionsList.add(0, lastAction...
b3fa80fb-9a60-4ee8-a62b-17ab6f4a43a7
5
public static void main(String[] args) throws IOException { FileReaderStrategy frs = new ReadFromTextFile(6); FormatStrategy format = new PipeSeparatorFormat(frs); // Shows formatted list for (String s : format.getFormattedList()) { System.out.println(s); } Sy...
7e947bda-57cf-4e61-b673-459030711224
5
@Override public boolean onCommand(CommandSender sender, Command command, String lable, String[] args) { Player player = null; Player toPlayer = null; if (!(sender instanceof Player)) { master.getLogManager().info( "You cannot do this from the server console."); return true; } player = ...
de09c1ee-f2c5-4d31-a458-56babb903bd2
1
public void stopPlayer() { status = STOP; if (player != null) { player.close(); } player = null; }
5162bd94-39ba-4af6-93c0-0f4220e413f2
0
@Override public void mousePressed(MouseEvent e) { isMouseDown = true; mouseY = e.getY(); }
dc53aaa8-a600-4609-ac61-1e8b60f8c425
2
public boolean heeftMonteur(String kt){ boolean b = false; for (Gebruiker m: alleMonteurs){ if (m.getNaam().equals(kt)){ b = true; } } return b; }
0a746085-d925-4004-85be-03b881999e12
2
public void jsFunction_setSpeed(int speed) { deprecated(); if(speed < 0) speed = 0; else if(speed > 3) speed = 3; JSBotUtils.setSpeed(speed); }
fbb89a22-f144-4b97-bc40-369572b6c5e9
9
private JScrollPane getScrollBar(Element e) throws IOException { Element scrollPaneElt = e.getChild("ScrollPane"); if( scrollPaneElt != null ) { int horizontal = JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED; int vertical = JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED; String s = scrollPaneElt.getAttributeValue...
0125e992-39e9-4a3d-a903-120d9001344d
6
public long discreteLogarithmFromExpectedRange(BigInteger value, long expectedResult, long searchRadius) { if(expectedResult - searchRadius < 0 || searchRadius == 0) { throw new IllegalArgumentException(); } long start = expectedResult - searchRadius; long end = expectedResult + searchRadius; boolea...
f67a24c5-7b97-4d9b-b4ba-6e81024c2a0d
1
@Override public int attack(double agility, double luck) { if(random.nextInt(100) < luck) { System.out.println("I just did a soul strike!"); return random.nextInt((int) agility) * 2; } return 0; }
eed30a6d-3fb4-431a-936a-343caa3321a8
8
public static void main(String[] args) { int count = 0; char[] faces = { '2', '3', '4', '5', '6', '7', '8', '9', '\10', 'J', 'Q', 'K', 'A' }; char[] suits = { '♣', '♦', '♥', '♠' }; for (int i = 0; i < faces.length; i++) { for (int j = 0; j < faces.length; j++) { for (int k = 0; k < suits.le...
5e687f3e-b7f8-4133-9f48-add61d11add7
1
public ShutdownPreview(SkinPropertiesVO skin, JPanel parent) { if (skin == null) { IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!"); throw iae; } this.skin = skin; this.parent = parent; }
f3afd743-b520-4d74-a226-8046b3b5f075
5
Object[] parameterForType(String typeName, String value, Widget widget) { if (value.equals("")) return new Object[] {new TableItem[0]}; // bug in Table? if (typeName.equals("org.eclipse.swt.widgets.TableItem")) { TableItem item = findItem(value, ((Table) widget).getItems()); if (item != null) return new Objec...
28fd3b93-9265-48dd-aeda-dc703f125466
2
public void visitTypeInsn(final int opcode, final String type) { mv.visitTypeInsn(opcode, type); // ANEWARRAY, CHECKCAST or INSTANCEOF don't change stack if (constructor && opcode == NEW) { pushValue(OTHER); } }
587282ca-7511-464d-8f3d-983d6cee14ad
2
public List<Transition> getTransitionsByStateAndSymbol(String state, String symbol) throws Exception{ List<Transition> result = new ArrayList<Transition>(); for(Transition tran: transitions){ if(tran.matchByStateAndSymbol(state, symbol, getSymbolByAlter(tran.getSymbolRef()))) ...
d0f8031f-fc11-450b-b643-f55f9c039d9a
9
static boolean processWith(StringBuffer sb) { int i = find(sb, "with"); if (i < 0) { return false; } int j = find(sb, "do", i); if (j < 0) { return false; } int k = find(sb, "begin", j); if (k < 0) { return false; } int l = find(sb, "end", k); if (l < 0) { return false; } Strin...
4f8ab429-0906-4391-8db0-4d06b774bc46
0
public void testStartSeleniumServer() throws Exception { //passing a method Print callCommand(TestSteps2(), "hello world"); }
dac4d1df-a9f4-4757-94ba-2848dd145ac7
5
public CheckResultMessage check18(int day) { int r1 = get(33, 5); int c1 = get(34, 5); int r2 = get(39, 5); int c2 = get(40, 5); BigDecimal b = new BigDecimal(0); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); b = getValue(r1 +...
a55ae3c2-470e-44fd-b97a-105929889a56
4
public int getHeadRulePriority(String category, String edgeLabel, String childCategory) { if (!headRules.containsKey(category) || !headRules.get(category).containsKey(edgeLabel)) return Integer.MAX_VALUE; if (headRules.get(category).get(edgeLabel).containsKey("")) return headRules.get(category).get(edgeLa...
71aafb89-2685-4e67-95e2-7d2bd48b88cd
4
public void addPattern(Pattern<?,?> pair) throws NNException { if (pair.inputAdapter.numberOfSignals() != network.numberOfInputs()) { throw new NNException("Incorrect number of inputs in pattern. " + "Network expected " + network.numberOfInputs() + ", but was " + pair.inputAdapter.numberOfSignals()); }...
0a230197-c409-47aa-806f-b7dd20f133a2
4
public void draw(Graphics g, Dimension d, Camera cam){ //Draw background drawBackground(g, d, cam); //Draw Player if (player != null){ player.draw(g,cam); } //Draw the world for (Tile items: map){ items.draw(g,cam); } //Draw the characters for (Entity entity: entities){ entity.draw(g,cam); ...
ede6b88c-705c-4af9-a59d-18e836fb6bb1
0
@Override public void setWatchKey(Object assignedWatchKey) { this.watchKey = (Integer) assignedWatchKey; }
4271c125-2cc5-4c4a-8278-5186e322559d
3
public String value_string(Object x) { if (x == null ) return "''"; else if(x instanceof String ) return "'" + x.toString() + "'"; else if(x instanceof java.util.Date) return sql_date((java.util.Date)x); else return x.toString(); }
fa1e03e7-22f9-4ccc-ade9-8abc38930e94
6
public static void main(String args[]) { Scanner sc = new Scanner(System.in); int T=sc.nextInt(); while(T>0) { T--; String s = sc.next(); if(s.length()>3) System.out.println(3); else { int cnt...
d82c20a7-5a8b-4f8d-abc1-27cebd8cb4cd
5
public int getBlue(int row, int col) { if (row >=0 && row < rows && col >= 0 && col < columns && grid[row][col] != null) return grid[row][col].getBlue(); else return defaultColor.getBlue(); }
755ec1fc-121e-43b3-bff8-63bf9cf70182
9
public String findSmallestWindow(String str1, String str2) { // table with counter for another string's characters int[] needsToFind = new int[256]; // variable for begin index int begin = 0; // table with counter for first string's characters int[] hasToFind = new int[256]; // variable for counting simil...
5504a8e4-e4e0-48a5-93fd-1e5bf2e3b109
7
private void inject(Player player) { boolean injected = false; if (player.getClass().isAssignableFrom(this.craftPlayer)) { try { final Object entPlayer = this.getHandle.invoke(player); if (entPlayer.getClass().isAssignableFrom(this.entityPlayerClass)) { ...
516f9a37-dcea-47a5-85c0-14806da5a615
3
public static void unpackConfig(Archive archive) { Stream stream = new Stream(archive.get("flo.dat")); int cacheSize = stream.getUnsignedShort(); if (Floor.cachedFloors == null) { Floor.cachedFloors = new Floor[cacheSize]; } for (int i = 0; i < cacheSize; i++) { if (Floor.cachedFloors[i] == null) { ...
67a6c5b2-0d78-44c0-8f67-520515a0546f
5
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == hero1) { whoIsHero = "Crazy Dave"; } if (e.getSource() == hero2) { whoIsHero = "Pea Shooter"; } if (e.getSource() == hero3) { whoIsHero = "Ice Plant"; } ...
9b61e025-1b58-4d9f-8f0a-4484ac7dd689
2
public static Connection getConnection() { if (connection == null) { try { Properties properties = new Properties(); properties.load(DatabaseHelper.class.getResourceAsStream("/com/dnx/multi/database/database.properties")); MysqlDataSource dataSource = ...
9802ac06-98f0-4479-a16a-8235b7b1a7ab
7
public int moveLeft(boolean findChange) { int total = 0; for (int y = 0; y < 4; y++) { for (int x = 3; x > 0; x--) { if (next.grid[x][y] != 0 && next.grid[x][y] == next.grid[x-1][y]) { next.grid[x-1][y] *= 2; next.grid[x][y] = 0; ...
a564702c-7f98-42c7-9a37-1efef3149e28
2
public void removeElement(GraphElement ge) { if (GraphLine.class.isInstance(ge)) { removeLine((GraphLine) ge); } else if (GraphPoint.class.isInstance(ge)) { removePoint((GraphPoint)ge); } }
2f4e3bb7-ae1d-4397-80ee-dc6635cde82a
4
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_saveActionPerformed // TODO add your handling code here: String nomeprod, qtdprod, codprod, dataped; nomeprod = txt_nomeprod.getText(); qtdprod = txt_qtdprod.getText(); codprod = ...
57b5c8c8-0ee6-47e6-b539-ecc40647e6a1
1
private void initialize() { this.setBounds(100, 100, 800, 600); sourceImagePanel = new JPanel(); sourceImagePanel.setBounds(10, 30, 293, 447); getContentPane().add(sourceImagePanel); imageSourceLabel = new JLabel(""); sourceImagePanel.add(imageSourceLabel); imageSourceLabel.setIcon(new ImageIcon(IMAGE_S...
bb7215bf-dad5-40a5-92b2-0ea0473d6575
9
public static void main(String args[]) { List<Integer> lists = new LinkedList<Integer>(); // list store all the // left numbers, big // at first for (int i = 9; i >= 0; i--) { lists.add(i); } System.out.println(lists.get(0)); int remain = pos; // 0 as the upper digits for ...
7c47d889-182f-4fff-b6f4-f78aed0c13fe
4
@Override public void tickClient() { super.tickClient(); if (SignalTools.effectManager != null && SignalTools.effectManager.isTuningAuraActive()) { for (WorldCoordinate coord : getPairs()) { SignalReceiver receiver = getReceiverAt(coord); if (receiver != n...
a625af94-c272-4b1a-acf2-e7113d995e61
2
public static CtMethod setter(String methodName, CtField field) throws CannotCompileException { FieldInfo finfo = field.getFieldInfo2(); String fieldType = finfo.getDescriptor(); String desc = "(" + fieldType + ")V"; ConstPool cp = finfo.getConstPool(); MethodInfo min...
3f8e6be2-e849-4dd9-ab1d-67bae083c25c
0
public synchronized void stopNotification() { this.aNotification.clear(); this.notifyAll(); }
777b2c0e-9a4c-45d0-93f7-0371e2dbad1d
0
public void setStrength(double strength) { this.strength = strength; }
11a0c9b5-d906-44af-9594-61eeb212740e
6
public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception { HashMap<String, HashMap<String, Integer>> map = new HashMap<String, HashMap<String,Integer>>(); BufferedReader reader = filePath.toLowerCase().endsWith("gz") ? new BufferedReader(new InputStreamReader( ...
8a95d5eb-2b28-48fc-a155-6b1bc0027f19
1
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) resp; if(request.getSession().getAttribute("USER_NAME") != null){ } ...
f4d90374-3607-4e4f-a2c2-571c4bec0673
4
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(args.length == 0) { return noArgs(sender, command, label); } else { final String subcmd = args[0].toLowerCase(); // Check known handlers first a...
f0c78ee3-1f69-45e1-b973-91edc3422c58
5
public void turnTaking(Move theMove) { Piece pieceToMove = getPiece(theMove.getSource()); String color = isLightTurn ? "light" : "dark"; if (pieceToMove.getPieceColor().equals(color) && pieceToMove != null) { makeMove(theMove); if (pieceToMove.isValid) { ...
d4135342-a9ae-4279-a8e4-b6a726f934f1
6
public Enemy(boolean side, int color, int movePattern, int bulletPattern, int bullets, double direction, int bulletSpeed) { super("sprites/fairyG_1.png"); if(color > 4 || color < 1) { color = 1; } if(color == 2) { setImage("sprite...
66e57b61-b921-465d-ab51-4c36672cdb27
9
protected final void move(byte dir) { if (distanceToTravel == 0) { if (dir == NORTH) { facing = NORTH; if (!hub.game.region.isTileOccupied(mapX, mapY - 1)) distanceToTravel = 50; } else if (dir == SOUTH) { facing = SOUTH; if (!hub.gam...
8e3158c0-6457-4e32-b6e5-fd7c9a654534
9
public static double getAngleOfEllipseAtAngle(double angleFromCenter, double horizontalAxis, double verticalAxis) { if (horizontalAxis == verticalAxis) { return angleFromCenter; } //System.out.println(angleFromCenter); double axisLengths = Math.pow(horizontalAxis ...
c7a61f26-0b9d-49b0-855e-b6031f51704d
0
public void setDesc(String desc) { this.desc = desc; }
fff21c03-8cab-4c47-8336-4a0b052ed68e
9
public void delete(Key key) { if(key == null) { throw new NullPointerException("Key may not be null"); } if(!membershipTest(key)) { throw new IllegalArgumentException("Key is not a member"); } int[] h = hash.hash(key); hash.clear(); for(int i = 0; i < nbHash; i++) { ...
aff486e1-a55f-49d5-87f1-7a77a0d7d92a
3
public boolean asyncRequest(String url, String httpMethod, OauthKey key, List<QParameter> listParam, List<QParameter> listFile, QAsyncHandler asyncHandler, Object cookie) { OAuth oauth = new OAuth(); StringBuffer sbQueryString = new StringBuffer(); String oauthUrl = oauth.getOauthUrl(url, httpMethod, ke...
9509c79f-ba04-4b06-bcb2-b31072401b65
8
public int[] fix45(int[] nums) { for (int i = 0; i < nums.length; i++) { if (nums[i] == 4) { for (int j = i+1; j < nums.length; j++) { if (nums[j] == 5) { int temp = nums[i+1]; nums[i+1] = nums[j]; ...
e95b2d41-6752-40c3-a6db-2b3a6e0e6bdf
4
public static void save(String filename) { File file = new File(filename); String suffix = filename.substring(filename.lastIndexOf('.') + 1); // png files if (suffix.toLowerCase().equals("png")) { try { ImageIO.write(onscreenImage, suffix, file); } catch (IOExcep...
c03fdd47-a53b-42a4-adf6-bf2aac594dc4
3
public static int parseColor(String colorString) throws IllegalArgumentException { if (colorString.charAt(0) == '#') { // Use a long to avoid rollovers on #ffXXXXXX long color = Long.parseLong(colorString.substring(1), 16); if (colorString.length() == 7) { // ...
b4e0861d-8d62-449b-9995-ad5499c2b85d
4
public static boolean isAllUpperCase(String cs) { if (cs == null || StringUtil.isEmpty(cs)) { return false; } int sz = cs.length(); for (int i = 0; i < sz; i++) { if (Character.isUpperCase(cs.charAt(i)) == false) { return false; } } return true; }
647e30b9-53b4-4fec-8f56-7d38ee65c37f
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) { ...
858357da-f0b6-470e-a8d7-5e01cf5324dc
3
private MapLayer unmarshalObjectGroup(Node t) throws Exception { ObjectGroup og = null; try { og = (ObjectGroup)unmarshalClass(ObjectGroup.class, t); } catch (Exception e) { e.printStackTrace(); return og; } final int offsetX = getAttribute(t,...
9ae2861c-00e6-4864-85d0-9e7061470474
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
ecbab431-e6bd-43b8-9946-6185d34d0497
4
@Override public void addComponent(Component component, LayoutParameter... parameters) { if(parameters.length == 0) { parameters = new LayoutParameter[] { CENTER }; } else if(parameters.length > 1) { throw new IllegalArgumentException("Calling BorderLayout.addComponen...
62ccb663-74d9-4328-bce8-c9556ccea076
3
private static Method getMethod(Class<?> cl, String method) { for(Method m : cl.getMethods()) { if(m.getName().equals(method)) { return m; } } return null; }
a950310a-f100-4330-b81e-7621cc30056e
7
public GamesFolder(ZipFile file, String path) throws IOException { this.path = path; JsonReader reader = ZIPHelper.getJsonReader(file, path + "info.json"); reader.beginObject(); while (reader.peek() == JsonToken.NAME) { String name = reader.nextName(); if ("game_folders".equals(name)) { Strin...
18bd9c5e-2427-42ad-8f1a-9b30d3f2ac49
9
public void compile() { errs.clear(); int n = 0; int max = links.getHighestDep(); //System.out.println("* MAX "+max); while (n<=max) { ArrayList<Import> imps = links.getLinksWithDepsOf(n); //System.out.println("* N "+n); //System.out.println("* IMPS "+imps); if (imps.isEmpty()) { n++; } ...
644c5b96-b839-486e-bfc0-bb5fc67ca2e4
1
public static S3Object downloadObject(RestS3Service ss, String testBucknetName, String testObjectName) { S3Object s3objectRes = null; try { s3objectRes = ss.getObject(testBucknetName, testObjectName); } catch (S3ServiceException e) { e.printStackTrace(); } return s3objectRes; }
de598bfc-bbce-4573-84b3-0f090ae6658c
2
public static BuildingTag getName(char tag) { if (mapping == null) { mapping = new HashMap<Character, BuildingTag>(); for (BuildingTag ut : values()) { mapping.put(ut.tag, ut); } } return mapping.get(tag); }
26a3808e-c692-4714-b042-500d7939e72a
7
private int partition(int start, int end) { SortingUtils.swap(array, start, new Random().nextInt(end-start+1)+start); int i = start; int j = end; int pivotV = array[i]; while(i<j) { while(i<j && array[j]>=pivotV) {j--;} if(i<j) { array[i++] = array[j]; } while(i<j && array[i]<pivotV) {i++;}...
9c13e47f-e502-4407-854d-9486fea0231b
1
public static <D> D getInstance(Class<D> _class) { try { return _class.newInstance(); } catch (Exception _ex) { _ex.printStackTrace(); } return null; }
211addcc-3445-4461-ad67-6ec20b24316d
7
public static int[][] multiply(int[][] f, int[][] s) { int f_rows = f.length; int s_rows = s.length; if(f_rows == 0) { return s; } if(s_rows == 0) { return f; } int f_cols = f[0].length; if (f_cols != s_rows) { ...
a3ff0379-0d83-4f51-96cb-457f7fab66c0
8
public void testDataDependance2() { try { TreeNode label = new TreeNode("label"); TreeNode result = contains(new TreeNode(label), mkChain(new TreeNode[]{ label })); assertTrue(null, "Failed to locate the only node of a leaf!", result != null &...
47a3b23b-deff-47d8-8fc3-12f207eb3dd7
3
* @return Returns the style of the cell. */ public Map<String, Object> getCellStyle(Object cell) { Map<String, Object> style = (model.isEdge(cell)) ? stylesheet .getDefaultEdgeStyle() : stylesheet.getDefaultVertexStyle(); String name = model.getStyle(cell); if (name != null) { style = postProcessCe...
3dcf8633-8e06-4ce4-b808-1fc22d3606cf
6
public static Long valueOf(Object o) { if (o == null) { return null; } else if (o instanceof Byte) { return (long)(Byte)o; } else if (o instanceof Integer) { return (long)(Integer)o; } else if (o instanceof Double) { return (long)(double)(D...
de82767b-55a7-48e8-a664-a88889520b37
0
public Double getAvb() { return avb; }
23daf9b2-bb3c-4d6d-9a0e-ac0ed75d753c
2
public static Matrix random(int M, int N) { Matrix A = new Matrix(M, N); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) A.data[i][j] = Math.random(); return A; }
e4f8be34-a3ec-4356-b2ea-951439ef3914
2
private boolean checkFieldInclineWinn(char cellValue){ if(checkInclineDownWinn(cellValue) || checkInclineUpWinn(cellValue)){ return true; } return false; }
02383b4f-8d5a-4972-b121-47377955dab5
9
private final static String[] buildFileForName(String filename, String contents) { String[] result = new String[contents.length()]; result[0] = null; int resultCount = 1; StringBuffer buffer = new StringBuffer(); int start = contents.indexOf("name[]"); //$NON-NLS-1$ start = contents.indexOf('\"', start); int e...
a016e1a3-022e-4967-97ca-1b291b12607d
5
public int[] getOID(byte type) throws ASN1DecoderFail { if(data[offset]!=type) throw new ASN1DecoderFail("OCTET STR: "+type+" != "+data[offset]); byte[] b_value = new byte[contentLength()]; Encoder.copyBytes(b_value, 0, data, contentLength(),offset+typeLen()+lenLen()); int len=2; for(int k=1;k<b_value.length;...
72cf2496-e8d2-4be3-b3fa-343dc921e715
5
public void onBlockAdded(World var1, int var2, int var3, int var4) { super.onBlockAdded(var1, var2, var3, var4); if(!var1.multiplayerWorld) { this.updateAndPropagateCurrentStrength(var1, var2, var3, var4); var1.notifyBlocksOfNeighborChange(var2, var3 + 1, var4, this.blockID); var1...
34156a55-b0f5-4303-a937-070f5ecc82a2
2
@Override public void mouseClicked(MouseEvent e) { //if (spawnMenuItem.isEnabled()) { int newX = (int) Math.round(e.getX() / (double) game.getPixelSize()); int newY = (int) Math.round(e.getY() / (double) game.getPixelSize()); if (game.isInBounds(newX, newY)) { if (erase) ...
b6d6714b-7d07-4ac6-be56-494c48e23e15
3
public static void main(String[] args) { for(int i = 1; i <= (10/2+1); i++) { for (int j = i; j <= 10/2; j++) { System.out.printf(" "); } for (int j = 1; j <= (i*2-1); j++) { System.out.printf("*"); } System.out.printf("\n"); } }
f274c82e-d575-4dab-8c8f-9fad577476a1
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; TextComponent other = (TextComponent) obj; if (components == null) { if (other.components != null) return false; } else if (!comp...
a2cf75bb-3bc2-40ff-b02d-920f1d7e755f
4
public void setGameOption(int token){ if( token == 0){ if( gameOptionCursor < gameOption.length - 1) gameOptionCursor ++ ; else gameOptionCursor = 0 ; }else if( token == 1){ if( gameOptionCursor > 0) gameOptionCursor -- ; else gameOptionCursor = gameOption.length - 1 ; } }