method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cfa72b2d-4bdb-42ae-b868-17cb47847f4e | 4 | public WebauthResponse(String token) {
String[] value = Util.split(RESPONSE_SEP, token);
// Note: the deprecated (since 1.4) URLEncoder.encode(String)
// form is used here for 1.3 compatibility. Should really be
// URLEncoder.encode(String,String)
nFields = (value.length < FIELD_NAME.length) ? value.length... |
5ab7106c-b972-4b47-8aa1-3c576e3a9ee1 | 2 | @SuppressWarnings("static-access")
public void collision(GameMaster game) {
// Collision with the player
if(collisionBox.intersects(game.player.collisionBox)) {
paddleSound();
// here
velx = speed;
}
// Collision with the AI
else if(collisionBox.intersects(game.ai.collisionBox)) {
paddleSound(... |
d1e19938-80c8-40e7-b1c0-1649bd44ea66 | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
8ee5e461-0f58-4dca-9498-bf714c744640 | 4 | protected String doInBackground() throws Exception {
MainFrame.getOpenButton().setEnabled(false);
MainFrame.getGoButton().setEnabled(false);
MainFrame.getSongTable().setEnabled(false);
((SongTableModel) MainFrame.getSongTable().getModel()).clearTable();
Logger.LogToStatusBar(file.getAbsolutePath()... |
ccb8dd88-3523-4e4a-a70b-0335241e0ac0 | 6 | public static BMap fromBencodedValue(String bencodedValue, AtomicInteger index) throws BParsingException {
if (!bencodedValue.startsWith(String.valueOf(START_SYMBOL), index.get())) {
throw new BParsingException("Invalid bencoded map");
}
index.incrementAndGet();
List<BString>... |
19df77e6-a861-43d4-b719-68a855953055 | 4 | public void computeSums(){
int inrangeSum=0;
int outofRangeSum=0;
boolean finished=false;
System.out.print("Enter top of range: ");
int top=Integer.parseInt(System.console().readLine());
System.out.print("Enter bottom of range: ");
int bottom=Integer.parseInt(Syst... |
d8142da1-e679-45ab-87c1-ba6ae6add1c2 | 7 | public static void main(String[] args) throws IOException {
File base = new File(args[0]);
Multiset<String> overallCounts = HashMultiset.create();
int leakType = 0;
if (args.length > 1) {
leakType = Integer.parseInt(args[1]);
}
Dictionary newsGroups = new Dictionary();
NewsgroupHel... |
e73a684d-235a-4ae1-8961-21525390f8af | 4 | final public Stat Assign(Exp.VarExp v0) throws ParseException {
List<Exp.VarExp> vl = new ArrayList<Exp.VarExp>();
vl.add(v0);
Exp.VarExp ve;
List<Exp> el;
Stat s;
long i = LineInfo();
label_3: while (true) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case 72:
;
break;
default:
jj_... |
140906ac-30e6-4de9-a032-66baf183afdd | 9 | private static int runProcess(String[] cmd, String[] environment,
InputStream in, OutputStream out,
OutputStream err)
throws IOException
{
Process p;
if (environment == null) {
p = Runtime.getRuntime().exec(cmd);... |
02a4fca4-eda7-4045-8d7a-30496987860c | 2 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
long n=in.nextLong();
int c=in.nextInt();
char[] result=Long.toString(n).toCharArray();
int starting = 0;
for(int i=0;i<c;){
if(starting>=result.length) break;
int index = findLargestIndex(result, c-i+1, starting);
swapFro... |
e9326d47-87d6-4855-8b13-cc6bd4818a8f | 6 | private void processCreateFile(APDU apdu) {
if (isLocked()) {
ISOException.throwIt(SW_CONDITIONS_NOT_SATISFIED);
}
byte[] buffer = apdu.getBuffer();
short lc = (short) (buffer[OFFSET_LC] & 0xff);
boolean eapProtection = (buffer[OFFSET_P1] != (byte)0x00);
... |
a65195f6-4e07-4963-93dd-65f1c90f50f0 | 4 | public GoColor getLabelColor(int x_sect, int y_sect) {
GoStone toFind = null;
for (GoStone stone: goStones) {
if (stone.x_sect == x_sect && stone.y_sect == y_sect) {
toFind = stone;
}
}
if (toFind == null) {
return GoColor.BLACK;
} else {
return toFind.color.opposite(... |
da528117-503e-4f2c-b5b7-60ff4fdf1fe9 | 2 | protected void setDesc(String desc) throws Exception{
if(desc.length()<1 || desc.length()>20){
System.out.println("La que peta => "+desc);
throw new Exception("La descripcion no puede estar vacio o contener mas de 20 caracteres.");
}else{
this.desc = desc;
}
} |
9099fd44-3f2f-4ab7-b842-fdad0cf93ae8 | 0 | public void setY(double _y) {
y = _y;
} |
2bbb6b6b-470f-4e27-8a30-b08aac698e19 | 7 | public static String escapeHTML(String in) {
StringBuilder s = new StringBuilder();
for (int i = 0; i < in.length(); i++) {
char c = in.charAt(i);
switch(c) {
case '&': s.append(amp); continue;
case '\'': s.append(apos); continue;
case '<': s.append(lt); continue;
case '>': s.append(gt); conti... |
41734907-73a5-4de8-9e2b-5ddb06fe40bf | 2 | private void menuItemVisiblityPropertiesActionPerformed(ActionEvent pEvent) {
final TableViewAdapter modelAdapter = (TableViewAdapter) getModel();
TableViewColumn[] columns = modelAdapter.getModel().getColumns();
if (mDialogVisiblity == null) {
initDialogVisiblity();
}
... |
db7f0174-f77f-4bc4-a1d5-5efaa6947038 | 7 | @SuppressWarnings("serial")
private void initialize() {
frameRemembra = new JFrame("Remembra");
frameRemembra.setResizable(false);
frameRemembra.setFont(new Font("WhitneyBook", Font.PLAIN, 12));
frameRemembra.setForeground(new Color(0, 0, 0));
frameRemembra.setTitle("Remembra V0.4");
//Creates the Time ... |
e0a60026-73ef-4fe0-8088-96e8ddfdd2c9 | 5 | public void insert(Node newNode)
{
if(items == 0)
{
root = newNode;
items++;
}else
{
if(root.frequency > newNode.frequency)
{
root.prev = newNode;
newNode.next = root;
root = newNode;
root.prev = null;
}else
{
Node temp = root;
while( temp.next != null && temp.next.fre... |
caab46f8-ca3c-4c58-a933-dbb6523d2216 | 2 | public int getLevelForXP(int exp) {
int points = 0;
int output = 0;
for (int lvl = 1; lvl <= 135; lvl++) {
points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
output = (int)Math.floor(points / 4);
if (output >= exp)
return lvl;
}
return 0;
} |
ed137387-0573-4836-a20a-08d1b7ad55ec | 1 | void send(ConduitMessage msg) {
Client[] clients;
synchronized (mClients) {
clients = mClients.toArray(new Client[0]);
}
synchronized (mSendLock) {
for (Client element : clients) {
element.send(msg);
}
}
} |
6f334046-6633-4fb4-b61d-441f163fb591 | 8 | @Override
public List<Edge<N>> edgesTo(N... toList) {
LinkedList<Edge<N>> list = new LinkedList<Edge<N>>();
if(toList.length == 1) {
N to = toList[0];
if(containsNode(to)) {
for(N node : getNodes()) {
if(!node.equals(to)) {
List<Edge<N>> edgesFrom = edgesFrom(node);
for(Edge<N> edge : ed... |
b53bb7c3-2f0f-4cbf-8e4e-99ed9118971b | 8 | public Direction getDirection(int spot) {
if (spot >= 0 && spot <= 9) {
return Direction.EAST;
}
if (spot >= 10 && spot <= 19) {
return Direction.SOUTH;
}
if (spot >= 20 && spot <= 29) {
return Direction.WEST;
}
if (spot >= 30 && spot <= 39) {
return Direction.NORTH;
}
return null;
} |
72c30e6d-a4b0-41d9-a301-2f9ebcbc07dd | 8 | @Override
public int[] getInts(int par1, int par2, int par3, int par4)
{
int i1 = par1 - 1;
int j1 = par2 - 1;
int k1 = par3 + 2;
int l1 = par4 + 2;
int[] aint = this.parent.getInts(i1, j1, k1, l1);
int[] aint1 = IntCache.getIntCache(par3 * par4);
for (in... |
7ded841b-bfaf-48c4-b6ec-cd9355bf4c47 | 3 | public void setLeft(PExp node)
{
if(this._left_ != null)
{
this._left_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
5180d379-fd15-4bd9-b552-0557a7b6dd54 | 6 | public void actionPressed(KeyEvent e)
{
int keyCode = e.getKeyCode();
PlayerCommand pc = null;
if (keyCode == KeyEvent.VK_RIGHT)
{
pc = new PlayerCommand(PlayerCommand.PRESS_RIGHT);
}
if (keyCode == KeyEvent.VK_LEFT)
{
pc = new PlayerCommand(PlayerCommand.PRESS_LEFT);
}
... |
89fe0fbe-bbe5-420d-8bed-5330a41a2731 | 8 | final void method2507(boolean bool) {
((Class284) ((Class318_Sub7) this).aClass284_6444).anInt3670
= ((Class129) ((Class318_Sub7) this).aClass129_6436).anInt1890;
anInt6448++;
((Class284) ((Class318_Sub7) this).aClass284_6444).anInt3666
= ((Class129) ((Class318_Sub7) this).aClass129_6436).anInt1889;
((Cla... |
c76c6de9-e6c3-4207-a8df-07abddafcb56 | 4 | private Object readResolve() throws ObjectStreamException
{
Map m = null;
try
{
m = new Map(width, height);
}
catch (SpriteException e)
{
e.printStackTrace();
}
m.links = links;
m.squares = squares;
for (int i = 0; i < m.squares.length; i++)
{
for (int h = 0; h < m.squares[1].length; h... |
2b31768a-ddd0-4408-894c-74644c4d6aa8 | 0 | public void setId(String value) {
this.id = value;
} |
5697aabd-7190-49ac-941c-ed828214a725 | 7 | private Stack<Symbol> parseNextBooleanSymbol(String inputExpression, int index, Stack<Symbol> parseTree) {
char symbol = inputExpression.charAt(index);
if (Character.isLetterOrDigit(symbol)) {
parseTree = insertString(inputExpression, index, parseTree);
}
else if (symbol == '... |
721e51de-0a10-459e-af5e-ff25543817bf | 3 | public static void main(String[] args) {
ExecutorService executor = Executors.newCachedThreadPool();
Task task = new Task();
Future<Integer> result = executor.submit(task);
executor.shutdown();
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
... |
a59b01c1-6f91-430b-8998-dd5e8b633956 | 9 | public void run(){
String mapKeyIdentifier=DFSMain.currentNode.getNodeID()+"-"+mess.line_index+"-"+mess.file+"-"+mess.operation+"A";
String mapKeyIdentifierCheckOut=DFSMain.currentNode.getNodeID()+"-"+mess.line_index+"-"+mess.file+"-"+mess.operation+"B";
String mapKeyIdentifierReadLockRelease=DFSMain.curren... |
53a0331b-ddbc-4112-be82-e38012463be8 | 8 | public boolean run(CommandSender csender, String[] preArgs, String cmd)
{
sender = csender;
usedCommand = cmd;
// Sort out arguments
args.clear();
args.addAll(Arrays.asList(preArgs));
// Check arg lengths
if (minArgs > -1 && args.size() < minArgs || maxArgs > ... |
e1afe3a2-2e31-4621-8036-1ac57f37511d | 9 | public Elevator CallUp(int fromFloor){
// System.out.println("just added " + fromFloor);
//check for error cases such as rider on top floor calling up
if ((fromFloor>super.numFloors) || (fromFloor<0)){
System.out.println("This floor does not exist");
}
//first we will send the first idle elevator
for (Ele... |
3813add6-14ab-4c3a-8b8f-732b039f30b7 | 3 | public void setSettings(String x1, String x2, String x3) {
if (x1.length() == 9) { // 1130-1700 --> 9 karakters
this.x1Start = x1.split("-")[0];
this.x1End = x1.split("-")[1];
}
if (x2.length() == 9) {
this.x2Start = x2.split("-")[0];
this.x2End =... |
549e9d27-46a3-4040-9446-cbd6bd65fc99 | 0 | public TMState createInnerTM(Point point, Serializable auto, String name, int i) {
TMState ntms = new TMState(i, point, this);
TuringMachine innerTM = (TuringMachine) auto;
addState(ntms);
ntms.setInnerTM(innerTM);
ntms.setInternalName(name);
return ntms;
} |
c0ea59a3-922b-4997-b4a7-de74cf7f9825 | 6 | @Override
public void populate(World world, Random random, Chunk source) {
if (random.nextInt(100) < CHANCE_OF_CHEST) {
ChunkSnapshot snapshot = source.getChunkSnapshot();
int x = 1 + random.nextInt(14);
int z = 1 + random.nextInt(14);
int y = snapshot.getHighestBlockYAt(x, z);
Block block = source.g... |
2fd78563-fe32-4fff-93fb-0e85ad6e6589 | 9 | private boolean r_t_plural() {
int among_var;
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
// (, line 160
// setlimit, line 161
v_1 = limit - cursor;
// tomark, line 161
if (cursor < I_p1) {
return false;
}
cursor = I_p1;
v_2 = limit_backward;
limit_backward = cursor;
curso... |
8ca4fbf4-2812-423f-bd6c-d477d8411ca7 | 4 | private boolean isInbounds(int x, int y) {
if (x < 0 || y < 0)
return false;
if (x >= numCols || y >= numRows)
return false;
return true;
} |
2ec91285-34e4-4aa5-9c50-7c94da456f70 | 9 | @Override
public void actionPerformed(ActionEvent e) {
if (OPEN_COMMAND.equals(e.getActionCommand())) {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int selectedOption = fc.showDialog(main, "Open File or Directory");
if (selectedOption == JFileChooser... |
b7b01277-9987-4f7e-8bce-a35d2e23524c | 0 | public int getSide()
{
return side;
} |
70e71b4c-7dbb-4fc5-92d7-28fa5dd84324 | 8 | @SuppressWarnings("rawtypes")
public boolean connect(String portName) {
CommPortIdentifier portId = null;
Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
// First, Find an instance of serial port as set in PORT_NAMES.
while (portEnum.hasMoreElements()) {
CommPortIdentifier currPortId = (Com... |
91fa8453-9a76-451d-83a4-359ba12b5a34 | 6 | public void setStartSpace(){
start = new StartSpace();
MansionArea leftMid = grid[grid.length/2][0];
MansionArea topMid = grid[0][grid[0].length/2];
MansionArea rightMid = grid[grid.length/2][grid[0].length-1];
MansionArea botMid = grid[grid.length-1][grid[0].length/2];
if(getId()==1){
start.setLinks(nu... |
8f5242bd-8696-4419-9b0a-75367e1e1bc0 | 2 | public boolean equals(final Object obj) {
return (obj != null) && (obj instanceof LocalVariable)
&& (((LocalVariable) obj).index == index);
} |
5a267e1a-923a-42bd-b5c8-4f77f4d402ec | 2 | private Connection getJdbcMydbsource() throws NamingException {
Context c = new InitialContext();
try {
return ((DataSource) c.lookup("jdbc/Mydbsource")).getConnection();
} catch (NamingException ex) {
ex.printStackTrace();
} catch (SQLException ex) {
... |
f9a40504-edf5-4e43-948a-1334f80bcfac | 8 | private void loadAlreadyDownload(String metaFilePath){
File metaFile = new File(metaFilePath);
// init empty meta file if not exist
if(!metaFile.exists()){
try {
if(!metaFile.createNewFile()){
System.out.println("Failed to create meta file " + me... |
41091c82-f3fd-438e-9ac5-bd7d6f4f801b | 3 | @Override
public String getColumnName(int c) {
String result;
switch (c) {
case 0:
result = "Section name";
break;
case 1:
result = "Section id";
break;
case 2:
result = "Words amount"... |
636561b5-ed2e-42ce-87a9-bd8785b47d2f | 8 | public void stop()
{
connected = false;
shutdown=true;
try { if(input!=null) input.close();}catch(final Exception e){}
try { if(connection!=null) connection.close();}catch(final Exception e){}
if(save_thread!=null)
{
CMLib.threads().deleteTick(save_thread, -1);
save_thread=null;
}
try { save(); }... |
82b36fd9-1e57-4f86-84f3-6fcf5c8a7c5f | 3 | public ArrayList<Cliente> buscarCliente(String tipo, String condicion){
Cliente clienteBuscado=null;
ArrayList<Cliente> clientes = new ArrayList<Cliente>();
try {
Statement comando=connection.createStatement();
//System.out.println("select * from Cliente where "+tipo+" lik... |
6f1776a5-1aeb-4a9b-8f71-121a60028ddb | 4 | private void activateButtons() {
if (maandPercentage != null && startKapitaal != null && aantalMaanden != 0) {
converter.setEnabled(true);
if (mensualiteit != null) {
create.setEnabled(true);
}
}
} |
16af376f-2136-4adf-8d07-494b5f30b9f3 | 9 | private double trainOnInstance(BackpropInstance instance){
NeuralLayerI inputLayer = _layers[0];
for(int i = 0; i < instance._features.length; i++){
inputLayer.getNodes()[i].setOutput(instance._features[i]);
}
for(int i = 1; i < _layers.length ; i++){
NeuralLayerI curLayer = _layers[i];
NeuralNode[]... |
11c49307-c950-401d-b2dc-53ed5b730ffb | 8 | public ScrabbleGame(Container contentPane)
{
// Create a canvas!
super();
// Load fonts
if (!FontLoader.isMainFontSet()) FontLoader.setMainFont("FontBoard.ttf", 18);
if (!FontLoader.isSecondaryFontSet()) FontLoader.setSecondaryFont("FontMessage.ttf", 13);
// Set fon... |
cf07beef-d89e-47f9-b5f0-7f0a84efec31 | 5 | public void run(){
long lastTime = System.nanoTime();
double nsPerUpdate = 1000000000D / 60D;
int updates = 0;
int frames = 0;
long lastTimer = System.currentTimeMillis();
double unprocessed = 0;
while (!Display.isCloseRequested()) {
long now = System.nanoTime();
unprocessed += (now - lastTime... |
d64e84f7-4b98-40a2-b9b0-0ddbec9e5ed4 | 2 | public void toggleQ4()
{
if (Q4Associated.equals(true))
{
pumpStatusQuicImage.updateImage("src/com/anakena/freePcaInterlock/Q4InactiveQUIC.png");
pumpStatusPanel.updateValue("X");
pumpStatusPanel.suplimate();
Q4Associated = false;
}
else if (Q4Associated.equals(false))
{
pumpStatusQuicImage.up... |
0d223ae4-eb21-4a61-8e63-830e1fcad871 | 8 | public int clearRows() {
boolean[] clear = new boolean[NUM_ROWS];
int count = 0;
for (int i=NUM_ROWS-1; i>2; i--) {
clear[i] = false;
count = 0;
while (count < 10) {
if (!dead[i][count])
break;
count++;
}
if (count == 10)
clear[i] = true;
}
int score = 0;
int to... |
f458e4ef-e7ba-4104-9333-5d6dddbda9c0 | 2 | public static ArrayList<Merchant> getAll(){
SQLiteJDBC db = new SQLiteJDBC();
ArrayList<Merchant> merchants = new ArrayList<Merchant>();
String sql = "SELECT reg_num FROM merchants";
ResultSet resultSet = db.query(sql);
try {
whi... |
002dee6f-972c-4381-8ff0-ec9f6a037922 | 5 | public synchronized void dispose()
{
if (!closed)
{
LOG.info("Shutting down the plugin handler and all registered plugins.");
Iterator<PluginWrapper> iterator = plugins.iterator();
while (iterator.hasNext())
{
PluginWrapper pluginWrapper = iterator.next();
try
... |
669c80b0-cb5d-4e34-aea6-6623113a6463 | 0 | public Double getFitness(){
setFitness();
return fitness;
} |
846f4c26-f8e8-486b-abd4-1b64ed714fae | 3 | public RomanSymbol toRoman(int arabic) {
if (arabic == 0) {
return new RomanSymbol(0,"0");
}
StringBuilder sb = new StringBuilder();
int number = arabic;
for (RomanSymbol symbol : SYMBOLS) {
while (number >= symbol.getValue()) {
sb.append(... |
06960138-edaa-4195-af5e-dd97ed143d87 | 9 | public void processFiles(List<File> files) {
final ExecutorService executor = Executors.newFixedThreadPool(NTHREADS);
for(File file : files){
IDocument<String, String> document = config.getDocumentBuilder().createDocument(file.getAbsolutePath());
final ArrayList<Future<IDocument<String,String>>> futures = new... |
1b82b582-94f2-47bb-8e03-9bfc752d096b | 0 | public Long getId() {
return id;
} |
48e09a22-1149-4e85-b4f8-4c5edc530832 | 8 | public String getFormattedNameSort() {
if (first_name == null) {
return "";
}
if (middle_name == null) {
return "";
}
if (last_name == null) {
return "";
}
if (last_name.isEmpty()) {
return "";
}
Stri... |
94791523-f621-4fdb-b24d-9d6db87615ea | 6 | final void method2567(int i, String string, byte i_17_, int i_18_,
int i_19_, int i_20_, RasterToolkit[] class105s,
int[] is) {
try {
anInt4056++;
if (i_17_ > 114 && string != null) {
method2579(i_19_, -78, i_18_);
method2583(0, i, 0, class105s, null, string, is, 25625, i_20_);
}
} catch ... |
8ef83c35-c265-4517-af34-4436ad4aacad | 8 | private List<SmsHistory> parseHistoryResult(String text) throws Exception {
List<SmsHistory> result = new ArrayList<SmsHistory>();
NodeList nodes = parse(text, "Table");
for (int i = 0; i < nodes.getLength(); i++) {
SmsHistory history = new SmsHistory();
NodeList childNodes = ((Element) nodes.it... |
a34383c6-fcea-474a-af53-7d5a0d6090d0 | 3 | private String readFromServer() throws IOException {
String reply="";
try {
do{
reply = inFromServer.readLine();
if (reply.startsWith("+OK") | reply.startsWith("-ERR") | reply.equals(".") | Character.isDigit(reply.charAt(0))) {// ignores mail content
System.out.println("<<POP3 Client got from " + u... |
251bf7b0-0786-468c-90be-22f584d954ec | 3 | public static boolean isBadVector(Vector vec) {
return vec == null || vec.isNaN() || vec.isInfinite() || vec.lengthSq() == 0;
} |
37779db2-fb3b-4fa2-a072-0583a5f21bfc | 1 | public void render(Graphics g){
// change the hover state
if(cong.mRegion.intersects(this.getBounds())){
state = 2;
}
else{
state = 1;
}
// render the appropriate image
g.drawImage(ss.grabImage(itemIndex, state, Menu.ITEMWIDTH, Men... |
208f9701-84d3-4920-be52-cc13a4311d83 | 3 | private static Vector<Class<?>> getLoadedClasses() throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
// get a list of all our classes
//Logger.debug("Getting classes...");
Field f = ClassLoader.class.getDeclaredField("classes");
//Logger.debug("Type: %s", f.getTy... |
ac5a0017-6c7d-4b9f-b987-747d2bdbebad | 8 | private String discardEscapeChar(String input) throws ParseException {
// Create char array to hold unescaped char sequence
char[] output = new char[input.length()];
// The length of the output can be less than the input
// due to discarded escape chars. This variable holds
// the actual length of ... |
d76ab6f2-b23f-4b51-96cf-5145fa658b8e | 6 | public void actionPerformed(ActionEvent event) {
Object source = event.getSource();
if (source == singlePlayerButton) {
frame.playSinglePlayer(false);
} else if (source == twoPlayerButton) {
frame.playTwoPlayer();
} else if (source == loadGameButton) {
frame.playSinglePlayer(true);
} else if (sour... |
5cfe5223-8bf1-4e79-885c-da860e658a93 | 9 | public static Map<String,Map> _search(String domain, String where, String sort, int limit) {
LinkedHashMap<String, Map> result = null;
try {
validateDomain(domain);
String select = "select * from " + domain;
if(where!=null && !"".equals(where))
select ... |
6e27770e-3a6f-4d19-84dd-0d8905570c89 | 6 | private void cmdERROR(final ArrayList<String> args) {
int errorCode = 0;
if (args.size() == 1) {
try {
errorCode = Integer.parseInt(args.get(0));
} catch (NumberFormatException e) {
sendError(util.Protocol.ERR_INVALID_COMMAND);
}
} else {
sendError(util.Protocol.ERR_INVALID_COMMAND);
}
if... |
9d155add-c7a9-4bf3-ac03-f2c4581b84c5 | 4 | public void dumpSource(TabbedPrintWriter writer) throws IOException {
if (isDeprecated) {
writer.println("/**");
writer.println(" * @deprecated");
writer.println(" */");
}
if (isSynthetic)
writer.print("/*synthetic*/ ");
int modifiedModifiers = modifiers;
/*
* JLS-1.0, section 9.3:
*
* E... |
daa88656-f247-481e-8859-157aa307ba1b | 1 | void actionDeleteCurrent() {
int row = table.getSelectedRow();
if (row > -1) {
commands.remove(row);
tableModel.removeRow(row);
}
delete.setEnabled(false);
} |
5e5017d5-2c35-4427-8f88-897a4413bf13 | 3 | public IrodsCollection asCollection() throws IrodsException {
if (exists()) {
if (irodsFile.isDirectory()) {
return (this instanceof JargonCollection) ? (IrodsCollection) this : new JargonCollection(conn, irodsFile);
} else {
throw new IrodsException("irod... |
cfbe92be-2277-49e3-bb97-1e52a1e010b4 | 3 | @Override
public boolean isSavingNotRequired() {
// return true;
try {
Path p = Paths.get(getTrackFileName());
if ( ! (Files.isRegularFile(p) && Files.size(p) > 0))
return false;
return (fixTag(Main.forceTagging)==null);
} catch (IOException e) {
Main.log(Level.WARNING,null,e);
}
retur... |
4e26ceb0-904d-4dc1-9f74-614fa6461001 | 7 | @Override
public void insertUpdate(DocumentEvent arg0) {
try{
if(Integer.parseInt(textRow.getText()) < 1){
JOptionPane.showMessageDialog(this, "Rows need to be higher than 0!");
textRow.setText("10");
}
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(this, "All Fields need to be... |
01b4559a-a152-4448-9e60-c7787a7ac7b7 | 4 | @Override
public void handleDFSInit() {
// rst $28
dfs.addJumpTable(0x191, 5);
dfs.addJumpTable(0x37a, 54, "GameStateTable");
dfs.addJumpTable(0x6500, 8);
dfs.addJumpTable(0x6510, 8);
dfs.addJumpTable(0x6520, 4);
dfs.addJumpTable(0x6528, 4);
dfs.addFunction(0x0, "Unused_rst00");
dfs.addRawBytes(0x3... |
5f2d0930-3ce8-4cab-9e73-532e08fbfb4d | 2 | public ByteBuffer read(int offset, int length)
throws IllegalArgumentException, IllegalStateException, IOException {
if (!this.valid) {
throw new IllegalStateException("Attempting to read an " +
"known-to-be invalid piece!");
}
if (offset + length > this.length) {
throw new IllegalArgumentException(... |
ba8c0971-2b8b-4427-9dc3-bf8705b613ae | 1 | public static double[] getVecOfCol( double[][] mat, int j )
{
int m = mat.length;
double[] res = new double[m];
for ( int i = 0; i < m; ++i )
res[i] = mat[i][j];
return(res);
} |
bbc53886-5711-4bb3-b0a3-be87b2593a2e | 2 | private void updateReceiver() {
for (WorldCoordinate recv : getPairs()) {
SignalReceiver receiver = getReceiverAt(recv);
if (receiver != null) {
receiver.onControllerAspectChange(this, aspect);
}
}
} |
2632e073-c125-4ca1-be2b-53cc3422e252 | 5 | public Complex effectiveSampleNumber_as_Complex() {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weightingOptionI) {
Stat.weightingOptionS = true;
} else {
Stat.weightingOptionS = false;
}
}
Complex nEff = Complex.zero();
switch (type) {
case 1:
case 12:
case 14:
... |
5ccaca21-0b36-4a2f-9744-eab3b13b7fc5 | 6 | private ScmIcon(String name, String propStr) {
this.name = name;
ApplicationManager manager = ApplicationManager.manager;
String[] props = Csv.decode(propStr);
setX(Integer.parseInt(props[0]));
setY(Integer.parseInt(props[1]));
String seek = name + ".";
for (Enumeration e = manager.properties.keys(); e.... |
08e074a1-485a-47b6-8f18-7fb0a9eb3e3e | 7 | @Override
synchronized void flush(Map<InvertedDocConsumerPerThread,Collection<InvertedDocConsumerPerField>> threadsAndFields, final SegmentWriteState state) throws IOException {
Map<TermsHashConsumerPerThread,Collection<TermsHashConsumerPerField>> childThreadsAndFields = new HashMap<TermsHashConsumerPerThread,Col... |
02e35e57-919b-4156-9972-1193801d8917 | 6 | public void showRecvMessage(String sender, String msg, boolean whisper_recv){
try {
String newText;
String[] tokens = msg.split("\002");
if(whisper_recv){
newText = "\n" + "( FROM "+ sender+ " )" + " :";// + msg;
}
else{
... |
8195e64e-18c6-4e96-9cec-f3ab351700b5 | 3 | public JSONObject accumulate(String key, Object value)
throws JSONException {
testValidity(value);
Object o = opt(key);
if (o == null) {
put(key, value instanceof JSONArray ?
new JSONArray().put(value) :
value);
} else if (o... |
8bdd90fd-8677-4398-a6a9-4cb2a3d96311 | 2 | public synchronized void add(Integer key, UserFollowers value) {
if (!hashMap.containsKey(key)) {
hashMap.put(key, value);
dequeue.addFirst(key);
capacity -= value.size();
while (capacity < 0) {
capacity += hashMap.remove(dequeue.removeLast()).size();
}
}
} |
b40b92b3-b54a-4a5e-a1e3-ebabe5830c97 | 3 | public double getCash(double amount) throws Exception {
try {
if (amount > checkBalance(currentCard))
throw new NotEnoughMoneyInAccount();
if (amount > moneyInATM)
throw new NotEnoughMoneyInATM();
currentCard.getAccount().withdraw(amount);
moneyInATM -= amount;
} catch (NotEnoughMoneyInAccount |... |
977ce1b9-edd6-44d9-ae8c-40c197e6052e | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
24dc1dfb-9391-4e31-b596-99f1ae157cac | 2 | public synchronized void close()
{
AudioDevice out = audio;
if (out!=null)
{
closed = true;
audio = null;
// this may fail, so ensure object state is set up before
// calling this method.
out.close();
lastPosition = out.getPosition();
try
{
bitstream.close();
}
catch (Bitst... |
b5134c29-201a-42a7-bb99-d22c0a6645fa | 7 | Point updatePosition(Point now, double ox, double oy, int rat) {
double nx = now.x + ox, ny = now.y + oy;
int id_rat = rat;
// hit the left fence
if (nx < 0) {
// System.err.println("RAT HITS THE LEFT FENCE!!!");
// move the point to the left fence
Point temp = new Point(0, now.y);
// how much we ha... |
ed11ae61-92a7-4b3b-8e90-c5450dd51eda | 3 | public void updateMatchRecord() {
if (id != null) {
PreparedStatement st = null;
try {
conn = dbconn.getConnection();
String q = "UPDATE match_record_2013 SET " +
"team_id = ?, match_number = ?, color = ?, " +
... |
875c728c-710b-4a8d-95c4-7df30e1be4c4 | 0 | protected void interrupted() {
end();
} |
f54d1fa4-5aea-483e-a8d1-a73f0983bf18 | 4 | public void updateTick()
/* We assume that this method is called every animPeriod ms */
{
if (!ticksIgnored) {
// update total animation time, modulo the animation sequence
// duration
animTotalTime = (animTotalTime + animPeriod)
% (long) (1000 * seqDuration);
// calculate current displayable imag... |
deafabab-5d0f-4a35-ae99-5be0e0b8c54d | 8 | @Override
public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, Set<MOB> followers)
{
if((mob!=null)
&&(mob!=killed)
&&(!mob.amDead())
&&((!mob.isMonster())||(!CMLib.flags().isVegetable(mob)))
&&((mob.getVictim()==killed)
||(followers.contains(mob))
||(mob==killer)))
return true;
re... |
6af6e533-c723-4898-a43c-4a4b6ca5256c | 2 | private Request makeRequest(Verb verb, String resourceURL, Map<String, String> parameters, String payload)
{
OAuthRequest request = new OAuthRequest(verb, resourceURL);
for (Entry<String, String> entry : parameters.entrySet())
{
request.addBodyParameter(entry.getKey(), entry.getValue());
}
if (payload != ... |
ce0f61c2-de28-4e8a-8a0d-ce9798ecb5cb | 6 | public void applyDead() {
c.getTradeAndDuel().stakedItems.clear();
c.respawnTimer = 15;
c.isDead = false;
if(c.duelStatus != 6) {
//c.killerId = c.getCombat().getKillerId(c.playerId);
c.killerId = findKiller();
Client o = (Client) Server.playerHandler.players[c.killerId];
if(o != null) {
if ... |
35b764c6-9ac7-4a46-8b88-b51179e1d01b | 5 | private Object[] remapEntries(int n, Object[] entries) {
for (int i = 0; i < n; i++) {
if (entries[i] instanceof String) {
Object[] newEntries = new Object[n];
if (i > 0) {
System.arraycopy(entries, 0, newEntries, 0, i);
}
... |
ebae9303-2c49-4113-b499-d0464004da43 | 7 | private void updateGui() {
if (reading) {
addFilesButton.setEnabled(false);
readFilesButton.setEnabled(false);
removeSelectedButton.setEnabled(false);
okButton.setEnabled(false);
cancelButton.setEnabled(false);
cancelReadButton.setEnabled(t... |
f5a91eb5-eccc-433e-a65d-87c71ea2fa6d | 0 | @Override
public void startSetup(Attributes atts) {
setTitle(atts.getValue(A_TITLE));
} |
4a5e1ff9-700c-4464-b2db-a7e1e2c63a96 | 7 | public static void parseGCPrint(String logLink, JvmUsage jvmUsage) {
Document mapLogs = HtmlFetcher.getHtml(logLink);
Element syslogPre = mapLogs.getElementsByTag("pre").first();
String syslog[] = syslogPre.text().split("\\n");
if(syslog.length == 0)
return;
if(!syslog[0].contains("[GC") &... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.