method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ea03bc44-5c1f-4879-96ef-03736833c6ec | 8 | @Override
public void setMiscText(String newMiscText)
{
onlyRoomDomains.clear();
neverRoomDomains.clear();
skills.clear();
super.setMiscText(newMiscText);
this.message=CMParms.getParmStr(newMiscText, "MESSAGE", "You can't do that here.");
String domains=CMParms.getParmStr(newMiscText, "ONLYROOMS", "");
... |
1e66d97a-fcfd-43e0-a870-a714698526aa | 6 | public void actionPerformed( ActionEvent e )
{
Object sender = e.getSource() ;
if ( sender == saveButton)
{
if ( fileDialog.showSaveDialog(null) == JFileChooser.APPROVE_OPTION)
{
TGlobal.config.saveToFile(fileDialog.getSelectedFile());
}
}
else if (sender == loadButton)
... |
d5486de0-24f7-4ed8-872d-d42e71fc48a8 | 6 | private void fineAdd(FineNode<T> curr, T t) {
if (curr != root) {
if (curr.getParent() != root) {
curr.getParent().getParent().unlock();
}
curr.lock();
}
try {
switch (t.compareTo(curr.getValue())) {
case -1:
fineInternalAddLeft(curr, t);
break;
case 1:
fineInternalAddRight(curr,... |
3aaef767-bd27-4596-a034-f92a231ffac3 | 8 | public static void main(String[] args) {
Params.readConf();
Params.printConf();
Rule r = new Rule(Params.rule, Params.radius);
boolean[][][] e = { getRandomTestCase(r), getTestCase(r), getTestCase2(r) };
GeneticAlgorithmKernel kernel = new GeneticAlgorithmKernel(Params.populationCount, e);
double bestF... |
db879e91-8600-4e83-b0a5-6eca87325239 | 7 | 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 server with glorious data
task = plugin.getServer().getScheduler()
... |
2692ead7-107e-4bc1-afdf-ac63d619088b | 1 | private void compute_pcm_samples0(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
float pcm_sample;
final float[] dp = d16[i];
pcm_sample = (float)(((vp[0 + dvp] * d... |
6b856990-9a9c-4c09-833a-638c9f6e78ff | 3 | void createChildWidgets () {
/* Add common controls */
super.createChildWidgets ();
/* Add TableEditors */
comboEditor = new TableEditor (table);
nameEditor = new TableEditor (table);
table.addMouseListener(new MouseAdapter() {
public void mouseDown(MouseEvent e) {
resetEditors ();
index = tab... |
5983fc50-a007-4db0-90db-d8e828073847 | 0 | public void setItemId(int itemId) {
this.itemId = itemId;
} |
28646931-5c08-4ff3-ba20-b8b68f30cb4f | 2 | public void setShutdownButtonBorderthickness(int[] border) {
if ((border == null) || (border.length != 4)) {
this.buttonShutdown_Borderthickness = UIBorderthicknessInits.SHD_BTN.getBorderthickness();
} else {
this.buttonShutdown_Borderthickness = border;
}
someth... |
9b30edab-ac5d-4541-9018-15e15f274d03 | 8 | public void dealClueCards() {
Random hazard = new Random();
int playerIndex = 0;
Card someCard;
dealDeck.addAll(deck);
// create solution set
while (true) {
someCard = dealDeck.get(hazard.nextInt(dealDeck.size()));
if (someCard.type == CardType.PERSON){
dealDeck.remove(someCard);
solution.a... |
c3f229df-588b-4890-bd13-7b84353cd7ee | 9 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
diccionario = new TreeMap<Integer, ArrayList<char[]>>();
for (int c = 0, C = parseInt(in.readLine().trim()); c < C; c++) {
String str = in... |
9262bed2-48ec-419a-ac82-22a544fb1813 | 7 | private WriteResponseList processRecordDeletesInBatchMode(BaseRef[] refs, String methodName) {
ArrayList<WriteResponse> responses = new ArrayList<WriteResponse>();
BaseRef[] batch = new BaseRef[getDeleteRequestSize()];
for (int i=0; i<refs.length; i++) {
if (i != 0 && (i%getDeleteRequestSi... |
c5446e13-81c9-4c51-8f46-510764b53a8e | 9 | private boolean r_mark_suffix_with_optional_U_vowel() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 159
// or, line 161
lab0: do {
... |
0d2ecce0-edc2-4d89-b179-d813a8bb869f | 1 | public void upgrade() {
if(tier < 19) {
fuelCapacity += 20;
fuelLevel += 20;
tier++;
} else {
tier = 20;
fuelCapacity = 500;
fuelLevel = 480;
}
} |
4dc8b16e-4530-43b6-b8bc-459030753ed4 | 8 | public static int[] twoSum(int[] numbers, int target) {
int[] result = new int[2];
result[0] = -1;
result[1] = -1;
HashMap<Integer, Integer> table = new HashMap<Integer, Integer>();
int other = 0; //start from 1
for(int m=0;m<numbers.length;m++) {
Integer otherPart = table.get(target-numbers[m]);
i... |
ac63fa06-9741-4d2e-a07c-c107fa099b23 | 5 | @Override
protected void init() {
try {
// check to see if the user is using a File or InputStream. This is
// here for backwards compatability
if (dataSourceStream != null) {
final Reader r = new InputStreamReader(dataSourceStream);
setDat... |
0971f6c5-bd3f-485b-b15b-6a82c71e131d | 4 | private boolean handleMessage(SelectionKey key, SocketChannel socketChannel, ProtocolHeader protocolHeader) {
long numRead;
numRead = 0;
int offset = 1;
buffer[offset] = ByteBuffer.allocate(ProtocolUtils.getBodySize(protocolHeader));
numRead = readBuffer(key, offset);
i... |
7640543c-7906-43ff-8f95-b2b1a3d0f67e | 5 | public static int[] sort(int[] list){
if(list == null || list.length <= 0){
return list;
}
boolean changed;
do {
changed = false;
for(int i=1; i<list.length; i++){
if(list[i-1] > list[i]){
swap(list, i-1, i);
changed = true;
}
}
} while(changed);
return list;
} |
46742d28-17fd-4899-b0cb-83a76dedda49 | 0 | public String getCivilState() {
return CivilState;
} |
080c487e-524b-423b-b543-4661fd39aaeb | 4 | @Override
public int compareTo(DBUpdateTimestamp o) {
int t = this.year - o.year;
int u = this.month - o.month;
int v = this.day - o.day;
int w = this.count - o.count;
if (t != 0)
return t;
if (u != 0)
return u;
if (v != 0)
return v;
if (w != 0)
return w;
return 0;
} |
f6aeeed4-1d4a-46d9-9d80-c089ac934887 | 3 | public DistributionSkew(int rack_size, int max_card, double skew){
super(rack_size, max_card);
//Clamp skew value, so we can keep the error weights normalized between 0-1
if (skew > 1) skew = 1;
else if (skew < -1) skew = -1;
//Compute skew line
offset = skew > 0 ? skew : 0;
slope = -skew / (double) rack_... |
c86f3480-fb51-4fb3-9f6b-0f1c71d53e30 | 2 | @Override
public String getParameter(String name) {
String custom = (String)this.customParameters.get(name);
if (custom != null)
return custom;
try{
return super.getParameter(name);
}catch(Exception e){
this.customParameters.put(name, null);
}
return null;
} |
5ddfcc45-e859-4b77-971a-b7e0180323c3 | 0 | public static void main(String[] args) {
Sleeper sleepy = new Sleeper("Sleepy", 1500), grumpy = new Sleeper("Grumpy", 1500);
Joiner dopey = new Joiner("Dopey", sleepy), doc = new Joiner("Doc",grumpy);
grumpy.interrupt();
} |
f7c40aeb-b3a5-4205-8c0e-deee3846c43e | 2 | public boolean dateConcorde(DateTime d){
if(dateDepart.minusHours(4).isBefore(d) && dateDepart.plusHours(4).isAfter(d))
return true;
return false;
} |
01640f23-8e78-4e90-a500-ea51fb6f0a01 | 9 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
f145b3a1-54d8-4f7c-a13e-01edd0c4c60b | 9 | private int requestEngineMove() {
int move = Game.NULL_MOVE;
int ponder = Game.NULL_MOVE;
try {
if (client.isPondering()) {
client.send("stop");
while (client.isPondering())
client.receive();
}
... |
3544f696-8614-49b6-8b21-db303ea5b1a5 | 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... |
8c8bc368-4127-4977-8abc-d3052a447195 | 1 | private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
this.jPanel1.setVisible(false);
this.jPanel2.setVisible(false);
if (this.jPanel3.isVisible())
this.jPanel3.setVisible(false);
else
{
this.jPanel3.setVi... |
9b536ce9-27de-4042-94da-c7e41c03c071 | 3 | private void fxInitErrorHandler()
{
webEngine.getLoadWorker().exceptionProperty().addListener(
new ChangeListener<Throwable>() {
public void changed(
ObservableValue<? extends Throwable> o,
Throwable old,
final Throwable value
)
{
if( webEngine.getLoadWorker().getSta... |
39b28188-37f7-44fe-b9e3-d1eebbfed2bf | 3 | public static DataType getType(String type) {
if (type.equalsIgnoreCase("YAML")) {
return YAML_SHARED;
}
for (DataType dt : DataType.values()) {
if (dt.name().equalsIgnoreCase(type)) {
return dt;
}
}
return null;
} |
71c53beb-b446-460a-9f24-e422d79db5ee | 9 | public final WaiprParser.machine_return machine() throws RecognitionException {
WaiprParser.machine_return retval = new WaiprParser.machine_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token string_literal2=null;
Token ID3=null;
Token char_literal4=null;
Token char_literal6=null;
Pa... |
41050787-5ce9-48a6-b1da-e9994bca9eda | 5 | public void handleKeyPress(int value) {
System.out.println(this.name + ": Keyboard key " + value + " was pressed.");
switch(value) {
case MinuetoKeyboard.KEY_Q:
this.closing = true;
window.close();
break;
case MinuetoKeyboard.KEY_W:
window.setCursorVisible(true);
break;
case Mi... |
5eeee084-8ab2-4961-9bd6-4eca093770cd | 4 | public Server() {
try {
serverSocket = new ServerSocket(11111);
} catch (IOException ioe) {
System.out
.println("Not create server socket. WTF?.");
System.exit(-1);
}
while (ServerOn) {
try {
Socket cl... |
c853bd2f-b6bd-444a-ac25-2f42a4c2f676 | 5 | public void write( SelectionKey key ) throws IOException {
SocketChannel chan = (SocketChannel) key.channel();
TcpConnection tcp = getConnection(key);
ByteBuffer buf = null;
// find something to write
while( tcp.hasWrite() ){
buf = tcp.fetchWrite();
if( buf != null && buf.hasRemaining() ){
... |
160a0682-f9e6-4265-aa21-510869fb5d1c | 6 | private int decodeBlackCodeWord() {
int current;
int entry;
int bits;
int isT;
int code = -1;
int runLength = 0;
boolean isWhite = false;
while (!isWhite) {
current = nextLesserThan8Bits(4);
entry = initBlack[current];
// Get the 3 fields from the entry
isT = entry & 0x0001;
bits = (ent... |
d73da8d3-54ae-4e2c-bd0f-ac7ef5678ad8 | 7 | public void print(Byte[] jeu){
for (int i=0; i < 37; i++){
if (i==4 || i==9 || i==15 || i==22 || i==28 || i==33)
System.out.println();
System.out.print(jeu[i]);
}
System.out.println();
} |
16302016-a555-4bb1-9092-3f79ad4c0b4e | 6 | public void pathSumRec(TreeNode root, int sum, Stack<Integer> tmp) {
if(root == null) return;
if(root.left == null && root.right == null) {
if(root.val == sum){
res.add(new ArrayList(tmp));
}
}
if(root.left != null){
tmp.add(root.left.val);
pathSumRec(root.left, sum - root.val, tmp);
tmp.pop(... |
a27977fc-8e2e-4949-a9c1-c1521b6e192b | 6 | public int oppDir(int dir) {
switch (dir) {
case 0:
return 2;
case 1:
return 3;
case 2:
return 0;
case 3:
return 1;
case 4:
return 5;
case 5:
return 4;
default:
return -1;
}
} |
dcc8492a-478c-4565-b9ac-4d27fc94ddd0 | 8 | private final int appendPostings(final FormatPostingsTermsConsumer termsConsumer, SegmentMergeInfo[] smis, int n)
throws CorruptIndexException, IOException {
final FormatPostingsDocsConsumer docConsumer = termsConsumer.addTerm(smis[0].term.text);
int df = 0;
for (int i = 0; i < n; i++) {
Segm... |
a4be2a17-5b81-4ce9-9d78-aa5b102b0be7 | 2 | public void mezclarTodosLosNodos(){
Nodo<E> cambiandoNodoA = cabeza;
Nodo<E> cambiandoNodoB;
for (int i = 0; i < talla; i++){
int posicionAzar = (int )(1+(Math.random() * (talla-1))); //numeros [1 , talla-1]
cambiandoNodoB = cabeza;
while( posicionAza... |
498105ae-adb8-442f-91ac-03612d6d6556 | 9 | @Override
public synchronized void run() {
String msg;
try {
while(!Thread.currentThread().isInterrupted()){
while(!messageQueue.isEmpty()){
try{
msg = messageQueue.removeFirst();
if(msg.contains(" JOIN ") || msg.contains((" PART "))){
messageDisplay.output(msg);
}
... |
a943543d-6aa4-4ede-8b0e-b05a2dde6e84 | 6 | public String stripLineBackup(String navigationLine) {
String arrow = " <-+-- ";
String vertical = " | ";
String corner = " +-- ";
String navigationLine2 = navigationLine;
if (navigationLine2.contains(corner))
navigationLine2 = navigationLine2.replaceAll(" \... |
6de7fd07-4d7c-4aaa-99ad-c9f4ebe68615 | 2 | public void typeKeycode(int keyCode) {
if( keyMap.containsKey((char)keyCode) ){
ShiftIndex shi = keyMap.get((char)keyCode);
if(shi.shift){
keyType(shi.keyVal, KeyEvent.VK_SHIFT);
}else{
keyType(shi.keyVal);
}
} else {
keyType(keyCode);
}
} |
2da2d35f-8dca-4fe6-a2db-fbcf9072a525 | 0 | public static void start() {
Rooms.currentRoom = 1;
Rooms.ChangeRoom("", -1, true);
showRoomInfo(1);
} |
9fa46730-8cf9-4cd0-89e1-d5663f38c4de | 1 | public static void main(String[] args) {
Main mainContext = new Main();
try {
mainContext.loadFileActions();
mainContext.performFileActions();
mainContext.deobfuscateAndDecompile(args);
mainContext.downloadCache(args);
} catch(Exception exception) {
exception.printStackTrace();
}
Logger... |
eb55fb65-3eff-46ee-afc2-7d4341881e15 | 1 | public DefaultItem( DefaultUmlDiagram diagram, ItemKey<T> key ) {
this.diagram = diagram;
contextCapability = new DefaultItemContextCapability( diagram, this );
setCapability( CapabilityName.CONTEXT_MENU, contextCapability );
if( key == null ) {
key = createKey( diagram );
}
this.key = key;
} |
23979970-5dd2-4dce-b771-31ecbde8358a | 4 | public void mouseClicked(int button, int x, int y, int clickCount){
if(this.playButton.contains(x, y)){
PlayerData.resetPlayer();
PlayerData.setLevel(this.currentLevel + 1);
this.sbg.enterState(TowerDefense.GAMEPLAYSTATE);
}
else if (this.prevButton.contains(x, y)){
if (this.currentLevel == 0)
thi... |
0db95869-95d9-4999-88b0-7ea6594ac3cf | 5 | private Point pickBestMove(Point pointA, Point pointB) {
Point best = pointA;
Item itemA = _worldMemory.get(pointA).getKey();
Item itemB = _worldMemory.get(pointB).getKey();
if (greenEnergy <= pinkEnergy) {
if (itemB != null) {
best = itemA.greenGain * itemA.quantity > itemB.greenGain * itemB.quantity /*... |
6ee9af56-12c9-4769-a172-53aa73f097b0 | 6 | public int findPivot(int array[], int start, int end) {
int mid = (start+end)/2;
if(mid<end && array[mid] > array[mid+1])
return mid;
else if(mid>start && array[mid] < array[mid-1])
return mid-1;
else if(array[mid] < array[start])
return findPivot(array, start, mid-1);
else if(array[mid] > ar... |
fc493388-e908-47ca-a474-9b6b155fc72b | 7 | private void updateFromNonCachableResponse(HttpRequest currentRequest, HttpResponse currentResponse) {
//update from 304 NOT MODIFIED responses
CachedResponse cached = responseCache.get(currentRequest.getUri());
if (currentResponse.getStatus().code() == 304) {
long lastModified = det... |
87db7851-82e8-43a6-b1ea-90b3108b4e18 | 8 | public static String inferDialectName(String url) {
return match(url, name -> {
switch (name) {
case "h2":
return "h2";
case "hsqldb":
return "hsqldb";
case "sqlite":
return "sqlite";
case "mysql":
... |
d65c7f84-d3fa-4f97-8b24-6b931acde7ff | 8 | private void exportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportButtonActionPerformed
int colCnt = loanScheduleTable.getColumnCount();
int rowCnt = loanScheduleTable.getRowCount();
File csvFile = null;
File renCsvFile = null;
String newFileName =... |
4ed21c37-5191-4bb1-95cd-3c60fc67cc9a | 7 | void pack(Object i, Buffer opb){
InfoFloor1 info=(InfoFloor1)i;
int count=0;
int rangebits;
int maxposit=info.postlist[1];
int maxclass=-1;
/* save out partitions */
opb.write(info.partitions, 5); /* only 0 to 31 legal */
for(int j=0; j<info.partitions; j++){
opb.write(info.parti... |
666a1cd3-c92a-4e46-8660-6ab77ea1daaa | 3 | private static Method getMethod(Class<?> theClass, String methodName, Class<?>... params) {
try {
Method method = theClass.getDeclaredMethod(methodName, params);
method.setAccessible(true);
return method;
} catch (Exception exception) {
Log.error(exception);
return null;
}
} |
912bd8f5-bb53-4305-837c-d19548d61a4a | 9 | public AlarmPanel() {
setLayout(new FormLayout(new ColumnSpec[] {
FormFactory.RELATED_GAP_COLSPEC,
ColumnSpec.decode("left:max(221dlu;default)"),},
new RowSpec[] {
FormFactory.RELATED_GAP_ROWSPEC,
FormFactory.DEFAULT_ROWSPEC,
RowSpec.decode("4dlu:grow"),
FormFactory.DEFAULT_ROWSPEC,
Fo... |
9370da01-ac15-420d-b228-ee09a49c789e | 7 | public boolean[] getAction()
{
double[] inputs;// = new double[numberOfInputs];
// byte[][] scene = observation.getLevelSceneObservation(/*1*/);
// byte[][] enemies = observation.getEnemiesObservation(/*0*/);
inputs = new double[numberOfInputs];
int which = 0;
for (int ... |
dc4bf95b-814f-4067-bd73-59428c27665e | 9 | private Filter.FilterAction buildExtractionTreeForFollow(ExtractedNode node, Cmd cmd)
throws Exception
{
if (cmd.getType() != Cmd.CmdType.FOLLOW) {
throw new Exception("Expected FOLLOW command");
}
CmdArg link = cmd.getArg("FOLLOW");
CmdArg with = cmd.getArg("... |
1c366ebc-f810-4f3d-9367-1824228048c0 | 4 | public void mouseMoved(MouseEvent e) {
if (isInside(e.getX(), e.getY()) && !highlighted) {
highlight();
}
if (!isInside(e.getX(), e.getY()) && highlighted) {
deHighlight();
}
} |
bbc80fe7-00a0-4e10-ab0d-e0c0cd782b3f | 8 | public void keyReleased(int k) {
if(k == KeyEvent.VK_A) player.setLeft(false);
if(k == KeyEvent.VK_D) player.setRight(false);
if(k == KeyEvent.VK_UP) player.setUp(false);
if(k == KeyEvent.VK_DOWN) player.setDown(false);
if(k == KeyEvent.VK_SPACE) player.setJumping(false);
if(k == KeyEvent.VK_W) player.setGl... |
86751774-380d-4ef5-b4a8-fe74041d1956 | 4 | public void saveWorldInfo(WorldInfo var1) {
NBTTagCompound var2 = var1.getNBTTagCompound();
NBTTagCompound var3 = new NBTTagCompound();
var3.setTag("Data", var2);
try {
File var4 = new File(this.saveDirectory, "level.dat_new");
File var5 = new File(this.saveDirectory, "level.d... |
7964fdbb-2de1-438a-9dbd-7693432f0741 | 3 | public void setValue(String s) {
for (int i = 0; i < values.length; i++) {
if (values[i].equals(s) && values[i] != null) {
value = i;
break;
}
}
} |
55192a7f-56f3-4650-b7b1-f85daec90676 | 2 | double t(int N1[], int N2[], double weight[]) {
int R1 = 0, R2 = 0;
int k = N1.length;
for (int i = 0; i < k; i++) {
R1 += N1[i];
R2 += N2[i];
}
double t = 0;
for (int i = 0; i < N1.length; i++)
t += weight[i] * ((N1[i] * R2) - (N2[i] * R1));
return t;
} |
ea483c62-17ee-46fa-849a-e5a2b0f459d2 | 7 | public void initconfig() {
BufferedReader bin;
boolean foundcmd;
String[] str;
String cfile;
cfile = fileName;
mytotmsg = 0;
// determine self process id
mypid = Integer.parseInt(cfile.substring("Server".length(),cfile.indexOf(".")));
tr... |
c837c181-1a7e-4205-bc1c-46fd38b7177e | 7 | public static void parseJSONResponse(HttpsURLConnection conn, String json_response){
try {
if (conn.getResponseCode() == 200 && json_response.contains("transaction")) //http status 200
{
Gson gson = new Gson();
TransactionResponse transaction_response = gson.fromJson(json_response, TransactionRe... |
e9866236-7e5c-4c1a-8ddc-57afc83041c1 | 4 | public static <A, B, C, D, E> Equal<P5<A, B, C, D, E>> p5Equal(final Equal<A> ea, final Equal<B> eb,
final Equal<C> ec, final Equal<D> ed,
final Equal<E> ee) {
return equal(p1 -> p2 -> e... |
9cc55128-5988-4ed8-9fe9-0920d11f1050 | 4 | public ExtDecimal log10(int scale) {
// Not yet customized
if (compareTo(ZERO) < 0) {
throw new ArithmeticException("Logarithm of a negative number in a real context");
} else if (compareTo(ZERO) == 0) {
throw new ArithmeticException("Logarithm of 0");
} else if (... |
efbd55a8-4851-4c8f-9f7d-ec74118e3852 | 3 | public boolean jsFunction_waitStartMove(int timeout) {
deprecated();
int curr = 0; if(timeout == 0) timeout = 10000;
while(!JSBotUtils.isMoving())
{
if(curr > timeout)
return false;
Sleep(25);
curr += 25;
}
return true;
} |
57f40f53-cbee-468c-a0f6-d458d9cb9e43 | 0 | @Override
public void restoreTemporaryToCurrent() {
copyHashMap(cur,tmp);
} |
22bdf803-a8ec-4cad-bb9d-fbf6407b1b37 | 1 | @Override
public boolean equals(Object ob) {
if (ob.hashCode() == this.hashCode()) {
return true;
}
return false;
} |
a64206fc-fd8b-48fa-9d23-cd3ffdf14145 | 0 | public boolean isMaximized() {
return maximized;
} |
b7b57807-a506-4893-a8c8-d7793ef78671 | 8 | public SQLite(Logger log, String prefix, String directory, String filename) {
super(log,prefix,"[SQLite] ");
if (directory == null || directory.length() == 0)
throw new DatabaseException("Directory cannot be null or empty.");
if (filename == null || filename.length() == 0)
throw new DatabaseException("Fi... |
4749b20e-d926-43de-92ee-e9166811a135 | 5 | @Override
public void run() {
try {
while (running) {
Message m = messages.take();
String message = m.getMessage();
int command = Protocol.CheckMessage.registrerProtocolType(message);
switch (command) {
case 1:
... |
075adb2f-e37c-4143-968c-fde414c245b1 | 8 | private int detectPacket0(byte[] buffer, int i) {
// if (buffer.length <= i)
// return PACKET_MAYBE;
// if (buffer[i] != (byte)0xAA)
// return PACKET_NO;
if (buffer.length <= i+1)
return PACKET_MAYBE;
if (buffer[i+1] != (byte)0xAA)
return PACKET_NO;
if (buffer.length <= i+2)
return PACKET_MAYBE;
... |
732e29af-66b9-4601-ba71-afa5eed89c5c | 0 | public static void main(String[] args) {
new Ship();
new Ship("Varangian");
} |
680d054e-5dc5-44f5-b252-0bf8b252810a | 7 | private void VerEntradaSeleccionadaConsultaControloResultados() {
int linha = jTableConsultaEntradas.getSelectedRow();
int contaLinhas = 0;
String nomeTabela = "ENTRADA";
if (linha == -1) {
JOptionPane.showMessageDialog(jDialogConsultaEntradas, "Seleccione ... |
01a30665-ebea-4f7d-8a4a-c85b96b8f78d | 2 | public int size() {
if(packetList != null) {
return packetList.size();
} else {
if(singlePacket != null) {
return 1;
} else {
return 0;
}
}
} |
e7a26851-d347-4069-9e09-452edbcf5b88 | 2 | private void find(Map<String,PriorityQueue<String>> tickets, String cur,List<String> result){
while (tickets.containsKey(cur) && !tickets.get(cur).isEmpty()) {
find(tickets, tickets.get(cur).poll(), result);
}
result.add(0,cur);
return;
} |
9cc3f71c-1628-40a2-8d86-93c8527790d5 | 8 | public void setVolume(float volume) {
if (Debug.video) System.out.println("VideoPlayer -> setVolume called with " + volume);
if ((null != player) && (realizeComplete)) {
// Verify the input
if (80 < volume){
if (Debug.video) System.out.println("VideoPlayer -> setVolume -> vol over limit");
volume = 8... |
a663fe54-ec74-4f58-9adc-52919bb4ba04 | 7 | private static void qsort(MilkFarmer[] milkFarmers, int start, int end) {
if (start >= end) return;
int l = start;
int r = end;
int pivot = milkFarmers[(l + r) / 2].p;
while (l <= r) {
while (milkFarmers[l].p < pivot) l++;
while (milkFarmers[r].p > pivot) ... |
98efefe1-7ad1-4133-8698-0626494f46a4 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
Department d = (Department) obj;
if (hashCod... |
c0fa4f61-f7e2-4e0d-9959-7410e78ccd12 | 4 | public void kill()
{
try {
this.playerAcceptor.interrupt();
worldHandle.interrupt();
expander.interrupt();
SocialSecurity.close();
try
{
if (!playerList.isEmpty())
{
for (PlayerOnline ... |
69f430f1-ac88-4990-9b05-9b083e6398d6 | 6 | public final List<MonsterDropEntry> retrieveDrop(final int monsterId) {
if (drops.containsKey(monsterId)) {
return drops.get(monsterId);
}
final List<MonsterDropEntry> ret = new LinkedList<MonsterDropEntry>();
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = DatabaseConnection.getConnection... |
9b097800-6a5a-44cc-94e8-8621cef77f7a | 1 | public String getText(String key) {
String retVal = (String) textResources.get(key);
if (retVal == null) {
System.out.println("Invalid text resource key: " + key);
}
return retVal;
} |
a526e3ed-1189-4bb9-ac81-f0b562927dff | 1 | @Override
public void setVisible(boolean state) {
if (state) {
}
super.setVisible(state);
} |
e08bb136-c1d7-463b-8fed-d467e4ff795b | 7 | public void mouseClicked(MouseEvent me) {
int x, y;
Rectangle r = new Rectangle(0, 0, (int) (m_nPaddedNodeWidth * m_fScale), (int) (m_nNodeHeight * m_fScale));
x = me.getX();
y = me.getY();
for (int iNode = 0; iNode < m_BayesNet.getNrOfNodes(); iNode++) {
r.x = (int) (m_BayesNet.getPositionX(iNode)... |
3b643278-6963-4367-a08b-840a240754fb | 9 | public String simplifyPath(String path) {
if (path == null || path.length() < 2) {
return "/";
}
Stack<String> s = new Stack<String>();
for(String p: path.split("/")) {
if (p.length() == 0 || p.equals(".")) {
continue;
} else if (p.equa... |
dd9379a7-5de9-4c5f-bd37-e524ffeccaa8 | 3 | public void processGridletReturn(Sim_event ev)
{
Object obj = (Object) ev.get_data();
Gridlet gl = null;
int glID;
if (obj instanceof Gridlet)
{
gl = (Gridlet) obj;
glID = gl.getGridletID();
System.out.println("<<< " + super.get_name() +... |
0a916f64-1e3b-4d2b-90ed-fc0ca190efc5 | 6 | public void removeSpace(char[] arr, int length){
if(arr==null)
return;
int spaceCount=0;
for(int i=0; i<arr.length ;i++){
if(arr[i]==' '){
spaceCount++;
}
}
char newarr[]=new char[arr.length+(spaceCount*2)];
for(int i=arr.length-1; i>=0;i-- ){
int k=i+spaceCount*2;
if(arr[i]==' '... |
2b402f0e-c23c-4bb0-a1f7-55ac896228d3 | 5 | final void method2670(int i) {
anInt4222++;
if (archiveLoaders != null) {
for (int i_0_ = 0; ((archiveLoaders.length ^ 0xffffffff) < (i_0_ ^ 0xffffffff)); i_0_++) {
if (archiveLoaders[i_0_] != null)
archiveLoaders[i_0_].method2342(0);
}
for (int i_1_ = i; i_1_ < archiveLoaders.length; i_1_++) {... |
eadd1b8c-56a4-4cc0-be6e-92d03279182b | 7 | @Override
public String toString() {
StringBuilder string = new StringBuilder();
if (this.operator.getNumOperands() > 1) {
string.append(this.operands.get(0)).append(" ");
}
string.append(this.operator).append(" ");
String prefix = "";
for (int curOperand = this.operator.getNumOperands() > 1 ? 1 : 0; cu... |
867e03e2-3daf-4eb0-bef7-b7ba10527265 | 6 | public int alloc(int size) {
int i, prev_i = 0;
for (i = this.head.s_free.next; i != 0; i = this.nf[i].free.next) {
if (this.nf[i].free.size >= size)
break;
prev_i = i;
}
// there is no free node
if (i == 0) {
System.err.format("alloc:NO FREE NODE\n");
return 0;
}
if (prev_i == 0) { ... |
c457e547-3432-40e8-9c16-b707418cc1ce | 4 | private String binaryCode(int cellAdress, int nbrVar) {
byte bt[] = new byte[nbrVar];
String binaryAdress = "";
for (int i = 0; i < nbrVar; i++)
bt[i] = 0;
if (cellAdress != 0) {
while (cellAdress != 0) {
bt[nbrVar - 1] = (byte) (cellAdress % 2);
cellAdress = cellAdress / 2;
nbrVar--;
}
}... |
9fbee1ac-a992-4e4e-bf8a-e3a964026a46 | 2 | private void writeShipUnlocks(OutputStream out, boolean[] unlocks) throws IOException {
for (int i = 0; i < unlocks.length; i++) {
writeInt(out, unlocks[i] ? 1 : 0);
}
} |
bc2328c7-a35e-4b0e-814d-a15be7010a2e | 5 | public static String long2TimeString(final long time) {
long ms = time % 1000;
long sec = (time / 1000);
long min = (sec / 60);
sec = sec % 60;
long hr = min / 60;
min = min % 60;
StringBuilder sbTime = new StringBuilder();
if (hr > 0) sbTime.append(hr).append(" hr ");
if (min == 0) {
if (sbTime.l... |
fc5a6dcc-535c-476f-b244-26da30f668e2 | 5 | @Override
public boolean equals(Object obj){
if (obj == null) return false;
if (!(obj instanceof Point)) return false;
Point point = (Point)obj;
if (!(getX() == point.getX())) return false;
if (!(getY() == point.getY())) return false;
if (!(getZ() == point.getZ())) return false;
return true;
} |
39538ca3-dead-40be-a9a2-4766ab9ee985 | 0 | @Override
public String getRealName() {
return name();
} |
0d87f1cd-8277-4335-9856-e553bf9939fb | 1 | public void testSet_DateTimeFieldType_int2() {
MutableDateTime test = new MutableDateTime(TEST_TIME1);
try {
test.set(null, 0);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals(TEST_TIME1, test.getMillis());
} |
6ac88b7e-a55b-4e05-85cf-2d0c823ca205 | 5 | public static void main(String[] args)
{
VideoPlayer player = new VideoPlayer();
ServerSocket server = null;
int port = getPort(args);
try
{
server = new ServerSocket(port);
}
catch(SecurityException e)
{
System.out.println("It appears you cannot use the port:... |
e4d4e5b2-2107-47eb-a2ee-8e5f706f2d87 | 7 | @SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2)
{
int i = par2 & 7;
if (i == 0){ return Block.cobblestone.getBlockTextureFromSide(1);}
else if (i == 1){ return Block.stoneSingleSlab.getBlockTextureFromSide(par1);}
else if (i == 2){ return Block.stoneBrick.getBlockTextureFromSide(... |
d83ae272-4ed1-423f-ba7c-3f44be9a892c | 2 | public static void main(String[] args) throws InterruptedException {
long startTime;
long endTime;
// Test case #1:
// start up WORKER_THREAD_NUM worker threads (each of which will request
// TRANSACTION_NUM transactions from the server)
System.out.println("Benchmarking server performance with "
+ Ba... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.