method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6e86ad10-0032-475b-b746-05b9aa40ec61 | 5 | @Override
public void validate() {
if (platform == null) {
addActionError("Please Select Platorm");
}
if (location == null) {
addActionError("Please Select Location");
}
if (blackberry.equals("Please select")) {
addActionError("Please ... |
669f5e9a-5f79-445a-80c4-bf5501ed009d | 3 | protected static String response(int status) {
String response;
switch(status){
case 400:
response="Bad Request";
break;
case 404:
response="Not Found";
break;
case 501:
... |
2b4c3988-2de8-42b0-87e7-e565b781fc17 | 0 | public JLabel getLblGeneration() {
return lblGeneration;
} |
ce0b1257-08e8-4ba2-a0aa-1dfa1c134b80 | 8 | public void CheckAcum(String checkInst, String CheckOper){
int size = 0;
for(int i = 0; i < IDX.size(); i++)
{
if(IDX.elementAt(i).equals(checkInst))
{
machCod.add(mIDX.elementAt(i));
//####### Code to make the second step in IDX instructions, changing 'xb' ########
String Step... |
0b9d3090-965d-40c7-8f39-756d2ec212c2 | 7 | public static void main(String[] args) {
String path = "/Users/davidpfau/Documents/Wood Group/PDIA/";
File objs = new File(path + "results/aiw_full_samples.gz");
PDIA_Dirichlet[] ps = null;
int[][] train = null;
int[][] test = null;
HashMap<Integer, Integer> alphabet = ne... |
ddf2b10a-dcfb-404f-b783-bc6f8e12776a | 4 | public boolean delete(DisplayTable table) {
Connection conn = null;
PreparedStatement st = null;
try {
conn = getConnection();
st = conn.prepareStatement(DELETE_TABLE);
st.setInt(1, table.getId());
st.execute();
} catch(Exception e) {
... |
eb720870-0999-4bed-a032-935ac4407e14 | 7 | public int solve() throws IOException {
Reader.init(System.in);
int N = Reader.nextInt();
int x = Reader.nextInt();
TreeSet<Integer> a = new TreeSet<>();
for (int i = 0; i < N; i++) {
a.add(Reader.nextInt());
}
if (x == 2) return 0;
if... |
e614bc4a-4448-4da0-a9d8-e77eb6b4afbf | 7 | private void AddRequestButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddRequestButtonActionPerformed
if (DBWorker.id == 0){ // добавляем запрос
if (StankiRadioButton.isSelected()){ // Если станки
DBW.setRequest(RequestNameField.getText(), 1, RequestTextArea... |
29f62da2-a196-42a6-a58c-ca40ec3d7cdc | 9 | private void ProcessJob() {
processJob = new Thread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
final UploadProcessFrame frame = new UploadProcessFrame();
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(dim.width / 2 - frame.getWidth... |
ec0b8c03-c7be-4e79-864c-d7124eb9df36 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (null == obj) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Role eq = (Role)obj;
if (!super.equals(eq)){
... |
7418956e-d48a-466a-bb96-e2f01f954f30 | 1 | private void startClicked()
{
WindowStack ws = WindowStack.getLastInstance();
System.out.println("map loaded "+ws+"");
start.hide();
back.hide();
options.hide();
QLabel loading = new QLabel("Wczytywanie...");
loading.setParent(this);
loading.setStyleSheet("font-size: 20px; qproperty-alignment: ... |
b9ee54dd-f96a-473c-908f-c18091699d4d | 6 | @FXML
private void ok(ActionEvent event) throws IOException {
File file = null;
if(!needsFileChooserWorkaround()) {
FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(new File("."));
fileChooser.getExtensionFilters().add(new ExtensionFilter("XML files (*.xml)", "*.xml"));
fi... |
bb6272d2-91e2-406f-b119-4e822c243a13 | 2 | public Object[] highlightUntransformed() {
HashSet unselectedSet = new HashSet(objectToProduction.keySet());
unselectedSet.removeAll(alreadyDone);
Object[] unselected = unselectedSet.toArray();
drawer.clearSelected();
for (int i = 0; i < unselected.length; i++)
if (unselected[i] instanceof State)
drawe... |
f7f69ad6-1ccd-4e8a-bd69-546218bc0855 | 2 | private List<Object> readArray(List<Character> types, int pos) {
int arrayLen = 0;
while (types.get(pos + arrayLen).charValue() != ']') {
arrayLen++;
}
List<Object> array = new ArrayList<Object>(arrayLen);
for (int j = 0; j < arrayLen; j++) {
array.add(readArgument(types.get(pos + j)));
}
return arr... |
1346323b-5bbc-41ac-b941-b2eb1ffc4a65 | 6 | public String toString(){
if(ant != null){
if(ant.getTeamID() == 1){
return "R";
} else {
return "B";
}
} else if (passable == false){
return "#";
} else if (food.isEmpty() == false){
return "" + food.size();
} else if (antHill == 1){
return "+";
} else if (antHill == 2){
retur... |
c922c635-3086-459c-8507-a761c3b28d76 | 8 | @EventHandler
public void signClick(PlayerInteractEvent e) {
Player player = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock()!=null){
if (e.getClickedBlock().getType() == Material.WALL_SIGN || e.getClickedBlock().getType() == Material.SIGN_POST){
Sign s = (Sign) e.getClick... |
0c0721d6-1e40-433e-bc53-fa2cdfefce03 | 2 | private static String loadShader(String fileName){
StringBuilder shaderSource = new StringBuilder();
BufferedReader shaderReader;
try{
shaderReader = new BufferedReader(new FileReader("./res/shader/" + fileName));
String line;
while ((line = shaderReader.re... |
e566a8ca-c11d-45fb-8cd7-b0f8e34699cf | 0 | public void start()
{
ActionListener listener = new TimePrinter();
Timer t = new Timer(interval, listener);
t.start();
} |
d0a772b9-27bb-4381-b2d2-021c3200843d | 3 | public DrawAndSaveImage() {
Graphics2D g2d = bImage.createGraphics();
g2d.setBackground(Color.white);
//bImage = new ImageIcon("haisuli.jpg").getImage();
g2d.clearRect(0, 0, BI_WIDTH, BI_HEIGHT);
g2d.dispose();
for (int r = 0; r < COLOR_DIV; r++) {
for (int g = 0; g ... |
f90c504f-9bf1-4c58-9544-b7773099834e | 3 | @Override
public void paint (Graphics g){
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// Unused but required to override
if(pktList.size() > 0){
PointPacket pkt = pktList.get(pktList.size()-1);
if(pkt.get_drawType() != DrawType.ERASE) {
g.setCo... |
3af67955-afe3-4384-a2ff-5d21c3d93df0 | 3 | private static void outputError(String message) { // Report an error on output.
if (writingStandardOutput) {
System.err.println("Error occurred in TextIO while writing to standard output!!");
outputErrorCount++;
if (outputErrorCount >= 10) {
outputErrorCount = 0;
... |
a1a1f262-1b99-471a-a455-9e89e3494d0a | 3 | public database(){
this.url = "jdbc:mysql://localhost/"+this.db;
try{
//obtenemos el driver de para mysql
Class.forName("com.mysql.jdbc.Driver");
//obtenemos la conexión
conn = DriverManager.getConnection( this.url, this.user , this.password );
if (conn!=null)... |
65737f55-d6b5-45ba-9e68-07b36e2f6884 | 8 | private void deleteCommits() throws IOException {
int size = commitsToDelete.size();
if (size > 0) {
// First decref all files that had been referred to by
// the now-deleted commits:
for(int i=0;i<size;i++) {
CommitPoint commit = commitsToDelete.get(i);
if (infoStream != nu... |
c2b3492d-2e11-4b68-a2ee-773500849a81 | 2 | @Override
public Component getTableCellRendererComponent(JTable table,
Object value, boolean selected, boolean focused,
int row, int column) {
super.getTableCellRendererComponent(table, value,
selected, focused, row, column);
Color bg;... |
6eccf2ec-f130-46da-81ae-6f5097762d0a | 1 | public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
} |
e67d6e17-5eb1-495f-97cf-3462a3345915 | 2 | private void clear() {
System.out.println("Freeing the ports...");
for (int i = 0; i < m_clients.size(); ++i) {
m_clients.get(i).net.halt();
}
System.out.println("Terminating server process ...");
if (m_server.thread != null) {
m_server.thread.terminate();
m_server.thread.stop();
}
} |
b9f63e4c-2d00-4b16-86f1-85ed1a7194e1 | 5 | public synchronized void deletePlayer(String data) {
try {
String log;
StringTokenizer ST = new StringTokenizer(data);
ST.nextToken();
String name = ST.nextToken();
int player = Integer.parseInt(ST.nextToken());
int gameID = Integer.parseInt(ST.nextToken());
log = "server: ... |
383d14cf-5a25-47f9-95b0-dc96a3391f0d | 5 | public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
//Position de la souris
int posX = Mouse.getX();
int posY = Mouse.getY();
//background
bg.draw();
g.setColor(Color.black);
//positions et mouvements des projectiles
for (int i = 0; i < listAnimationProjectiles.size()... |
5f7810b2-3d1d-46bd-80fd-55cee130ae69 | 4 | public void ajoutSingesErratiques(final int n)
{
int id = 0;
for (int nbSinges = 0; nbSinges < n; nbSinges++) {
int x = this.random.nextInt(this.monkeyIsland.getLongueurCarte());
int y = this.random.nextInt(this.monkeyIsland.getLargeurCarte());
while (this.monkeyIsland.valeurCarte(x, y) == 0 && !isSinge(x... |
5bd782bf-aa21-48d2-abb4-8e33592af8c5 | 5 | public void checkWordExists(String testWord)
{
if(this.allWords.contains(testWord))
{
String currentWord = this.queue.get(0);
int wordsWeight = this.wordWeight.get(currentWord).getWeight()+1;
WordWeight wordWeight = new WordWeight(currentWord, wordsWeight);
this.queue.add(testWord);
this.wordWei... |
a433f025-e138-4c43-8246-62bb8f69a421 | 5 | public static Note[] merge(Note[] arr1, Note[] arr2) {
// Set up the return index and all the counting variables
Note[] ret = new Note[arr1.length + arr2.length];
int retIndx = 0;
int indx1 = 0;
int indx2 = 0;
// Loop through the arrays until one of them runs out,
// adding the lower number to the retu... |
a7b33e06-4463-4cbf-8cf1-0627456cab71 | 3 | public int numOfEmptySquares()
{
int count = 0;
for (Square[] a : squares)
{
for (Square s : a)
{
if (s.piece == null)
{
count++;
}
}
}
return count;
} |
1ba066e2-89a0-4e00-86c2-7fdf65813b27 | 5 | @Override
public int buffersProcessed()
{
processed = 0;
// Stream buffers can only be queued for streaming sources:
if( errorCheck( channelType != SoundSystemConfig.TYPE_STREAMING,
"Buffers may only be queued for streaming sources." ) )
{
... |
45cfe505-9878-41fc-a668-b1a3be87496c | 5 | private void parseDocument() {
//get a factory
SAXParserFactory spf = SAXParserFactory.newInstance();
try {
//get a new instance of parser
SAXParser sp = spf.newSAXParser();
//parse the file and also register this class for call backs
try {
sp.parse(xmlfile, this);
} catch(F... |
1b6f6adf-7e80-426c-8214-b3a104bfb74e | 6 | public static Cons cppTranslateCodeSignature(Cons signature) {
{ Cons translatedreturntypes = Stella.NIL;
Cons translatedparametertypes = Stella.NIL;
{ Stella_Object returntype = null;
Cons iter000 = ((Cons)(signature.value));
Cons collect000 = null;
for (;!(iter000 == Stella.N... |
861f7a8e-2846-4f4f-b3eb-4a843c5c7ad0 | 8 | @Override
/**
* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
Thread.currentThread().setName(_chefName);
while ((!this._managmentSentDeathSignal) || (!this._incomingOrders.isEmpty()) || (!this._futuresOfOrder.isEmpty())) {
try {
this._orderFinishedSignal.acquire();
} catch (... |
fd37aa1a-8830-4589-b86f-4345d0b8d24b | 9 | public String getWeightedTract(int[] columnCodes, boolean isEmployment) {
String tract = "";
ArrayList<ArrayList<String>> columns = new ArrayList<ArrayList<String>>();
int columnLength = 0;
int total = 0;
// Calculate combined column total
for(int i = 0; i < columnCodes.length; i++) {
ArrayList<... |
378f3b40-836b-4006-8e46-f8b7fc1181ba | 1 | private void compare(int rId, String checkText, String link, int docId)
{
IComparer comparer = new MyComparer(rId, _settings);
comparer.setOnCompareFinishedListener(new OnCompareFinishedListener()
{
@Override
public void onCompareResultFound(ArrayList<CompareResult> compareResult, int docId)
{
MySql... |
279a5b07-960b-4624-9702-20dcf495a48d | 8 | public Set<Map.Entry<Integer,Byte>> entrySet() {
return new AbstractSet<Map.Entry<Integer,Byte>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TIntByteMapDecorator.this.isEmpty();
}
pu... |
ac12d973-a3b0-47b5-8441-6ae402daecd0 | 2 | public static void main(final String[] args) {
int cols = 0;
int rows = 0;
if (args.length != 2) {
printUsage();
return;
}
try {
cols = Integer.parseInt(args[0]);
rows = Integer.parseInt(args[1]);
} catch (final Exception ... |
36f6155f-e149-4481-91bf-4e4004b19c09 | 5 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (movies != null) {
if (columnIndex == 0) {
return movies.get(rowIndex);
} else if (columnIndex == 1) {
return movies.get(rowIndex).getYear();
} else if (columnIndex == 2... |
dee4e5d8-6df4-4569-bd1b-ceb9b7f2c940 | 9 | protected TreeDragState checkDragAcceptability(DropTargetDragEvent event) {
mAlternateDragDestination = null;
try {
if (event.isDataFlavorSupported(TreeColumn.DATA_FLAVOR)) {
TreeColumn column = (TreeColumn) event.getTransferable().getTransferData(TreeColumn.DATA_FLAVOR);
if (column != null && isColumnDr... |
68780c39-b61f-452f-b4ed-5e8cfb44936b | 7 | public void TalkWithMatka(){
BufferedReader bf2=null;
try{
BufferedReader bf = new BufferedReader(new InputStreamReader(socket.getInputStream()));
PrintWriter toServer = new PrintWriter(socket.getOutputStream(),true);
bf2 = new BufferedReader(new InputStreamReader(System.in));
boolean flag=true;
whil... |
29714edb-7296-4f1a-8004-350005187494 | 8 | public JSONObject connectPlayer(int gId) {
int me = addPlayer(gId);
boolean successCode = gameHook.doInit(gId);
String errorMessage = "";
int totalTimeSlept = 0;
while(pCount.get()!=GameManager.MAX_PLAYERS && totalTimeSlept < ServerBootstrap.TIMEOUT_LENGTH){
try {
Thread.sleep(100);
totalTime... |
8a6f0e7d-bc36-4687-a400-8737aba3a451 | 1 | private static boolean insertSchedule(Schedule bean, PreparedStatement stmt) throws SQLException{
stmt.setDate(1, bean.getWorkDay());
stmt.setTime(2, bean.getFrom());
stmt.setTime(3, bean.getTo());
stmt.setBigDecimal(4, bean.getHourRate());
stmt.setInt(5, bean.getVacationDays());
stmt.setString(6, bean.g... |
2ffa604e-2c99-4248-a597-03bb07f0fe45 | 3 | private void Equipa1_RadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Equipa1_RadioButtonActionPerformed
//Atualiza Jogador_ComboBox
Jogador_ComboBox.removeAllItems();
if(!AutoGolo_CheckBox.isSelected()) {
Jogador_ComboBox.setEnabled(true);
St... |
c460d22e-996b-4aac-ba7b-349fe0415035 | 1 | public void test_cutoverPreZero() {
DateTime cutover = new LocalDate(-2, 6, 30, ISOChronology.getInstanceUTC()).toDateTimeAtStartOfDay(DateTimeZone.UTC);
try {
GJChronology.getInstance(DateTimeZone.UTC, cutover);
fail();
} catch (IllegalArgumentException ex) {
... |
a4d519ad-2b83-4383-b94a-7547d191b581 | 6 | private static Metasymbol getConsensusMetasymbol(char[] column) {
Metasymbol sym = new Metasymbol();
List<Character> listC = new ArrayList<Character>();
for (char c : column) {
listC.add(c);
}
List<Integer> freqs = new ArrayList<Integer>();
freqs.add(Collections.frequency(listC, 'A'));
... |
24d01457-68d5-4c6f-9d54-af9c6100276b | 5 | @Override
public void actionPerformed(ActionEvent event) {
//Handle button presses.
if (match.isInProgress()) { //Don't do anything if the game is over.
String actionCommand = event.getActionCommand();
if (actionCommand == GameInfoPanel.END_TURN_BUTTON_TEXT) { //Handle turn ending.
match.endTurn();
} ... |
e2f93ba4-11fb-4551-93db-a23b5a1777ed | 2 | public void setValue(MemberValue[] elements) {
values = elements;
if (elements != null && elements.length > 0)
type = elements[0];
} |
c7cb5fbb-1915-48d2-8d9c-13c5a0428626 | 0 | public void setVenue(Venue venue) {
this.venue = venue;
} |
abe5ea31-abce-4349-b1a1-d595d66704f4 | 6 | public static void drawString(String string, float x, float y, float z, float scale, boolean centered)
{
texture.bind();
if(string.length() == 0)
return;
scale /= 1000;
x-= (Main.WIDTH/2 + 350) * scale;
y-= (Main.HEIGHT + 260) * scale;
float currentXOffset = 0;
float currentYOffset = 0;
flo... |
aaaf67d6-133e-4a24-8aa7-e994025f3450 | 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... |
c60f3de5-a1e8-4418-8458-fabac6a30ea2 | 3 | public void addSymbol(Symbol symbol){
boolean notFinded = true;
for(Symbol s : alphabet)
if(s.getValue().equals(symbol.getValue()))
notFinded = false;
if(notFinded)
alphabet.add(symbol);
} |
36f583aa-fcb5-463a-93e0-66db18c2238e | 9 | protected String replaceSupers(String aCode)
{
// constructors
int pos = -2;
while (pos != -1) {
if (pos != -2) {
HumboldtJS.showLog("Rewriting call to constructor super", 3);
String theFirstPart = aCode.substring(0, pos);
String theSecondPart = aCode.substring(pos + 5);
if (mRoot.mExtends.eq... |
6fd8ff85-67cb-4ba1-88a9-291ed98eac51 | 9 | public CollisionParams checkCollision(MovingObject movingObject, AabbToAabbParameters pointToPlaneParams){
CollisionParams collisionParams = new CollisionParams(false, movingObject.getCurrentDirection());
int difference = pointToPlaneParams.getDistance();
boolean collidedMajorPlane = Math.signum... |
ca382a85-e9c1-4a88-bd9d-7c8f9973ba72 | 2 | public static boolean isPermutation(String s1, String s2) {
if(s1.length() != s2.length()) {
return false;
}
int[] counts1 = new int[256];
int[] counts2 = new int[256];
char[] chars1 = s1.toCharArray();
char[] chars2 = s2.toCharArray();
... |
1f674748-def3-4ec4-97d2-42c1a85f5b23 | 3 | @Override
public int open(JoeTree tree, DocumentInfo docInfo, InputStream stream) {
// Set the objects we are going to populate.
this.docInfo = docInfo;
this.tree = tree;
// initialize result flags
int success = FAILURE;
errorOccurred = false;
// try to read the file
try {
// we'll be grabbing... |
fd03b3cc-1dcf-4e74-865a-0d68310fe64b | 3 | private void processPossibleReference() {
if (nextPotentialReferencePosition != -1) {
boolean isNumberedReference = originalMessage.charAt(currentPosition + 1) == '#';
boolean wasProcessable = isNumberedReference ? processNumberedReference() : processNamedReference();
if (wasProcessable... |
8c040746-6585-44b0-a83b-2dd422f35a44 | 4 | public void addLocation(int jaar, int maand, DataPoint location)
{
boolean found =false;
for (Period per: this.periods)
{
if (per.jaar == jaar && per.maand == maand)
{
found =true;
per.addLocation(location);
}
}
if (!found)
{
Period per = new Period(jaar,maand);
per.addLocation... |
d1d554f7-e915-4ddb-bd8c-24d6b8fd31c1 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the... |
09e3eb1b-798c-4897-826e-f8623b226719 | 4 | static void bubble_sort(int a[]) {
length=a.length;
for (int i=0;(i<a.length-1);i++) {
j=0;length--;
while (j<length) {
if(a[j]>a[j+1]) {
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
j++;
}
}
for (int i:a) {
System.out.println(i);
}
} |
2b308e4f-a0f5-43f4-9ada-08636b184671 | 6 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((cpf == null) ? 0 : cpf.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((emailC == null) ? 0 : emailC.hashCode());
result = prime * result
+ ((e... |
3524f143-6929-4db9-89e1-a64ec4481482 | 2 | public void format(){
StringBuilder sbClass = new StringBuilder();
StringBuilder sbTable = new StringBuilder();
int endPosition = fileds.size()-1;
for (int i = 0; i < fileds.size(); i++) {
ModelFiledDesc mfd = fileds.get(i);
if(i < endPosition){
sbClass.append(mfd.getFiledType()+" "+mfd.getFiledName()... |
d20b0172-39f6-4afb-bbbf-2baaf6badd1e | 7 | public void writeIndent (int indent) throws IOException {
if (indent == -1) indent = 0;
if (!indentation || column > indent || column == indent && !whitespace) writeLineBreak(null);
if (column < indent) {
whitespace = true;
StringBuffer data = new StringBuffer();
for (int i = 0, j = indent - column; i ... |
c1be73cb-1598-442c-9e6a-aceec0c9dec1 | 8 | public int order(int x){
Object node= this.root;
int ans= 0;
while (!(node instanceof Leaf)){ //while we havent found the key's leaf
Junction junctionNode= (Junction)node;
Vector<Link> elements= junctionNode.getElements();
Vector<Object> pointers= junctionNode.getPointers();
int i; //i will hold the... |
e22df00e-c90b-4a32-bd9a-62a839c92459 | 4 | @SuppressWarnings("unused")
public void grabIcal(String Strurl) throws IOException {
FileOutputStream fos = null;
String path = "Cal.txt";
try {
URL url = new URL(Strurl);
System.out.println("Opening connection to " + Strurl + "...");
trustManager();
... |
abf4692a-8828-4efa-b2e0-8d8707a3b1a6 | 6 | int getCountContributed()
{
int count = 0;
for(int i=0;i<sudokuSize;i++) {
for(int j=0;j<sudokuSize;j++) {
if(cells[i][j].valueState == 2 || cells[i][j].valueState == 3 || cells[i][j].valueState == 4 || cells[i][j].valueState == 5)
count++;
}
}
return count;
} |
93aea028-f2a5-466c-b2ad-5e2806e95cdd | 7 | public SplitsDialog(JDialog parent, List<TransactionSplit> splits, AccountRecord account) {
super(parent, "Edit Splits", true);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
this.splits = splits;
//
// Create the splits table
//
tableModel = new Spl... |
f5eec5c8-5d0e-4b5b-8dc8-48b4a1167b19 | 8 | @Override
public void mouseDragged(MouseEvent e) {
currentX = getGraphCoordinateX(e.getX());
currentY = getGraphCoordinateY(e.getY());
if(leftPressed && !rightPressed) // Left click is for arrows
{
/* If left click and drag:
* 1. If clicked on nothing, don't draw anything
* 2. If clicked... |
478fcff9-e7bb-4ed9-9f4b-76c7806991be | 4 | public static void loadSettings(){
File settingsFolder = new File("settings");
if(!settingsFolder.exists()){
settingsFolder.mkdir();
}
File iniFile = new File("settings", "settings." + getExtension("settings file"));
if(iniFile.exists()){
try {
... |
68c31060-3927-4ffc-879a-fc0398cc1f8e | 3 | public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... |
3d59bf7a-e5d7-44c0-b545-dbda2c29bbfc | 8 | private void rule_johwa(int from,String prev,String str,int cur) {
String buf;
String buf2;
String new_str;
if (cur>0&&pcheck(str,cur-1,"양성모음")!=0) {
if (cur+2<str.length()&&str.charAt(cur+1)=='ᄋ'&&str.charAt(cur+2)=='ᅡ') {
new_str=replace(str,cur+2,"ᅥ");
buf = new_str.substring(0,cur+1);
... |
4c7e9e94-d89b-4cb7-9d3e-3799a333ce2a | 0 | public void execute(String[] _parameters) {
this.parameters = _parameters;
run();
} |
47fb287e-3721-4814-8fd9-bfc878a2b631 | 9 | public void run() {
while (m_run) {
if (CommandBase.raspberryPi.isEnabled()) { //Checks for Thread to run
if (CommandBase.raspberryPi.isConnected()) {
report = true;
try {
String[] data = CommandB... |
86e1e2e5-4fe6-437f-b9f1-9c0e357974fc | 8 | public void testSign() {
for (double x = -80D; x < 80D; x++) {
for (double y = -80D; y < 80D; y++) {
int s = this.cm.evaluateSlopeSign(0, x, y, 1D);
System.out.print(s < 0 ? "<" : s > 0 ? ">" : " ");
int sY = this.cm.evaluateSlopeSign(1, x, y, 1D);
System.out.print(sY < 0 ? "v" : sY > 0 ? "^" : " "... |
3dfa11e1-c0a2-41f5-868d-99861ca9f549 | 0 | public String getUri() {
return uri;
} |
b33ed293-f59e-4af7-b2dc-de4eeb0567c3 | 2 | public boolean answer(int answer)
{
if (checkAnswer(answer))
{
addPoints();
newMove();
if (timerOn)
timer.addSmartSeconds();
return true;
}
else
{
gameOver = true;
return false;
... |
9fba4d1c-143d-424f-add1-e01ea6cd8b4b | 9 | public int evaluateSurroundingColumns(Position position, Token token,
Map<Position, Token> tokenMap) {
int row = position.getRow();
int column = position.getColumn();
this.anothertokenMap = tokenMap;
Position[] position1 = { new Position(row, column),
new Position(row, column - 1), new Position(row, colu... |
ddabd0b4-c522-4afe-8d48-8d59aa5af2dd | 5 | public void loadCommands(ComponentManager componentManager) {
// use reflection to get access to bukkit's command map
try {
// grab our field
final Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
// make it accessible
boolean accessible = commandMapField.isAc... |
a0cff1f7-43ea-493b-8761-3c797724f731 | 0 | @Override
public Term next() {
Term term = queue.get(0);
queue.remove(0);
return term;
} |
ea39e754-755f-4aee-a522-0d9a8add73e1 | 3 | static File locFile(File work, String descr, Locale l) {
if (l == null) {
return new File(work, descr);
}
String locName = descr.substring(0, descr.lastIndexOf('.'));
String locExt = descr.substring(descr.lastIndexOf('.'));
String locLan = l.g... |
144e03c8-259e-41a0-979d-f6017cdf440b | 3 | private static void addListener(PathChildrenCache cache) {
// a PathChildrenCacheListener is optional. Here, it's used just to log changes
PathChildrenCacheListener listener = new PathChildrenCacheListener() {
@Override
public void childEvent(CuratorFramework client, PathChildren... |
8bc6d843-5b35-474c-ae3a-09a02a376e90 | 5 | private int stripMultipartHeaders(ByteBuffer b, int offset) {
int i;
for (i = offset; i < b.limit(); i++) {
if (b.get(i) == '\r' && b.get(++i) == '\n' && b.get(++i) == '\r' && b.get(++i) == '\n') {
break;
}
}
return i + ... |
42062700-12f1-4974-80b6-0258b0484ab4 | 9 | private boolean r_combo_suffix() {
int among_var;
int v_1;
// test, line 91
v_1 = limit - cursor;
// (, line 91
// [, line 92
ket = cursor;
// substring, line 92
among_var = find_among_b(a_2, 46);
if (among_var == 0) {
return false;
}
// ], line 92
bra = cursor;
// call R1, line 92
if (... |
4397681d-efde-4e5d-bfae-cda6fb9f8eb4 | 7 | private byte[] pkcs1unpad2(BigInteger src, int n)
{
byte[] bytes = src.toByteArray();
byte[] out;
int i = 0;
while(i < bytes.length && bytes[i] == 0)
{
++i;
}
if(bytes.length-i != n-1 || bytes[i]>2)
{
return null;
}
++i;
while(bytes[i]!=0)
{
if(++i>=bytes.length)
{
... |
e1b24949-9167-47c8-bd0e-83713d5a80d2 | 4 | private void blueTeamWin() {
for (String n : this.getPlayers()) {
if (this.getBlueTeam().getPlayers().contains(n)) {
PlayerStats s = plugin.getPlayerStats().get(n);
if (s != null) {
s.setWins(s.getWins() + 1);
} else {
... |
2c3f9e12-a4af-4d34-8075-ae8eeead9262 | 8 | public boolean paintConnectFourBoard(Graphics2D g2) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: paintConnectFourBoard() "
+ "BEGIN");
}
if (PLAYER1_COLOUR.equals(Color.YELLOW)
|| PLAYER1_COLOUR.equals(C... |
22457b77-f74f-4cdd-a73b-a2203087939e | 9 | public final void arrayElement() throws RecognitionException
{
Token id = null;
AST ast1 = null, ast2 = null, ast3 = null;
try {
// CPP.g:797:3: (id= IDENTIFIER '[' expr ']' index )
// CPP.g:797:5: id= IDENTIFIER '[' expr ']' index
{
... |
196ca08b-3b5d-4230-a71d-81d6f662bfe8 | 5 | public Model method538() {
if (anIntArray658 == null) {
return null;
}
Model models[] = new Model[anIntArray658.length];
for (int i = 0; i < anIntArray658.length; i++) {
models[i] = Model.getModel(anIntArray658[i]);
}
Model model;
if (models.length == 1) {
model = models[0];
} else {
model =... |
a30908a1-3510-4fcb-a65f-d47bf0eef0af | 8 | private void writeRequestToFile(FileOutput out) throws FileNotFoundException,IOException
{
switch(out)
{
case ONDEMAND:
System.out.println("Writing the ondemand requests to file...");
File ondemandFile=new File("data/request/OndemandRequest.txt");
BufferedWriter bwriter1=new BufferedWriter(new OutputS... |
7ed72804-dd50-4f0f-8812-daca2e3f59ca | 8 | private Rectangle2D.Float setMovingRect(float[] a, int x, int y) {
switch (selectedSpot) {
case LOWER_LEFT:
case LOWER_RIGHT:
case UPPER_LEFT:
case UPPER_RIGHT:
a[0] = Math.min(x, anchorPoint.x);
a[1] = Math.min(y, anchorPoint.y);
a[2] = Math.abs(x - anchorPoint.x);
a[3] = Math.abs(y - anchorPoint... |
8ee31fb5-c2d4-43a0-9cf1-fa844409b9e4 | 7 | private void setPostion(final int offset){
int x = panel.getX();
int y = panel.getY();
int x2 = tagPanel.getX();
int y2 = tagPanel.getY();
if(Debug.shimmy)System.out.println(" offset = " + offset);
if(direction=="left" || direction=="right"){
x=offset;
... |
44f2cf0d-e89a-4a41-a3a9-7e6f1f988399 | 6 | private void sort(int column) {
if(table.getItemCount() <= 1) return;
TableItem[] items = table.getItems();
String[][] data = new String[items.length][table.getColumnCount()];
for(int i = 0; i < items.length; i++) {
for(int j = 0; j < table.getColumnCount(); j++) {
data[i][j] = items[i].getText(j);
}
}
... |
e313da8b-9486-466f-92dc-38cacd69ec3f | 1 | private void doDrawing(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.blue);
for (int i = 0; i <= 1000; i++) {
Dimension size = getSize();
Insets insets = getInsets();
int w = size.width - insets.left - insets.right;
int h = size.height - insets.top - insets.bottom;
... |
28e2b5b0-12f2-487e-a6c9-3def04552f1e | 2 | public static void main(String[] args)
{
HashMap map = new HashMap();
for (int i = 0 ;i <10000; i++){
map.put(new Integer(i),new Integer(i + 100));
}
long startTime=System.currentTimeMillis(); //获取开始时间
Set set = map.keySet();
for(Iterator iter = set.iterator(); iter.hasNext();){
I... |
6a32b52d-032c-4874-8f79-165c8940c942 | 0 | public void setSort(String sort) {
this.sort = sort;
} |
d5585e91-782e-4fb3-81f5-87c9835e5aaf | 3 | private void insertKeywords(HttpServletRequest request,
HttpServletResponse response) {
try {
PrintWriter out = response.getWriter();
String filename = "keywords.txt";
Keywords kw = new Keywords();
kw.removeAll();
InputStream is = getServletContext().getResourceAsStream(filename);
if (is != n... |
92081b78-91a6-4cec-a0bd-76dff34bb732 | 4 | public void eseguiSimulazione() {
/* Inizializzazione vettore. */
ArrayList<Double> tempiUscitaMedi = new ArrayList<Double>();
/* Cicla sui job. */
for (int i = passo ; i <= jobTotali ; i += passo) {
/* Cicla sui run. */
for (int j = 1 ; j <= run ; j++) {
... |
d2c14642-324a-433b-8bc0-1abbdc52c5eb | 1 | public void clearAll() {
entityList.clear();
for (HashMap<Entity, IComponent> componentLists : registeredComponents.values()) {
componentLists.clear();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.