method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dc8dac05-6e22-4347-b3da-12d67a991334 | 9 | private void createDragOperations(Composite parent) {
parent.setLayout(new RowLayout(SWT.VERTICAL));
final Button moveButton = new Button(parent, SWT.CHECK);
moveButton.setText("DND.DROP_MOVE");
moveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button b = (... |
12948813-6af4-43ca-935b-6076142f775c | 8 | public void connect(TreeLinkNode root) {
TreeLinkNode cur = root;
while (cur != null) {
TreeLinkNode next = null;
TreeLinkNode prev = null;
while (cur != null) {
if (next == null) {
if (cur.left != nu... |
eb70a61c-0a8f-4639-9a84-4e1e0b517e04 | 4 | public int solve() {
startTime = System.currentTimeMillis();
if (solns.size() >= MAX_SOLUTIONS) return 0;
if (emptySpots.isEmpty()) {
this.solns.add(grid);
return 1;
} else {
Spot sp = emptySpots.get(0);
ArrayList<Integer> cand = sp.getCandidates();
if (cand.isEmpty()) {
endTime = System.curr... |
ffc14011-e29f-4fcd-abf7-3b7f62b14761 | 1 | private void evaluate_code() {
myDataList linklist = (myDataList) mylist.clone();
myDataList temp;
int size = linklist.size();
arrList.add(linklist.clone());
while (size > 2) {
((data) linklist.get(size - 2)).append_data(((data) linklist.get(size - 1)));
... |
2cf088eb-c8db-406d-b0e8-21f4513e1c61 | 5 | public void createFromXML(NodeList components) {
try {
for(int i = 0; i < components.getLength(); i++) {
Node node = components.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Class c = Class.forName("settii.actorManager.components." + node.... |
3d4f6cd1-e10e-413e-8e8b-c4d67d1f4fa4 | 2 | private void notifyListeners() {
if(!listeners.isEmpty())
for(Listener listener : listeners)
listener.update();
} |
f5b62806-0cae-4e0d-96df-59aee2f9a270 | 3 | public static void keyboardReader() {
byte[] buf = new byte[255];
StringBuilder sb = new StringBuilder();
int n;
String temp;
while (true) {
try {
n = System.in.read(buf);
} catch (IOException e) {
break;
}
... |
a4479e11-1170-41a0-8769-c9df104b44a3 | 7 | public void decreaseRope(int x, int y) {
if (ropelength > -1) {
ropelength --;
}
x += 1;
y -= 2;
switch (ropelength) {
case 124: getWorld().removeObject(rope6); ropeman.setLocation(x, y+15); break;
case 99: getWorld().removeObject(rope5); ropem... |
9b92e56e-1aaa-467a-bde2-d34b886eeb93 | 1 | public boolean setPWfieldWidth(int width) {
boolean ret = true;
if (width <= 10) {
this.pwfield_Width = UISizeInits.PWFIELD.getWidth();
ret = false;
} else {
this.pwfield_Width = width;
}
somethingChanged();
return ret;
} |
68ccc510-e179-4c0a-90a6-bf265f257e9e | 3 | @WebMethod(operationName = "ReadOrderOutDetail")
public ArrayList<OrderOutDetail> ReadOrderOutDetail(@WebParam(name = "ord_out_det_id") String ord_out_det_id) {
OrderOutDetail ord_out_det = new OrderOutDetail();
ArrayList<OrderOutDetail> ord_out_dets = new ArrayList<OrderOutDetail>();
... |
5a981072-ad4f-4348-84a9-82328e904f18 | 2 | @DBCommand
public boolean kickPlayer(CommandSender sender, Iterator<String> args) {
if(!sender.hasPermission("db.kickplayer")) {
sender.sendMessage(RED + "You don't have permission to use this command!");
return true;
}
if(!args.hasNext()) {
sender.sendMes... |
6aad1d0c-2ca8-4be2-9a61-5d7127f8f3e4 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(msg.targetMinor()==CMMsg.TYP_DISEASE)
&&(!mob.amDead())
&&(CMLib.flags().isGood(mob))
&&((invoker==null)||(invoker.fet... |
76b9e664-0172-4744-8315-7ba1a9243f94 | 6 | */
public void iniciar() {
/* 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://download.ora... |
58e1614b-3bed-4eaf-8e82-a416188ef710 | 0 | public void setValueMAC(byte[] value) {
this.valueMAC = value;
} |
56410895-dd9b-44d9-ad51-329cd66d2c81 | 4 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
boolean inside=false;
Point firstPoint = new Point();
Point secondPoint = new Point();
Point thirdPoint = new Point();
firstPoint.x = sc.nextDouble();
firstPoint.y = sc.nextDouble();
secondPoint.x = sc.nextDouble()... |
97ae5715-5412-452e-a23c-97bed4719f53 | 1 | private Object fireReceiveQueryEvent(ReceiveQueryEvent evt) throws Exception {
if (invokeHandler == null) {
throw new IllegalStateException("InvokeHandler not assigned on client side");
}
localConnectionInfo.remove();
localConnectionInfo.set(evt.getConnectionInfo());
return new Reflexia().invo... |
387fdd91-d4d8-4274-9d1a-8e5b1c34d6a5 | 8 | protected void getCounterClaimDetail(String title) {
if (title != null) {
for (int i = 0; i < counterClaimResultList.size(); i++) {
if (counterClaimResultList.get(i).getTitle().equals(title)) {
if (!(counterClaimResultList.get(i).getDescription() == null
|| counterClaimResultList.get(i).getDescrip... |
c60e6aa9-cd13-4b0f-9f54-58a0b50ce34b | 6 | public char newSymbol() {
char next = (char) (this.lastChar +1);
while (next == '{' || next == '}' || next == '"' || next == '[' || next == ']' || next == '@') {
next += 1;
}
this.lastChar = next;
return next;
} |
ad1ab438-c624-4422-ba7f-3f08bc4134da | 4 | public void startSimulation() {
try{
int rr = Integer.parseInt(refreshRate.getText());
if(rr <= 0){
Main.minorError("Invalid input: '" + refreshRate.getText() + "' is not a positive integer.\nThe refresh rate has to be a positive integer.");
return;
}
Configuration.refreshRate = rr;
} catch(java... |
7ea547da-264d-4f58-9a9a-a1bf9af1c3b6 | 7 | private boolean processFilePairs(Map<File, File> inputFilePairs,
File outputFolder) {
boolean sucess = true;
List<String> scriptLines;
StringBuffer outputVideoFileName;
String commandToRun;
Map<String, String> templatePairs = new HashMap<String, String>();
File avsScriptFile = new File(
properties
... |
19981476-c968-452b-8c99-2d98dbad709d | 7 | public void set(int key, int value) {
if (!cache.containsKey(key)) { // Cache doesn't contain the key
if (cache.size() < capacity) { // Cache is not full
for (int k : frequency.keySet()) {
int temp = frequency.get(k);
frequency.replace(k, temp ... |
08a3bf68-ad38-41ad-a3c9-56858948decd | 1 | public static void main(String[] args) throws IOException {
ServerSocket server = new ServerSocket(2048);
while (true) {
Socket client = server.accept();
new Thread(new ClientHanldler(client)).start();
}
} |
a17d1070-18d4-40eb-a0eb-a6a90b8852d9 | 1 | @RequestMapping(method = RequestMethod.POST)
public String addUserFromForm(@Validated User user, BindingResult bindingResult){
if(bindingResult.hasErrors()) {
return "user/edit";
} else {
// spitterService.saveSpitter(spitter);
return "redirect:/user/"+user.getLo... |
47d1e1c8-792d-44da-929c-b0509cbe4a5a | 6 | public void addExternalStep(int x, int y) {
if (isFocusPointsEmpty()) {
resetMovement();
}
MovementPoint lastPosition = getFocusPoints().peekLast();
int deltaX = x - lastPosition.getX();
int deltaY = y - lastPosition.getY();
int maximumDelta = Math.max(Math.abs(deltaX), Math.abs(deltaY));
for (int i = ... |
ac4fd818-034e-4015-8b4f-7ea0b4dc8f33 | 3 | private boolean newerVersionBigger(String newestVersion, String oldVersion){
StringTokenizer newestToken = new StringTokenizer(newestVersion, ".");
StringTokenizer oldToken = new StringTokenizer(oldVersion, ".");
while(newestToken.hasMoreTokens()){
int newest = Integer.parseInt( newestToken.nextToken());
in... |
deb86e35-cd3e-47e8-81fd-fb411f2acb02 | 9 | public void setPoints() {
super.setPoints();
if (dn > 150 && this == sim.getDragElm()) {
setSize(2);
}
int hs = gheight;
int i;
ww = gwidth2; // was 24
if (ww > dn / 2) {
ww = (int) (dn / 2);
}
if (isInverting() && ww + 8 > ... |
70f32b57-8143-4f09-90b0-bcbb69438c97 | 4 | public void keyPressed(int k)
{
heart.keyPressed(k);
if(k == KeyEvent.VK_ENTER && gameOver) gsm.setState(0);
if(k == KeyEvent.VK_ENTER && levelClear) gsm.setState(3);
} |
fbbe9431-debe-48bb-95e9-9f0dfbb60747 | 7 | public int maxDepth2(TreeNode root) {
// Note: The Solution object is instantiated only once and is reused by
// each test case.
Stack<TreeNode> stack = new Stack<TreeNode>();
HashSet<TreeNode> visited = new HashSet<TreeNode>();
TreeNode node = null;
if (root == null)
return 0;
stack.push(root);
int ... |
c868f8ab-181c-49f8-8e7c-61091cc3fb2b | 0 | public Long getId() {
return id;
} |
f574c94d-8ed0-46fe-a4df-63ffda3ebd5d | 8 | @Override
public void prepararPanel(){
try {
BufferedImage db = ImageIO.read(new File("PLAN.png"));
JLabel plan = new JLabel(new ImageIcon(db));
pizarra.addPLAN(plan);
} catch (IOException ex) {
Logger.getLogger(Salidas.class.getName()).log(Level.SEVER... |
a429deb7-f842-479b-b579-e7d02d905963 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == cancelBtn) {
tools.setFormula(formula);
ok = false;
setVisible(false);
} else if (e.getSource() == paramBtn) {
ParameterManager pm = new ParameterManager(params);
pm.setVisible(true);
params = pm.getParams();
} else if ... |
a2484c0e-01e2-4ffe-a1f2-9c65150a39c8 | 8 | @Override
public void modifyManufacturer(MOB mob, Manufacturer me, int showFlag) throws IOException
{
if((showFlag == -1) && (CMProps.getIntVar(CMProps.Int.EDITORTYPE)>0))
showFlag=-999;
boolean ok=false;
while(!ok)
{
int showNumber=0;
final String newName=prompt(mob,me.name(),++showNumber,showFlag,"... |
35e97f44-6dd6-47f7-9158-8ceb0f139edc | 7 | private void login() throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
Cliente c;
Funcionario f;
String cpf;
int tam;
cpf = jTextField1.getText();
cpf = cpf.replaceAll("[^0-9]", "");
//System.out.println(cpf);
tam = cpf.length();
if ((tam != 11 && !cpf.mat... |
6ea7bfdf-7efb-4f73-ab7b-181aa9973fc1 | 5 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof StackTrace)) {
return false;
}
StackTrace other = (StackTrace) obj;
if (other.trace.length != trace.length) {
return false;
}
if (!(other.state == this.state)) {
return false;
}
for (int i = 0; i < trace.length; i+... |
33aacf91-5bd0-4488-95f6-3ee9735fdd0c | 9 | public static double scoreForUnsafePieces(BoardState state, boolean white) {
int unsafeCount = 0;
for(int i=0; i<BoardUtils.BOARD_SIZE; i++) {
if(state.getCountAt(i)==0) continue;
boolean match = (white == state.isPositionWhite(i));
if(!match) continue;
if(state.getCountAt(i)==1) {
if(white && i<=5)... |
1f50957a-77cd-4d00-b5e4-3432412da7ab | 5 | public List ObtenerLasCompras(int idju){
Connection cn = this.conectar();
ArrayList lista = new ArrayList();
Statement st = null;
try {
st = cn.createStatement();
} catch (SQLException ex) {
Logger.getLogger(conectar.class.getName()).log(Level.SEVERE, null, ex);
... |
49cd2996-2001-4985-aa7b-8afe3abcd63f | 0 | public T[] getSource()
{
return _source;
} |
5ca3a019-5857-4614-8e32-9469fc1fbd9e | 9 | public static void appendQuotedChar(Appendable sb, int c) {
int q = 0;
if (c == '\b')
q = 'b';
else if (c == '\n')
q = 'n';
else if (c == '\r')
q = 'r';
else if (c == '\t')
q = 't';
else if (c == '\"' || c == '\\')
... |
a2471237-cd24-4e25-b3dd-b8ca5dd72954 | 3 | public ConfigDialog(IRCMainFrame owner) {
super(owner, "mntmConfiguration", true);
this.mainFrame = owner;
setTitle("IRC Configuration");
setBounds(100, 100, 325, 447);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, B... |
62c920c1-932a-4229-ac7e-146de322b615 | 2 | void printEff(File dir) throws IOException {
PrintWriter w;
if (file!= null) {
w = new PrintWriter(new FileWriter(new File(dir,file), true));
} else {
w = new PrintWriter(new OutputStreamWriter(System.out));
}
w.println(result());
w.flush();
... |
578e8724-2758-4e95-951a-396fad2ddfdc | 6 | protected void getFiles() {
File i = new File(getDataFolder(), "EventoThor.AGInfo");
File message = new File(getDataFolder(), "messages.yml");
File file = new File(getDataFolder(), "config.yml");
if (!i.exists()) {
try {
i.createNewFile();
} catch ... |
cee3a998-5e0b-4a64-998f-981efe213904 | 6 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
7c2860aa-ab49-4e21-aeb2-d8fd462acb38 | 6 | private static HashMap<String,BusStop> readBusStopInfo(Scanner input) throws Exception
{
String temp;
int x, y;
BusStop bs = null;
HashMap<String,BusStop> busStops = new HashMap();
temp = input.next();
if (temp.compareTo("busstops") != 0)
throw new Exception(temp ... |
a3c9b68b-b407-433b-a789-bcca447d2afc | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
7779500e-5e8f-42b0-ad21-998dbed35165 | 9 | private void destroyPopupMenu(final JPopupMenu pm) {
if (pm == null)
return;
pm.setInvoker(null);
PopupMenuListener[] pml = pm.getPopupMenuListeners();
if (pml != null) {
for (PopupMenuListener i : pml)
pm.removePopupMenuListener(i);
}
Component c;
AbstractButton b;
for (int i = 0, n = pm.getC... |
7e3f223d-71df-44c9-bdb0-de9d9e7197bc | 8 | @Override
protected void readInternal(byte[] b, int offset, int len) throws IOException {
final ByteBuffer bb;
// Determine the ByteBuffer we should use
if (b == buffer && 0 == offset) {
// Use our own pre-wrapped byteBuf:
assert byteBuf != null;
byteBuf.clear();
... |
236fff89-3d29-4575-8ace-9db2c720a4a9 | 4 | private void serverTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_serverTableMouseClicked
currentCheck.setSelected(false);
try {
int index = serverTable.getSelectedRow();
if(index>=0){
String server = (String)serverTable.getModel().getValueAt(... |
89fbcd98-4b19-457d-abcc-4371e6cba642 | 1 | public CNRLink setDeviceName(String s) {
if (s == null) {
devname = null;
flags.clearValidDevice();
} else {
devname = s;
flags.setValidDevice();
}
return this;
} |
053b91b9-16d0-46ec-b40e-429a245adf29 | 1 | @Override
Integer redactEntity(Criteria criteria, AbstractDao dao) throws DaoException {
Integer idUser = (Integer) criteria.getParam(DAO_ID_USER);
if (idUser != null) {
return updateUser(criteria, dao);
} else {
return createUser(criteria, dao);
}
} |
3540fdea-8721-4b83-9d12-7a5742e86122 | 4 | public void initORB(String[] args) throws IOException {
Properties props = System.getProperties();
props.setProperty("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
props.setProperty("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
// 启动参数
props.setProperty("... |
8ec90962-59c9-4a1f-a8ff-25da474e2d8d | 2 | public void forceClose(){
try{
this.fileChannel.close();
this.fileOutputStream.close();
}catch(Exception e){
e.printStackTrace();
try{
this.fileChannel.close();
this.fileOutputStream.close();
}catch(Exception e1){
e1.printStackTrace();
}
}finally{
this.file.delete();// 丢弃损害的文件... |
25c06703-78d2-4bb1-9991-8e6d1f07b168 | 5 | public int getHeightValue(int var1, int var2) {
if (var1 >= -32000000 && var2 >= -32000000 && var1 < 32000000 && var2 <= 32000000) {
if (!this.chunkExists(var1 >> 4, var2 >> 4)) {
return 0;
} else {
Chunk var3 = this.getChunkFromChunkCoords(var1 >> 4, var2... |
21d84472-e81a-4c0c-b11b-f2fcb5079cf1 | 8 | public double[] findIntervalEigenEnergies(int index) {
ArrayList<Double> energyList = new ArrayList<Double>();
double[] eRange = getEnergyRange();
for (int i = 1; i < eRange.length - 1; i++) {
// if (VERBOSE) {
// System.out.println("Index of interval: " + index + " en... |
a89d1444-97b9-4acc-a9fd-a04a823f5734 | 3 | public int compareTo(User otherU) {
// ugly, but works. :)
int result = getID().compareToIgnoreCase(otherU.getID());
if (result == 0) {
result = getPoints() - otherU.getPoints();
if (result == 0) {
result = getLastName().compareToIgnoreCase(otherU.getLastName());
if (result == 0) {
result = get... |
83ff29ea-358e-42ad-a092-445ed3f35ee0 | 3 | public void getNPCData () {
ResultSet rs = Main.mysql.getData("SELECT id, name, description, room, flags FROM `npcs`");
try {
while (true) {
npcData.put(rs.getInt(1) + ":name", rs.getString(2));
npcData.put(rs.getInt(1) + ":desc", rs.getString(3));
... |
f1ad4607-48fe-459f-b6c9-615378fd4bf5 | 4 | public static int getGreatesProdDownLeftDiagonal(int[][] arr, int maxDigits, int columns, int rows) {
int prod = 1;
for(int i = 0; i < (rows-(maxDigits - 1)); i++) {
int tmp = (maxDigits-1);
for(int j = 0; j < (columns-(maxDigits-1)); j++) {
int tmpProd = 1;
for(int k = 0; k < maxDigits; k++) {
t... |
1f5f581e-86f1-4bd8-a6ea-aaf373e8bd39 | 8 | public static void main(String[] args) {
try {
String key=args[3];
seed=1;
for(int i=0;i<key.length();i++,seed*=10)
seed*=key.charAt(i);
rotors=Integer.parseInt(args[2]);
offsets=new int[args.length-4];
for(int i=4;i<args.le... |
2180635f-f21c-4e38-bfdc-4b6dc531a550 | 3 | private boolean Cerrar() {
boolean gc = true;
if (!syntaxArea.getText().equalsIgnoreCase("")) {
int res = JOptionPane.showConfirmDialog(this, "Save sintax file?",
"WARNING", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (res == JOptionPa... |
9f4c0e7c-67a6-4379-9100-aa9fc1a100d1 | 3 | @Override
public void tick(int arg0, int arg1, int arg2) {
ArrayList<ComponentPlayer> comps = player.getComponentsOfType(ComponentPlayer.class);
ColliderBox coll;
if(comps.size() > 0)
coll = player.pos.add(comps.get(0).colliderPos).getColliderWithDim(comps.get(0).colliderDim);
else
coll = player.pos.getC... |
1f895c82-b41f-48da-84d1-4179829eb2c1 | 2 | private static PrintService findPrintService() {
DocFlavor myFormat = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
PrintService[] printers = PrintServiceLookup.lookupPrintServices(myFormat, aset);
PrintService printService = ... |
cc01616e-cbf1-40b8-a679-9ef28ff3e67a | 0 | public OutOfSpaceException(Exception e, String name)
{
super(e, name);
} |
bf921ee6-484c-4d25-adde-834867b45ea1 | 0 | private static boolean fun(){
return k != 3;
} |
c6578fef-4d3a-4644-a9dd-237ce2555a03 | 5 | public void doFirmwareFlash() {
firmwareDialog.enableButtons(false);
new Thread(new Runnable() {
public void run() {
try {
if (connectionState == ConnectionState.CONNECTED) {
altimeter.disconnect();
setConnectionState(ConnectionState.BUSY);
}
log("Flashing altimeter firmware ...", ... |
71f15e9b-21c8-4bc8-befc-88fc628bfd46 | 6 | public static String fileHash (File file, String type) throws IOException {
if (!file.exists()) {
return "";
}
if(type.equalsIgnoreCase("md5"))
return fileMD5(file);
if(type.equalsIgnoreCase("sha1"))
return fileSHA(file);
URL fileUrl = file.toU... |
d78f580b-75b8-4a12-9694-9af953fbd525 | 4 | private void displayCompResults(List<MapperCompJvmCost> cMapperJvmCostList, List<ReducerCompJvmCost> cReducerJvmCostList,
String mapperFile, String reducerFile, String jobName) throws IOException {
File mFile = new File(mapperFile);
File rFile = new File(reducerFile);
if(!mFile.getParentFile().exists())
... |
7a33f49e-5f95-4726-ab4a-384174ede337 | 2 | public Final findFinalByValue(String value){
for(Final fin: finals){
if(fin.matchByValue(value))
return fin;
}
return null;
} |
854f0469-0c85-4958-bdfc-11607c2f6cfd | 7 | public static String getPStats(char c, HTTPRequest httpReq)
{
boolean changes = false;
final PhyStats adjPStats=(PhyStats)CMClass.getCommon("DefaultPhyStats");
adjPStats.setAllValues(0);
if(httpReq.isUrlParameter(c+"ESTATS1"))
{
int num=1;
String behav=httpReq.getUrlParameter(c+"ESTATS"+num);
while(... |
c117c2d0-e6e5-4261-aaf4-9f9802b6c600 | 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... |
c6ed07ba-4590-4d07-9883-d798bc8f4912 | 4 | @Override
public String toString(){
String str = "";
if(node1.getClass().equals(getClass()) || !(node1 instanceof Operation))
str += node1.toString();
else
str += "(" + node1 + ")";
str += super.toString();
if(node2.getClass().equals(getClass()) || !(node2 instanceof Operation))
str += node2.toStrin... |
54c7283d-4430-4bdb-996c-000534e18d2f | 3 | public void onPrivateMessageReceived(PrivateMessage pm) {
if(pm.getMessage() != null && pm.getSender() != null) {
addText("[" + pm.getSender() + "]: " + pm.getMessage() +
(pm.getMessage().endsWith("\n") ? "" : "\n"));
}
} |
c56b657a-cf84-46af-9994-2925514b8e3d | 0 | public void setDescription(String description) {
this.description = description;
setDirty();
} |
9596c578-eada-4ebd-b15b-add33c591ab9 | 3 | public static String viewRoleString(){
String str="";
int agent_type = viewRoleInt();
if (agent_type>99)
str=str.concat("R");
if (agent_type %100 > 9)
str=str.concat("B");
if (agent_type%10>0)
str=str.concat("P");
return str;
} |
bef66f31-c0a7-4ca9-86ce-8d5ad4daedbb | 7 | private MutablePiece randomPiece(final int the_x, final int the_y)
{
final Block[] blocks = Block.values();
MutablePiece result;
switch (blocks[RANDOM.nextInt(blocks.length)])
{
case I:
result = new IPiece(the_x, the_y);
break;
case J:
result = new JPiece(the_x, t... |
561c403c-8c69-4e7e-8cb4-2df55ce5533d | 3 | public boolean subMenu(){
String[] opciones = {"Ver Detalles ", "Ingresar", "Retirar dinero", "Transferir", "Borrar Cuenta", "Atrás"};
int opcion = this.presentar(opciones);
if(opcion == 0){
System.out.print(seleccionada);
}
if(opcion == 1){
... |
22abc494-8ca8-4a22-9d08-a314bc3c5013 | 0 | public void setSimilarity(double similarity) {
DecimalFormat doubleFormatter = new DecimalFormat("#.##");
this.similarity = Double.parseDouble(doubleFormatter.format(similarity));
} |
f84d83f5-6802-4f3a-bb3b-b806e0a3bfd9 | 5 | public static void maxHeapify(int[] A, int i, int heapSize){
int l=left(i);
int r=right(i);
int largest;
int temp;
if (l<heapSize && A[l]>A[i]){
largest=l;
}else{
largest=i;
}
if (r<heapSize && A[r]>A[largest]){
largest=r;
}
if (largest!=i){
temp=A[i];
A[i]=A[largest];
A[largest]=t... |
a4c10911-b90d-413a-888d-55d106f3683b | 8 | @Override
public void paintRow(Graphics2D g2d, int row, int firstCol, int lastCol,
int x, int y, int cellWidth, int rowHeight) {
if ((!translate) || translator == null) {
ErrorWindow.showErrorWindow(new IllegalStateException("The Amino Acid painter must have a translator set before it can be used to paint"));... |
0257b524-6606-4718-8f45-d2121aba422c | 3 | public String readUTF8(int index, final char[] buf) {
int item = readUnsignedShort(index);
if (index == 0 || item == 0) {
return null;
}
String s = strings[item];
if (s != null) {
return s;
}
index = items[item];
return strings[item... |
1f4e19b0-f2ec-407a-8fb6-74a35c6d1dd3 | 7 | public static List read(File file) {
ObjectInputStream input = null;
try {
input = new ObjectInputStream(new FileInputStream(file));
} catch (IOException e) {
e.printStackTrace();
return null;
}
int amount;
try {
amount = (Integer) input.readObject();
} catch (ClassNotFoundException e) {
e... |
66158d45-c346-4f8e-b3ff-46e80b0bd709 | 0 | @Override
public void setOnCompareFinishedListener(OnCompareFinishedListener listener)
{
_onCompareFinishedListener = listener;
} |
1b9f7b7b-fec7-4784-8e71-caf6cbe63d4e | 4 | public void receiveShipment(int shipid) {
try {
PreparedStatement stmt = connection.prepareStatement("select stock_number, amount from ShippingListed where ship_id = ?");
stmt.setInt(1, shipid);
ResultSet rs = stmt.executeQuery();
DepotItemModel depotItemModel = n... |
611d2f5b-2052-4edd-bb16-0c8f32e0f2b1 | 5 | protected void exchange(String[] argv) {
int bottom = first_nonopt;
int middle = last_nonopt;
int top = optind;
String tem;
while (top > middle && middle > bottom) {
if (top - middle > middle - bottom) {
// Bottom segment is the short one.
int len = middle - bottom;
int i;
// Swap it with... |
122d55c6-5d40-4cbb-993f-da9ad00453ab | 9 | @SuppressWarnings("unchecked")
public static <T> T convertToType(Class<T> type, String value) {
if (type == String.class) {
return (T) String.valueOf(value);
} else if (isNumber(type))
return (T) getNumber((Class<? extends Number>) type, value);
else if (type == Boolean.class || type == boolean.class) {
... |
3b4b5918-9f06-4ffc-b9de-90f17793d751 | 2 | private void load() {
for (int Ly = 0; Ly < SIZE; Ly++) {
for (int Lx = 0; Lx < SIZE; Lx++) {
pixels[Lx + Ly * SIZE] = sheet.pixels[(Lx + this.x) + (Ly + this.y) * sheet.SIZE];
}
}
} |
c8748472-9066-4b0c-90a3-e288f0f5c04e | 1 | private boolean seuraavanaLaskutoimitus() {
if (syote.substring(paikka, paikka + 1).equals("-")) {
return true;
}
return syote.substring(paikka, paikka + 1).matches("[+|*|/|']");
} |
c1f089e3-9167-4f2d-8b91-2969e77ff532 | 6 | public void addXRefTableEntries(Parser parser) {
m_bIsCrossReferenceTable = true;
try {
//System.out.println("Starting to read xref table : " + (new java.util.Date()));
//int countOfAllEntries = 0;
while (true) {
Object startingObjectNumberOrTrailer = parser.getNumberOrSt... |
6a1787ba-36ae-4577-b78a-9fb75cde414d | 2 | void addMethod(CtMember method) {
method.next = methodTail.next;
methodTail.next = method;
if (methodTail == consTail) {
consTail = method;
if (methodTail == fieldTail)
fieldTail = method;
}
methodTail = met... |
e850f886-5c4f-474a-87f0-c8286bf88489 | 4 | private static boolean shouldUpdateValue(final String playerName) {
// Incorrectly cached, so cache now.
if (!isLastCached(playerName) || !isCachedUUID(playerName))
return true;
final long lastCacheTime = getLastCached(playerName);
// No cache time
if (lastCacheTime <= 0) {
return tru... |
d9bc12dd-73ae-46e3-acab-404c2f0cc356 | 2 | private void reloadCommandsTable() {
while ( tableModel.getRowCount() > 0 )
tableModel.removeRow(0);
commands = settings.getCommands();
for (Command c : commands) {
String[] row = {c.name, c.content};
tableModel.addRow(row);
}
} |
1eb6fcc3-57fe-4eae-8dc2-2fee87fb8576 | 3 | public static void moveInventoryListObjectBefore( String listName ) {
ArrayList<InventoryListObject> inventoryLists;
InventoryListObject inventoryListObject;
int curPosition, newPosition;
inventoryLists = _inventoryObject.getInventorysLists();
inventoryListObject = getInventoryListO... |
5d232915-5874-4900-a926-7a5bcd09f9fd | 8 | public void deleteNode(T deleteItem){
LinkedListNode<T> current;
LinkedListNode<T> trailCurrent;
boolean found;
if ( first == null) //the list is empty
System.err.println("Cannot delete from an empty "
+ "list.");
else{
i... |
484aac90-7cbb-4714-91e7-2030faca6a91 | 9 | protected Exit findExit(final Modifiable M, XMLTag piece, Map<String,Object> defined) throws CMException
{
try
{
final String tagName="EXIT";
final List<XMLLibrary.XMLTag> choices = getAllChoices(M,null,null,tagName, piece, defined,true);
if((choices==null)||(choices.size()==0))
return null;
final ... |
3d4097fc-524f-4dfd-b2af-4214dc52562d | 0 | private Settings() {
// JFormDesigner - Action initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
putValue(NAME, "Preferencias");
putValue(SHORT_DESCRIPTION, "Abrir ventana de preferencias");
putValue(LONG_DESCRIPTION, "Abrir ventana de preferencias");
... |
abb0d901-b4d4-4b53-9742-81fdc8ea3886 | 7 | private void addSpecialAbilityDialog() {
JLabel nameLabel = new JLabel("Name");
nameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
JTextField nameField = new JTextField();
nameField.setAlignmentX(Component.LEFT_ALIGNMENT);
JTextArea descField = new JTextArea();
JLabel d... |
0584f7a9-cbb5-4e39-ada0-bbcb889006be | 4 | public Player(Vector3f position)
{
if(gunMesh == null)
{
gunMesh = new Mesh();
float sizeY = GUN_SIZE;
float sizeX = (float)((double)sizeY / (1.0379746835443037974683544303797 * 2.0));
float offsetX = 0.05f;
float offsetY = 0.01f;
float texMinX = -offsetX;
float texMaxX = -1 - offs... |
cc195f9d-935b-4898-b3bc-cdf97bf47630 | 2 | public List<T> getRange(Integer startId, Integer endId) {
ArrayList<T> values = new ArrayList<T>();
if (startId < endId)
{
for (Integer i = startId; i <= endId; i++)
{
T value = this.getById(i);
values.add(value);
}
}
... |
6ef5e14b-2495-43b2-a090-46f3371a47aa | 3 | public void rejectedExecution( Runnable r,
ThreadPoolExecutor executor ) {
if( this.threadPoolExecutor != executor ) {
this.logger.log( Level.SEVERE,
getClass().getName(),
"A ThreadPoolExecutor rejected a Runnable to be executed but the executor is unknown. Returning." );
... |
871d204c-aeae-4165-ba61-296467c28dfc | 7 | protected void processFile(File inFolder, File file, String target) throws IOException {
final String fileExt = "." + FilenameUtils.getExtension(file.getName());
switch (fileExt) {
case PAGE_EXT:
if (collectMetrics) {
final long time1 = System.currentTim... |
99d65123-a09d-4a8a-8d63-01895a44104c | 4 | public boolean addContextEntry(String key, String value) {
logger.info(new StringBuilder("key=").append(key).append(", value=").append(value).toString());
boolean result = false ;
if (key == null || key.isEmpty()) {
logger.log(Level.WARNING, new StringBuilder("key is null or is empty").toString());
retur... |
b8d985b3-f883-49d6-a4c8-4a0dcb275964 | 7 | static final public void sum() throws ParseException {
term();
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PLUS:
case MINUS:
;
break;
default:
jj_la1[1] = jj_gen;
break label_1;
}
switch ((jj_ntk==-1)?jj_ntk():jj_nt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.