method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6722ac0a-9f88-4317-bf24-d3b3531c8ceb | 3 | @Override
public Venda ListById(int id_fornecedor) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Venda v = new Venda();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID);
r... |
b944dcdd-770e-484e-850b-d717cfd5b3d7 | 2 | public static int countVertices(Poly p, Segment s) {
int count = 0;
for(int i = 0; i < p.size(); i++) {
if(containsPoint(s, p.get(i))) {
count++;
}
}
return count;
} |
ac117a6d-ae91-46c8-9329-8db2166bd5e3 | 1 | public static void main(String[] args) {
// ArrayMerge am = new ArrayMerge();
// int[] a = { 1, 2, 9, 10, 13, -1, -1, -1, -1, -1, -1, -1 };
// int[] b = {4,5,7,9,11,12,14};
//
// am.merge(a, b, 5, 7);
// for(int i = 0; i<a.length;i++){
// System.out.print(a[i]+" ");
// }
// int[] sa = {3,6,7,9,11,12... |
807cde38-d40d-45c4-83e6-459692df99b6 | 9 | public FlyAWayView(SingleFrameApplication app) {
super(app);
initComponents();
Controller.Instance().addObserver(this);
this.renderMarqueeText();
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap()... |
2a231496-73d2-49c0-983d-b7df241f1398 | 5 | public static int[][] loadMethod(File file) {
try {
FileReader reader = new FileReader(file);
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
ArrayList<ArrayList<Integer>> posList = new ArrayList<ArrayList<Integer>>();
while ... |
e53ccb35-78aa-4959-801e-84e996a49561 | 7 | public Value get(Key key1)
{
if (size() > 0)
{
Node<Key, Value> x = root;
while(x != null)
{
int cmp = key1.compareTo(x.key1); //compare with the left key of Node
if (cmp < 0)
{
x = x.left;
}
else if (cmp > 0) //big... |
0ba90a52-9485-4825-af9a-7b43ffd566c8 | 2 | public void startElement(String name)
throws IOException, XMLWriterException {
if (!bDocumentOpen) {
throw new XMLWriterException(
"Can't start new element, no open document.");
}
if (bStartTagOpen) {
w.write(">" + newLine);
}
... |
1ca4832d-dfba-4551-b21e-982567f0c3ed | 6 | ArrayList<movePair> possibleMoves(Point[] grid, Pair pr) {
ArrayList<movePair> possible = new ArrayList<movePair>();
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
Point currentPoint = pointAtGridIndex(grid, i, j);
if (currentPoint.value == 0) {
continue;
}
for (Pair d : d... |
cae397ce-c1eb-4358-98d3-88d38dea7496 | 6 | public static ArrayList<ArrayList<Integer>> combine2(int n, int k) {
if(n<k||k==0) return null;
ArrayList<ArrayList<Integer>> all = new ArrayList<ArrayList<Integer>>();
// boundary case
if(n==k) {
ArrayList<Integer> al = new ArrayList<Integer>();
for(int i=1;i<=n;++i) {
... |
6250d0ed-0b22-4d5e-adf2-de4adeff4602 | 5 | @Override
public void keyPressed(int k) {
if(k == KeyEvent.VK_ENTER){
select();
}
if(k == KeyEvent.VK_UP) {
currentChoice--;
if(currentChoice == -1) {
currentChoice = options.length - 1;
}
}
if(k == KeyEvent.VK_DOWN) {
currentChoice++;
if(currentChoice == options.length) {
currentCh... |
9f2e86bc-268a-4af7-a63e-b99e45e67ae3 | 1 | private void readLine() {
try {
line = bf.readLine();
lineCount++;
pos = 0;
lastPos = 0;
}
catch ( IOException e ) {
e.printStackTrace();
}
} |
49a0a8c8-a52b-41d6-bdf3-20e5a410a522 | 2 | private String validateDirective(String directive) {
directive = directive.substring(directive.indexOf(".") + 1, // Retrieve the directive from the line w/o the period
directive.indexOf(" ")); // Stop at the end of the directive (Do not fetch the operand)
for (String dir : directives) {
if (di... |
c95eb7c5-2c09-4293-9826-699152244021 | 4 | private void drawHUD(Graphics g) {
boolean underground = yOffset <= -GameModel.GROUND_LEVEL;
// Version
g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
g.setColor(Color.WHITE);
g.drawString(Configurables.GAME_VERSION, 5, getHeight() - 10);
// Money
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 24))... |
1959d676-be69-401d-8aea-e32bb094d897 | 3 | public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException {
JSONObject jo = new JSONObject();
if (properties != null && !properties.isEmpty()) {
Enumeration enumProperties = properties.propertyNames();
while(enumProperties.hasMoreElements()) {
... |
2b9da33a-6bbb-4659-89bb-0f894ae2da93 | 2 | private IBlock createBlock(int index) throws IOException {
if (storageMode != StorageMode.File) {
if (allowedMaxOffHeapBlockCount < 0) {
return new DefaultStorageBlock(dir, index, capacityPerBlock, StorageMode.File);
}
allowedMaxOffHeapBlockCount --;
... |
beef0303-6239-482e-89de-9dbf6f453da3 | 8 | public static boolean updateOperatorCardinality(Operator o,
Map<String, Integer> tableAliasToId,
Map<String, TableStats> tableStats) {
if (o instanceof Filter) {
return updateFilterCardinality((Filter) o, tableAliasToId,
tableStats);
} else if (o i... |
f6562c43-e7f9-4675-8acd-2cef7b69cd13 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Student other = (Student) obj;
if (gender != other.gender)
return false;
if (id != other.id)
return false;
if (name == null) {
if (o... |
67be6cd4-4ea3-484d-8cf1-c9dc297888bc | 9 | private int pruneLists(String desc, HashedMap<ByteChars, java.util.ArrayList<ResourceData>> cache,
int lowater, int hiwater)
{
long min_age = dsptch.getSystemTime() - config.minttl_lookup;
int delcnt = 0;
java.util.Iterator<ByteChars> it = cache.keysIterator();
while (it.hasNext()) {
if (pruneList(cache,... |
6bd37176-bd49-483c-907e-bfe9856cb48b | 7 | public void calculateVelocity() {
// If the current velocity is 0, simply add the acceleration to it
if (velocity.equals(new Vector())) {
velocity.add(acceleration);
}
// Otherwise,
else {
// If the couch is moving forward
if (movingForward()) {
// And it is accelerating backwards (braking)
... |
5725af51-44e3-4185-91f5-4cc5b62d7a70 | 0 | public void setTime(String newTime) {
time = newTime;
} |
d03c579a-528d-472b-82c5-bf5bfd92c5a7 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
316daeba-67b4-4a1d-ac8b-d496e007ca41 | 9 | private void chooseOrder() {
print("Choosing order.");
choiceFound = false;
boolean poor = false;
// check if poor
if (money <= menu.getCheapestItem())
poor = true;
while (!choiceFound) {
if (pastChoices.size() == menu.getSize()) {
print("No more choices available...");
event = AgentEvent.n... |
838fc0a7-d7f3-415c-9617-eab900ba9f07 | 6 | public void mouseMoved(int x, int y) {
if ((x >= theComponent.getX()) && ((x <= (theComponent.getX() + buttonWidth)))) {
if ((y >= theComponent.getY()) && (y <= (theComponent.getY() + buttonHeight))) {
if ((y > theComponent.getY()) && (y < (theComponent.getY() + buttonHeight))) {
... |
a2b0373e-498a-44bb-a81d-b2e984f41220 | 8 | public static void computeCoefficients(Artist[] artists,DatabaseConnector db,int k){
String stringArtists="";
int i=0;
for(Artist a:artists){
if(i>0){stringArtists+=",";}
stringArtists+="\""+a.name+"\"";
i++;
}
String[] topTags=new String[k];
String query="select tag,sum(count) as c from artisttags... |
3aad962a-f9b5-4b84-943f-c6f1b1b7bdf2 | 0 | public void addQuizGPS(String title,int quizId,ArrayList<String> imageList, ArrayList<Boolean> imageInventoryList,ArrayList<String> soundList,
ArrayList<Boolean> soundInventoryList, int narration,String paragraphList, String preNote, String postNote,
String goTo, int points, String date,double x,double y,
... |
d6417238-7875-4eca-9798-f84b404b6802 | 9 | private Map<String, TermObject> search_by_phrase(String phrase)
{
TermObject _to = null;
List<String> terms = this.split_phrase_into_terms(phrase);
Map<String, TermObject> _result = new HashMap<String, TermObject>();
int _num_t = terms.size();
if(_num_t < 1) return null;
try
{
for(int i = 0;... |
ceca7ea7-5e2b-4485-9548-d74acef5f413 | 3 | public void actionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == okButton) {
SetConfig.this.okButtonActionPerformed(evt);
}
else if (evt.getSource() == cancelButton) {
SetConfig.this.cancelButtonActionPerformed(evt);
}
... |
14fe174c-775f-45ba-912b-1f247e3bf9ed | 4 | public Animate(BufferedImage[] images,
int startingIndex, int loopCount, boolean reverseWhenDone, boolean removeWhenDone, long timePerImage) {
this.children = images;
if (images == null) {
logger.error(new NullPointerException(), "images given to Animation component were null");
}
if (startingIndex < 0 ... |
8da3c237-b787-466f-96aa-46f5afdbb4d6 | 3 | public void draw(Graphics2D g2) {
try {
stageManager.draw(g2);
if (showFps) {
g2.drawString(Main.version, WIDTH - 60, 15);
g2.drawString("FPS: " + fps, WIDTH - 60, 30);
}
Graphics g = this.getGraphics();
if (g != null) {
g.drawImage(image, 0, 0, WIDTH * 2, HEIGHT * 2, null);
g.dispose(... |
f9c89ff3-35d1-40e1-953f-03e1287c38f2 | 5 | public static int menu(String question, ArrayList<String> menu){
if(menu.size() <= 0) {
return -1;
}
else if(menu.size() == 1) {
return 0;
}
out.println(question);
for(int i = 0; i < menu.size(); i++){
out.println((i + 1) + ": " + menu.get(i));
}
int choice = in.nextInt... |
a96c6ec0-8248-4bcb-a69b-271ed2647cfb | 6 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("************ Calling Captcha Servlet *********");
ServletOutputStream outputStream=null;
BufferedImage captchaImg=null;
try {
GRSCaptchaUtil grsCaptchaUtil = GRSCaptcha... |
5fee8ede-b5de-469a-8627-79229f85e85c | 9 | public void applyConfig(JsonObject values) {
for (Map.Entry<String, JsonElement> entry : values.entrySet()) {
switch (entry.getKey()) {
case "prefix": prefix = entry.getValue().getAsString(); break;
case "name": name = entry.getValue().getAsString(); break;
case "title": title = entry.getValue().getAsS... |
7bbc2b1a-9509-4764-a00c-1163f95cc001 | 4 | protected MyPGPid(byte[] buffer, short offset, byte length) {
// G+D uses non-zero offset, JCOP uses offset=0
if(length > 9) {
// data offset is used for application specific parameter.
// initialization with default offset (AID offset).
short dataOffset = offset;
// Ins... |
85e40947-74be-4d17-8e81-dd8b3129b13e | 6 | public static JMenu makeMenu(String items, String label, int shortcuts[])
{
JMenu ret = new JMenu();
if (label != null) ret.setText(label);
String[] a = items.split("\\|");
int i = 0;
for (String b : a)
{
if (b.equals("-"))
ret.addSeparator();
else
{
JMenuItem tmenui = new JMenuItem();
... |
228c30b4-2089-4c23-b192-9dfcd2dca2e1 | 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.");
... |
b7d19760-a61d-4f77-95f8-fd89d408a6f4 | 8 | public void setRoom(int x, int y, Room newRoom) {
// if we're adding a real room to an empty place, howManyRooms++
if ((newRoom != null) && (myWorld[x][y] == null)) {
howManyRooms++;
} // if we're blanking (nulling) a real room, howManyRooms--
else if ((newRoom == null) && (... |
544df27b-a236-4792-86a0-199a64ed75a5 | 4 | public static List<Question> getQuizQuestions(int QuizDbId)
{
try
{
String query = String.format("select qq.QUIZID, q.QUESTIONID, q.QUESTIONTEXT, q.ISVALIDATED, qa.ANSWERID, qa.ANSWERTEXT, qa.ISCORRECT from Question q right join \n" +
"QuestionAnswer qa on Q.QUESTIONID = \n" +
"qa.QUESTI... |
82c0fc41-2ec6-464c-a47a-66f62116d7a4 | 3 | @Test
public void testInvalidConstruction() {
Tile t;
try {
t = new Tile(null, new Room());
fail("IllegalArgumentException was expected");
}
catch (IllegalArgumentException e){
//expected
}
try {
t = new Tile(new Point(1, 2), null);
fail("IllegalArgumentException was expected");
}
catch ... |
fa87d901-6d2d-4400-b95b-8ff6a63433d9 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UrlEntity url1 = (UrlEntity) o;
if (count != null ? !count.equals(url1.count) : url1.count != null) return false;
if (lastTime != null ? !lastT... |
c6fe2a68-a2e4-46ab-9a6d-24a77025697c | 8 | @Override
public boolean equals(Object other) {
if (other == null || !other.getClass().equals(this.getClass())) {
return false;
}
Revision revision = (Revision) other;
boolean boolCommitID = commitID.equals(revision.commitID);
boolean boolParentIDToDiffF... |
ec0a957a-9877-4d31-996a-903dd5f00191 | 7 | private void readPrefixes() throws Exception {
String path = PATH + "router-" + router_number + ".txt";
BufferedReader br = new BufferedReader(new FileReader(path));
String line;
/* Reads the file line-by-line */
while ((line = br.readLine()) != null) {
/* Skips lines that don't start "prefix "... |
ec3efb4a-d6f0-4802-81a5-86039891d050 | 3 | private void jTextField4KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField4KeyPressed
if (evt.getKeyCode() == 38) {
jTextField3.grabFocus();
} else if (evt.getKeyCode() == 40) {
jList1.grabFocus();
} else if (evt.getKeyCode() == 39) {
cmbPublisher.grabFocus();
... |
6dc938ea-ce0f-4ddb-b2db-c74d12dbda6b | 2 | @Override
public String toString(){
if(map.isEmpty())
return "empty mapping";
String result = "";
for(Map.Entry<Byte, Byte> entry: map.entrySet()){
result += ", "+(char)entry.getKey().byteValue()+"->"+ (char)entry.getValue().byteValue();
}
return resul... |
4a33fe62-8202-4c46-9a3f-d9c16900d723 | 8 | public void testFoundColony() {
Game game = getGame();
Map map = getCoastTestMap(plainsTileType);
game.setMap(map);
Colony colony = getStandardColony(3, 1, 8);
Player dutch = colony.getOwner();
Tile colonyTile = colony.getTile();
assertEquals(colonyTile.getType()... |
ee0dc682-9ff9-4c29-99f6-e40f166c41b4 | 4 | public int getPlayer1Score() {
boolean test = false;
if (test || m_test) {
System.out.println("Game :: getPlayer1Score() BEGIN");
}
if (test || m_test) {
System.out.println("Game :: getPlayer1Score() END");
}
return m_player1Score;
} |
66858015-06f8-4c5a-b3da-450b3929ae85 | 4 | public static <T extends DC> Set<Pair<T,T>> getPhiMax(Set<Set<Pair<T,T>>> allPhis)
{ Similarity simMax,sim;
if(allPhis!=null)
{ Set<Pair<T,T>> phiMax=allPhis.a;
simMax=getPhiSim(allPhis.a);
for(Set<Set<Pair<T,T>>> p=allPhis;p!=null;p=p.next)
{ sim=getPhiSim(p.a);
if(sim.greater(simM... |
1ece350e-b63b-48e1-853d-ff4995cbddd8 | 4 | @Override
public ArrayList<BoardPosition> getPossibleDestinations(Board board) {
ArrayList<BoardPosition> possibleDestinations = new ArrayList<BoardPosition>();
if (board.pieces[targetPosition.getColumn()][targetPosition.getRow()] != null) {
if (board.pieces[targetPosition.getColumn()][... |
69f30f7b-084b-403e-9963-6e060ea44a26 | 5 | private void createNewPath() {
JTextField edgeName = new JTextField(20);
JTextField edgeWeight = new JTextField(20);
JPanel newEdgePanel;
newEdgePanel = new JPanel(new GridLayout(3,1,5,2));
newEdgePanel.add(new JLabel("Vad ska förbindelsen heta?"));
newEdgePanel.add(edgeN... |
62e8b229-444e-41a1-b9eb-714a4cbfa8d2 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass()) {
if (obj.getClass() == String.class) {
return name.equals((String) obj);
}
return false;
}
Variable other = (Variable) obj;
if (name == null) {
... |
d98ec606-c7f2-443d-aaf5-626f52240c62 | 4 | public Tile tile(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height) {
return Tile.OOB;
} else {
return tiles[x][y];
}
} |
fc3e46b7-32bb-4814-923a-0b45ae4ac484 | 2 | public MeanFilterDialog(final Panel panel) {
setTitle("Mean filter");
setBounds(1, 1, 250, 140);
Dimension size = getToolkit().getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
JPanel pan = new JPanel();
pan.... |
17b7cb10-86be-46ab-b5d6-17a4e8979e73 | 4 | public void update(GameContainer gc, StateBasedGame sbg, GameplayState gs, int delta) {
for (Entry<Long, Enemy> enemy : this.enemies.entrySet()) {
enemy.getValue().update(gc, sbg, gs, delta);
if (enemy.getValue().isDead()) {
this.toBeRemoved.add(enemy.getKey());
}
else
... |
3a0d3e08-5652-4e69-a576-a875a8e71418 | 1 | @Override
public boolean canMove(Board board, Field currentField, Field emptyField) {
return this.validSetupForMove(currentField, emptyField) && board.clearPathBetween(currentField, emptyField);
} |
0df93396-aaec-4267-90b8-a8e5b51d2e0a | 8 | private static AbstractResultSet doVoting(
AbstractResultSet[] secondaryResSets, Match matchCriterion,
boolean typeChecking, int voteThreshhold) throws FileNotFoundException {
AbstractResultSet res = new EnsembleResultSet();
res.docNumber = secondaryResSets[0].docNumber;
String resType = "";
... |
58d516f4-91c1-4021-872d-df07dadcc49e | 5 | private void create(Color bg, Animation init, String fieldTitle) {
setPreferredSize(new Dimension(GUIConstants.DEFAULT_FIELD_WIDTH, FIELDHEIGHT));
setBackground(bg);
setLayout(new VerticalLayout(5, VerticalLayout.CENTER));
setBorder(BorderFactory.createTitledBorder(fieldTitle));
... |
2548d6db-7a6a-44f3-a80e-938751e0947c | 7 | private Token scanTag() {
// See the specification for details.
Mark startMark = reader.getMark();
char ch = reader.peek(1);
String handle = null;
String suffix = null;
if (ch == '<') {
reader.forward(2);
suffix = scanTagUri("tag", startMark);
... |
95a81f33-3719-43ab-9cb4-9540b2547000 | 3 | public List<String> readActiveDates() {
List<String> retList = new ArrayList<String>();
try {
ResultSet rs = _sqLite.query("SELECT DISTINCT date(time_login) AS dt FROM login;");
while (rs.next()) {
try {
String tmpStr = rs.getString("dt");
retList.add(tmpStr);
} catch (SQLException e) {
... |
b663b5bc-cd4b-4733-8872-42e6b1f51071 | 4 | @Override
protected void onTextMessage(CharBuffer text) throws IOException {
Message message = new Message(text.toString());
RoboBase robo_base = RoboBase.getInstance();
String status;
switch (message.getCommand()) {
case LOGIN:
status = robo_base.isOnline(message.getRobotName()) ? "ok" : "error: offlin... |
51814717-dcb9-4275-b1a9-73ef59b10f34 | 7 | public void start(){
setSize(300, 300);
setTitle("Serial Port Manager");
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
SerialDevices[] devices = SerialDevices.values();
HashMap<String, String> content = PortList.readFromFile(PortList.FILE_LOCATION);
for(SerialDevices device: devices){
if(device != Ser... |
228af498-fd22-4f55-b47e-c69d05492f1a | 9 | public void start() {
// TODO Auto-generated method stub
Socket socket = null;
try {
socket = new Socket("127.0.0.1",6116);
} catch (UnknownHostException e) {
logger.log(Level.WARNING,"Can't connect", e);
} catch (IOException e) {
logger.log(Level.WARNING,"Can't io", e);
return;
}
if(socket ==... |
ac87dd14-7811-4811-a9ca-34ef67b1514f | 9 | public static void main(String[] args) {
String keyPass = "fanjun" ;
InputStream inputStream = CertificateSignatureMain.class.getResourceAsStream("rsa.jks");
InputStream inStream = CertificateSignatureMain.class.getResourceAsStream("rsa.cer");
try {
KeyGenerator kg = KeyGenerator.getInstance("AES");
k... |
2b20fb5b-a5ea-4841-9cd1-17cc713b401b | 3 | public static int getRotatedMapChunkX(int rotation, int y, int x) {
rotation &= 3;
if (rotation == 0) {
return x;
}
if (rotation == 1) {
return y;
}
if (rotation == 2) {
return 7 - x;
} else {
return 7 - y;
}
} |
27104bad-23e4-483a-bb73-7affef195f5d | 4 | public void update() throws IOException {
// update player
player.update();
tileMap.setPosition(
GamePanel.WIDTH / 2 - player.getx(),
GamePanel.HEIGHT / 2 - player.gety()
);
// set background
bg.setPosition(tileMap.getx(), tileMap.gety());
// attack enemies
player.checkAttack(enemies);
... |
8385c885-40fb-48f1-ad16-d7aeb4603229 | 0 | public String variableForState(State state) {
return (String) MAP.get(state);
} |
7d1e3cfb-0e6b-4829-b344-4c109461b534 | 7 | public String toTreeString( int depth ) {
StringBuilder result = new StringBuilder();
if (nodeType != NodeType.VALUE) {
result.append(indent(depth));
result.append( nodeType.toString() );
if ( valueToken != null && ( nodeType == NodeType.EXPRESSION || nodeType == Nod... |
93927153-2bc9-4151-901c-5c50f3c671ce | 9 | public static void start(File fileName) {
if(fileName==null)
return;
InstrumentReplacer replace = new InstrumentReplacer();
putInstruments();
try {
Scanner file = new Scanner(fileName);
String songText = file.nextLine();
replace.setParams... |
def6d8ce-9ee1-41ad-bfb7-126861f9a522 | 1 | public synchronized void InsertContent(String list_name, String content, int article_id) {
try {
content_ste.executeUpdate("INSERT INTO zhangyu_sca.article_content (article_id , list_name, list_content) values ( '" + article_id + "' , '" + list_name + "' , '" + content + "');");
} catch (E... |
cc1d4909-15ce-48c7-827c-fb8fd07b3c35 | 5 | public void scanThrough(int numTiles) {
for (int n = 0 ; n < numTiles ;) {
final int scanX, scanY ;
if (scan == 0) {
scanX = scanY = 0 ;
initSeeds() ;
}
else {
scan = lfsr.nextVal() ;
scanX = scan / size ;
scanY = scan % size ;
if (scan == seed... |
cf48e92f-c872-42fb-aeab-40e7932692ad | 9 | public JScrollPane createTree() {
DefaultMutableTreeNode top = new DefaultMutableTreeNode(getString("TreeDemo.music"));
DefaultMutableTreeNode catagory = null ;
DefaultMutableTreeNode artist = null;
DefaultMutableTreeNode record = null;
// open tree data
URL url = getCla... |
dba02885-c91d-4678-bd9d-1fe8db438e15 | 4 | private void itmMnuRelatorioProjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuRelatorioProjetoActionPerformed
if (usuarioLogado.getTipo().equals("Gerente") || usuarioLogado.getTipo().equals("Diretor")) {
ProjetoBO projetoBO = new ProjetoBO();
//chamar o rel... |
ce917d6b-92c9-45f5-9209-4347d73bde98 | 7 | public static boolean isWorkingDay(DayOfWeek day){
switch(day){
case MONDAY:
case TUESDAY:
case WEDNESDAY:
case THURSDAY:
case FRIDAY:
return true;
case SUNDAY:
case SATURDAY:
return false;
}
return false;
} |
19661478-9b70-460b-9af2-1f7e090a7f9d | 1 | private JLabel getLbEstado() {
if (lbEstado == null) {
lbEstado = new JLabel("Estado:");
}
return lbEstado;
} |
6708b46b-b57c-4d10-80f9-3cd847abcaa3 | 7 | private boolean isHorizontalWin(int player) throws Exception {
boolean result = false;
if ((player < 0) || (player > TicTacToeBoard.PLAYER_O)) {
throw new Exception("Invalid player index -- must be 0 or 1");
}
String playerSymbol;
if( player == PLAYER_X) {
playerSymbol = X;
} else {
playerSymbol = ... |
90705a66-6455-4452-9f89-1c55c465e44b | 0 | public Activator() {
} |
2ef6480e-ba24-47d6-8f99-5874a7adf4d6 | 9 | public static void loadSmsBase(){
ImD=new ImportDriver(getConfigDirectoryPath(), "", "");
if(ImD.verifyConnection()){
System.out.println("Connected to database fontlineSms");
try{
rs=ImD.executer("SELECT * FROM message");
if(rs !=null){
while(rs.next()){
System.... |
619c02ec-bfd3-42e7-aab5-936d1dec8fbe | 6 | private void collision(LinkedList<GameObject> object) {
for (int i = 0; i < handler.objects.size(); i++) {
GameObject tempObject = handler.objects.get(i);
switch (tempObject.getID()) {
case Block:
if (getBoundsTop().intersects(tempObject.getBounds())) {
y = tempObject.getY() + tempObject.getHeigh... |
4fffe4dd-e191-403c-9d2c-b836d63cc275 | 3 | void table3(){
int startNumber = 2;
StringBuilder currentLine = new StringBuilder();
do{
for (int secondMultNumber = 1; secondMultNumber <= 10; secondMultNumber++) {
for (int firstMultNumber = startNumber; firstMultNumber < startNumber + 4; firstMultNumber++) {
... |
23995f72-1f2c-47c9-a76a-5d770ff26a00 | 7 | public CheckResultMessage checkG(int day) {
BigDecimal g = new BigDecimal(0);
int row1 = get(10, 2);
int clums1 = get(11, 2);
int total1 = get(13, 2);
if (version.equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
for (int i = row1; i < total1; i++) {
... |
d0c1e3d2-eb67-4d88-959d-7f5f2809edd2 | 2 | public static double angle2DBetween(double[] coord1, double[] coord2)
{
if (coord1.length != coord2.length && coord1.length != 2)
throw new IllegalArgumentException (
"Number of dimensions is not valid for the provided coordinates");
double xDiff = coord2[0] - coord1[0];
double yDiff = coord2[1] - coo... |
1d13ff95-72e4-46c4-947f-912ab2a14a65 | 3 | @Test
public void testMeilleurParcour()
{
Random rand = Mockito.mock(Random.class);
LandSensor sensor = new LandSensor(rand);
// On crée un chemin de terre.
Mockito.when(rand.nextInt(Land.CountLand())).thenReturn(0);
try {
sensor.getPointToPointEnergyCoeffic... |
f8578efc-ab84-402e-86b5-da1ae806dc8e | 5 | private CycAccess establishAndVerifyCycAccess(final String hostname, final String port)
throws UnknownHostException, IOException, CycApiException {
final StringBuffer hostnamePortBuffer = new StringBuffer();
hostnamePortBuffer.append(hostname);
hostnamePortBuffer.append("/");
hostnamePortBuffer.app... |
88a881d3-7a0d-46e4-9fa7-13d8a4bc44b3 | 3 | private boolean korjaaSijainti()
{
ArrayList<Suunta> suunnat = paivitaTormaystarkistus().suunnat();
if(suunnat.isEmpty())
return true;
else if(suunnat.contains(Suunta.OIKEA))
return yritaPoistuaTormaamasta(Suunta.VASEN);
else if(suunnat.contains(Suunta.VASEN)... |
4f62887e-37eb-4936-86fe-2ce63c4e771f | 1 | @Override
public List<NepticalData> getAllData() {
if (fragments.isEmpty()) {
return new ArrayList<>();
}
return getDataModule(fragments.get(fragments.size() - 1)).getAllData();
} |
0e27dc89-7bf1-40dd-bdd0-f073acf9b676 | 1 | public synchronized void start(){
if(running)
return;
running = true;
thread = new Thread(this);
thread.start();
} |
edd795b6-e10c-4b86-8d6a-e79f2632fb97 | 7 | public void loadHeader(BufferedReader bin) throws MaltChainedException {
String fileLine = "";
Pattern tabPattern = Pattern.compile("\t");
try {
while ((fileLine = bin.readLine()) != null) {
if (fileLine.length() == 0 || fileLine.charAt(0) != '\t') {
break;
}
String items[];
try {
ite... |
be0d4c0c-2b8a-403e-9479-46d1c02b756b | 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... |
9a62b650-6476-44ba-844d-92cab39d6c03 | 8 | private Vector2f rectCollide(Vector2f oldPos, Vector2f newPos, Vector2f size1,
Vector2f pos2, Vector2f size2){
Vector2f res = new Vector2f(0, 0);
if(newPos.getX() + size1.getX() < pos2.getX() ||
newPos.getX() - size1.getX() > pos2.getX() + size2.getX() * size... |
198cc4e8-c185-4c70-9e4e-a684e95f0d1c | 7 | @Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Type)) {
return false;
}
Type t = (Type) o;
if (sort != t.sort) {
return false;
}
if (sort >= ARRAY) {
... |
7a744a56-d3f7-4763-80df-5623da422b44 | 9 | public void Afficher()
{
String res = "";
for (int i = 0; i < this.hauteur; i++)
{ // Parcours le premier tableau
for (int j = 0; j < this.largeur; j++)
{ // Parcours le second tableau
switch (this.background[i][j])
{
case MUR : res = res +"M"; break;
case HERBE : res = res +... |
778509e6-33d1-4d83-8d36-e8682ca6a7aa | 8 | @Override
public Iterable<ImmutableToken> tokenizeDocument( String document
, Set<String> stopwords
)
{
PorterStemmer stemmer = new PorterStemmer();
int index = 0;
Matcher whitespaceMatcher = null;
List<ImmutableToken> tokens = new ArrayList<ImmutableToken>();
while(document !=null... |
eca1030d-e1e8-4521-935c-1037d7224c7a | 3 | public void mouseReleased(MouseEvent e) {
if (documentViewModel.getViewToolMode() ==
DocumentViewModel.DISPLAY_TOOL_TEXT_SELECTION) {
textSelectionHandler.mouseReleased(e);
} else if (documentViewModel.getViewToolMode() ==
DocumentViewModel.DISPLAY_TOOL_SELECT... |
4fbf3142-cd44-485c-8dc3-1bdd4ef6ea34 | 3 | public void draw(Graphics2D g) {
bg.draw(g);
tileMap.draw(g);
player.draw(g);
for (int i = 0; i < enemys.size(); i++)
((Enemy) enemys.get(i)).draw(g);
teleport.draw(g);
for (int i = 0; i < explosions.size(); i++) {
((Explosion) explosions.get(i)).setMapPosition(
(int) tileMap.getx(), (int) tileMa... |
8b61c718-1d0e-4321-b458-37e6594966bc | 4 | @EventHandler(priority = EventPriority.MONITOR)
public void onEnchant(EnchantItemEvent event){
Player player = (Player)event.getEnchanter();
String playername = player.getName();
World world = player.getWorld();
Boolean staff = false;
String worldname = world.getName();
Map<Enchantment, Integer> ench = e... |
4701b2ea-5905-4413-8ead-2922fae8ae24 | 0 | public static void main(String[] args) {
String[] hostNames = initializeHostNames();
// Parse the parameters (fill gaps with defaults):
Alloy alloy = parseInput(args, hostNames);
// Run stuff:
buildAndRunGui(alloy, hostNames);
alloy.runSimulation();
... |
97930b87-ae85-4ee9-ba55-2be9e8b1d512 | 6 | public boolean reserveSeat(int theaterId, int line, int column){
if(line == -1 || column == -1)
return false;
TheaterSeats seats = TheaterSeatsCatalog.getTheaterSeats(theaterId);
//if it isn't on cache, then we must seek on the disk
if(seats == null){
seats = loadSeatsFromDisk(new File(workingDir + Fi... |
a25119de-7390-45d5-947e-70fd2f7c16eb | 5 | final void method1716(boolean bool) {
anInt6050++;
if (bool != false)
method1714(-51, -128);
if (((Class348_Sub51) ((Class239) this).aClass348_Sub51_3136)
.aClass239_Sub25_7271.method1830((byte) -123)
&& !Node.method2714(7351,
((Class348_Sub51)
((Class239) this).aClass348_Sub51_3136)
... |
43857eec-0530-4361-af0d-9fee8319c92a | 6 | public void save(ConnectionWrapper cw, String subClassName, Long realId) throws SQLException
{
// store a reference to the subclass table entry
Integer subClassNameId = adapter.getPersist().getClassNameNumberMap().getNumber(cw, subClassName);
addValueTrio(Defaults.REAL_CLASS_COL, subClassNameId, Integer.class);
... |
d05aa72f-d08a-4d5c-9e61-1ddb392bc395 | 9 | public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term,
final float minSimilarity, final int prefixLength, boolean transpositions) throws IOException {
if (minSimilarity >= 1.0f && minSimilarity != (int)minSimilarity)
throw new IllegalArgumentException("fractional edit distances are not all... |
11cdbe09-201c-41e8-8c2c-e1daa13a9fcd | 2 | private void lockOnReportDir(File reportDir) {
synchronized (files) {
while (files.contains(reportDir))
try {
files.wait();
} catch (InterruptedException ex) {
logger.log(SEVERE, Thread.currentThread().getName() +" INTERRUPTED",... |
c6fedd12-d526-43d2-ab4d-aae330b4a6f6 | 0 | public void templateMethod() {
System.out.println("前処理:" + LoggerUtils.getSig());
// 独自処理はサブクラスで実装
method();
System.out.println("後処理:" + LoggerUtils.getSig());
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.