method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
90b65c91-9836-4cbf-8c4e-9fa5adcd9da4 | 3 | static public DataType getDataType(String typeNumber) throws IncorrectFormatOfData {
boolean dataException = true;
DataType dataType = null;
for (DataType type : DataType.values()) {
if (type.getDataTypeValue().equals(typeNumber)) {
dataException = false;
... |
70954b8b-db3b-481f-9a65-e3d14e91ab33 | 8 | @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent e) {
Player player = e.getPlayer();
Block blockClicked = e.getClickedBlock();
ItemStack heldItem = e.getItem();
if (blockClicked.getState() instanceof InventoryHolder) {
if (RandomShop.creatingShop.... |
e4ad502a-2ddb-4181-9fb1-926c5c1f4f39 | 7 | @Override
public void affectPhyStats(Physical affected, PhyStats affectableStats)
{
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if(mob.isInCombat())
{
final Weapon W1=getFirstWeapon(mob);
final Weapon W2=getSecondWeapon(mob);
if((W1!=null)&&(W2!=null)
&&(W1.weaponClassifica... |
d9ca2612-22ce-4393-a920-35381a917e47 | 3 | @Test
public void testShareName() {
try {
for (int i = 0; i < 2; i++) {
account.buyShare("daniel", "BMW", 2);
account.buyShare("daniel", "Opel", 2);
account.buyShare("daniel", "Merzedes", 2);
account.sellShare("daniel", "BMW", 2);
account.sellShare("daniel", "Opel", 2);... |
d91fc8a0-a654-4a44-be0a-5bb6a3203a3f | 1 | public boolean hasPower(Integer powerUp) {
if(powers.get(powerUp) != null) {
return powers.get(powerUp).isActivated();
}
else return false;
} |
1261fab2-9fdf-449f-bd30-86f83650aba9 | 1 | private void openURL (String url) throws IOException, URISyntaxException{
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.BROWSE)){
desktop.browse(new URI(url) );
}
} |
ccad58ca-83ad-44de-a966-51ef5f96e06a | 0 | public MainWindowModel() {
} |
f6032c4e-c986-493c-95fd-93564078b965 | 6 | void doDelete() {
int i;
pushUndo();
setMenuSelection();
boolean hasDeleted = false;
for (i = elmList.size() - 1; i >= 0; i--) {
CircuitElm ce = getElm(i);
if (ce.isSelected()) {
ce.delete();
elmList.removeElementAt(i);
... |
cd221ba8-ec63-4e8f-bea8-3cfa9d202fe3 | 5 | public void checkCollisions() {
Rectangle r3 = craft.getBounds();
for (int j = 0; j<aliens.size(); j++) {
Alien a = (Alien) aliens.get(j);
Rectangle r2 = a.getBounds();
if (r3.intersects(r2)) {
craft.setVisible(false);
a.setVisible(f... |
23b7880c-a173-4e14-bc11-f70358eb5db9 | 8 | static private int jjMoveStringLiteralDfa12_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(10, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0);
return 12;
}
switch(curChar)
{
... |
42c9bdf3-8803-4bb2-9d6f-3f0efb299883 | 9 | final public void Constant_expression() throws ParseException {
/*@bgen(jjtree) Constant_expression */
SimpleNode jjtn000 = new SimpleNode(JJTCONSTANT_EXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
if (jj_2_5... |
77d5e752-fd49-4d7c-b857-e79423492467 | 3 | public void generateSubsciptionFiles(String endpoint, String graph,
String directory) {
URL url = getClass().getResource(File.separator);
String dir = url.getPath() + directory;
Repository myRepository = new HTTPRepository(endpoint, "store");
try {
myRepository.initialize();
RepositoryConnection c... |
37735a9f-f5c5-4179-b7b4-12236f2b5571 | 3 | public void run() {
boolean wasInterrupted = false;
try {
wash();
}
catch (InterruptedException e) {
wasInterrupted = true;
}
catch(RTInterrupted e) { // Thrown by semaphores
wasInterrupted = true;
}
if (wasInterrupted) {
System.out.println("Washing program aborted.");
myTempController... |
77624ccb-023f-4002-973c-e4eee778be48 | 0 | public void setPass_code(String passCode) {
pass_code = passCode;
} |
b29cfd55-103c-444c-9a6d-140b03658d0d | 6 | public void setRight(FileAccessor accessor, FileRight right, boolean set) {
int index = 0;
if (right == FileRight.READ) {
index = 0;
} else if (right == FileRight.WRITE) {
index = 1;
} else if (right == FileRight.DELETE) {
index = 2;
} else if... |
6e17bb1b-4535-48f8-aba2-ffe59dc29c44 | 3 | public static void ExecuteDailyTask(int hour, int minute, TimerTask task)
{
//New calendar
Calendar now = new GregorianCalendar();
int presentHour = now.get(Calendar.HOUR_OF_DAY);
int presentMinute = now.get(Calendar.MINUTE);
//first execution and successives
Calen... |
d67bc7d5-cf36-4356-9c41-69141ea0134e | 8 | public void removeLineFromFile(String file, String lineToRemove) {
try {
File inFile = new File(file);
if (!inFile.isFile()) {
System.out.println("Parameter is not an existing file");
return;
}
//Construct the new file that will later be renamed to the origin... |
f71fbb5e-40af-4b24-b06b-111f0b7cb57e | 7 | public static byte[] parseSong(String song, int sps)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
boolean sharp = false;
int scale = '4';
int lastNote = -1;
int tempo = 120 * 2; //*2 for since everything is an eighth note
int volume = 24;
try
{
for (int i = 0; i < song.length(); i++)
... |
305e9691-8819-4809-a92d-8b4a5225a152 | 6 | public void endElement(String namespaceURI, String localName, String rawName)
throws SAXException {
if (rawName.equals("author")) {
article.addAuthor(content);
} else if (rawName.equals("title")) {
article.setTitle(content);
} else if (rawName.equals("pages")) {
article.setPages(content);
} else if ... |
d026b47d-0e28-4175-a577-8533ebd429db | 9 | @Override
public void keyPressed(KeyEvent e) {
if(e.getExtendedKeyCode()==KeyEvent.VK_DOWN)
{ controler.control("B");}
if(e.getExtendedKeyCode()==KeyEvent.VK_LEFT)
{
controler.control("G");
}
if(e.getExtendedKeyCode()==KeyEvent.VK_R... |
56ee0c35-7c43-4505-9300-afae4c3acadd | 3 | public double[][][] getGridD3ydx1dx2dx3(){
double[][][] ret = new double[this.lPoints][this.mPoints][this.nPoints];
for(int i=0; i<this.lPoints; i++){
for(int j=0; j<this.mPoints; j++){
for(int k=0; k<this.nPoints; k++){
ret[this.x1indi... |
d2e2913e-3210-4eef-a767-3dc3eef65943 | 5 | public HashMap getInfo(String link){
String sourceName = "京东图书";
String html = GetHTML.getHtml(link,"gb2312");
Document document = Jsoup.parse(html);
String smalldesc = document.select("div#product-intro").select("div#name").select("h1").text();
String pagePicLink = document.sele... |
7a9a9be4-dcdd-42c4-ad4d-1b83afbe0e22 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IndexRange that = (IndexRange) o;
if (empty != that.empty) return false;
if (fromIndex != that.fromIndex) return false;
... |
3659a7ec-bf64-46d8-a9b3-cab2d2532b6e | 8 | public static boolean equal(BinaryTreeNode t1, BinaryTreeNode t2) {
if (t1 == null && t2 == null) {
return true;
}
if ((t1 == null && t2 != null) || (t1 != null && t2 == null)) {
return false;
}
if (t1.data != t2.data){
return false;
}
boolean leftAreEqual = equal(t1.leftChild, t2.lef... |
0608c2e8-93d9-46c4-a181-6d729c89682f | 2 | public static void printPath(int i, int j, Double[][] P)
{
// System.out.println("PRINT_PATH: i=" + i + " j=" + j + " P[" + i + "][" + j +"]=" + P[i][j].intValue());
if(P[i][j] != -1.0 && P[i][j].intValue() != i)
{
printPath(i, P[i][j].intValue(), P);
System.out.print(P[i][j].intValue() + "->");
printPat... |
e9ec4b6e-7dba-4fa9-973f-d409dfe003da | 0 | public String getEventName() {
return eventName;
} |
a8091057-7570-4ad7-8d3f-4c758b91e3f0 | 9 | private OrderedAnswer getChosenOrderedAnswer() {
String l1 = GuiUtils.stripHtmlWrappedString(this.jLabel3.getText());
String l2 = GuiUtils.stripHtmlWrappedString(this.jLabel5.getText());
String l3 = GuiUtils.stripHtmlWrappedString(this.jLabel6.getText());
String l4 = GuiUtils.stripHtmlWr... |
aeedff6f-2f97-4dae-94cf-9d67e3383898 | 8 | public void paint(Graphics g) { //function for painting and displaying
super.paint(g);
if (ingame) { //paints/repaints if the game is in process (refer to "in game")
g.drawImage(bg.getImage(), bg.getX(), bg.getY(), //draws the paddle
bg.getWidth(), bg.getHeight(), this); ... |
cd976f76-a255-4496-9c64-851e85140693 | 4 | @Override
protected void detectOptionArgument( OptionParser parser, ArgumentList arguments, OptionSet detectedOptions ) {
if ( arguments.hasMore() ) {
String nextArgument = arguments.peek();
if ( !parser.looksLikeAnOption( nextArgument ) )
handleOptionArgument( parse... |
6000bbec-f9c0-4277-b4b6-da4348841d26 | 7 | @Override
public String translate(String text) {
if (!isCorrect(text))
return "TEXT IS NOT CORRECT";
String serviceUrl = "http://lingvopro.abbyyonline.com/ru/Translate/%s-%s/%s";
String resultUrl = "";
String translate = "";
try {
resultUrl = String.format(serviceUrl, sl, tl,
URLEncoder.encode(t... |
9989fc9b-ec16-43cb-88cd-f9d21364fbc0 | 0 | @Override
public String toString() {
return String.format("[%1$-3d]", priority) + " Task id : " + id;
} |
76bba062-9de3-4390-80d5-0c85b0f872f1 | 9 | static final public void inicio() throws ParseException {
trace_call("inicio");
try {
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NUMBER:
case STRING:
case IF:
case WHILE:
case OUTPUT:
case INPUT:
case VARIAVEL:... |
6ce7565f-1031-42aa-a400-5bce20fb6a53 | 5 | private static void executeUserCommand(String command, Field field) {
switch (command) {
case SAVE_COMMAND:
SaveLoad.saveGame(field);
break;
case SURRENDER_COMMAND:
field.openField();
break;
default:
... |
635a4bee-96c4-4f66-84c2-2867a57f3750 | 9 | public boolean remove(String target) {
boolean ret = false;
if (this.searchPrefix(new StringBuilder(target)) == IS_WORD_ONLY ||
this.searchPrefix(new StringBuilder(target)) == IS_PREFIX_AND_WORD) {
LinkedList curList = this.root;
Node iter = curList.head;
... |
a911a6f2-154d-49f7-9437-b9baa3b9ec33 | 9 | private boolean r_vowel_suffix() {
int v_1;
int v_2;
// (, line 170
// try, line 171
v_1 = limit - cursor;
lab0: do {
// (, line 171
// [, line 172
... |
fbc9c126-8947-4859-9e89-0429cf16e094 | 9 | public List<BundleDescriptor> scanForBundles(String filterString,ClassLoader loader) throws Exception
{
Filter filter = (filterString != null) ? FrameworkUtil.createFilter(filterString) : null;
loader = (loader != null) ? loader : getClass().getClassLoader();
Set<String> bundledJars = ... |
d7d2be6e-e291-4086-b3ad-62d592b4fb00 | 2 | public void compact() {
ConstPool cp = compact0();
ArrayList list = methods;
int n = list.size();
for (int i = 0; i < n; ++i) {
MethodInfo minfo = (MethodInfo)list.get(i);
minfo.compact(cp);
}
list = fields;
n = list.size();
for (i... |
727660da-7398-43fa-8d2c-102b6ad82295 | 2 | public boolean isConsoleOpen() {
HUD hud = null;
for (int i = (huds.size() - 1); i >= 0; i--) {
hud = huds.get(i);
if (hud.getName().equals("Console")) {
return hud.getShouldRender();
}
}
return false;
} |
d3ef61dc-12a9-46f8-b346-12344a06669a | 0 | public Frame(Brett spielBrett, Spiel s) {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
GridBagLayout gbl_contentPane = new GridBagLayout();
gbl_con... |
0be6068f-93b6-4883-928b-ae02cab3b6ed | 5 | public Form theLastEmpty (boolean[][] newField, int[] type){ //если осталось место только на 1 фигуру
Block tempBlock = findEmpty(newField);
for (int i = 0; i < type.length; i++){
whatAForm(type[i], tempBlock.x, tempBlock.y);
if (!newField[block[0].x][block[0].y] && !newField[blo... |
4ac0acb6-ee96-4e76-9e73-f12e5e0d7d1a | 1 | public void draw(Graphics g, Player p, double width, double height){
BufferedImage hud = ImageLibrary.get("hudSprite.png");
int x = (int)(width-hud.getWidth());
int y = 0;
g.drawImage(hud,x,y,null);
int barX = 60;
int barY = 20;
int barLength = 183-60;
int barHeight = 25-20;
g.setColor(Color.YELLOW);
... |
ab46eb2e-430f-48d1-aa0d-8d9a96a1be9d | 3 | public boolean changeOwner(String newOwner, Hexpos hp) {
String oldOwner = (String) owner.get(hp);
// check if newOwner is a valid string
if (!(newOwner == null || newOwner.equals("red") || newOwner
.equals("blue")))
return false;
// decrease the count of squares of the old owner,
// and increase for ... |
9b03a737-cb6c-4623-8519-149502f2bcc6 | 5 | public void setPlotData(List<PlotData> plotDataList) {
this.plotDataList = plotDataList;
minX = Double.POSITIVE_INFINITY;
minY = Double.POSITIVE_INFINITY;
maxX = Double.NEGATIVE_INFINITY;
maxY = Double.NEGATIVE_INFINITY;
for (PlotData pd : plotDataList) {
if (pd.getMinPoint().x < minX) {
minX = pd.ge... |
8a86b9b5-8c1b-47a3-b670-dbc69ad4cd05 | 1 | public User authenticate(String login, String password) {
User found = new User();
String jpql = "select d from User d where d.login=:p1 and d.pwd=:p2";
Query query = u.createQuery(jpql);
query.setParameter("p1", login);
query.setParameter("p2", password);
try{
found = (User) query.getSingleResult();
}... |
553f8cb8-afa3-4fed-b8d0-9a40361cda85 | 3 | private static void createNewPlayer( final ProxiedPlayer player ) throws SQLException {
String ip = player.getAddress().getAddress().toString();
SQLManager.standardQuery( "INSERT INTO BungeePlayers (playername,lastonline,ipaddress,channel) VALUES ('" + player.getName() + "', NOW(), '" + ip.substring( 1,... |
f1bcca97-9347-4a4c-96ca-cfc0c4ca4a82 | 8 | public UserDTO setUser( UserDTO user ) throws DAOException{
query = "";
query += "INSERT INTO chat_user \n";
query += "( nickname, passwd, register_date, status, email ) \n";
query += "VALUES \n";
query += "( ?, ?, now( ), ?, ? ) \n";
try{
connection = DBManager.getConnection( );
statement = c... |
9004559b-2757-454c-9792-674b1fb8046f | 9 | private static Alignment traceback(Sequence s1, Sequence s2, Matrix m,
byte[] pointers, Cell cell, short[] sizesOfVerticalGaps,
short[] sizesOfHorizontalGaps) {
char[] a1 = s1.toArray();
char[] a2 = s2.toArray();
float[][] scores = m.getScores();
int n = s2.len... |
ec5b7f85-2df7-4c6c-a6ef-2bc5b390ad87 | 6 | public void drawSprite3(int x, int y, int opacity) {
int alpha = opacity;
x += this.anInt1442;// offsetX
y += this.anInt1443;// offsetY
int destOffset = x + y * DrawingArea.width;
int srcOffset = 0;
int height = this.myHeight;
int width = this.myWidth;
int destStep = DrawingArea.width - width;
int src... |
0418880b-8dce-4099-883a-76db8fa408ac | 2 | public static double[] getPageSize(PrintService service, PrintRequestAttributeSet set, LengthUnits units) {
PageOrientation orientation = getPageOrientation(service, set);
double[] size = getPaperSize(service, set, units);
if (orientation == PageOrientation.LANDSCAPE || orientation == PageOrientation.REVERSE_LAN... |
68d34e1a-6780-4d6a-af68-be03b1f0a9d1 | 1 | public void getFps() {
delta = getTime() - currentTime;
currentTime = getTime();
lastLoopTime += delta;
fps++;
//System.out.println(delta);
if(lastLoopTime >= 1000) {
Camera.get().updateHeader();
currentfps = fps;
fps = 0;
lastLoopTime = 0;
}
} |
4b8d902f-633b-432a-9cb8-77f6ab82088e | 9 | public static void main(String[] args) throws InstantiationException, IllegalAccessException
{
Organism.mutationMethod = MUTATION_MODE.newInstance();
Organism.perfectOrganism = new Organism(GOAL_ORGANISM_COLOR);
final ArrayList<Organism> organism = new ArrayList<Organism>();
... |
aa066168-b0c2-4b1b-9da9-71c35b433225 | 8 | public static org.jdom2.Document recevoirCommande(String nom) throws IOException {
org.jdom2.Document res = null;
try {
gbu = (IGestionBoutiques) Naming.lookup("rmi://localhost/GestionBoutiques");
} catch (NotBoundException ex) {
Logger.getLogger(ConnexionThreadClientComm... |
9508433a-0bf0-48ee-a608-2dc48cc3d722 | 9 | public void setUp() throws Exception {
log.trace("Node1::setUp()");
context = NodeTool.createContext("/META-INF/spring/node11.xml");
// Paxos Group A
leaderA = (PaxosLeader) context.getBean("protocolAL");
followerA = (PaxosFollower) context.getBean("protocolA1");
followerA.addListener(new ProposalListene... |
a6efa970-ad57-450c-93f6-09e82035c1d2 | 6 | public int match_main(String text, String pattern, int loc) {
// Check for null inputs.
if (text == null || pattern == null) {
throw new IllegalArgumentException("Null inputs. (match_main)");
}
loc = Math.max(0, Math.min(loc, text.length()));
if (text.equals(pattern)) {
// Shortcut (potentially not gua... |
ce454bdd-df38-49a7-b178-c4d2fdbc9fd2 | 0 | public void setPartC(PartC partC) {
this.partC = partC;
} |
7f6b3da6-af7f-4d85-999e-982258040881 | 4 | boolean dinicBfs(int src, int dest, int[] dist) {
Arrays.fill(dist, -1);
dist[src] = 0;
int[] Q = new int[V];
int sizeQ = 0;
Q[sizeQ++] = src;
for (int i = 0; i < sizeQ; i++) {
int u = Q[i];
for (Edge e : ady[u]) {
if (dist[e.t] < 0 && e.f < e.cap) {
dist[e.t] = dist[u] + 1;
Q... |
3521e95b-46a2-4d5b-8fb3-d031d980d581 | 5 | private String saveCrashInfo2File(Throwable ex) {
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
ex.printStackTrace(printWriter);
writer.append("\n-------feng-ge-xian-------\n\n");
Throwable cause = ex.getCause();
while (cause != null) {
cause.printStackTrac... |
548af655-3e50-4609-8505-4e4ba0045659 | 2 | public Robot getLastRobot()
{
double min = Double.MAX_VALUE;
Robot mr = null;
for(Robot r : this.robots)
{
if(r.getTime() < min)
{
mr = r;
min = r.getTime();
}
}
return mr;
} |
0955b7e8-1203-4e9d-8e85-6eeaf5af5ce5 | 7 | public boolean addSkillXP(int amount, int skill){
if (amount+c.playerXP[skill] < 0 || c.playerXP[skill] > 200000000) {
if(c.playerXP[skill] > 200000000) {
c.playerXP[skill] = 200000000;
}
return false;
}
amount *= Config.SERVER_EXP_BONUS;
int oldLevel = getLevelForXP(c.playerXP[skill]);
c.playerX... |
b6fcc4ec-3c60-49a7-b935-ed7b9129c923 | 0 | @Column(name = "PCA_POS_ID")
@Id
public Integer getPcaPosId() {
return pcaPosId;
} |
71ace76c-f7ef-4af1-bf70-2c24d08d15f9 | 8 | public void poll() {
Keyboard.enableRepeatEvents(false);
keyEvents.clear();
keyPressEvents.clear();
mouseEvents.clear();
mousePressEvents.clear();
while (Keyboard.next()) {
Integer k = Keyboard.getEventKey();
boolean down = Keyboard.getEventKeyState();
keyEvents.add(new Duple<Integer, Boolean>(k, d... |
9c6ceb03-e54e-4db9-bc66-93827241e019 | 5 | public void keyReleased(KeyEvent key) {
int keyCode = key.getKeyCode();
if(keyCode ==KeyEvent.VK_LEFT){
player.setLeft(false);
}
if(keyCode ==KeyEvent.VK_RIGHT){
player.setRight(false);
}
if(keyCode ==KeyEvent.VK_UP){
player.setUp(false);
}
if(keyCode ==KeyEvent.VK_DOWN){
player.setDown(fals... |
1cb2e9cb-e5bb-43c4-9e89-4c340695accd | 4 | private LinkedHashMap<String, String> getStarsInRashiWithPadam() {
LinkedHashMap<String, String> starsInRashiWithPadam = new LinkedHashMap<String, String>();
ArrayList<String> starsPadamList = new ArrayList<String>();
for (Nakshatra nakshatra : Nakshatra.values()) {
for (int i = 1; i <= 4; i++) {
starsPad... |
a1636f10-f97a-4294-a5ab-96e301947c29 | 1 | public void add(Items item) {
// System.out.println("adding " + item.toString());
if (this.head == null) {
// The list is empty.
this.head = item;
this.last = item;
} else {
// The list is NOT empty.
this.last.setNext(item);
... |
63505964-5e53-454f-8ef6-6e610264d329 | 1 | public List<Plaga> ObtenerPlagas(String consulta){
List<Plaga> lista=new ArrayList<Plaga>();
if (!consulta.equals("")) {
lista=cx.getObjects(consulta);
}else {
lista=null;
}
return lista;
} |
8d7c415d-35dd-4c25-bc6d-5e7f688913b0 | 4 | public void checkType(Symtab st) {
exp1.setScope(scope);
exp1.checkType(st);
exp2.setScope(scope);
exp2.checkType(st);
if (!exp1.getType(st).equals("int")
&& !exp1.getType(st).equals("decimal")) {
Main.error("type error in leq!");
}
if (!exp2.getType(st).equals("int")
&& !exp2.getType(st).equal... |
144b769a-9c1e-4684-9798-a23403ad2b12 | 3 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._avalie_ == child)
{
this._avalie_ = null;
return;
}
if(this._estrCaso_.remove(child))
{
return;
}
if(this._senao_.re... |
e934dc30-2f31-4a85-96f4-e56992efc4b5 | 9 | public static GameState read(String saveName) {
JSONParser parser = new JSONParser();
try {
FileReader fileReader = new FileReader(saveName + ".json");
JSONObject jsonGame = (JSONObject) parser.parse(fileReader);
JSONObject jsonPlayer = (JSONObject) jsonGame.get("Player");
JSONArray jso... |
4ac3ba84-72d5-444c-9e66-eb247ef93ba4 | 5 | protected void movesToward(VGDLSprite target)
{
double distance = this.physics.distance(rect, target.rect);
for(Direction act : Types.DBASEDIRS)
{
//Calculate the distance if I'd apply this move.
Rectangle r = new Rectangle(this.rect);
r.translate((int)act... |
69e1c8a5-f574-4c43-a9d7-96a7f79c0ccb | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
2909d625-90bc-473e-a422-7330e1b73802 | 0 | public void paintPath(DrawableItem di, Graphics2D g) {
drawShape(di, g);
} |
2b28bfca-e63a-4747-9408-d9211d222f7a | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Genre other = (Genre) obj;
if (genreNr != other.genreNr)
return false;
if (naam == null) {
if (other.naam != null)
return false;
} ... |
e0746287-600c-4190-af09-e1247f294fd9 | 8 | protected boolean disconnectOutput(NeuralConnection o, int n) {
int loc = -1;
boolean removed = false;
do {
loc = -1;
for (int noa = 0; noa < m_numOutputs; noa++) {
if (o == m_outputList[noa] && (n == -1 || n == m_outputNums[noa])) {
loc =noa;
break;
}
}
if (loc >... |
0ae82a9b-31f2-4afa-94cf-698582300e1c | 5 | private long readSample() throws IOException, WavFileException
{
long val = 0;
for (int b=0 ; b<bytesPerSample ; b++)
{
if (bufferPointer == bytesRead)
{
int read = iStream.read(buffer, 0, BUFFER_SIZE);
if (read == -1) throw new WavFileException("Not enough data available");
bytesRead = read;... |
1921dc1c-fa9d-4c98-9fec-ce305508a407 | 8 | public static void validatePassword(String password, String username, Errors err) {
if(password == null || password.isEmpty()) {
err.rejectValue("password", "password.empty");
} else {
if (password.length() < PASSWORD_MIN_LENGTH) {
err.rejectValue("password", "password.length", new Integer[]{ PASSWO... |
2463b82f-ff9a-4db9-bbca-605f2ca95c45 | 3 | private void CommandNewSource(boolean priority, boolean toStream,
boolean toLoop, String sourcename, FilenameURL filenameURL,
float x, float y, float z, int attModel, float distORroll) {
if (soundLibrary != null) {
if (filenameURL.getFilename().matches(
SoundSystemConfig.EXTENSION_MIDI)
&& !SoundSy... |
c2984adf-475f-44b5-a6e3-8744a152887a | 1 | public static void closeConnections() {
String dbType = ConfigurationManager.getProperty("db.type").toUpperCase();
switch (dbType) {
case "MYSQL": MysqlDaoFactory.closeConnections();
}
} |
885028aa-ec0c-4428-92fa-b90fc6f3998e | 4 | public int[] generateSampling(int[] A, int m) {
if (A == null || A.length <= m || m <= 0) {
return A;
}
int[] subSet = new int[m];
generateSamplingCore(A, A.length - 1, m);
for (int i = 0; i < m; i++) {
subSet[i] = A[i];
}
return subSet;
... |
37ff73ce-6c42-4cff-8f27-b95bdeb68a67 | 9 | public String findNamespace(String namespace) {
Map<String, List<String>> allNamespaces = new LinkedHashMap<String, List<String>>();
for (String n : getNamespaces()) {
allNamespaces.put(n, new ArrayList<String>(Arrays.asList(n.split(":"))));
}
List<String> found = new ArrayL... |
423cd099-211f-4426-b3da-a46c6007a96d | 2 | public static boolean isRecognizedFileExtension(String fileExtension) {
boolean isRecognizedFileExtension = false;
if ((null != fileExtension) && (!fileExtension.isEmpty())) {
String[] recognizedExtensions;
String extensions = ValidatorProperties.getInstance().getProperty(
PropertyKeys.RECOGNIZED_FILE_EX... |
cfbd588e-e035-4977-964e-9c5a379c74af | 8 | private Graph<TypedVerTex, DefaultEdge> generateGraph(Tuple<double[][], String[][]> params) throws UserError {
double[][] data1=params.getKey();
//String [][]data2=params.getValue();
int noTypes=(int)data1[0][0];
int noNoRels=(int)data1[0][1];
//------------
BuildHeteGraph x=new BuildHeteGraph();
List<I... |
9cc66128-e29d-4984-8613-4dd91668cd53 | 8 | public void postVisit(Graph<String, String>.Vertex v) {
if (!done.contains(v.getLabel())) {
done.add(v.getLabel());
circle.remove(v.getLabel());
if (preReq.get(v.getLabel()) != null) {
if (fileInfoMap.get(v.getLabel()) != null) {
... |
f7eb0f95-5c16-40c2-9bb5-eeb5b7fa946d | 7 | public static void editLineFromFile(String file, String lineToEdit, String lineValueToReplace, String lineReplacementValue)
{
try
{
File inFile = new File(file);
File tempFile = new File(inFile.getAbsolutePath() + ".tmp");
BufferedReader br = new BufferedReader(new FileReader(file));
Print... |
c3e02e64-5818-4d69-84ec-5c42500ba59f | 6 | @Override
protected void paintOVComponent(Graphics2D g2d) {
Color c = new Color(255, 255, 255, 100);
if (getMode().isExec()) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
c = getBackground();
if (action_ == DragAction.PRESSED) {
c = c.darker();
} e... |
6ab574b5-5c6e-4d4d-aa15-56f82e96f067 | 2 | @Override
public void run() {
try {
Socket socket = new Socket(BananaBankBenchmark.SERVER_ADDRESS, BananaBankBenchmark.PORT);
PrintStream ps = new PrintStream(socket.getOutputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
ps.println("SHUTDOWN");
... |
3416b28d-aaef-4d79-81aa-9cc8a948f367 | 8 | @Override
public String List_files(String id) {
String texto_html = "";
try {
this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE);
String sql = "select a.NO_FILE,a.NO_ORIGINAL from RHTV_ARCHIVO_DOCUMENTO a , RHTV_DOCUMENTO_ADJUNTO d where d.ID_DOCUMENTO_ADJUNTO... |
75c4486e-b610-4193-9a99-270975ee7caf | 1 | @Override
public String getRecordID() {
String rowID = row.getMdkey();
if (rowID == null) {
rowID = FPConstants.DETAIL_ID;
}
return rowID;
} |
74e9c3f1-35a0-46c8-9e70-3ac53ce2cfa6 | 2 | public AdvancedPropertiesPane() {
super(JTabbedPane.TOP, JTabbedPane.WRAP_TAB_LAYOUT);
if (jMeterPropertyPanel == null) {
jMeterPropertyPanel = new JMeterPropertyPanel();
}
if (hostsOverridePanel == null) {
hostsOverridePanel = new HostsOverridePanel();
}
... |
6c70f17d-8655-4880-aff1-31791460fa45 | 8 | private void processToken() throws SyntaxException, IOException {
while (hasNextCharacter()) {
nextCharacter();
if (isAlpha(getCurrentCharacter())) {
tokens.add(EbnfScannerHelper.scanIdentifier(this));
currentToken++;
return;
}... |
2a64b936-b718-4a33-b18b-46a4f0cfa8bd | 2 | public static Set getCompleteProductionWithUsefulVariableSet(
Grammar grammar, Set usefulVariableSet) {
Set set = getNewProductionWithUsefulVariableSet();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (belongsInProductionWithUsefulVariableSet(producti... |
fe121e06-6c66-4150-b1ad-9b9192c92883 | 0 | public double value() { return value; } |
a52acb22-6243-4d65-8d79-68a29c66db62 | 5 | public String getChildInfo(String compoundId) {
StringBuilder sb = new StringBuilder();
List<Peak> peakList = this.peakAccessor.getOrderedPeakListByRecordId(compoundId);
if (peakList.size() == 0) {
sb.append("0\t0\t\t");
} else {
for (Peak peak : peakList) {
sb.append(String.format("%s\t%s\t\t", pe... |
56e363e9-45e7-45b9-bf98-89d823762f9d | 3 | private void createServerMenu() {
JMenu menu = new JMenu("Server");
JMenuItem connect = new JMenuItem("Připojit...");
connect.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK) );
connect.addActionListener( new ActionListener() {
@Override
... |
53a8ab70-0781-4146-b47b-c929f7b1670f | 7 | public DbComparator.ChangeType detectChange(ResultSet srs, ResultSet drs) throws Exception {
// Verify we're on the same row
Key srcPk = getPk(srs);
Key dstPk = getPk(drs);
int eq = Key.compare(srcPk, dstPk);
/*
Left Right
ACD BDE
A B Left < right, insert A into right
C B Le... |
d93d2b32-d15c-4423-be7a-2d235c1127ff | 2 | public synchronized void loadCredsPkcs12(InputStream in, char[] pw) throws IOException, CertificateException {
clear();
try {
creds = KeyStore.getInstance("PKCS12");
creds.load(in, pw);
this.pw = pw;
} catch(KeyStoreException e) {
throw(new Error(e));
} catch(NoSuchAlgorithmException e) {
t... |
f9f919bf-d7af-4aae-9aed-3b8651fd23ab | 9 | public HandType getType() {
if(hasStraight() && hasFlush())
return HandType.STRAIGHT_FLUSH;
else if (hasQuads())
return HandType.QUADS;
else if(hasFullHouse())
return HandType.FULL_HOUSE;
else if (hasFlush())
return HandType.FLUSH;
else if (hasStraight())
return HandType.STRAIGHT;
else if (ha... |
758b1e42-e46c-45ad-80fa-66f370361a9c | 0 | public void setBlock(boolean step) {
blockStep = step;
} |
4f336cf3-8d78-4c57-bb62-87764bde5bf7 | 5 | @Test
public void testGetMultiplier() {
// Set relevant variables to defaults.
Settings.totalMissed = 0;
Settings.totalKilled = 5;
Settings.difficulty = 1;
sc = new ScoreCon();
// Make sure that the multiplier is the same as the difficulty.
assertEquals(1, sc.getMultiplier());
// Simulate killing 5 ... |
14516008-fcc3-4dc3-ba61-72bfbbb7fe61 | 8 | public static void main(String[] arg) {
BufferedReader bf = null;
BufferedReader bff =null;
int total = 0;
int total2 = 0;
try {
File registro1 = new File("cregistro.txt");
File registro2 = new File("registro2.txt");
System.out.println("EL registro.txt del ejercicio 4 tiene "+ registro1.le... |
85240def-4ebc-4330-9008-8294a4e2e53b | 3 | public static String pickAFile()
{
JFileChooser fileChooser = null;
// start off the file name as null
String fileName = null;
// get the current media directory
String mediaDir = getMediaDirectory();
/* create a file for this and check that the directory exists
* and if it... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.