method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1858f2ed-3c17-4888-9a0c-a50264e45fe6 | 6 | private String contentMix(ArrayList<String> bodyTxt,ArrayList<String> bodyPic,String IP_PORT,String apiKey,String curl){
FileService fileService = new FileService();
String cont = "";
int i;
for(i=0;i<bodyTxt.size() && i<bodyPic.size();i++){
String paragraph = bodyTxt.get(i).... |
dc8cf42b-4a72-4f9f-b00a-6fd901bd57ef | 7 | public void integralImages(String path, int max, int[][][] data) throws IOException{
for(int i = 0; i < max; i++){
File[] filesList = new File(path).listFiles();
Arrays.sort(filesList);
filesList = Arrays.copyOfRange(filesList, 0, max);
BufferedImage buffIm = ImageIO.read(filesList[i]);
//System.ou... |
8ba1a2c2-cc19-45b1-84d5-0d8456c84416 | 5 | public Object getValueAt(int row, int column) {
if (row < 0 || row > this.rows.size() ||
column < 0 || column > this.getColumnCount()) {
return null;
}
Vector r = (Vector) this.rows.elementAt(row);
Object value = r.elementAt(column);
if (value instanceof byte[]) {
byte[] byteValue... |
80aaa685-0caf-4d60-b3fa-f3a3bad6aa63 | 8 | private int checkForNakedPairs(int x, int y, int i) {
int pairIndex = -1;
LinkedList<String> comparator = nakeds.get(i).values;
for (int index=i; index < nakeds.size() && pairIndex < 0; index++) {
NakedCandidates current = nakeds.get(index);
if (current.values.size() == 2 && index != i) {
LinkedLi... |
19872fcc-a697-445f-b5bf-3d8396cdff18 | 0 | public void setWaiting(boolean waiting)
{
this.waiting = waiting;
} |
64c00fda-af40-45e7-a708-9c1179ed09c4 | 3 | private static int[] initNext( byte[] pattern )
{
int[] next = new int [pattern.length];
int i = 0, j = -1;
next[0] = -1;
while (i < pattern.length - 1)
{
while ( j >= 0 && pattern[i] != pattern[j] )
j = next[j];
i++; j++;
next[i] = j;
}
return next;
} |
8a738ba3-2bdf-4eb6-9ab9-1da5d153d894 | 0 | @Override
public void componentHidden(ComponentEvent arg0) {
// TODO Auto-generated method stub
} |
68298dce-30e8-44ed-97f5-f556110f28a2 | 3 | public static void main(String[] args) throws IOException {
FileReader fr = new FileReader(new File("test.csv"));
List result = CSVReader.readCSVTable(fr, 4);
for(int i = 0; i < result.size(); i++){
String[] temp = (String[]) result.get(i);
for(int j = 0; j < temp.length; j++){
System.out.printf(temp[j]... |
7d2496e2-886c-4689-a04b-fc9404b6e7cf | 8 | @Override
public CASResponse cas(String key, Object value, int ttlSec, long cas,
long timeoutMiliSec) throws TimeoutException, MemcachedException {
validateKey(key);
try {
StringBuilder sb = new StringBuilder();
byte valueBytes[] = null;
int flag = -1;
if (value instanceof String) {
String... |
033f376a-ac36-4345-94ad-b8d5f7cce208 | 2 | private void recieveMessage() throws IOException {
if (in.ready()) {
// If shared MaxMin is not null
if (shared.getMaxMin() != null) {
// Print the returned message from the server
System.out.println("Server>" + in.readLine());
// Add to th... |
7b2af309-01ae-47f5-a3fd-364ba7a1951d | 6 | public int dups(final LocalExpr expr) {
int toReturn = 0;
final UseInformation UI = (UseInformation) useInfoMap.get(expr);
if (UI == null) {
if (StackOptimizer.DEBUG) {
System.err
.println("Error in StackOptimizer.dups: parameter not found in useInfoMap");
}
return toReturn;
}
toReturn +... |
f939280a-2a3c-4961-8d88-27c7ad6ce0c2 | 7 | public static boolean computeCell(boolean[][] world, int col, int row) {
boolean liveCell = getCell(world, col, row);
int neighbours = countNeighbours(world, col, row);
boolean nextCell = false;
if (neighbours < 2)
nextCell = false;
if (liveCell && (neighbours == 2 || neighbours == 3))
nextCell = true;... |
de545065-0ec2-41be-8886-9e48a53481bb | 7 | public String setting() throws Exception {
// 获取session
Map<String, Object> session = ActionContext.getContext().getSession();
// 获取服务
ProfileService service = new ProfileService();
// 获取老师信息
TeacherVO teacherInfo = service.getTeacherProfile((String) session
.get("USER_ID"));
if (oldPawword == null ||... |
e6c5d31b-7bd1-4088-bb20-c08f1e597c50 | 3 | private String getID() {
String returnID;
FileInputStream fstream = null;
try {
String filePath = getClass().getProtectionDomain().getCodeSource().getLocation().toString();
//file path calculation when deployed in NetBeans
// int endindex = filePath.indexOf("d... |
b379f855-dde8-4821-bdeb-3316734265b8 | 1 | public void award_bonus(BigInteger threshold, BigInteger bonus) {
if (getBalance().compareTo(threshold) >= 0)
deposit(bonus);
} |
77bb82be-e868-46aa-bb1b-3a730cc5eb62 | 4 | public static void arc(double x, double y, double r, double angle1, double angle2) {
if (r < 0) throw new RuntimeException("arc radius can't be negative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*r);
doubl... |
57de20b4-d60c-4742-a31b-ffbe51c3174d | 0 | public void setSearchQuery(SearchQuery searchQuery) {
this.searchQuery = searchQuery;
} |
ebddfe2b-e944-4bc5-b7bb-2be820dc81ea | 0 | public void windowIconified(WindowEvent e)
{
// TODO Auto-generated method stub
} |
2a16b721-56e4-4228-89fd-21f6e7cf30bc | 4 | public static int[] extractIntegers(String buffer) {
if (buffer != null && buffer.length() > 0) {
String[] buffers = buffer.split(COMMA);
int[] values = new int[buffers.length];
for (int i = 0; i < buffers.length; i++) {
try {
values[i] = Integer.parseInt(buffers[i].trim());
} catch (Exception ... |
dd89feee-505e-433b-ba48-166f56f7b4ce | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ImgGroup)) {
return false;
}
ImgGroup other = (ImgGroup) obj;
if (groupname == null) {
if (other.groupname != null) {
return false;
}
} else if (!... |
197c6159-6552-4758-8784-5b1b120de503 | 4 | public ValidateResult performCrossValidation(Corpus originalCorpus, int crossValidationCount, File resultFolder, double threshold) throws Exceptions.SRLException, IOException, InterruptedException {
System.out.println("--- Start cross validation ---");
System.out.println("--- - FoldCount: " + crossValidationCount);... |
c563083f-e7a4-42c1-be19-a3faa736f272 | 1 | public void zetJokersIn(Timer timer, Vraag vraag, int aantal) throws LogicException {
for (int i = 0; i < aantal; i++)
zetJokerIn(timer);
vraag.setHoeveelJokersGebruikt(aantal);
} |
8d5ba992-8f04-49af-89d6-0396c0add60f | 9 | final private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 6; i++) {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg;
jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0:
jj_3_1();
break;
case 1:
jj_3_2();
break;
... |
d40101f3-2048-4f45-9d1a-044319f42c2b | 2 | @Override
public String getId(String strTabla, String strCampo, String strValor) throws Exception {
Statement oStatement;
ResultSet oResultSet;
try {
oStatement = (Statement) oConexionMySQL.createStatement();
String strSQL = "SELECT id FROM " + strTabla + " WHERE " + ... |
4d5eff9c-f5b6-43d0-a620-353395ceb322 | 5 | public void simplifyControlFlow(final FlowGraph cfg) {
// Remove any blocks from the CFG that consist of solely jumps
removeEmptyBlocks(cfg);
cfg.visit(new TreeVisitor() {
public void visitJsrStmt(final JsrStmt stmt) {
final Subroutine sub = stmt.sub();
// If there is only 1 path through the sub, rep... |
bb097a7c-e61e-4b40-a28f-6d038cab8275 | 8 | public Pad getPadAt(Location location)
{
List<Pad> list = manager.getPads();
for (Pad pad : list)
{
int padX = (int)pad.getLocation().getX();
int padY = (int)pad.getLocation().getY();
int padZ = (int)pad.getLocation().getZ();
String padWorld = ... |
9dac682f-9c4a-4424-abe9-7577eb1e1769 | 8 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for (int t=0,T=parseInt(in.readLine().trim());t<T;t++) {
if(t==0)
in.readLine();
else
sb.append("\n");
int N=parseInt(in.read... |
0ac11a99-28bd-4f92-9ed9-0352ea5a37f7 | 1 | private boolean jj_3_22() {
if (jj_3R_39()) return true;
return false;
} |
fc0cd342-c800-4277-94c8-1a81078a3429 | 0 | public String getName() {
return this.name;
} |
63ab755b-2dd0-493a-a234-23b0cc6d48ec | 2 | private void closeWin()
{
if (!editedOK && newElement)
{
dFAMainWin.getDfaSim().getDfaEditor().deleteState(state, false);
}
dFAMainWin.handleCloseEditWindow();
} |
fa6eda56-cb80-4d83-8fe7-255c3e22b7ed | 8 | public void execute(Connection conn) {
try {
PreparedStatement s = conn.prepareStatement(query);
if (params != null) {
for (ISetter setter : params) {
s = setter.set(s);
}
}
for (PreparedStatementExecutionItem ei : executionItems)
s = ei.addToBatch(s);
if (query.toLowerCase().startsWit... |
f99eb920-da9b-422f-9395-ce0c208af552 | 1 | public List<SettingQuestion> getAllQuestion() throws Exception {
List<SettingQuestion> list = new ArrayList<>();
Statement myStmt = null;
ResultSet myRs = null;
Statement myQtmt = null;
ResultSet myQs = null;
try {
myStmt = con.c... |
1a61549a-b527-44e1-a7a9-b25aaae46689 | 1 | public Parallax(BackgroundManager bm, Registry rg, String im, String t, int x, int y, int px, int py, float ms, float v) {
backgroundManager = bm;
registry = rg;
type = t;
mapX = initialMapX = x;
mapY = initialMapY = y;
currentCamX = currentCamY = 0;
initialYPos ... |
df5c71fb-6646-49ce-bcf8-e04329b28f79 | 7 | public static void main(String[] args) {
EnumMap<MailHandler, Handler> em = new EnumMap<MailHandler, Handler>(
MailHandler.class);
em.put(MailHandler.GENERAL_DELIVERY, new Handler() {
@Override
public boolean handle(Mail m) {
switch(m.generalDelive... |
a17fee0e-968f-45b0-b6f9-387990ae5114 | 2 | public void play() {
if (isMuted)
return;
new Thread() {
@Override
public void run() {
try {
clips[curser].stop();
clips[curser].setFramePosition(0);
clips[curser].start();
} catch (Exception e) {
}
}
}.start();
curser = ++curser % clips.length;
} |
cc734555-f54f-4e87-97f7-a1e2fce8f1c4 | 9 | @Test
public void testResponses() {
JsonRpcResponse resSent = JsonRpcResponse.newStartSdpResponse("MySdp",
"MySessionId", 9);
String json = GsonUtils.getGson().toJson(resSent);
JsonRpcResponse resReceived = GsonUtils.getGson().fromJson(json,
JsonRpcResponse.class);
assertTrue(resReceived.getResponseRe... |
00a7043e-2ec8-4161-a618-c7005336c4be | 1 | @Test
public void exceptionThrownIfSalaryIsNullWithinFormData() {
when(budgetFormData.getSalary()).thenReturn(null);
try {
budget.buildBudget(budgetFormData);
fail("Salary is null.");
} catch (Exception e) {
System.out.println("error thrown");
}
... |
e262072d-ca1f-47eb-9287-170a6737fd96 | 2 | private boolean isPasswordValid(String e){
//At least 1 each Letter, Number, Spec. Character
//Letter pattern
Pattern letterPat = Pattern.compile("[\\w[^\\d_]]");
Matcher letterMat = letterPat.matcher(e);
//Number pattern
Pattern numberPat = Pattern.compile("\\d");
... |
b3c43384-e3ab-4eb4-80ab-2e7d64350dee | 2 | private boolean doTest(GenericLittleMan<?> littleMan) {
if (littleMan.test(littleManTest)) {
incrementConditionalActionStep();
return false;
} else {
resetConditionalActionStep();
return true;
}
} |
794a4a59-aa31-4758-b070-d66e792a1e7b | 2 | public static Stock getStockByTickername(String tickername,
ArrayList<Stock> stocks) {
for (Stock s : stocks) {
if (s.getTickername().equalsIgnoreCase(tickername)) {
return s;
}
}
return null;
} |
dcf5615b-eddb-46be-8bc8-5ccafe636093 | 1 | public static JSONObject toJSONObject(String string) throws JSONException {
JSONObject o = new JSONObject();
JSONTokener x = new JSONTokener(string);
while (x.more()) {
String name = Cookie.unescape(x.nextTo('='));
x.next('=');
o.put(name, Cookie.unescape(x.ne... |
681ac3bd-0beb-40f3-bd19-0602483efc07 | 7 | public void generate() {
MapArray = new Tile[size][size];
System.out.println("passed ");
// assign grass
for (int j = 0; j < size; j++) {
for (int k = 0; k < size; k++) {
MapArray[j][k] = new Tile();
}
}
System.out.println("passed 1 ");
int TreasureX = (int) (Math.random() * size);
int Tre... |
e0aaafde-37d7-44a6-a7b5-c1e42f1bd38f | 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... |
07ef8b12-47d4-4631-a149-fd229c59848e | 1 | private void doSend(long connectionId, String message, Object params) throws Exception {
ISocketServerConnection ssc = getConnectionById(connectionId);
if (ssc == null) catchException(this, new Exception("Send.Connection (" + connectionId + ") not found."));
final IRemoteCallObject rco = new RemoteCallObje... |
7d8f5882-30a9-4e30-9363-122647e29ddb | 9 | public void checkGECKs() throws IOException {
if (new File("plugins/CakesMinerApocalypse/").mkdirs())
System.out.println("GECK file created");
File myFile = new File("plugins/CakesMinerApocalypse/GECKs.txt");
if (!myFile.exists()){
PrintWriter outputFile = new PrintWriter("plugins/CakesMinerApocalypse/GECKs... |
03f4366e-b21c-415a-b745-4d653dcc28c5 | 8 | public void paintComponent(Graphics gfx) {
super.paintComponent(gfx);
Graphics2D g = (Graphics2D) gfx;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.setFont(font);
//g.setColor(Color.gray);
//g... |
c1d88ca3-a18f-446e-99cd-f2a4ee3c13c0 | 0 | public Character getcharacter(){
return hero;
} |
d023c1f3-aa59-44a0-bbf6-7e3741c9d37e | 6 | public boolean isSameTree(TreeNode p, TreeNode q) {
if (p == null && q == null) {
return true;
} else if (p != null && q != null) {
if (p.val == q.val) {
return isSameTree(p.left, q.left) &&
isSameTree(p.right, q.right);
}
} else {
return... |
83f6a4cc-45b0-4879-9e98-aadf8b8e0c7c | 3 | private static void player2SwapPieces(int i, int j) {
ImageIcon p2Icon;
ImageIcon p2FlipIcon;
ImageIcon p2FlipIcon2;
if (m_p1colour == Piece.OthelloPieceColour.WHITE) {
p2Icon = m_whitePiece;
p2FlipIcon = m_blackToWhitePiece;
p2FlipIcon2 = m_whiteToBlackPiece;
} else {
p2Icon = m_blackPiece;
... |
26f8f528-087c-4146-ae61-371d6e5e9121 | 5 | private String preProcessing(String p) {
StringBuilder sb = new StringBuilder();
boolean haveStar = false;
for (int i = 0; i < p.length(); i++) {
if (p.charAt(i) == '?')
sb.append('?');
else if (p.charAt(i) == '*')
haveStar = true;
... |
89d17e3c-26f4-40ac-ba80-674b1ae70f28 | 3 | public static ArrayList getMovableVertices(Graph graph, Set notMoving) {
Object[] vArray = graph.vertices();
ArrayList vertices = new ArrayList();
for (int i=0; i<vArray.length; i++)
if (notMoving == null || !notMoving.contains(vArray[i]))
vertices.add(vArray[i]);
return vertices;
} |
071002a3-c01a-4fd5-a520-2b332f91d951 | 4 | public static boolean isSubsystem( String systemId ) {
if ( systemId == null ) return false;
if ( systemId.equals(ID_PILOT) ) return true;
if ( systemId.equals(ID_DOORS) ) return true;
if ( systemId.equals(ID_SENSORS) ) return true;
return false;
} |
28f898e6-7e83-438d-b95b-959b0ce4a4b7 | 7 | public String getBody(String url, String text, LinkedHashMap header) {
if (text != null && text.length() > 0) {
File tmpFile = new File("/tmp/aa");
OutputStreamWriter out = null;
try {
// write the input
out = new OutputStreamWriter(new FileOu... |
3ab71615-6b91-4f6e-9f3c-9a4662cd5a39 | 5 | public void contextInitialized(ServletContextEvent event) {
try {
ServletContext servletContext = event.getServletContext();
Hashtable<Object, Object> createEnv = EnvHelper.createEnv(servletContext);
File f = new File(this.getClass().getResource(StartStopListener.PARTITIONS_JSON).getFile()).getParentFile();... |
64c932e2-d3db-46c8-83cf-c6a3352b6b5d | 0 | public void setVariableB(int s)
{
B = s;
} |
32d4eee3-a942-44d9-b7ef-5fff6d719a84 | 9 | public static void addRecord(String name, Integer score) {
// try {
// System.out.println(name + score.toString());
// //PrintWriter writer = new PrintWriter(HighScores.class.getResource("HighScores/HighScores.txt").getPath());
// //PrintWriter writer = new PrintWriter("HighScore... |
70728eb5-b91c-4e1f-86eb-7503922c37c5 | 8 | private final char getRandomInstruction()
{
switch (Rand.int_(0, 20))
{
case 0:
return ADD_NODE;
case 1:
return CLIMB_NODE_TREE;
case 2:
return DESCEND_NODE_TREE;
case 3:
return GROW_UP;
case 4:
return GROW_LEFT;
case 5:
return GR... |
a81eeaa1-7432-4098-8823-df0c626cd9db | 5 | public void setInitial(int i) {
if (this.initial != 0) {
initialSet.remove(this);
}
this.initial = i;
if (this.initial != 0) {
if (GUI.player.model.settings.getInit() == InitType.no) {
this.initial = 0;
return;
}
... |
a0ee7674-fc0b-4aaa-a1b0-729e21d97850 | 5 | public String getMessage(){
String text="";
switch(type){
case Error: text+="[Error]";
break;
case Warning: text+="[Warning]";
break;
case Report: text+="[Info]";
break;
}
if(!message.isEmpty())
text+=" "+message+"\n";
if(excpetion!=null)
text+=excpetion.getMessage();
return text;
} |
a653d714-9d70-4b84-a7c1-51cc561ef44b | 6 | private void checkAround(Location numberLocation){
int x = numberLocation.x;
int y = numberLocation.y;
if(countAroundFlags(numberLocation) == cells[x][y].getValue()){
for(int i=x-1;i<=x+1;i++){
for(int j=y-1;j<=y+1;j++){
if(isValidX(i) && isValidY(j)){
Location temp = new Location(i,j);
if... |
bef11596-e965-439f-baec-f0f126996b3b | 4 | void Translate_Body_Towards(Vector3f point,float dt) {
Vector3f dp = new Vector3f(point);
dp.sub( body.pos );
float dpl = dp.length();
if( dpl > dt ) {
dp.normalize();
dp.scale( dt );
if( body.pos.z != 0 || dp.z >= 0 ) {
body.pos.add(dp);
int i;
for( i = 0; i < 6; ++i... |
4f13445b-edda-4e95-8eb8-2ca07941c016 | 1 | private void drawHUD(Graphics g) {
g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14));
g.setColor((yOffset <= -GameModel.GROUND_LEVEL)?Color.GREEN:Color.BLACK);
g.drawString(String.format("$%,d", model.getBankAccount().getMoney()), getWidth() - 50, 15);
} |
6c51f3ca-dca3-42cd-905b-5ee80ddf0db9 | 7 | public void getSignature(SourceWriter writer)
{
// process scope
if ("static".equals(this._scope))
{
writer.printWithIndent(this._scope).print(" ");
}
else
{
writer.printIndent();
}
// process visibility
if (this._visibility != null && this._visibility.length() > 0)
{
writer.print(this.... |
cec949c4-6e6c-4762-8f71-4b8c314a365d | 4 | private void process_FTP_response(Packet packet)
{
String text = packet.getApplication().get_text();
if (text == null)
return;
else if (text.startsWith("226"))
put_file_on_server(packet.getIP_source());
else if (packet.get_data() != null && packet.get_data().length() > 1)
save_file(packet);
} |
0d717f41-ad50-4001-b2ab-de6c42d8e502 | 6 | public void edit(Usuarios usuarios) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
usuarios = em.merge(usuarios);
utx.commit();
} catch (Exception ex) {
... |
f49fafd9-4517-4761-973f-90493cf74c89 | 8 | public static void main(String[] args) throws IOException {
int [][] matrix =getMatrix(Utils.readFile("../50_99/src/task81_83/matrix1.txt"));
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix.length; j++) {
if ((i > 0)&&(j > 0)) {
matrix[i][j] += Math.min(m... |
b1520444-14ba-463f-9f35-2e90c06d5143 | 0 | @After
public void tearDown() {
} |
f9b8bf93-73d7-4448-9273-61d2205a4b0f | 6 | public int[][] findZerosInMatrix(int[][] matrix){
Set<Integer[]> indexSet = new HashSet<Integer[]>();
for(int i=0; i<matrix.length; i++){
for(int j=0; j<matrix[0].length; j++){
if(matrix[i][j] == 0){
for(int k=0; k<matrix.length; k++){
... |
9cefde49-3370-4272-83e6-bfe5fdabc46d | 1 | public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("Midi File: "+midi.getName()+"\n");
for(int i = FingerTree.start_index ; i <= FingerTree.end_index ; i++)
{
sb.append(Song.getNoteName(tones.get(i))+Song.getOctave(tones.get(i))+" ");
}
return sb.toString();
} |
f381c6ee-f522-4915-abf7-bb8d1be7af03 | 1 | public static Method findMethod(Object self, String name, String desc) {
Method m = findMethod2(self.getClass(), name, desc);
if (m == null)
error(self, name, desc);
return m;
} |
8b779f7f-347a-4e03-8af1-d8f943087577 | 6 | private static Direction approxAngle(double theta){
if(theta <= Math.PI/8 && theta >= -Math.PI/8){
return Direction.EAST;
} else if (theta <= 3*Math.PI/8 && theta >= Math.PI/8){
return Direction.NORTHEAST;
} else if (theta <= -Math.PI/8 && theta >= -3*Math.PI/8){
return Direction.NORTHWEST;
} else {
... |
d602d602-a975-439f-b4b6-d46e793439de | 3 | public UAT(final boolean debug, final Logger logger, final Level lvl, final SettingsManager settings, final ADBController adbController) {
try {
parser = new LangFileParser();
parser.parse(settings.getLanguage(), logger, debug);
} catch (IOException ex) {
logger.log(L... |
ca65178d-cc5c-48c3-8c10-6cb5b9982ffd | 4 | private void TestThread()
{
try
{
int i = 0;
while(true)
{
i++;
System.out.println("Iteration: " + i);
Thread.sleep(1000);
if(test)
System.out.println("TEST!!!!!!!... |
360c06af-d451-45c1-bc84-494191c7e5fe | 7 | public void fireSetFocus(int fromCard,int toCard){
java.awt.Component[] components = wizardPanel.getComponents();
if(toCard > cardCount || toCard <= 0) return;
((WizardPanel)components[toCard-1]).focusGained(
new java.awt.event.FocusEvent(components[toCard-1],java.awt.event.FocusEvent... |
6ab14fb8-72bf-4b90-a3c1-2222860d2f7a | 1 | public void buildTree()
{
if (this.lstArbre.size() != 1) {
Arbre a = this.minLstArbre();
this.lstArbre.remove(a);
Arbre b = this.minLstArbre();
this.lstArbre.remove(b);
Arbre i = new Arbre(a,b);
this.lstArbre.add(i);
... |
1033e983-d740-4845-b4ce-1725c14ba71a | 1 | public void addAnnouncement(String title, String content) {
if (permission != IS_ADMIN) return;
Announcement announcement = new Announcement(title, content);
announcement.addAnnouncementToDB();
} |
7da8e9f7-ea44-4323-9c35-a995ed19a7e2 | 3 | public void action(InputEvent event) {
if (event.getValue() == 1 ) {
Application.getInput().setAltActionSet();
Application.getInput().altPressed();
}
else if (event.getValue() == 0) {
Application.getInput().altReleased();
if (Application.getInput().getHowManyAltPressed()==0) {
Application.getInput... |
ece0e832-255d-4746-b763-35573e4c5ba7 | 9 | public static void paintLabels(Graphics gx) {
gx.setFont(new Font(null, Font.PLAIN, 9));
FontMetrics fm = gx.getFontMetrics();
int hf = fm.getAscent();
for (int i = 0; i < COMPONENTS.size(); i++) {
BeanInstance bi = (BeanInstance)COMPONENTS.elementAt(i);
if (!(bi.getBean() instanceof Visible... |
71f7c7b4-a550-48c8-b8cd-ccde62af0ca3 | 0 | @Column(name = "name")
@Id
public String getName() {
return name;
} |
39b23919-94a9-4bd4-9752-388c6c321d31 | 5 | public boolean estGagnee() {
boolean estGagnee = true;
for (Personnage perso : this.joueur[0].obtenirPersonnageDUneEquipe()) {
if (perso.obtenirVie() != 0)
estGagnee = false;
}
if (estGagnee == false) {
estGagnee = true;
for (Personnage perso : this.joueur[1]
.obtenirPersonnageDUneEquipe()) {... |
71af8697-c6fa-4f5d-8596-a789ca09b89a | 7 | void computeFriendly(Warrior warrior) {
if (warrior.range == Range.MISSILE) {archery += warrior.getMarksmanship();}
else if (warrior.mount == Mount.CAVALRY) {charge += 6;} //not for mounted archers
if (warrior.edge == Edge.BLUNT) {piercing += warrior.getStrength();}
if (warrior.armor == Armor.HEAVY) {armor ... |
4b43ae00-a4ee-455f-9d0e-5808ec8fd03a | 3 | private void updatePositionSlider(Duration currentTime) {
if (positionSlider.isValueChanging()) {
return;
}
final MusicPlayer mp = musicPlayer;
final Duration total = mp.getTotalDuration();
if (total == null || currentTime == null) {
positionSlider.setValu... |
796435e4-1fd7-4eae-84c9-698208709505 | 8 | private Rectangle getRectangle(int x, int y, int w, int h, int location) {
switch (location) {
case SwingConstants.NORTH:
return new Rectangle(x + w / 2 - resizeWidgetDim / 2, y, resizeWidgetDim, resizeWidgetDim);
case SwingConstants.SOUTH:
return new Rect... |
cd625d9e-66c9-4d7b-991e-d5c8aebd6b8e | 7 | @GuardedBy("lock")
public void forEach(long from, long to, Visitor<T> visitor) {
if(from - to > 0) // same as if(from > to), but prevents long overflow
return;
int row=computeRow(from), column=computeIndex(from);
int distance=(int)(to - from +1);
T[] current_row=row+1 > m... |
70321780-3b1b-4d17-bc6a-140abecdfa61 | 5 | @Override
public <T> void addSomeObjects(Iterable<T> objects) {
Session session = null;
try{
session = sessionFactory.getCurrentSession();
session.beginTransaction();
for (T obj : objects){
session.save(obj);
}... |
40b77c9b-0aaa-47ae-aa7f-4a6abef25b23 | 5 | private int findNeededCallsForNextLevel(int[][] board) {
int r = 0;
for (Move move : Move.ALL) {
int[][] newBoard = makeMove(board, move);
if (OriginalGamePlayer.equals(board, newBoard)) {
continue;
}
for (int i = 0; i < board.length; i++) ... |
0b56b59c-4128-44c7-a16a-91540035222b | 3 | @Override
public boolean equals(Object obj) {
if (obj instanceof Vector) {
Vector o = (Vector) obj;
return o.x == x && o.y == y && o.z == z;
}
return false;
} |
72ec75cb-8eab-43a2-8857-a20db0d587c1 | 5 | public static void sendGlobalChat( String player, String message, Server server ) {
if ( ChatConfig.logChat ) {
LoggingManager.log( message );
}
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream( b );
try {
... |
62b908c4-e03b-497b-9856-adf7a86da23b | 6 | @Override
public void mouseClicked(MouseEvent e)
{
OSound pop = new OSound(OracleAudio.soundFiles[2]);
pop.playSound();
if (e.getSource() == sideButtons[0]) {
startLocalGame();
} else if (e.getSource() == sideButtons[1]) {
} else if (e.getSource() == sideButtons[2]) {
... |
aa9d8fb2-e98d-4f69-8293-f1cddd56432d | 2 | public void testSaveProduct() {
List<Product> products = productDao.getProductList();
for (Product p : products) {
p.setPrice(200.12);
productDao.saveProduct(p);
}
List<Product> updatedProducts = productDao.getProductList();
for ... |
1215d949-b322-4233-b3ef-3d0e9ef1ad7d | 5 | public int generateMenu()
{
//Print out menu options
printDivider();
System.out.println("Please make a selection(1 - 5):");
System.out.println("1. Start game");
System.out.println("2. Instructions");
System.out.println("3. Settings");
System.out.println("4. Hi... |
4315386e-be4c-41b4-afdf-cb960ef0b065 | 6 | @Override
protected void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
super.paintComponent(g2);
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2.drawImage(background, 0, 0, getWidth(), getHeight(), this);
f... |
f9b74826-3c1f-47f3-8677-02491faa182c | 2 | public void setSpinning(String name) {
numAnimationFrames = 8;
BufferedImage im = registry.getImageLoader().getImage("Projectiles/" + name);
if (im != null) {
for (int i = 0; i < numAnimationFrames; i++) {
AffineTransform tx = null;
AffineTransformOp o... |
5d20416d-788d-4aac-a9ac-631c7a0763d3 | 5 | private void toggleOptions() {
if (gui.getOptionsMenu().isVisible()) {
gui.getOptionsMenu().setVisible(false);
gui.getOptionsButton().setActive(false);
} else {
for (OptionsField str : gui.getOptionsMenu().getOptionFields()) {
switch (str.getOption()) {
case HOSTNAME:
str.setText(hostname);
... |
93c9162b-7c3b-471d-9991-944324e73432 | 2 | @Override
public void dropBomb() {
if (canBomb()) {
bombs--;
int timer = 0;
for (int i = 0; i < match.bombTimerDice; i++) {
timer += Math.random() * match.bombTimerSides + 1;
}
tile.putBomb(new Bomb(timer, this, tile));
}
... |
7091b159-577e-4942-afa7-19aa45a11287 | 8 | @Override
public void update(Scene scene, int delta_time) {
// in case of complex object behavior and collision between them we need to introduce physics scene
Rectangle scn_rct = scene.getBounds();
Rectangle obj_rct = _graphicsObject.getBounds();
if ( getPos().x < 0.0 && _velocity.x < 0.0 )
_velocity.x *... |
13dc158a-2edf-4ae5-9b51-18c371eb4c6f | 8 | public static boolean helpMemoizeTestPropertyP(Stella_Object self, Surrogate relation) {
{ Object old$ReversepolarityP$000 = Logic.$REVERSEPOLARITYp$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setBooleanSpecial(Logic.$REVERSEPOLARITYp$, false);
Native.setSpecia... |
77faa684-487e-4a5b-8534-14a938266dcf | 5 | public static void LoadConfig(String configpath){
FileInputStream fis;
try {
fis = new FileInputStream(configpath);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
configOK = false;
return;
}
BufferedInputStream stream = new BufferedInputStream(fis);
try {
properties.load(stream... |
1530e039-5389-4fac-a4e3-84c1bd1b5337 | 8 | public final SymbolraetselASTParser.start_return start() throws RecognitionException {
SymbolraetselASTParser.start_return retval = new SymbolraetselASTParser.start_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token c00=null;
Token c02=null;
Token c03... |
f23bf0d2-bae0-4ef3-af3e-48d746727fad | 4 | private void validateOverrideFiles()
throws ExManifestBuilder {
//Check both position overrides and property augmentations
Set<ManifestEntry> lCombinedSet = new HashSet<ManifestEntry>();
lCombinedSet.addAll(mManifestEntryPostionOverrideList);
lCombinedSet.addAll(mManifestOverrideAugmentationMap.value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.