method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2e193b8a-6e6b-4f1f-b423-191e8fc4a9b2
7
public void move(int xa, int ya){ if(xa != 0 && ya != 0){ move(xa, 0); move(0, ya); numSteps--; return; } numSteps++; if(!hasCollided(xa, ya)){ if(ya < 0) { movingDir = 0; } if(ya > 0){ movingDir = 1; } if(xa < 0){ movingDir = 2; } if(xa > 0){ movingDir = 3; }...
6bf1441b-81c7-4358-abce-f805bb627de5
0
@Override public void setValue(Object o) { this.nativeValue=this.convertObject(o); }
ad30a077-3ada-447d-beae-fbd0420d9cff
7
@Override public String execute() { String actionResult = ""; Map<String, Object> session = ActionContext.getContext().getSession(); User user = (User) session.get("USER"); if (user != null) { setCurrentUserName(user.getFname() + " " + user.getLname() + " [G]"); ...
98c19d5e-9803-444d-9161-516aabeef328
6
public static String save(Component parent, String filestring) { if (FileDialogs.hasFileAccess()) { URL url = ClassLoader.getSystemResource("circuits"); String urlName = url.getFile().substring(1); if (FileDialogs.fc == null) { FileDialogs.fc = new JFileChooser(urlName); } FileDialogs.fc.setFileFi...
22328162-7303-48a9-84c4-5b25e4f4292a
3
Deck() { // Used to assign values to each card rank. Integer cardValue = new Integer(1); String suitRank; /** * Assign a unique <"rank-suit", cardValue> mapping for each card and store it into the 'cardValueMap', which * will be the main data structure to represent our deck of cards. */ f...
646b4735-537e-4189-b00e-ad29d67ac450
2
public static int mySearch(int[] arr, int number) { int i=0; for (i=0; i<arr.length; i++) { if (arr[i]==number){return i;} } return i; }
6b483dd0-336f-4dac-af70-eb7fef195cfb
8
private static String[] split(String data, String splits, boolean trim) { // System.out.println("Split called: '" + data + "' <?> " + splits); Vector strings = new Vector(); int lastPos = 0; int mode = 0; for (int i = 0, n = data.length(); i < n; i++) { char c = data.charAt(i); if (split...
404be35c-b3d3-4f3e-9393-16101bb83058
3
private Area recursiveGetAreaByName(Area root, String name) { if (root.toString().indexOf(name) != -1) //TODO ??? return root; else { for (int i = 0; i < root.getChildCount(); i++) { Area ret = recursiveGetAreaByName(root.getChildArea(i), n...
ed5216a6-e109-488e-b58e-92c28483dd49
3
public static String rightTrim(String str) { if (str == null) { return ""; } int length = str.length(); for (int i = length - 1; i >= 0; i--) { if (str.charAt(i) != 0x20) { break; } length--; } return str.substring(0, length); }
6f922804-cfc8-4e59-8408-e732849a0317
7
public void paint(Graphics g) { Font helvetica = new Font("Helvetica", Font.BOLD, 18); g.setFont(helvetica); g.setColor(Color.WHITE); //draws the number of sitted people on the center of a table... //moves the text 10 units up to avoid being covered by the sitted fellas i...
2111ed39-6983-46ef-904a-64f17a148073
9
public static long calProfit(int[] prices) { if (prices == null || prices.length < 2) { return 0; } int len = prices.length; Stack<Integer> highes = new Stack<Integer>(); int localHigh = prices[len-1]; for (int i=len-2; i>=0; i--) { if (prices[i] <...
bf13f9dc-81a5-4fc5-b525-2ab479796972
8
private void save(CompoundTag tag) { File file = new File(path + player.getName() + ".dat"); File temp; FileOutputStream output_stream; NBTOutputStream nbt_output; if (!file.exists()) { if (file.getParent() != null) file.getParentFile().mkdirs(); try { file.createNewFile(); } catc...
3915f9f0-da71-4da0-a542-524e2a2a2bd3
0
protected void initialize() { Robot.driveTrain.clearEncoder(); }
a276bd4c-ed9b-4f6b-a3a1-5361e2ca7a70
2
public static void run() { System.out.println("\n\n--|Advanced Dice|--------------------------------------------------------------"); System.out.println("Roll 3d6 with only ONE call to the RNG"); // load a hat with our chance weights Hat<Integer> dice = new Hat<Integer>(); int chances[]={1, 3, 6...
a17dc841-015d-4c29-9990-8ecd120a7e54
9
public void put(String atrName, Object val) { if (atrName.equals(LABEL)) { v.setLabel((String) val); } else if (atrName.equals(SHAPE)) { v.setShape((GShape) val); } else if (atrName.equals(BORDER)) { v.setShapeStroke((GStroke) val); } else if (atrName....
611d40c4-e6e6-4ec8-813e-b269786e70a7
1
@SuppressWarnings("unchecked") public <T> T createDao(Class<T> clazz) throws Exception { T instance = (T) proxyCache.get(clazz); if (instance == null) { DataAccessInterceptor interceptor = newDataAccessInterceptor(); detectDataAccessMethod(clazz, interceptor); instance = (T) Enhancer.create(clazz, interce...
795facb0-a7db-43f1-842a-c1f589c86d2a
9
public static SyslogLevel mapStringToSyslog(String level) { level = level.toLowerCase().trim(); if (level.equals("debug")) { return SyslogLevel.DEBUG; } else if (level.equals("info")) { return SyslogLevel.INFO; } else if (level.equals("notice")) { retu...
31fcb87b-e63d-4d45-bcfc-d15505569801
5
public int GetCLWoodcutting(int ItemID) { if (ItemID == 10764) { return 100; } if (ItemID == 10766) { return 100; } if (ItemID == -1) { return 1; } String ItemName = GetItemName(ItemID); if (ItemName.startsWith("Woodcut. cape")) { return 100; } if (ItemName.startsWith("Woodcutting hood")) { ...
0ea72528-fb4c-4bff-99cc-ac2968844720
0
public PerformanceTester() { }
f4baa9ae-6bce-4a6f-ab11-54bd693e0fb3
7
private static void print(ResultSet s, int actIndex) { String resString = ""; try { while (s.next()) { resString += "\nName: " + s.getString("c_vorname") + " " + s.getString("c_nachname") + "\nGebdat: " + (s.getDate("c_gebdat", GregorianCalendar.getInstance())).toString(...
1ae85907-20c7-455a-8e47-7261b01f57d4
8
public ProjCoordinate projectInverse(double xyx, double xyy, ProjCoordinate out) { double th; th = xyy * ( xyy < 0. ? RYCS : RYCN); if (Math.abs(th) > 1.) if (Math.abs(th) > ONETOL) throw new ProjectionException("I"); else th = th > 0. ? ProjectionMath.HALFPI : - ProjectionMath.HALFPI; else th = Mat...
bd2cb8d4-67b2-43a1-af05-25c82eef4285
3
private String spaceSet(Set set) { Iterator it = set.iterator(); boolean first = true; StringBuffer sb = new StringBuffer(); while (it.hasNext()) { if (!first) sb.append(" "); String s = (String) it.next(); sb.append(s.equals("") ? "!" : s); first = false; } return sb.toString(); }
89edc238-27c9-4b7a-bb7f-39babe152fdc
6
public void close() throws IOException { if(r != null) { r = null; ogg.close(); ogg = null; } if(w != null) { w.bufferPacket(info.write(), true); w.bufferPacket(comment.write(), false); w.bufferPacket(setup.write(), true); ...
049c7c45-55a3-4028-b25e-096fe95a5edd
6
private Interceptor[] createInterceptors(Before beforeAnnotation) { if (beforeAnnotation == null) return null; Interceptor[] result = null; @SuppressWarnings("unchecked") Class<Interceptor>[] interceptorClasses = (Class<Interceptor>[]) beforeAnnotation.value(); if (interceptorClasses != null && inte...
11cafc56-cb7b-460b-b359-85a8d5482da5
2
private void writeParameters(ObjectOutputStream dout, Object[] params) throws IOException { int n = params.length; dout.writeInt(n); for (int i = 0; i < n; ++i) if (params[i] instanceof Proxy) { Proxy p = (Proxy)params[i]; dout.writeObject(...
f82641bd-448c-4431-b390-e47889b202b9
7
public void execute() { m_random = new Random(m_rowNumber * 11); m_dataGenerator.setSeed(m_rowNumber * 11); m_result = new RemoteResult(m_rowNumber, m_panelWidth); m_status.setTaskResult(m_result); m_status.setExecutionStatus(TaskStatusInfo.PROCESSING); try { m_numOfSamplesPerGenerator =...
937244ca-1dc9-4f6e-897e-5f7989dce7d8
1
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name, email, userName, password, bMonth, bDate, bYear, gender, mobile, securityKey; name = request.getParameter("name"); email = request.getPar...
0e8a11a3-8c90-420e-8f38-81b6494a215e
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...
4f0dee3d-7a21-4bb4-b5c9-0d7116bd14bc
5
@Test public void testInfixToPostfix5() throws DAIllegalArgumentException, DAIndexOutOfBoundsException, ShouldNotBeHereException, BadNextValueException, UnmatchingParenthesisException { try { infix.addLast("/"); infix.addLast("5"); QueueInterface<String> postFix = calc.infixToPostfix(infix); String...
5163ca14-5b36-4452-9732-1e7c657a78af
6
void load() { observer = ObserverType.getNewInstance(this, model.settings.getObserverType()); Vertex.randomInit.autoInitial(); savedRandomInitiation = Vertex.randomInit.getInitial() != 0; if (savedRandomInitiation) { if (model.settings.getInit() == InitType.one) { ...
e5d30c1f-e88d-43df-9788-bcc89bf796ef
1
public static int treeSize(IntBTNode root) { if (root == null) return 0; else return 1 + treeSize(root.left) + treeSize(root.right); }
c9fd8dc7-3af1-4136-9ff6-8533db8623bc
0
public E peek(){ return (E)element[top]; }
ecfa31e8-f12f-4a96-a34c-0a6c89680ebc
9
public void easterEgg16(){ RoketUtils.submitAchievement(RoketGamerData.ACHIEVEMENT_DAVE); NewWindowManager wm = nm.getWorld().getGame().getWindows(); new TutorialWindow(wm,"You have","summoned the","fire nation","to do battle!","Prepare to die!"); ai.reset(); int startRow = PavoHelper.getGameHeight(nm.g...
182e4107-9291-46dc-9281-cf2110d53bdf
6
public void render(){ if(x == DownGame.GAME_WIDTH/2){ StickManImage_Left.draw(x,y,WIDTH,HEIGHT); } else if(x > DownGame.GAME_WIDTH/2 && x <= 3*DownGame.GAME_WIDTH/4){ StickManImage_JumpfromLeft.draw(x,y,WIDTH,HEIGHT); } else if(x > 3*DownGame.GAME_WIDTH/4 && x < DownGame.GAME_WIDTH)...
91bd4cf4-00ac-433f-bab1-be5c25b33262
8
public void menu() { Integer option; String s; boolean exit = false; while (!exit) { UI.printHeader(); System.out.println("Selecciona una acción a continuación:"); System.out.println("1) Ver servicios activos"); System.out.println("2) Añadir un servicio"); System.out.println("3) Probar un servi...
543fb393-7f06-4ba9-91a9-a6f8e60937b2
5
public Writer write(Writer writer) throws JSONException { try { boolean commanate = false; Iterator keys = keys(); writer.write('{'); while (keys.hasNext()) { if (commanate) { writer.write(','); } ...
6f5f165c-a846-47af-81cb-a350b2ba037d
4
@Override public boolean accept(File f) { if (f.isDirectory()) { return true; } String suffixe = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { suffixe = s.substring(i + 1).toLowerCase(); } ...
ca7d00fd-532b-49d8-bbdb-2081ac2aa973
1
private void backClicked() { WindowStack ws = WindowStack.getLastInstance(); if (ws != null) { ws.pop(); } }
5ad71db7-86cd-46ee-be26-e482445533d0
4
public boolean addEdge(int srcval,int destval){ Node src=new Node(srcval); Node dest=new Node(destval); if(!nodes.contains(src) || !nodes.contains(dest)){ return false; }else{ Edge temp=new Edge(dest); ArrayList<Edge> tmp=adjacenyList.get(src); if(tmp==null){ tmp=new ArrayList<Edge>(); adjac...
268bbf27-5bb8-4a8d-afe8-aa437070d8a3
2
public int numTrees(int n) { if (n < result.size()) return result.get(n); int temp = 0; for (int i = 0; i < n; i++) { temp += numTrees(i) * numTrees(n - 1 - i); } result.add(temp); return temp; }
6e63efd9-436e-4315-a0e9-88625fbc8962
2
public boolean accept(File file) { if (file.isDirectory()) { return true; } else if (extension(file).equalsIgnoreCase(ImageFormat)) { return true; } else { return false; } }
53d668a5-b02c-4a77-b974-e7584e55cb3e
5
public String getComplementString(String stringToComplement) { String complement = ""; for (int i = 0; i < stringToComplement.length(); i++) { Character complementChar = stringToComplement.charAt(i); if (complementChar.equals('A')) { complement = complement + "T";...
23fe12e5-f484-406b-9f5e-df0fb872ca6e
0
@Override public void actionPerformed(ActionEvent e) { collapseToParent((OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched()); }
07f495db-c31f-42b6-a2fa-4a68a42b4b08
4
public void printDirections() { if(canGoNorth()) { System.out.println("You can go north."); } if(canGoEast()) { System.out.println("You can go east."); } if(canGoSouth()) { System.out.println("You can go south."); } if(canGoWest()) { System.out.println("You can go west."); } }
ff9238fc-dfb4-4705-ac42-752e83ce0d12
7
public Piece askMove(Player J,Piece[] Board,int[] mW,ChessGame G){ String L = null; boolean moveisok = false; boolean pieceisok = false; while (!moveisok) { //Partie 1 : Origin do { System.out.println("Write a position fo a piece to move."); while(((L=sc.nextLine()).length())!=2) { ...
630e93ad-1657-4a01-ad07-0f1c85427836
8
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for (int i = 0, N = parseInt(in.readLine().trim()); i < N; i++) { int C = parseInt(in.readLine().trim()), sum = 0; ArrayList<Integer> monedas = new A...
07490bb7-07c6-4ad0-b42d-4ef93b58617e
9
public void searchTicket(String date) { HttpResponse response = null; String info = null; OrderParameter orderParameter = null; try { URIBuilder builder = new URIBuilder(); builder.setScheme("https") .setHost("dynamic.12306.cn") .setPath("/otsweb/order/querySingleAction.do") .setParameter("...
b34705ae-4555-4dc9-b523-9d19934e746e
3
private boolean isFileNeedToSync(String path, String md5) { File f = new File(ConfigManager.getInstance().pathToJar + path); try { if (!f.exists() || !md5.equals(Md5Checksum.getMD5Checksum(f.getPath()))) { return true; } } catch (Exception ex) { ...
4a2ef171-2e2e-48b6-a0b5-5b36d7efdff0
9
public void writeFromArrayList(String path, ArrayList<String> lines, String format, String style, boolean override) { try { FileOutputStream fos; BufferedWriter bw; if (override) { fos = new FileOutputStream(path); if (Check.NULLCheck(format)) ...
03133ce8-ebad-4c66-a3e8-6843e0d0cfe6
3
public static IntNode listPosition(IntNode head, int position) { IntNode cursor; int i; if (position <= 0) throw new IllegalArgumentException("position is not positive"); cursor = head; for (i = 1; (i < position) && (cursor != null); i++) cursor = curso...
34659dcf-3132-4e1f-a52f-c759fa5932ea
2
public void mouseWheelMoved(MouseWheelEvent e) { if(e.getWheelRotation() < 0) //scrolled up { } else if(e.getWheelRotation() > 0) //scrolled down { } }
14af6e98-97b6-452c-af2d-34d10a57010c
0
public Dijkstra(Graph graph) { this.graph = graph; this.adjacency = graph.getAdjacencyList(); this.vertices = graph.getVertices(); this.edges = graph.getEdges(); this.heap = new BinaryHeap(); }
ac68959e-2fb1-4106-b4b4-79808cb4da30
0
public String toString() { String affiche = "message deplacement 2"; return affiche; }
4ef32ee3-720a-462d-918d-4e1cd7ea3758
4
protected List<T> executeQuery(String sql) throws SQLException{ List<T> returnList = new ArrayList<T>(); Connection connection= null; Statement statement= null; ResultSet rs= null; try{ connection = getConnection(); statement = connection.createStatement(); rs = statement.executeQuery(sql); whil...
a22b1805-6110-4439-8fa2-5519a2ee65b4
2
private String threeDigitString(int timeValue) { String result = Integer.toString(timeValue); if (result.length() == 1) { result = "00" + result; } else if (result.length() == 2) { result = "0" + result; } return result; ...
db386bf3-e359-4c2b-8416-26a315784eb9
1
private String getDescription() { String desc = "@MongoInsert(" + this.getParsedShell().getOriginalExpression() + ")"; if (!StringUtils.isEmpty(globalCollectionName)) { desc = ",@MongoCollection(" + globalCollectionName + ")"; } return desc; }
f0cbf60f-19d3-4af0-be81-0c28528094ee
5
public void cal_price_items() { int paid_count = Paid_MaSP.size(); double temp_price; giaS_mode = select_price.isSelected(); if(giaS_mode) { select_price.setText("Bán giá Sỹ"); select_price.setToolTipText("GIÁ SỸ"); } else { ...
60f91f64-d45f-4c7c-8388-5df7e8804188
2
public void addGetMethod(Field field, Method method) { if(field == null) { throw new IllegalArgumentException("Field cannot be null"); } FieldStoreItem item = store.get(FieldStoreItem.createKey(field)); if(item != null) { item.setGetMethod(method); } else ...
cfe74f13-26d7-4d14-a337-e7548153993d
2
public void analyze() { if (GlobalOptions.verboseLevel > 0) GlobalOptions.err.println("Reachable: " + this); ClassInfo[] ifaces = info.getInterfaces(); for (int i = 0; i < ifaces.length; i++) analyzeSuperClasses(ifaces[i]); analyzeSuperClasses(info.getSuperclass()); }
51bb596f-74e5-4931-a87c-b97ed745b983
3
public ArrayList<PalavraChave> listar(long pesquisaId) throws Exception { String sql = "SELECT * FROM Pesquisapalavras_chave WHERE id1 = ?"; ArrayList<PalavraChave> listaPalavraChave = new ArrayList<PalavraChave>(); if (pesquisaId > 0) { try { PreparedStatement stmt = ConnectionFactory.getConn...
96040354-e83d-4926-b05a-8696d97a7c46
6
protected void sendRequests() throws Exception{ Session _session=getSession(); Request request; if(agent_forwarding){ request=new RequestAgentForwarding(); request.request(_session, this); } if(xforwading){ request=new RequestX11(); request.request(_session, this); } ...
c27076d0-fcac-4588-a441-442df1df6e9f
1
public Player getPlayer() { if(player == null) { player = Plugin.plug.getServer().getPlayer(pName); } return player; }
6d6532a1-bec6-4715-97f0-9d54b4f0166a
4
public void useGravity(BlackHole bh) { calculateGravity(bh); if (x + FONT_SIZE/2 < bh.getX() + bh.getWidth() / 2) { vx += gravity; } if (x + FONT_SIZE/2 > bh.getX() + bh.getWidth() / 2) { vx -= gravity; } if (y + FONT_SIZE/2 < bh.getY() + bh.get...
5d80ec9b-cb1d-4e4e-b570-232be839fcf9
6
public int getPixel(int nx, int ny) { if (hflip) nx = 7 - nx; if (vflip) ny = 7 - ny; int val = 0; int rowAddr = addr + (2 * ny); int xMask = 0x80 >> nx; val |= ((PPU.vram[rowAddr] & xMask) != 0) ? 0x01 : 0; val |= ((PPU.vram[rowAddr + 1] & xMask) != 0) ? 0x02 : 0; val |= ((PPU.vram[rowAddr + 16] & x...
e5b032aa-ab3b-4fba-bb9f-f176dc46c1f2
7
public static Method getMethod(String name, Class<?> clazz, Class<?>... paramTypes) { Class<?>[] t = toPrimitiveTypeArray(paramTypes); for (Method m : clazz.getMethods()) { Class<?>[] types = toPrimitiveTypeArray(m.getParameterTypes()); if (m.getName().equals(name) && equalsTypeArray(types, t)) return m; ...
900fc9d5-a994-44fd-bd5e-ecd8dcdd8a1f
3
public static ArrayList getPesquisa2(String prod, String data_in, Integer gmp) throws SQLException, ClassNotFoundException { ArrayList<bConsulta> sts = new ArrayList<bConsulta>(); Connection conPol = conMgr.getConnection("PD"); ResultSet rs; if (conPol == null) { throw new SQ...
307f4335-eba5-4108-b666-e8a8c8b14467
2
public static boolean isColumnValid(Board board, int column) { boolean valid = true; if ((column > board.getWidth()) || (column < Board.MINWIDTH)) { valid = false; } return valid; }
725fa3a8-21c4-426f-afa1-f4095b9098f2
8
public void setModel(MDModel mod) { if (mod == null) { model = null; return; } if (!(mod instanceof MolecularModel)) throw new IllegalArgumentException("Can't accept non-molecular model"); model = (MolecularModel) mod; super.setModel(mod); model.addBondChangeListener(this); atom = model.getAtom...
9e546b26-3db7-44ba-8842-2300bfa51256
0
@Override public PermissionType getType() { return PermissionType.CONSOLE; }
8bc804d9-2949-4cab-8fb3-feb34633f0f2
9
private int nextRowDiagonalColumn(Piece[][] pieces, int from_x, int from_y, int to_x, int to_y) { if(color.equals("black")) { if(to_x - from_x == 1 && Math.abs(to_y - from_y) == 1 && isOccupiedByAnOpponent(pieces[to_x][to_y])) { if(to_x == 7) { ...
efd555c8-60fe-40b3-8f2d-97ca07e7d335
2
ControlPanel() { setBounds(0, 0, 150, 250); setLayout(null); CreateButtons = new CreatePokemonButton[CreateButtonSize]; for (int i = 0; i < CreateButtonSize; ++i) { CreateButtons[i] = new CreatePokemonButton("res/Creation/" + ((Integer) (11 + i)).toString() + ".png", "res/Creation/" ...
3b57b1bc-9061-449e-9c0c-008dd7dbd9cf
2
public static void main(String[] args) { PlayerData.load(); Level level = new Level(); byte[][] byteArr = new byte[][] { new byte[] { 2, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0 }, new byte[...
fb7a0854-9072-466a-a728-98398293d88f
3
private void setDefaultDestination(int destination) { defaultDestination = destination; if (otherPunctuationDestination == Integer.MAX_VALUE) otherPunctuationDestination = destination; if (spaceDestination == Integer.MAX_VALUE) spaceDestination = destination; if (numDestination == Integer.MAX_VALUE) num...
3d6209d5-2595-4d87-802d-64810626e90d
7
private static String convertNewLines(String text, String newLine) { if (text == null) return ""; // NOI18N if (newLine == null) return text; StringBuilder newText = new StringBuilder(); for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (c == '...
1ed841a5-26ed-408f-b22c-cac847b6a0e4
3
public synchronized void endThreadAccess() { Object requestingUser = Thread.currentThread(); if (m_oCurrentUser == null) { this.notifyAll(); } else if (m_oCurrentUser == requestingUser) { m_oCurrentUser = null; this.notifyAll(); ...
60cbdf35-9673-4f60-85f9-1a68013349cd
3
public Resolution newOrder() { HttpSession session = context.getRequest().getSession(); if (shippingAddressRequired) { shippingAddressRequired = false; return new ForwardResolution(SHIPPING); } else if (!isConfirmed()) { return new ForwardResolution(CONFIRM_ORDER); } else if (getOrder...
9d7e4f21-86b9-4868-a159-53f2b31d2469
7
public static Digraph rootedInDAG(int V, int E) { if (E > (long) V*(V-1) / 2) throw new IllegalArgumentException("Too many edges"); if (E < V-1) throw new IllegalArgumentException("Too few edges"); Digraph G = new Digraph(V); SET<Edge> set = new SET<Edge>(); // fi...
a47cc494-28e7-4fb5-920c-ed28f725ac48
8
public String toSource(String className, Instances data) throws Exception { StringBuffer result; boolean[] numeric; boolean[] nominal; String[] modes; double[] means; int i; result = new StringBuffer(); // determine what attributes were processed numeric = new ...
8453b13a-b572-49ca-8b5b-136baf76b218
4
private int jjMoveStringLiteralDfa25_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 24); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 24); } switch(curChar) { case 48: return jjMoveStringLiter...
9c7531c1-ba1c-43a8-b1a0-bb1f755e3510
6
public void buildIndices() { if ((allIndices == null) || allIndices.isEmpty()) { return; } for (String indexName : allIndices.keySet()) { indexMap = allIndices.get(indexName); indexGlobal.setSubscriptCount(0); indexGlobal.appendSubscript(indexName)...
d7e5a972-d10d-476d-8083-21e9a7b65a42
4
public Component getTableCellRendererComponent( JTable table, Object color, boolean isSelected, boolean hasFocus, int row, int column) { Color newColor = (Color)color; setBackground(newColor); if (isBordered) { if (isSelected) { if (selectedBorder == null) { selectedBorder = BorderFactory.cre...
b79e2957-a2e1-4a7a-9b6c-2b03397a2bb5
3
@Override public boolean removeSpecialTile(Tile tile) { if(tile == null) return true; Iterator<Tile> it = specials.iterator(); while(it.hasNext()){ Tile next = it.next(); if(next.getName().equals(tile.getName())){ it.remove(); return true; } } return false; }
5ef3da94-35c7-420a-b9e3-d0a589f3fab9
1
public void Save() throws IOException { if (!new File("levels").exists()) new File("levels").mkdir(); FileOutputStream fos = new FileOutputStream("levels/" + name + ".ggs"); GZIPOutputStream gos = new GZIPOutputStream(fos); ObjectOutputStream out = new ObjectOutputStream(gos); out.writeLong(serialVersionUI...
cf52f6e6-eb38-4e98-820e-2f49cbd89a3a
2
private static void copy(File f1, File f2) { try { InputStream in = new FileInputStream(f1); OutputStream out = new FileOutputStream(f2); byte[] buf = new byte[4096]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); ...
ff12394a-a670-44d0-8132-c64b9482523a
6
public int bufferRight(int ori) { int buff = 0; int width = getTiles()[0].length == 9 ? 3 : 4; // get width (3 or 4) of piece width = getTiles()[0].length == 4 ? 2 : width; for(int j = width-1; j >= 0; --j){ boolean tmp = true; for(int i = 0; i < width; ++i){ if(tiles[ori][i*width+j]) { tmp = fa...
1c3a8415-404d-494a-a6f9-fa958e2236a3
5
protected void changeSelection() { ListSelectionModel model = table.getSelectionModel(); int min = model.getMinSelectionIndex(), max = model .getMaxSelectionIndex(); drawer.clearSelected(); if (min == -1) { convertPane.getAutomatonPane().repaint(); return; } for (; min <= max; min++) { if (!mod...
720ab647-fa1f-4de0-971e-50dd17e445b1
5
private void updateGroups() { if (user != null) { groups = new HashMap<>(); groupIdNameMap = new HashMap<>(); //get their groups ArrayList<Integer> temp = user.getGroups(); if (temp != null) { groupNames = new String[temp.size()]; ...
f646b098-9a4d-4c36-8613-19fea0e61a00
6
public Object getFieldValue(_Fields field) { switch (field) { case LEFT_RHINO_ID: return Long.valueOf(getLeftRhinoId()); case LEFT_TITAN_ID: return Long.valueOf(getLeftTitanId()); case RIGHT_RHINO_ID: return Long.valueOf(getRightRhinoId()); case RIGHT_TITAN_ID: return Long...
c69f220f-0403-4f14-8efb-d0da639357e6
0
public void setbossoldclass(HeroClass hc) { this.oldclass = hc; }
1d048902-aa2e-4e25-b885-626217bea07d
6
public void run() { while (true) { try { String[] nextCommand; try { nextCommand = dialogue.getUserInput("Enter command:").split(" "); } catch (IOException e) { throw new SystemCommandException( "Error while reading most recent command.", e); } String commandName = nextCom...
f78ad842-7054-46e9-b899-54a87f172ac7
0
public void treeNodesRemoved(TreeModelEvent e) { invalidate(); }
587bbf4d-e82b-4675-b351-c855101da671
7
public void remove(Armor a){ switch(a.getType()){ case HEAD: armorList[0] = null; break; case SHOULDERS: armorList[1] = null; break; case BREAST: armorList[2] = null; break; case GLOVES:armorList[3] = null; break; case BELT: armorList[4] = null; break; case PANTS: armorList[5] = null; break; ...
66196cfb-2160-4190-8b82-d23abae50af3
4
public boolean equals(Object configuration) { if(configuration == this) return true; try { MealyConfiguration config = (MealyConfiguration) configuration; return super.equals(config) && myUnprocessedInput.equals(config.myUnprocessedInput) ...
ea49a6ac-d1b1-479d-8e13-d344cec79cb8
2
public HUDQuickBar(HUDManager hm, Registry rg, int x, int y, int w, int h) { super(hm, rg, x, y, w, h); setImage("HUD/QuickBar/BG"); HUDArea hudArea = null; //slots int slotX = 0; for (int i = 0; i < SLOTS; i++) { slotX = SLOT_START_X + (i * SLOT_WIDTH) + (...
c6ba8315-f248-4c21-a5c6-8d80c186d225
1
public static ctrlTaller getInstance() { if (INSTANCE == null) { creaInstancia(); } return INSTANCE; }
13c5b93b-5e87-4ea5-8059-d5ea7795b0a5
0
public JTextField getjTextFieldVilleCP() { return jTextFieldVilleCP; }
c132d3ae-5679-4938-8801-460cd1803c32
6
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof Lap)) { return false; } final Lap lap = (Lap) o; if (id != null ? !id.equals(lap.id) : lap.id != null) { return false; } if (rawDataSet != null ? !rawDataSet.equals(lap.rawDataSet) : lap.rawD...
81b529be-4eec-4169-886d-51889799aaf6
9
public static <E extends Comparable<E>> void sortWithQueue(IMyQueue<E> queue) { if(queue.isEmpty()) { return; } IMyQueue<E> auxQue = new MyLinkedQueue<E>(); while(!queue.isEmpty()) { // First get current element from queue E element = queue.poll(); // Then, get current smallest item (CSI) // i...
fd2488a1-8d90-4def-a4aa-ef8e3e696493
1
public void addRequierField(String requierField) { if (this.requireFields == null) { this.requireFields = new ArrayList<String>(); this.requireFields.add(requierField); } else this.requireFields.add(requierField); }
1ff2f9e9-6c6a-46d2-a4f9-59ac7bd972b1
2
@Override public int compareTo(Apple o) { if (id > o.getId()) { return 1; } else if (id == o.getId()) { return 0; } else { return -1; } }