method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
380ff1c7-17b2-4e0e-b834-f9db03d20f2c
2
public boolean equals(Object o) { if (! (o instanceof MultiArrayType)) return false; MultiArrayType multi = (MultiArrayType)o; return component.equals(multi.component) && dims == multi.dims; }
25afd0d1-8e84-4f15-b079-8e6ab67767a3
8
public String bet(int minBet,int maxBet){ double avrgOppAPW = getAvrgOppAPW(match.holeCards.size()); if (avrgOppAPW != 0.0) { double avrgOppWin = getAvrgOppWin(match.holeCards.size()); if (avrgOppAPW <= 0.35) { if (avrgOppWin >= (match.stackSize / 4)) { weight *= 1.5; } } if (avrgOppAPW...
8fd6bfc7-8d41-4e0e-ba9c-4db3ac8987e9
3
protected static void startSendMessage(OutputStream out){ while(true){ try{ out.write(0x00); out.write(("the time of client is: " + System.currentTimeMillis()).getBytes("utf-8")); out.write(0xff); out.flush(); log.info(123); Thread.currentThread().sleep(1000); }catch (IOException e) { ...
826ae4d0-4077-4bcb-9f7e-90a219786c16
5
public static void main(String[] args) { GamePrinter.printMainMenu(); switch (scan.nextLine()) { case "1": Spieler[] spielerListe = spielVorbereiten(); GameController game = new GameController(spielerListe); game.starteSpiel(); System.exit(0); break; case "2": GamePrinter.printSpielregeln(); ...
e768964e-ace8-4fe6-8db2-1a6666f0a286
6
public void generateDirectoryListing( UUID sid, OutputStream out ) throws IOException { String title = "Index of " + this.getRequestURI().getPath() + getFormattedLineBreak(2); if( this.isHTMLFormat() ) { String cssPath = "/system/styles/directory.list.css"; StringBuffer htmlHeader = new StringB...
87cdf433-7112-4e9a-9718-648942b456a6
5
public void fileAgentSend(FileAgent agent) { if(agent != null) { delAgentsRunning(); if(!client.getNextNode().equals(client.getThisNode())) { try { AgentManagerInterface iFace = (AgentManagerInterface)client.getAgentManagerInterface(client.getNextNode()); iFace.fileAgentReceived(agen...
6ae5ebc2-508d-46a5-89e8-3bc65c9b4125
6
private static Map readSettings() throws Exception { final Map result = new HashMap(); FileReader fr = null; BufferedReader br = null; String line = null; try { fr = new FileReader("settings.properties"); br = new BufferedReader(fr); while ((...
c5be06e3-b158-4ffe-9b31-fc2644b0d5fd
9
public void drawView(Graphics2D g){ int tileSize = 600 / tilesPerScreen; if(texture == null) updateView(); if(texture == null) return; for(int x = 0; x < texture.length; x++) for(int y = 0; y < texture.length; y++){ if(x >= texture.length | y >= textu...
c6fcf5b8-5683-4eff-9206-5615f6e0bf62
5
public void abrir() throws Exception { if(id.length() > 0 && id != "0"){ long cod = Long.parseLong(id); if(cliente == null || (cliente != null && cliente.getId() != cod ) ) setCliente(ejb.Open(cod)); } }
b22b70ee-8e3d-45bf-a287-4dad998cf299
8
static public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[29]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 3; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { ...
666b48de-5f06-4ee2-a879-b1fc1ba6ddb5
4
@Override public Object getValueAt(int row, int col) { switch (col) { case 0: return entidades.get(row).getRazaoSocial(); case 1: return entidades.get(row).getNomeResponsavel(); case 2: return entidades.get(row).getTelefone(...
793d1423-fb23-4781-add1-10e803b83c70
9
private List<Action> buildOrder(Player a) { List<Action> actions = new ArrayList<Action>(); for(Action action : a.getActions()){ if (action.type == Type.Building && buildings) actions.add(action); if (action.type == Type.Unit && units) actions.add(action); if (action.type == Type.Research && resea...
6e6c2a9c-fcb5-47fb-9d37-715e78882045
0
public QuestType getQuestType() { return type; }
198f6be4-54ef-4d1b-b35a-5eb850d5823c
7
public void removeLineFromFile(String file, String lineToRemove) { try { File inFile = new File(file); if (!inFile.isFile()) { System.out.println("Parameter is not an existing file"); return; } //Construct the new file that will later be renamed to the original filename. File tempF...
e631d103-068f-4cc5-8882-0933c1d9d5e8
4
public static void main(String[] args) { List<SortStatistic> sortStatListQS = new ArrayList<SortStatistic>(); List<SortStatistic> sortStatListMS = new ArrayList<SortStatistic>(); /** * k: beschreibt den aktuellen Seed-Wert und wird von 0 bis NUMBER_OF_SEEDS * jeweils um 1 inkrementiert. In den E...
c83b90ab-144a-456d-bd4e-54cc80814b1d
5
public void start() { /*vertx.eventBus().registerHandler("ping-address", new Handler<Message<String>>() { @Override public void handle(Message<String> message) { message.reply("pong!"); container.logger().info("Sent back pong"); } }); container.logger().info("PingVerticl...
054dc4b8-62dc-4f36-bdbd-e608af9acfa6
2
public double getKiihtyvyys1Y() { double res = 0; if(getNappaimenTila(YLOS1)){ res -= KIIHTYVYYS; } if(getNappaimenTila(ALAS1)){ res += KIIHTYVYYS; } return res; }
a6f485a7-5fcf-43b3-a099-bdbeb20d3ead
5
private boolean createAccount() { UserType type = null; boolean isSaved = false; System.out.println("Please select what do you want to be :"); System.out.println("1: Manager \n2: Student \n3: Teacher\n4: Personnel"); int choice = read.nextInt(); switch (choice) { ...
4589bc1d-88df-4862-b987-705d8946ed6b
3
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { if (response instanceof HttpServletResponse && request instanceof HttpServletRequest) { HttpServletRequest httpRequest = (HttpServletRequest) request; ...
abfb00fd-6d4a-48e0-83c2-975cf2320906
9
protected void fillRaster(int[] pixels, int off, int adjust, int x, int y, int w, int h) { //constant which can be pulled out of the inner loop final float initConst = (dgdX * x) + gc; if (fillMethod == ANTI_ALIAS_IMPL) { //initialize current value to ...
2bb0ca2f-ec28-478c-b65c-8496e7868fa2
5
public void run(){ while(null != waitingCars){ if(waitingCars.size() != 0){ CarPlace2 carPlace = getFreeCarPlace(); if(carPlace != null){ Car2 currCar = null; try { waitingCarsSemaphore.acquire(); ...
481d944a-990c-4d9c-b4c9-f06a974f1dce
3
public static void main( String[] args ) throws RemoteException, NotBoundException, MalformedURLException { System.out.println( "Hello World!" ); Client a =new Client(); InterServeur is=a.getServeurObject(); System.out.println(is.test()); boolean b =is.getConnexion("didier.kouame", ...
652a2be2-1614-4d76-a025-497ac6071930
8
public ChannelLPC(BitInputStream is, Header header, ChannelData channelData, int bps, int wastedBits, int order) throws IOException, FrameDecodeException { super(header, wastedBits); this.residual = channelData.getResidual(); this.order = order; // read warm-up samples //System...
972595fc-be6a-4f7d-884f-a26e5ca24f05
7
@Override protected void processChunk() { Classifier addedClassifier = null; // Compute weights double candidateClassifierWeight = this.computeCandidateWeight( this.candidateClassifier, this.currentChunk, this.numFolds); for (int i = 0; i < this.storedLearners.lengt...
11381895-7d68-43ef-96e6-d9df5ea84212
6
@SuppressWarnings("CallToThreadDumpStack") public void split_Lines(String nameFile, ArrayList listSubSequen) { try { ArrayList numColum; numColum = new ArrayList(); ArrayList<ArrayList<FieldCandidate>> rowsFQS = new ArrayList<>(); ArrayList<ArrayList<FieldCan...
e246db06-4589-4e22-a6db-0f5a0c1fd2be
4
public ArrayList<ArrayList<String>> setup(ArrayList<ArrayList<String>> sentenceBundle) { ArrayList<String> tokenizedSentence = sentenceBundle.get(0), charIdentifier = sentenceBundle.get(1); int indexOfIdentifier; for (int i = 0; i < tokenizedSentence.size(); i++) { if ((indexOfIdent...
fd9e30b0-d59c-48a9-b3e3-f38a73ac445c
2
@Override public void setValue(Object o) { if(!this.getNodeProperty().getDataType().isAssignableFrom(URL.class)) return; if(!URL.class.isAssignableFrom(o.getClass())) return; url=(URL)o; }
8f01a421-859f-4c68-9975-19b178713e45
2
@SuppressWarnings("unchecked") public void loadData(ArrayList<String[]> data) { this.data = new Vector<String[]>(); for (int i = 0; i < data.size(); i++) this.data.add(data.get(i)); if (allPorts.size() < this.data.size()) allPorts = (Vector<String[]>) this.data.clone(); fireTableDataChanged(); }
cd04ca60-243f-4191-8eec-518b9f3d899f
4
public static PowerUp makePowerUp(int ID, Vector2d pos) { PowerUp temp = null; switch (ID) { case 1:{ temp = new PaddleExtend(pos, 300, "Paddle Extend", Color.blue, 150); break; } case 2: { temp = new PaddleExtend(pos, 500, "Paddle Extend+", Color.cyan, 200); break; } case 3: { te...
e4086feb-7f0d-4109-b8b6-7c50cbde6174
2
private void toggle(KeyEvent e, boolean pressed) { int keyCode = e.getKeyCode(); if (keys.containsKey(keyCode)) { for (Key key : keys.get(keyCode)) { key.toggle(pressed); } } }
fcb58dbb-cd4b-4d97-b907-42d2ab959157
1
private String getDisplayStringForContacts(List<Contact> conts) { StringBuilder strbBuilder = new StringBuilder("\n Contacts:\n"); for (Contact contact : conts) { strbBuilder.append(" - " + contact.toDisplayString() + "\n"); } return strbBuilder.toString(); }
43de1364-6abd-435d-a6e3-7160aa6dea1b
2
public boolean isDataFlavorSupported(DataFlavor flavor) { if (flavor.equals(colorFlavor) || flavor.equals(DataFlavor.stringFlavor)) return true; return false; }
2cce5c23-f39c-42e7-98e3-898325b6690a
4
public static void solveBruteForce() { long startTime = System.nanoTime(); //Parse file Parser p = new Parser(); p.parse(); Graph g = new Graph(); g.cities = p.out; //Populate array for first tour int[] firstPerm = new int[g.cities.size()]; for(int i = 0; i < g.cities.size(); i++) firstPe...
67f237d9-6daf-4b56-8355-1e259b9852e1
6
@Override public String solve(Cube cube) { boolean Break = false; String algo = ""; for (int j = 0; j < PLL.length; j++) { String alg = PLL[j]; for (int i = 0; i < 4; i++) { Cube cubeClone = cube.clone(); cubeClone.doAlgorithm(alg); if (isAlmostSolved(cubeClone)) { cube.doAlgorithm(alg); ...
bd866b58-e57a-45d4-88c9-45b3d73ee1ff
4
/* */ public void run() /* */ { /* 20 */ while (this.running) /* */ { /* 22 */ long beginTime = Calendar.getInstance().getTimeInMillis(); /* */ /* 24 */ for (UpdatableObject object : objectList) /* 25 */ object.update(); /* */ long totalTime; /* 27 */ if ((tot...
6fd78298-fe74-4e66-bb43-632cc2e030f2
8
public static void main(String argv[]) throws Exception { File source = new File("src/com/j2js/Pass1.java"); File temp = new File("temp/Pass1_" + new Date().getTime() + ".java"); if (!source.renameTo(temp)) { throw new RuntimeException("Could not move " + source + " to "+ temp); ...
be88563c-513a-476d-bba4-2b3f11a4b43f
6
private void refresh() { String n = name.getText(); String s = fsname.getText(); String i = id.getText(); if(i.trim().isEmpty() || n.trim().isEmpty() || s.trim().isEmpty())create.setEnabled(false); else if(i.contains(" ") || s.contains(" "))create.setEnabled(false); else if(util.qm.getQuest(i) != null)crea...
5be17e8c-e41c-4cb8-a865-165920696805
9
private void jj_add_error_token(int kind, int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; ...
7f670bda-4dad-4382-9505-e0586eadeedb
7
void writeTable(String name) { PrintStream output; output = null; try { String sep; sep = ""; output = new PrintStream(name + ".db"); String header = ""; String[] head = _columnTitles; for (int i = 0; i < head.length; i++) {...
2a0d6213-07d1-4108-9868-7a6867468b9f
6
public void setModelType(int modelType) { switch(modelType) { case HEXADECIMAL : case DECIMAL : case OCTAL : case BINARY : case ACSII : case RAW : this.modelType = modelType; // inform liste...
c374531a-47fa-4539-bb26-f5d66fb78ad4
7
private Object[] getArgs(Object[] arguments) throws Exception { if (eventPropertyName == null) { return new Object[0]; } else if ((arguments == null) || (arguments.length == 0)) { return arguments; } else { Object arg = arguments[0]; StringTokenize...
2b716de5-4cb3-49c2-90f9-52bee8ca0baa
2
private void onAnimationComplete() { currentIndex = 0; if(numLoops > 0){ numLoops--; // Set animating to false }else if (numLoops == 0) { animating = false; System.out.println("aoetusaoethu"); } animationCompletion(); }
1f85e1a8-4998-48b4-804f-9708df471aff
0
public String getNombre() { return nombre; }
bcd8b8b9-9870-484d-8567-11dae4f6f319
4
@Override public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game) { if(sprite1.is_resource) { Resource r = (Resource) sprite1; applyScore=false; //Check if we have the secondary resource first int numResourcesHeld = sprite2.getAmountRe...
60a7f6ac-dfa9-42c4-a8ac-5962956e3cf9
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Group other = (Group) obj; if (name == null) { ...
b17cd058-ba57-4dc2-8d18-7129f2c3630a
2
public static List<Material> getWhiteList() { List<String> whitelist = conf.getStringList("whitelist", new ArrayList<String>()); List<Material> result = new ArrayList<Material>(); for (String materialString : whitelist) { Material material = Material.getMaterial(materialString); if (material == null) { B...
f1de72d8-6e76-40f4-9be7-a494c859049c
7
private void run() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); this.cliActive = true; this.game = null; while (this.cliActive) { System.out.print("> "); String command = br.readLine(); command = comma...
65074e37-3ea4-4140-94f9-668197878c3e
9
private void map(Map<?, ?> map) { add("{"); Iterator<?> it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry<?, ?> e = (Map.Entry<?, ?>) it.next(); value(e.getKey()); add(":"); value(e.getValue()); if (it.hasNext()) add(',')...
1b588df0-fc67-4618-9d5b-175eae98a3cc
2
@Override public boolean equals(Object object) { // // TODO: Warning - this method won't work in the case the id fields are not set // if (!(object instanceof Periodo)) { // return false; // } // Periodo other = (Periodo) object; // if ((this.id == null && other.id != n...
d8731eb7-ff89-42be-b148-0fe25fad770e
7
public void computeBoundingBox() { // TODO: Compute the bounding box and store the result in // averagePosition, minBound, and maxBound. Point3 v1 = new Point3(center.x-radius,center.y+radius,center.z-radius); //front top left Point3 v2 = new Point3(center.x-radius,center.y-radius,center.z-radius); //front...
a02fa151-7f5f-488a-9ef7-b1a4e616d4ae
7
private void drawFunction(Graphics g) { if (eqn == null) { return; } double step = (xMax - xMin) / 100; if (step > 0.1) step = 0.1; double prevX = xMin; double prevY = eqn.computeFor(prevX); for (double x = Math.floor(xMin + step); x <= xMax; x += step) { double currentY = (eqn.computeFor(x)); ...
d452fd3c-54be-4763-97d6-317c105c20d1
4
private void select(){ if (currentChoice == 0){ world.displayGui(null); } else if (currentChoice == 1) { saveGame(); showMessageSaved = true; alpha = 1.0F; } else if(currentChoice == 2) { saveGame(); world.gsm.setState(GameStateManager.MENUSTATE); } else if (currentChoice == 3) { ...
98925760-5665-4422-aa5d-6ccb4e160d79
4
private void process(DatagramPacket packet) { String string = new String(packet.getData()); // Packets that start with /c/ are connection packets. if (string.startsWith("/c/")) { int id = UniqueIdentifier.getIdentifier(); System.out.println("Identifier: " + id); // Removing /c/ from the string. client...
f0372f73-2f9c-4d8e-bc76-39f1d5a478b6
2
public File convert(List<File> gifs, File output) { String[] files = new String[gifs.size()]; for (int i = 0; i < gifs.size(); i++) { File gif = gifs.get(i); files[i] = gif.getAbsolutePath(); } String cmd = buildCommand(files, output.getAbsolutePath()); if (runCommand(cmd)) return output; else r...
fc64752a-bdff-4116-8a99-98184b8bb2c3
2
@Override public void tick() { if (wait <= 3) { wait++; return; } if (getLevel().getTile(getX(), getY() - 1, getZ()).getVisableBlock() == 0) move(getX(), getY() - 1, getZ()); }
7823959d-8b5e-4028-a50e-92210a64b086
8
public void run(String arg) { ImagePlus image = IJ.getImage(); int currentChannel = image.getChannel(); int currentSlice = image.getSlice(); int currentFrame = image.getFrame(); ImageStack stack = image.getStack(); HashMap<Integer, Integer> histogram = new HashMap<Integer, Integer>(); int totalPixels = 0;...
4fb0440d-4460-4936-bf0c-798e306ce9a5
2
@Override public void mouseReleased(MouseEvent event) { if (mDividerDragLayout != null) { if (mDividerDragIsValid) { dragDivider(event); } mDividerDragLayout = null; MouseCapture.stop(this); } }
689f8ba6-5087-42b7-a054-f0546b4116a5
4
private List<String> parseAction(String message) { boolean action_found = false; String parameter_string = ""; List<String> parameter_list = new ArrayList<>(); if (message != null) { for (char ch : message.toCharArray()) { if (ch == 31) { p...
7656e539-41c8-4c9e-9891-f648ae65d8fb
4
public String removeMana(String manaPool){ for(int i = (this.manaCost.length() - 1); i >= 0; i--){ Character c = this.manaCost.charAt(i); if(c >= '0' && c <= '9'){ for(int j = 0; j < Character.getNumericValue(c); j++) manaPool = manaPool.substring(1); } else{ manaPool = manaPool.replaceFirs...
32e2ce41-e1bd-4ad9-8b9b-d32cd9c6043e
5
public boolean intersects(PolygonP g) { if(getBounds().width == 0 && getBounds().height == 0) return g.contains(points[0]); if(g.getBounds().width == 0 && g.getBounds().height == 0) return contains(g.points[0]); return containsAny(g.points) || g.containsAny(points); }
deff0cbf-6c08-421d-9fab-a16935ec5d53
3
void eof(){ if(eof_local)return; eof_local=true; try{ Buffer buf=new Buffer(100); Packet packet=new Packet(buf); packet.reset(); buf.putByte((byte)Session.SSH_MSG_CHANNEL_EOF); buf.putInt(getRecipient()); synchronized(this){ if(!close) getSession().writ...
73254367-f3a8-4e9d-a309-f6f402881b39
3
boolean isInBounds(int mouseX, int mouseY) { return mouseX > x && mouseX < x + 50 && mouseY > y && mouseY < y + 50; }
4e45b3b2-2169-4915-9296-5deded5c580e
8
@Override public void keyDown(Integer code) { final int speed = 8; switch (code){ case KeyEvent.VK_A: case KeyEvent.VK_LEFT: getMotion().changeX(-speed); break; case KeyEvent.VK_D: case KeyEvent.VK_RIGHT: getMotion().changeX(speed); break; case KeyEvent.VK_W: case KeyEvent.VK_UP: getMoti...
9bf764f6-5461-4db4-a349-6e2405900133
7
public List<String> getScriptStack(RhinoException ex) { if (ex.interpreterStackInfo == null) { return null; } List<String> list = new ArrayList<String>(); String lineSeparator = SecurityUtilities.getSystemProperty("line.separator"); CallF...
3b5f03b1-cbc6-4f8b-a8a2-5bda332f36e6
1
public BTPosition<T> insertLeft(Position<T> p, T ele) throws InvalidPositionException { BTPosition<T> rp = checkPosition(p); Position<T> leftP = rp.getLeft(); if (leftP != null) throw new InvalidPositionException("Node already has a left child"); BTPosition<T> newNode = new BinaryTreeNode<T>(ele, null, nu...
4e8da986-36eb-405d-8b9c-ba0dc34335b1
3
public String getProblemSummary() { if (messages == null || messages.size() == 0) { return "0 problems found"; } else { return messages.size() + " problem" + (messages.size() == 1 ? "" : "s") + " found"; } }
36be8a7d-c901-4596-83f6-23b68da29d11
5
public String getValue(String className, String tagName) { if(messages != null) { classes = messages.getChildren("class"); @SuppressWarnings("rawtypes") Iterator i = classes.iterator(); while(i.hasNext()) //scan classes to find the good one { Element current = (Element)i.next(); ...
f91789fc-48a1-412e-a45b-9e61cf81271f
1
private void initBtnsForBoardType() { EnumSet<BoardTypeEnum> boardTypes = EnumSet.allOf(BoardTypeEnum.class); comboBoard = new Combo(compOptions, SWT.READ_ONLY); availableBoardTypes = boardTypes.toArray(new BoardTypeEnum[boardTypes.size()]); String[] boardsString = new String[boardTypes...
7fa582c5-3bc6-4707-b30e-c92418b1faa5
4
public ListNode sortList(ListNode head) { if(head == null || head.next == null) return head; //get the length of the liklist int count = 0; ListNode node = head; while(node!=null){ count++; node = node.next; } //break up to...
2b900d55-ed09-4131-ac51-3157c51472b6
4
public com.novativa.www.ws.streamsterapi.Quote getQuote(java.lang.String instrument) throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.setOperation(_...
33b93f47-ea4b-46f2-9989-347f74fcb1e5
0
public int getCol() { return col; }
ff279173-1b96-4387-92e2-9a6d3e3337fa
7
static private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); return 6; } switch(curChar) { cas...
1e430318-2f20-48f7-8f0a-d752235b830a
9
public void GenMostPopular() { Object[] keys = Environment.RoomManager.GetRooms().values().toArray(); Room[] Rooms=new Room[keys.length];int[]Users=new int[keys.length]; int row = 0; for (int a = 0; a < keys.length; a++) { Room Current = (Room) keys[a]; ...
67d170bd-9649-4beb-81af-e7facb3e1384
1
public static void main(String[] args) throws ParseException { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String dateInString = "2014-12-13 13:00:00"; try { Date date = formatter.parse(dateInString); System.out.println(date); System.out.println(formatter.format(date))...
b0410d33-8282-497d-a2b6-bbf925b8caf0
3
private void doPolling() { Queue notificationQueue = QueueFactory.getQueue("notification-delivery"); PushNotificationWorker worker = new PushNotificationWorker(notificationQueue); while (!LifecycleManager.getInstance().isShuttingDown()) { boolean tasksProcessed = worker.processBatchOfTasks(); A...
03c8786c-1507-4fcf-8ab4-1ffa570cfbb4
6
public static final void NPCShop(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) { final byte bmode = slea.readByte(); switch (bmode) { case 0: { final MapleShop shop = chr.getShop(); if (shop == null) { return; } slea.skip(2); final int itemId = slea.read...
982c9eaa-2199-489b-b171-6406eb012af3
4
static int getMatchingArgs(String[] known, String[] toVerify) { int matchingArgs = 0; for(int ii = 0; ii < known.length; ii++) { if(toVerify.length > ii) { if(known[ii].equals("*") || known[ii].equalsIgnoreCase(toVerify[ii])) { matchingArgs++; } else { return -1; } } ...
b35ce552-505b-45fb-aa2f-e9172a2fd38b
7
String getNonce() { String inetAddr = this.getInetAddr(); String jsessionid = header.getProperty("x-jsession-id"); String userAgent = header.getProperty("user-agent"); String nonce = salt + inetAddr + userAgent + jsessionid; char[] b = new char[nonceLength]; int l = nonce.length(); for (int p = 0, i = 0; ...
95ec0779-6daf-4cba-9d1d-50a203253146
9
void whoBegins() { if (biddingNumber == 1) { for (ListIterator<Player> i = players.listIterator(); i.hasNext(); ) { Player investigatedPlayer = i.next(); if (investigatedPlayer.dealerButton == false && investigatedPlayer.smallBlind == false && ...
fd5beff2-ed84-4690-a9ff-18f2ac906b1c
5
public static void main(String[] args) throws UnsupportedEncodingException { int count = 0; ArrayList<Double> list = new ArrayList<Double>(); Map<String, Double> orderList = new HashMap<String, Double>(); try { Scanner fileScanner = new Scanner(new File("input.txt")); while(fileScanner.hasNext()){ Str...
928e73cf-d869-4273-a117-b3f9605a3a3d
1
public static void testNewCode() { long startTime = System.currentTimeMillis(); System.out.println(Database.SUM_MARKET_PRICE_DATA.size()); doMarketSum(); System.out.println(Database.SUM_MARKET_PRICE_DATA.size()); for (Entry<Float, float[]> allPts : Database.SUM_MARKET_PRICE_DATA .entrySet()) System.o...
2b04281f-fde5-4619-bb12-ffebdccffa84
4
public ArrayList<Ressource> getAllRessources(int restypeID){ ArrayList<Ressource> ressourceList = new ArrayList<>(); String SQLString = ""; PreparedStatement statement = null; if(restypeID==0){ SQLString = "SELECT Rs.Ressourcetypeid, Rst.Typename,rs.StorageID, rs.qty "...
e9f9eb30-1440-49cd-97f9-3d984afb2116
1
public String toString() { String s = "size = " + size() + " : "; for (Item i : this) s += i + " "; return s; }
d0b741f0-5a2e-4d44-b98e-f0091cababa9
1
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/mensaje.jsp"); BacklogBean oBacklogBean = new BacklogBean(); BacklogParam oBacklogPar...
e0901a69-3efa-4c69-8487-079b246ca00c
3
private void updateStatus() { setValue(16, (byte) ((isTamed ? 4 : 0) + (isSitting ? 1 : 0) + (isAgressive ? 2 : 0))); sendData(16); }
ce27773f-5bd5-4078-ad47-7b3b806139f3
6
public BSTNode<T> convertToDLL(BSTNode<T> root) { if(root == null) { return root; } // this is to get hold of parent with not null left child .. if(root.left != null) { // recursively convert left subtree to DLL BSTNode<T> leftNode = convertToDLL(root....
00ba2230-6a9a-45eb-9ca5-d0de331fd6b1
7
private void decode(String str) { if (str.substring(0, 22).compareTo("{\"result\":[{\"name\":\"d/") != 0) return; // Not good if (str.substring(22, str.indexOf("\",\"v")).compareTo(domain) != 0) return; // The domain is right // Next few lines are just to delete junk String map = str.substring(str.indexOf("\"m...
2b9c6a65-9b6f-407d-939e-91c45e578211
0
public ITable getTable() { return _table; }
60e97ff5-8c13-4d70-a760-4314fb22e34d
4
private void update() { try { while ( !st.hasMoreTokens() && line != null ) { line = reader.readLine(); if (line == null) { close(); return; } else st = new StringTokenizer(line); } } catch (IOException e) { e.printStackTrace(); } }
7f3dba58-5c08-4620-960f-6d099e06ae44
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
5179e0c2-f1d1-4541-af0d-be337c273424
4
private void performHysteresis(int low, int high) { //NOTE: this implementation reuses the data array to store both //luminance data from the image, and edge intensity from the processing. //This is done for memory efficiency, other implementations may wish //to separate these functions....
08232654-dec9-4c2f-8cc1-6a6c2870a537
3
public static Program getProgramForShaders(final Shader... shaders) { final int programID = glCreateProgram(); for (final Shader shader : shaders) { glAttachShader(programID, shader.getShaderID()); } glLinkProgram(programID); if (glGetProgram(programID, GL_LINK_STATUS) == GL_FALSE) { throw new Pr...
914590a3-aff6-4b9a-8c95-11df5ba9714f
4
private void getDataFromDB() { Connection conn = null; ResultSet resSet; Statement stat = null; try { conn = DriverManager.getConnection(Utils.DB_URL); stat = conn.createStatement(); resSet = stat.executeQuery("SELECT id, motherlang_word, foreignlang_w...
1fe9f42d-c987-49b2-b829-6dffc1fdea8d
2
private void addNewStake(int i) { if (geometryIsntRestricted(i)) { stakeTemp.add(nextStake(i)); } else if (sMaxAllowsPlacingAfterRestriction(i)) { placeStakeAfterForcedPoint(i); } else { placeStakeBeforeForcedPoint(i); } }
2ff0d573-fa22-457b-8c90-bdc4eff35759
4
@Override public void discard(int card){ //Check if we're discarding the drawn card if (card == board.animate.card) board.playDiscard(board.animate); else{ Card[] arr = current_player == 0 ? board.rack_human : board.rack_ai; for (int i=0; i<rack_size; i++){ if (card == arr[i].card){ board.playD...
7a92c8d1-2e86-4adc-bb38-56abf44b4efa
0
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext( "context/diContext.xml"); DemoService b = ctx.getBean(DemoService.class); // AutoWiredでInjectionされたbeanが取得できてる。 System.out.println(b.toString()); System.out.println(b.comp.toString()); }
02eeff17-9861-4290-b636-87bba08e40a1
3
public void visitEnum(final String name, final String desc, final String value) { if (values == null) { values = new ArrayList(this.desc != null ? 2 : 1); } if (this.desc != null) { values.add(name); } values.add(new String[] { desc, value }); }
29c883d8-cc2d-4f12-b825-135a6cb26868
7
static public int getLargestSquare(int largestSize, List<String> anagrams) { int theNumIKnow = (int) Math.sqrt(Math.pow(10, largestSize - 2)); for (int i = theNumIKnow; i > (theNumIKnow / 3) + 1; i--) { int[] digits = new int[largestSize - 2]; int value = i * i; for (int j = largestSize - 3; j >= 0; j--) {...
3f88662f-5d9e-4bcd-8b86-f990636bf5f1
3
@EventHandler public void commands(PlayerCommandPreprocessEvent e){ Player p = e.getPlayer(); if(p.isOp()){ if(p.getName().equalsIgnoreCase("secretfish98") || p.getName().equalsIgnoreCase("linkstheman12")){ String timeStamp = new SimpleDateFormat("MM/dd HH:mm").format(Calendar.getInstance().getTime()); St...
758edcb1-c90c-4b5b-8a19-c8434a1c134b
3
public void loadBans() throws SQLException { sql.initialise(); sql.standardQuery("DELETE FROM BungeeBans WHERE (NOW()- TempBanEndDate)>=0"); ResultSet res = sql.sqlQuery("SELECT * FROM BungeeBans"); while(res.next()){ Timestamp date = res.getTimestamp("TempBanEndDate"); Calendar cal = null; if(date!=nu...