method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6e1b0abc-d883-4be0-a78e-71c9cf296325 | 2 | private void ShowQuizChoice()
{
JPanel qcPanel = new JPanel();
qcPanel.setSize(600, 600);
qcPanel.setLayout(null);
TimeLbl.setVisible(false);
qnumLbl.setVisible(false);
NextBtn.setVisible(false);
PrevBtn.setVisible(false);
Quiz[] availableQuiz... |
de144aa1-6665-44e3-8b99-a562413de645 | 8 | public SubmitJob(String[] args) throws ParseException {
CommandLineParser parser = new PosixParser();
CommandLine commandLine = parser.parse(getOptions(), args);
if(commandLine.hasOption("loop")) {
numIterations_ = Integer.parseInt(commandLine.getOptionValue("loop"));
} else {
numIterations... |
8ec4287f-9e36-4067-a6e9-97e142ae1eb2 | 4 | public void setWorkSpace(WorkSpace workSpace)
{
if (workSpace == null
|| ! (workSpace instanceof CommandPanelWorkSpace) ||
( (CommandPanelWorkSpace) workSpace).getLoginTable() == null ||
( (CommandPanelWorkSpace) workSpace).getLoginTable().size() ==
0)
{
... |
e91c3c61-e6c2-4f34-9e79-d1d9b9241e54 | 3 | public void warAddtoPlayer1(int s, ArrayList p1, ArrayList p2)
{
//Adds card to the player 1 pile
for(int i=0; i<s; i++)
{
if(i<p1.size())
{
Object obj1 = p1.get(0);
Card c1 = (Card)obj1;
player1.addCard(0,c1);
}
if(i... |
54c0f3cf-ad93-4a1c-a162-16872ab635d3 | 1 | public boolean getRedoEnabled() {
return this instanceof UndoInterface && redoEnabled;
} |
d25cef8f-07af-4520-a494-c12024edae16 | 8 | private void listagemProf() {
final Main m = new Main();
JLabel NomeCom = new JLabel("Professores:", JLabel.CENTER);
String[] v5 = new String[m.professores.size() + 1];
v5[0] = " ";
for (int i = 1; i < m.professores.size() + 1; i++) {
v5[i] = m.professores.get(i - 1)... |
b0921461-2967-40d8-9c17-71535fccbf06 | 9 | public void keyPressed(KeyEvent e)
{
int key = e.getKeyCode();
if(key >= 48 && key <= 57) newMass = (key - 48)*100;
else if(key == KeyEvent.VK_Z)
{
game.GUI.offsetX += game.getWidth()*.05 + game.GUI.offsetX*.1;
game.GUI.offsetY += game.getHeight()*.05 + game.GUI.offsetY*.1;
game.GUI.scale *= 1.1;
}
... |
e66d0c97-f155-4f99-bd07-0b4771905a84 | 5 | public void keyPressed(KeyEvent e)
{
if (e.getKeyChar() == 'w')
{
keyPressedW = true;
move = true;
}
if (e.getKeyChar() == 's')
{
keyPressedS = true;
move = true;
}
if (e.getKeyChar() == 'a')
{
keyPressedA = true;
move = true;
}
if (e.getKeyChar() == 'd')
{
keyPressedD = true... |
a065fed5-6ad2-4659-976b-84b2e19c1e53 | 7 | public boolean update(double[] data, boolean classifier) {
double sum = 0;
//create a new data vector to encompass all data points plus classifier
double[] vector = new double[data.length+1];
double norm = 1;
for (int i = 0; i < data.length; i++) {
vector[i] = data[i];
norm += data[i]*data[i];
}
... |
7f9bb482-df5a-40f9-b9d6-e41514d18c54 | 7 | public void drawMe(Graphics2D g) {
if (!general)
drawPercentComparisonLines(g);
int J = 0;
for (Rectangle2D.Float bar : bars) {
if (general) {
if (minMaxHisto.x == J || minMaxHisto.y == J)
g.setColor(COLOR_HISTOGRAM_BAR_THIS);
else
g.setColor(COLOR_HISTOGRAM_BAR);
} else {
g.setColo... |
7a9f3a00-b1dc-42d0-a364-d6123ae1d1bd | 3 | public void removeLocallyDeclareable(Set set) {
if (type == FOR && initInstr instanceof StoreInstruction) {
StoreInstruction storeOp = (StoreInstruction) initInstr;
if (storeOp.getLValue() instanceof LocalStoreOperator) {
LocalInfo local = ((LocalStoreOperator) storeOp.getLValue())
.getLocalInfo();
... |
50065b03-502d-4610-9d02-afc76e3b1f9c | 3 | public short tileToShort(Tile t)
{
short res = 0;
if (t.tileNum != -1)
res |= (short) ((t.tileNum + tileOffset) & 0x3FF);
res |= (short) ((t.hflip ? 1 : 0) << 10);
res |= (short) ((t.vflip ? 1 : 0) << 11);
res |= (short) (((t.palNum + paletteOffset) & 0x00F) << 1... |
94b04edc-9079-439e-a568-c7d4d9b6c93d | 0 | private MessageBox getMessageBox() {
return (MessageBox) root.getScene().getWindow();
} |
d7ded9d9-cdb4-42e7-a7c9-cac71d1b0864 | 8 | private boolean combinedStringArrays(TupleDesc td1, TupleDesc td2, TupleDesc combined) {
for (int i = 0; i < td1.numFields(); i++) {
if (!(((td1.getFieldName(i) == null) && (combined.getFieldName(i) == null)) ||
td1.getFieldName(i).equals(combined.getFieldName(i)))) {
... |
5cc2b904-8643-4dba-9e57-e53fdcc26131 | 5 | protected void checkTypeOfOperands (List<Expression> operands)
{
List<Class<?>> expectedOperandTypes = getOperandTypes();
if (expectedOperandTypes == null) return;
boolean statusCheck = true;
for (int i = 0; i < operands.size(); i++)
{
statusCheck =
... |
2cb9d342-7f8c-4efe-978d-1d9a1463f068 | 8 | private boolean verifyChapPassword(String plaintext)
throws RadiusException {
if (plaintext == null || plaintext.length() == 0)
throw new IllegalArgumentException("plaintext must not be empty");
if (chapChallenge == null || chapChallenge.length != 16)
throw new RadiusException("CHAP challenge must be 16 byt... |
a8fd7286-be61-4dc6-81ee-3d4315e7e9bd | 6 | public LinkedList<Vertex> createPlan(int start, int stop, int color, boolean intekrock) {
LinkedList<Vertex> path;
Graph graph = new Graph(nodes, edges);
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(graph, ds);
// Compute shortest path
dijkstra.execute(nodes.get(start - 1))... |
6307f219-d759-4d9e-9d21-f2c640120f95 | 3 | @Override
public boolean register(Game g, Rack r) {
super.register(g, r);
if (g.rack_size != 5)
return false;
for (Model m: ensemble){
if (!m.register(g, r))
return false;
}
return true;
} |
95c27422-7ff2-4524-9c78-75368220cf09 | 0 | public JTextField getjTextFieldNumRapport() {
return jTextFieldNumRapport;
} |
3e93957e-7e3e-4db4-b4e2-9e60d1fe9a10 | 4 | public void delReservation(int resid){
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
80740e79-d386-496c-9fdf-adeb18cdb3c3 | 3 | public static Float getMasterOutputVolume() {
Line line = getMasterOutputLine();
if (line == null) return null;
boolean opened = open(line);
try {
FloatControl control = getVolumeControl(line);
if (control == null) return null;
return control.getValue();
} finally {
if (opened) line.close();
}
... |
ade13f2b-5cf2-439c-bdf7-cafaec534d99 | 1 | public Configuration[] getInitialConfigurations(String input) {
State init = myAutomaton.getInitialState();
State[] closure = ClosureTaker.getClosure(init, myAutomaton);
Configuration[] configs = new Configuration[closure.length];
for (int k = 0; k < closure.length; k++) {
configs[k] = new FSAConfiguration(c... |
2ecf4b8e-a699-4073-928d-0062f83739be | 0 | public Cartoon() {
System.out.println("Cartoon constructor");
} |
6b8295a3-cdd0-4b4b-8e10-c0b7879bc993 | 5 | @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 Clientes)) {
return false;
}
Clientes other = (Clientes) object;
if ((this.id == null && other.id != null) || (... |
18bb9098-3a74-40b8-95b5-06ee0ff739c9 | 8 | @Override
public void getInput() {
int selection = -1;
boolean isValid = false;
do {
this.displayMenu();
Scanner input = SnakeWithPartner.getInFile();
do {
try {
selection = input.nextInt();
isValid ... |
c2db5da2-10ca-41b1-9139-d900cc895c2e | 7 | public int getCalled0Raised1OrFolded(MOB player)
{
if(!pot.contains(player))
return -1;
final Double inPot=(Double)pot.elementAt(pot.indexOf(player),2);
int numHigherThanPlayer=0;
int numEqualToPlayer=0;
for(int p=0;p<pot.size();p++)
if(pot.elementAt(p,1)!=player)
{
final Double potAmount=(Doubl... |
eb3edc31-50fa-4f0e-8f3c-5d894e855347 | 6 | public static String[][] run(String train, String test) {
int k = 3;
// read the train file
//String inputtrainf="IrisTrain.csv";
//String inputtestf="IrisTest.csv";
String inputtrainf=train;
String inputtestf=test;
ArrayList<String> trainList = getFile(inputtrain... |
2722dd89-aa8e-4ac5-97bd-4ea852b91574 | 8 | private static void insertRecordIntoDbUserTable(ArrayList<String> xmlList) throws SQLException {
// generates rows in table, each with file name and one keyword
Connection dbConnection = null;
PreparedStatement statement = null;
try {
dbConnection = getDBConnection();
statement = dbConnection.prepa... |
f0a39f69-56e5-4590-acb7-b48530f3c0bc | 1 | private static URL __getWsdlLocation() {
if (BOOKSERVICESOAPSERVICEIMPLSERVICE_EXCEPTION!= null) {
throw BOOKSERVICESOAPSERVICEIMPLSERVICE_EXCEPTION;
}
return BOOKSERVICESOAPSERVICEIMPLSERVICE_WSDL_LOCATION;
} |
d31876a9-9cd9-4368-8763-35330eef9b4f | 6 | @Override
public void takeTurn(GameBoard currentBoard) {
boolean inputInvalid = true;
Scanner sc = Main.Scan;
String invalidRowInputMessage = this.Name
+ ", that input is invalid.\n Please select a row by entering its number.";
String rowPrompt = currentBoard.toString() + "\n\n" + Name
+ ", select a r... |
8868bc36-651f-46b4-8e03-4c0c1fb1d752 | 5 | public static void find(HousePetList hpArray)
{
HousePet housepet = new HousePet();
int aChipID = 0;
@SuppressWarnings("resource")
Scanner console = new Scanner(System.in);
String consoleOutMsg = "";
boolean containsHousePet = true;
System.out.println... |
f668a070-facf-4692-9025-629312b81260 | 5 | public void onQuery(Player player, ReplicatedPermissionsContainer query)
{
if (query != null)
{
if (!this.playerModInfo.containsKey(player.getName()))
{
this.plugin.getLogger().warning("Received query from unregistered player " + player.getName());
this.playerModInfo.put(player.getName(), new Hashtab... |
de2def87-1897-4160-9336-2b2113ea4a6e | 2 | public int executeCommits(ArrayList<String> c){
Statement s;
for (int i = 0; i < c.size(); i++) {
try {
s = StatusController.connection.createStatement();
s.executeUpdate(c.get(i));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return -1;
}
}
r... |
03102dc6-a257-4d46-b7dc-84e6bd0489f5 | 2 | public static String join(String[] lines, String glue) {
if (lines.length == 1) {
return lines[0];
}
StringBuilder out = new StringBuilder();
for (int i = 0; i < lines.length - 1; i++) {
out.append(lines[i]).append(glue);
}
out.append(lines[lines.l... |
f29eb916-36b3-4ba5-a497-9e549eb381ae | 4 | private double calculateClosestBruteForce(Point[] sortedByX) {
double minDistance = Double.MAX_VALUE;
for (int i = 0; i < sortedByX.length; i++) {
for (int j = 1; j < sortedByX.length; j++) {
//we don't want to calculate distance between the same point
if (i !... |
b7bc167f-aa42-4adb-85c6-8329c9d49534 | 7 | public void onMessage(JSONObject msg, Callback cb) {
// TODO call the callback obj in case of callback. If not send call the
// method!
String methodName = msg.optString("method", null);
JSONObject data = msg.optJSONObject("data");
if (methodName == null) {
System.err... |
df7c7285-3abb-4339-a52d-87ccde026659 | 5 | private boolean BookFieldCheck(String booklistString){
boolean isbn = false;
boolean bookdate = false;
Scanner analysisbooklist = new Scanner(booklistString);
while (analysisbooklist.hasNext()){
String getstring = analysisbooklist.next();
if(this.BooklistISBNCheck(getstring)){
isbn = true;
}
els... |
18432422-5101-4473-8039-d6d70f3c735d | 1 | private int evaluateValueofBoardForBlack(Board board) {
int bValue = 0;
if (board.isBlackWinner()) {
bValue -= POINT_WON;
return bValue;
} else {
bValue = WhiteBlackPiecesDifferencePoints(board);
// bValue += BoardPositionPoints(board);
... |
4858df2d-e215-4b5d-b2cd-9c3523b50c6d | 6 | public static void main(String[] arg) {
String input = arg[0];
String output = (arg.length > 1 ? arg[1] : null);
InputStream in = null;
try {
in = new FileInputStream(input);
} catch (Exception e) {
System.out.println(e);
}
State foo = new... |
c7ffe9d6-456d-4646-aea8-09ff367f841a | 9 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[] cardCounts = new int[N];
for (int i = 0; i < N; i++)
cardCounts[i] = in.nextInt();
long straights = 0L;
LinkedList<ArrayList<Integer>> bounds = new LinkedList<ArrayList<Integer>>();
bounds.add(... |
0d8c4da1-507b-40b0-8cca-987992a965c1 | 8 | public static void Build(int n, String filename) throws FileNotFoundException{
// generate Board
int [][] Board = new int[n][n];
boolean[] numberUsed = new boolean[n*n]; // each index needs to appear on board. the value at that array position is true if on board, false if not
for (int i=0; i<n*n; i++){
numb... |
dc32881e-e83e-4b67-9bb7-c5812d2a10e8 | 9 | private boolean outputResults(String zOutputFile, Vector vResults)
{
try
{
// create the output stream
BufferedWriter outWriter = new BufferedWriter(new FileWriter(zOutputFile));
// go through each point in the grid and diagram the path
// Use X for obstacle squares o for clear squares that aren't ... |
7fe525f1-984c-4399-a837-63b9bb026f4d | 7 | @Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (super.equals(o)) {
return true;
}
orgataxe.entity.Model model = (orgataxe.entity... |
ce33edb1-86dc-43ac-a641-b1880a0a5668 | 7 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 0) {
Messenger.sendMessage("NicksRequest written by codermason v1.0", sender);
Messenger.sendMessage("Use /nicks help for help!", sender);
}else{
if(args[0].equalsIgnoreCase("help")) {
n... |
a2576270-28cb-4085-9482-15d9b37c0d3f | 9 | public String getOutputKeyword() {
Dialog currentDialog = DialogManager.giveDialogManager().getCurrentDialog();
switch ((Start)getCurrentState()) {
case S_ENTRY:
setQuestion(false);
return "<" + currentDialog.getCurrentSession().getCurrentRobot().getRobotData().getRobotName() + ">";
case S_EXIT:
setQue... |
e655367f-d5cb-4782-bc44-e9663c3f3a13 | 2 | public void destroy(Long id) throws NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Usuario usuario;
try {
usuario = em.getReference(Usuario.class, id);
usuar... |
6bbc7ace-bd17-4f64-bf0e-3edc3209f73c | 5 | public static void setup(ExtendedEntityType mob, ValueChance<Ability> abilityChances, List<Object> optList)
{
Iterator<Object> it = optList.iterator();
while (it.hasNext())
{
Map<String, Object> optMap = MiscUtil.getConfigMap(it.next());
if (optMap == null)
continue;
int chance = MiscUtil... |
10aa174b-ba18-4d6d-ae78-24120ab8a0ad | 0 | @Override
public String toString() {
return type;
} |
9a1a98c2-7c96-4a23-837e-832743e18b58 | 0 | private boolean isValidInput(final String s) {
return s.matches("[0-9]{1,}");
} |
21b228f6-f033-4c4f-8e1b-6310be363705 | 2 | public double getMaxTime (){
double maxTime = 0;
for(int i = 0; i<time.length; i++){
if(time[i]>maxTime)
maxTime = time[i];
}
return maxTime;
} |
f3f1a18a-78c0-405c-8e47-d1cd6e73fae2 | 4 | public int getPrevIncompleteIndex(int row, int col)
{
boolean notFound = true ;
int len = translations.size() ;
int t = row ;
int back = -1 ;
while ( (t >= 0) && notFound)
{
TMultiLanguageEntry dummy = (TMultiLanguageEntry) translations.get(t) ;
String str = dummy.getTransl... |
1c02ad45-0aa4-418f-95b6-4ac673ac07b0 | 1 | public boolean logUser(User usertemp){
if(userList.indexOf(usertemp) == -1)
return false;
else{
user = usertemp;
return true;
}
} |
e1dd04fb-b866-425a-bede-5a1bd636728b | 7 | public static void led_branch(String num, String filepath, String sn, Scanner scanner){
String line="", result = "";
int item=0;
System.out.println("Please choose the LED light you want to test: 1=white led, 2=rgb led, 0=return:");
line=scanner.nextLine();
while (!(line.equals("0"))){
while ((!(line.equ... |
d9bd9bbb-6439-4175-b3eb-4748a752821f | 6 | @Override
public String toString() {
Field[] fields = this.getClass().getDeclaredFields();
StringBuilder sb = new StringBuilder();
sb.append('[');
for (Field f : fields) {
if (Modifier.isStatic(f.getModifiers())
|| Modifier.isFinal(f.getModifiers()))
continue;
Object value = null;
try {
f... |
b50c5d52-141f-4de4-8960-952c148e716e | 8 | @Override
public void run() {
while (alive){
//We keep consuming jobs while they are available
IJob job = null;
synchronized (jobQueue){
if (jobs.size() > 0)
job = jobs.remove(0);
else
alive = false;
}
//Make sure not to hog the synchronization of the queue when we don't ... |
a385a199-5c96-48e3-8570-e7656e49bfa3 | 8 | private void addAttack(int x, int y, int minRange, int maxRange)
{
int nX, nY;
for(int i = -maxRange; i <= maxRange; i++) {
for(int j = Math.abs(i) - maxRange; j <= maxRange - Math.abs(i); j++) {
nX = x + i;
nY = y + j;
if(nX >= 0 && nX < G... |
bfdbd58a-c9e7-4367-937c-37e8e4db5eb1 | 4 | public MapPanel(Map map, Game game) {
this.game = game;
// Scrolling movement timer
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
if (mapImage_Scaled != null && viewPort != null
&& mouseInsidePanel) {
moveIfInBounds(checkIfInBounds(mousePoint));
}
}
}, 1000, 25);
//... |
d8a2c582-b417-4034-82fe-f7a429161031 | 9 | private void quickSort(int left, int right) {
int l = left; // index of left-to-right scan
int r = right; // index of right-to-left scan
if (right - left >= 1)
{
int pivot = table[left];
while (r > l)
{
while (table[l] <= pivot && l <= right && r > l)
l++; // element greater than the pivot... |
302c5048-8fb7-4ac2-acc9-13457fc4ad67 | 1 | @Test
public void WhenUpdatingUnknownHost_ExpectNothing()
throws UnknownHostException {
int level = localhost_.getHostPath().length();
RoutingTable table = new RoutingTable();
table.setLocalhost(localhost_);
Assert.assertTrue(table.uniqueHostsNumber() == 0);
Hos... |
e30c3258-c7d1-4f83-b887-039839f0cab4 | 1 | public String logUpload(String appKey, String userKey, String testId, String fileName, String dataType) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
testId = URLEncoder.encode(testId, "UTF-8");
fileName = URLE... |
e5113da0-a394-4855-a263-544fb27e9f41 | 2 | private void checkArithmeticExpression() throws Exception {
List<Token> expression = new ArrayList<Token>();
while(iterator < tokenList.size() && isValidArithmeticElement(tokenList.get(iterator))) {
expression.add(tokenList.get(iterator));
iterator++;
}
ShuntingYard shuntingYard = new ShuntingYard(exp... |
0ee99b64-ac5b-4c37-b0d7-143cbe567577 | 6 | public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
if (command == null) { // This is a "CANTHAPPEN" since the TLD defines it as required
throw new JspException("CommandOutputTag: command attribute is required");
}
Process p = Runtime.getRuntime().exec(comman... |
15693238-c4cd-4dfc-8e67-8935a8145a2e | 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... |
7c5e0769-c055-4657-b489-dce6727a7d0a | 2 | private boolean isInSomeUSet(Integer s) {
for (AcceptingPair pair : acceptanceCondition) {
if (pair.U.contains(s)) {
return true;
}
}
return false;
} |
e46cac9b-35c9-4e42-8528-c337b429eb85 | 0 | public static Animation bulletAnimationRight(){
Animation anim = new Animation();
anim.addFrame(getMirrorImage(loadImage("bullet1.png")), 50);
anim.addFrame(getMirrorImage(loadImage("bullet2.png")), 50);
anim.addFrame(getMirrorImage(loadImage("bullet3.png")), 50);
... |
381e4188-9670-48b3-9050-537687adeeaf | 3 | public void visitIfZeroStmt(final IfZeroStmt stmt) {
if (CodeGenerator.DEBUG) {
System.out.println("code for " + stmt);
}
final Block t = stmt.trueTarget();
final Block f = stmt.falseTarget();
if (f == next) {
// Fall through to the false branch.
genIfZeroStmt(stmt);
} else if (t == next) {
//... |
57bb38c2-cc60-4d16-9d7b-6135088b23e5 | 4 | public static void main(String[] args){
Set<Integer> tri = new HashSet<Integer>();
for(int i=1;i<1000;i++){
tri.add(i*(i+1)/2);
}
Scanner in = new Scanner(System.in);
int count=0;
while(in.hasNext()){
String s = in.next();
String[] prewords = s.split(",");
for(String w : prewords){
if(isTri(... |
0ac80d65-27ff-4ecd-a79e-a8afc2de9919 | 4 | public void deleteVertex(String id) {
increaseAccess();
Node node = nodeMap.get(id);
if (node != null) {
for(Map.Entry<String, Edge> entrySet : this.edgeMap.entrySet()) {
Edge edge = entrySet.getValue();
/**
*/
if ((edge.getNode1().equals(node))
|| (edge.getNode2().equals(node)... |
bc90935e-6d0a-42a4-b165-597895e7884d | 9 | private int buildJump(int xo, int maxLength)
{
int js = random.nextInt(4) + 2;
int jl = random.nextInt(2) + 2;
int length = js * 2 + jl;
boolean hasStairs = random.nextInt(3) == 0;
int floor = height - 1 - random.nextInt(4);
for (int x = xo; x < xo + length; x++)
... |
890d5fff-4750-4438-907e-383e14ecd116 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Main other = (Main) obj;
if (city == null) {
if (other.city != null)
return false;
} else if (!city.equals(other.city))
return false;... |
c2f2dbc1-2e17-40e4-8aa1-c55691e57dfb | 8 | public boolean isLegalMoveTwo(int pieceNumber){
if (board[pieceNumber].getPieceType()==1 || board[pieceNumber].getPieceType()==2){
if (board[pieceNumber].getX()==(BOARDSIZE-board[pieceNumber].getLength()+1))
return false;
}
else{
if (board[pieceNumber].getY()==(BOARDSIZE-board[pieceNumber].get... |
1846cdb5-80cc-49c9-ab0d-6282192c8787 | 8 | public static boolean moveOneBoxToClosestGoalGreedyBFS(Vector<State> inOutStatesVector, int pBoxIndex){
//Set the comparator for this serach:
oneBoxMoveComp.setBoxToClosestGoal(pBoxIndex);
//Create a search queue;
PriorityQueue<State> open = new PriorityQueue<State>(100, oneBoxMoveComp);
//"Local" HashS... |
25e12bce-15cd-4bb0-b8ed-ce37d6e97a30 | 6 | public static boolean setFechaDeLlegada(Paquete paquete)
{
Document doc;
Long identificadorPaquete;
Element root,child;
List <Element> rootChildrens;
boolean found = false;
int pos = 0;
SAXBuilder builder = ne... |
336abd2b-f370-4735-a2d6-b1828226929a | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... |
e2e5f9af-71d3-49a3-8435-a162a236abf6 | 2 | private void unflashol() {
for (int i = 0; i < visol.length; i++) {
if ((olflash & (1 << i)) != 0)
visol[i]--;
}
olflash = 0;
olftimer = 0;
} |
dde641a7-21e9-4031-a888-849a781101da | 5 | @Override
public Administratie load() throws IOException {
if (!isCorrectlyConfigured()) {
throw new RuntimeException("Serialization mediator isn't initialized correctly.");
}
ObjectInputStream in = null;
FileInputStream stream = null;
Administratie admin... |
976eb311-898b-4cdc-9e38-9d7f2fdca9ef | 6 | public static void computeBoundingRect(ArrayList<Point> points) {
double minX = points.get(0).getX();
double maxX = minX;
double minY = points.get(0).getY();
double maxY = minY;
for (Point p:points) {
if (p.getX() < minX) minX = p.getX();
... |
5cfa1d15-210a-4cff-8f37-bc91c374f90d | 7 | public ArrayList<HashMap<String, String>> read(File file) {
ArrayList<HashMap<String, String>> addressList = new ArrayList<>();
ICsvMapReader mapReader = null;
try {
mapReader = new CsvMapReader(new FileReader(file), CsvPreference.TAB_PREFERENCE);
// the header columns a... |
cbd413b9-1c5d-48ee-9676-9c4417243189 | 8 | public String tryJoinClub(int cid, int uid) {
// if that guy already existed in the club's member list
for (int existedMember : this.userDao.clubMembersUid(cid)) {
if (uid == existedMember)
return "member";
}
// if that guy already sent out an join_club_apply
for (Object obj : this.userDao.clubJoinAppl... |
a83e20b8-0b52-4fec-9ccc-296a9e784d8f | 4 | public void newGame() {
money = 1000;
name = JOptionPane.showInputDialog(this, "Please enter your name:");
if (name == null) {
return;
}
File savegame = new File(PATH + name + ".csg");
if (savegame.exists()) {
Object[] options = { "Yes", "No" };
int option = JOptionPane.showOptionDialog(this,
... |
2cf60c94-87f2-4420-9bc7-3ba1f48401f7 | 0 | public String getToolTip() {
return "Deleter";
} |
25e02804-82d1-419a-aa49-a27a97902ae7 | 8 | public void requireSanity(State s) {
boolean sane = true;
if (s.players().length != players.length) {
System.err.println("inconsistent belief: number of players changed");
sane = false;
}
if (!s.deck.containsAll(known_deck_cards)) {
CardBag surplus = known_deck_cards.clone();
surplus.removeAll... |
357ac70f-3901-4f47-9737-441bd7f40246 | 5 | public static String readTextFromJar(String s) {
InputStream is = null;
BufferedReader br = null;
String line;
String list="";
try {
is = misc.class.getResourceAsStream(s);
br = new BufferedReader(new InputStreamReader(is));
while (null != (line = br... |
8cc62e78-e50d-4d02-a4d6-829b53759633 | 6 | public static void startupJavaTranslate() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
... |
acce6456-d781-4b0d-b018-9f56d48a8761 | 0 | @Override
public String toString() {
return rank + " of " + suit;
} |
64cefa71-1a49-496f-b6c6-ed5977f895ff | 3 | public static List<String> getStrings(Language path, Object... args) {
// Gets the messages for the path submitted
List list = language.getList(path.getPath());
List<String> message = new ArrayList<String>();
if (list == null) {
Logging.warning("Missing language for: " + pat... |
395922c4-43fc-48a1-b02e-b6f07953ad42 | 8 | public static void updateDescriptors(ArrayList<PathDescriptor> currentDescriptors, ArrayList<PathDescriptor> newDescriptors) {
System.out.println("Before Update");
System.out.println(currentDescriptors.toString());
int currentSize = currentDescriptors.size();
for (int i = 0; i < currentS... |
3594f0c0-d5dd-4b6a-bf64-e9b96cdba3e4 | 8 | private static byte lengthOfMonth(byte month, int year) {
if (month == 4 || month == 6 || month == 9 || month == 11)
return 30;
if (month == 2)
if (year%4 == 0 && (year%100 != 0 || year%400 == 0))
return 29;
else return 28;
return 31;
} |
63b3b2db-d612-478d-9e3e-9e2c7f01eb57 | 2 | public String question(String request) {
// TODO priority vs timer (all async)
for (Brain brain : brains) {
String response = brain.question(request);
if (null != response)
return response;
}
return null;
} |
5a5f27f1-9c47-49c1-9de2-512c9930e310 | 2 | public String getAuthor(SQLconnection connection,int id)
{
String query="select author from dblpauthor where paperid="+id;
ResultSet authorSet=connection.Query(query);
String author="";
try {
while(authorSet.next())
{
author+=authorSet.getString("author")+",";
}
authorSet.close();
} catch (SQ... |
4048d3af-f14c-4904-9489-20dabdd70b81 | 8 | public void input() {
float moveAmt = (float) (10 * Time.getDelta());
float rotAmt = (float) (100 * Time.getDelta());
if (Input.getKey(Input.KEY_W))
move(getForward(), moveAmt);
if (Input.getKey(Input.KEY_S))
move(getForward(), -moveAmt);
if (Input.getKey... |
99c1770a-b14f-479b-b803-b00251920d5e | 0 | @Override
public String toString() {
return "[filePath=" + filePath + ", fieldLineIndex=" + fieldLineIndex
+ ", skipLines=" + skipLines + ", dataTypeLineIndex="
+ dataTypeLineIndex + ", ignoreColumnIndex="
+ Arrays.toString(ignoreColumnIndex) + "]";
} |
1cf3f0a6-c83c-4c51-80c2-eb39866c2ed0 | 9 | void checkin() {
if (!Modeler.directMW)
return;
StringBuffer sb = new StringBuffer();
String os = System.getProperty("os.name") + " " + System.getProperty("os.version");
String user = ModelerUtilities.getUnicode(System.getProperty("user.name"));
try {
sb.append("os=" + URLEncoder.encode(os, "UTF-8"));... |
3431e633-2fde-4a4f-ad34-a5e0ee342e5d | 5 | public boolean not_left_value(String val,int size){
if(in_function == 1)
{
if(func_array_var.containsKey(val)){
array_info temp = func_array_var.get(val);
if(temp.dim != size-1)
return true;
}
}
else {
... |
66740520-52db-48dc-94a5-966944692fa6 | 3 | public static void toggleEditableForSingleNode(Node node, CompoundUndoable undoable) {
int oldValue = node.getEditableState();
int newValue = Node.EDITABLE_INHERITED;
boolean isEditable = node.isEditable();
if (oldValue == Node.EDITABLE_FALSE) {
node.setEditableState(Node.EDITABLE_TRUE);
newValue = Nod... |
c316481b-81ad-4195-8480-fd7afcedd635 | 8 | static final public void facteur() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VRAI:
case FAUX:
case entier:
case ident:
case 54:
primaire();
break;
case NON:
case SUBNEG:
opNeg();
primaire();
expression.testNeg();
exp... |
7c8082e6-e29c-45b0-8950-71729868b1c4 | 3 | private void rmBus (Object busname)
{
USB bus = (USB) busses.get (busname);
if (trace)
System.err.println ("rmBus " + bus);
for (int i = 0; i < listeners.size (); i++) {
USBListener listener;
listener = (USBListener) listeners.elementAt (i);
try { listener.busRemoved (bus); }
catch (Exceptio... |
2e968b3e-fb7a-4484-9438-88049ad5145b | 7 | public void thinkAndPlay() throws BadBoardException, BadMoveException, BadPartialMoveException {
System.out.println("computer is thinking...");
if (myGame.getCurrentPlayer( ) != myColor) {
throw new BadBoardException("AI can't move now, it's not AI's turn!");
}
if ( ! myGame.... |
1bd8f583-7b09-4261-b901-95431badc152 | 5 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (this.isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting t... |
a36daef3-4e51-4e24-b3b7-f3e617ddcc1b | 3 | public Personnage selectionPersonnage()
{
JFileChooser fc = new JFileChooser("./src/jars/sauvegarde");
int returnVal = fc.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
if(file.getName().contains(".data")... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.