method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7819c2ac-9640-4a1c-959a-c3cc38aa3bef | 7 | private void btnSearchEmpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSearchEmpActionPerformed
try{
int key=jComboBox1.getSelectedIndex();
String search=txtSearchEmp.getText();
String query2="";
switch(key){
c... |
1f161daa-a182-45dd-8e5e-99dfab5f1f06 | 2 | public void save( String fn )
{
try( ObjectOutputStream os = new
ObjectOutputStream( new FileOutputStream( fn ) ) )
{
os.writeInt( size );
for( T x : this ) os.writeObject( x );
}
catch( IOException e )
{
e.printStackTrace( );
}
System.out.println( "Save done" );
} |
32059314-01df-4a1e-b2f4-bc2b60aa43bb | 4 | public static ArrayList<ArrayList<String>> mergeLists(
ArrayList<ArrayList<String>> allLists,
ArrayList<ArrayList<String>> newLists) {
ArrayList<ArrayList<String>> merged = new ArrayList<ArrayList<String>>();
int i = 0;
if (allLists.size() == 0) {
while (i < newLists.size()) {
ArrayList<String> list2... |
d8f15046-e852-480b-bf4d-03e758bbfe0c | 2 | protected Element getElement(String name, int id) {
NodeList dList = doc.getElementsByTagName(name);
for (int i = 0; i < dList.getLength(); i++) {
if (Integer.parseInt(dList.item(i).getAttributes()
.getNamedItem("id").getTextContent()) == id) {
return (Element) dList.item(i);
}
}
System.out.print... |
a7f51dc5-37b3-4ef1-8d0a-6f6628cd5682 | 2 | @Override
protected Integer doInBackground() throws Exception {
while(true){
jProgressBar1.setValue(ChatBox.introStatus);
if (ChatBox.introStatus == 100) {
dispose();
break;
}
}
return 666... |
917156d7-92b9-4e9c-9e7f-075156e51d9e | 3 | private int HammingToAscii(String recieved)
{
// split the recieved code into 2 parts
String[] recieveds = new String[] {
recieved.substring(0, 7),
recieved.substring(7, 14)
};
// decode each part and join them to get the result byte
StringBuffer decoded = new StringBuffer();
for (String recieve... |
d7858c34-b739-4ca9-acf2-74940be7fb28 | 9 | @Override
public int execute(int cycles) {
m6502_ICount[0] = cycles;
change_pc16(m6502.pc.D);
do
{
int /*UINT8*/ op;
m6502.ppc.SetD(m6502.pc.D);
//CALL_MAME_DEBUG;
op = RDOP();
/* if an irq is pending, take it now */
if( m6... |
5d6496f5-a130-44ae-b403-d7071a7e59ea | 1 | public Color getPrintColor() {
if (printColor == null)
printColor = new Color (printColorCode);
return printColor;
} |
b0fac9ce-e662-473e-842f-4dbcd18e5438 | 8 | public Policy[] list () {
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<Policy> policies = new ArrayList<Policy>();
try {
con = ConnectionManager.getConnection();
String searchQuery = "SELECT * FROM policies";
statement = con.prepareStatement(s... |
7f7e9fad-73dd-4ce8-979f-b20d8d0a658c | 6 | boolean checkForSimilarName(String name) {
ArrayList < Client > il = new ArrayList < Client > ();
for (int i = 0; i < clients.size(); i++) {
il.add(clients.get(i));
}
for (int i = 0; i < channels.size(); i++) {
ArrayList < Client > templ = channels.get(i).getUsers... |
ddd802a3-7ba2-479d-8568-cff8ed3e9015 | 0 | public Integer interpret(Context ctx) {
return i;
} |
46a7150d-fe37-4d88-9d49-a189870a2d51 | 8 | private void callAllAnnotatedSetters(HashMap<String, String> headerToFieldMap, T instance) {
for (Class<?> iteratedClass = clazz; iteratedClass != Object.class; iteratedClass = iteratedClass
.getSuperclass()) {
List<Method> allMethods = Arrays.asList(iteratedClass.getDeclaredMethods(... |
d9a63e45-cce6-420d-adee-00e468826a86 | 6 | public static void main(String[] args) {
LinkedList<SudokuApp> sudokusProfondeurDAbord = new LinkedList<SudokuApp>();
LinkedList<SudokuApp> sudokusFirstBest = new LinkedList<SudokuApp>();
String chaine="";
String fichier ="src/main/java/aima/gui/applications/search/sudoku/liste_de_sudokus";
//lect... |
1a7cad6e-5a8c-401a-b26c-bc9ec495e583 | 0 | public Boolean setPlayerWin(Boolean playerWin) {
this.playerWin = playerWin;
return playerWin;
} |
70ec68f9-0dd7-4f7b-80ab-eb06883651f5 | 1 | protected void addRange(
TextPresentation presentation,
int offset,
int length,
TextAttribute attr) {
if (attr != null)
presentation.addStyleRange(
new StyleRange(
offset,
length,
... |
fd66c86d-4c39-4006-8e79-791eae7425bd | 9 | public void run() {
Set<String> keys = this.gs.getMembershipList().getKeys();
ArrayList<String> randomKeys = new ArrayList<String>();
ArrayList<String> completedGossips = new ArrayList<String>();
Random rand = new Random();
int failedContactServers = 0;
//convert to arraylist for easier randomization
f... |
0d385691-df4d-4391-a47b-fdc2c78f0c19 | 4 | public double getTax() {
if (!name.contains("pill") && !name.contains("book") && !name.contains("chocolate")) {
tax += roundNumber(price * .1, .05);
}
if(imported) {
tax += roundNumber(price * .05, .05);
}
return tax;
} |
84935451-211e-48ec-807c-aabc05d6a1ec | 1 | Item newFieldItem(final String owner, final String name, final String desc) {
key3.set(FIELD, owner, name, desc);
Item result = get(key3);
if (result == null) {
put122(FIELD, newClass(owner), newNameType(name, desc));
result = new Item(index++, key3);
put(result);
}
return result;
} |
0aa5df3f-4a68-4268-aa89-9a1f34731fd2 | 7 | public HashMap dbHashing(String query) throws SQLException
{
Connection connection = null;
Statement statement = null;
ResultSet result = null;
String key = "";
String val = "";
HashMap hashedList = new HashMap();
HashMap value = new HashMap();
try
{
Class.forName(driver);
connection = Driv... |
f2090825-cca8-4a04-877f-9ce8bf820ad0 | 5 | private static BufferedImage makeIcon(Color background) {
final int WIDTH = 16, HEIGHT = 16;
BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
for (int y = 0; y < HEIGHT; ++y)
for (int x = 0; x < WIDTH; ++x)
image.setRGB(x, y, 0);
... |
9ed9273e-628d-417c-a8c9-ccbbd52ec2b6 | 8 | public void move_ghost_spec(char p, int i, int j){
if (p == 'w'){
if (maze[i][j-1] != 'X'){
maze[i][j] = ' ';
maze[i][j-1] = g.symbol;
}
}
if (p == 'a'){
if (maze[i+1][j] != 'X'){
maze[i][j] = ' ';
maze[i+1][j] = g.symbol;
}
}
if (p == 's'){
if (maze[i][j+1] != 'X'){
maze[i]... |
6f19467a-3154-4fe1-aaac-eaa6b73c2714 | 9 | public void update (Graphics g) {
//timed, refreshes every interval
if (TIMER % sleep == 0 && value == LAND &&
!(targeter == null && (lifeform instanceof Egg
|| lifeform instanceof Fish || lifeform instanceof Player))) {
if (targeter instanceof Player && lifeform instanceof Fish)
score++;
life... |
e6807375-45d6-4687-864f-028e7c74b712 | 9 | private boolean r_vowel_suffix() {
int v_1;
int v_2;
// (, line 169
// try, line 170
v_1 = limit - cursor;
lab0: do {
// (, line 170
// [, line 171
ket = cursor;
if (!(in_grouping_b(g_... |
5c097ba0-01c8-448f-9f5c-5f7f8504675b | 4 | @SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent e) {
JComboBox<String> cb = (JComboBox<String>) e.getSource();
String field = (String) cb.getSelectedItem();
if (visualisation instanceof OlympicBubbleplot) {
OlympicBubbleplot s = (OlympicBubbleplot) visualisation;
// s.setYField(field... |
c7e0da07-6922-4bbc-9b10-661fe663daa5 | 8 | public boolean pickAndExecuteAnAction() {
// If customer underpaid
synchronized(Bills) {
for (Bill b : Bills) {
if (b.state.equals(Bill.State.underpaid)) {
TellCustomerTheyOwe(b);
return true;
}
}
}
// If customer overpaid
synchronized(Bills) {
for (Bill b : Bills) {
if (b.st... |
7375a453-1b2a-4f4f-8ec0-085d498d8ed2 | 2 | public void run() {
List<ClassNode> newClasses = new ArrayList<ClassNode>(module
.getClasses().size());
for (ClassNode c : module.getClasses().values()) {
ClassNode c2 = new ClassNode();
c.accept(new RemappingClassAdapter(c2, remapper));
newClasses.add(c2);
}
module.getClasses().clear();
for (Cla... |
2ad0a13b-dfb3-42fc-8dcb-4681ac1341db | 2 | public boolean goToWaypoint(int wpNumber){
System.out.println("Changing waypoint number");
if(wpNumber >= 0 && wpNumber < points.size()){
nextWaypointNumber = wpNumber;
System.out.println("WP number now: " + wpNumber);
return true;
}else{
return false;
}
} |
2cfc728c-8441-46ad-9c75-da7e71f919f9 | 9 | @RequestMapping(value = "/add_post", method = RequestMethod.POST)
public @ResponseBody
List<PostInfo> add(@RequestBody PostInfo postInfo) throws Exception {
int flag = 0;
AnalysisResult analResult = new AnalysisResult();
// flag = this.userDao.check_user(postInfo.getUser_name());
// if (flag == 1) {
analR... |
4891cd40-6321-49a7-8ba3-e7b9972fcc06 | 9 | public NPC[] getSpawns() {
int npcs[] = new int[6];
int index = 0;
int id = stage;
for (int i = 6; i >= 1; i--) {
int threshold = (1 << i) - 1;
if (id >= threshold) {
for (int j = 0; j <= id / threshold; j++) {
npcs[index++] = BASE_NPCS[i - 1]
+ (i == 6 ? 0 : RANDOM.nextInt(2));
id -=... |
5e25ce3b-1a6f-48e8-9af7-49b2555766df | 1 | public final void removeJump() {
if (jump != null) {
jump.prev = null;
jump = null;
}
} |
eb720c4b-c8e7-4bee-a28c-bb4337e66302 | 5 | private String read() {
StringBuffer buffer = new StringBuffer();
int codePoint;
boolean zeroByteRead = false;
try {
do {
codePoint = this.in.read();
if (codePoint == 0) {
zeroByteRead = true;
}
... |
24096ddf-3006-4a1f-b206-8305f61304f3 | 1 | @Override
public boolean isClosed() {
return (glfwWindowShouldClose(window) == GL_TRUE) ? true : false;
} |
4e202cbc-2c9b-401d-a47b-04feb94045d4 | 8 | protected void setPhenomena(String phenomena) {
this.phenomena = phenomena;
if (phenomena.equals(MetarConstants.METAR_MIST)) {
isMist = true;
} else if (phenomena.equals(MetarConstants.METAR_FOG)) {
isFog = true;
} else if (phenomena.equals(MetarConstants.METAR_SMOKE)) {
isSmoke = true;
} else if... |
b4317ce9-74b2-4cb3-9355-1d281ba253c6 | 7 | public void render(Graphics g){
g.setColor(new Color(81, 217, 61));
g.fillRect(50, 40, player1.energy, 30);
g.fillRect(JudokaComponent.WIDTH - 50, 40, -player2.energy, 30);
g.setColor(Color.RED);
g.fillRect(450, 40, player1.energy - 400, 30);
g.fillRect(JudokaComponent.WIDTH - 450, 40, 400 - player2.energy,... |
2192b090-b275-43f0-b607-037fcbb1fcb9 | 0 | public void worldDeleter()
{//delete the gems, walls, areas arrayLists
gems.clear();
walls.clear();
areas.clear();
} |
f578fdbd-e2de-4fcc-b180-e93ba16e2910 | 0 | public void setViewed(boolean viewed) {
this.viewed = viewed;
} |
e6b34c67-09a8-4dec-a74a-47a1b9f85632 | 5 | private Dimension getImageDimensions(File imgFile, Properties props) throws IOException, InterruptedException {
logger.entering(getClass().getName(), "getImageDimensions", imgFile.getName());
int width = 0;
int height = 0;
if (props.containsKey("imageTestProgArgs") &&
... |
41e37929-21a6-41e9-a727-c06b1dc50e15 | 5 | private String generateFunctionString(String origStr,//
Map<LiteralVariable, LiteralVariable> literalVariableMapping) throws ParserException {
try {
LiteralVariable lv = DflTheoryParser2.extractLiteralVariable(origStr);
if (null != literalVariableMapping && literalVariableMapping.containsKey(lv)) {
lv = ... |
a2f9b2b4-ae3a-4f28-a5de-da11eeba615f | 8 | public static String[] parse(String cmdline) {
if(cmdline == null) {
return new String[0];
}
char[] chars = cmdline.toCharArray();
boolean inquote = false;
ArrayList args = new ArrayList();
StringBuffer buf = new StringBuffer();
for(int i=0;i<chars... |
0cb4dbd3-54ee-4ead-818e-417ed9acee41 | 6 | protected void paintProvince(final Graphics2D g, int provId) {
final String religion = mapPanel.getModel().getHistString(provId, "religion");
if (religion == null) {
mapPanel.paintProvince(g, provId, Utilities.COLOR_NO_HIST);
} else if (religion.length() == 0 || religion.equ... |
bb70a136-a0cb-4880-b9f4-183fba588e04 | 9 | private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_... |
b83ee2f2-7409-4d72-92d7-a00b4fc53425 | 0 | public boolean equals(Land land) {
return this.getID() == land.getID();
} |
8a8f81c3-b90d-41e9-9401-0e329dd74c66 | 8 | public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String service;
ServiceDef sd;
String userEmail;
Integer sessionId;
try {
HttpServletReque... |
37be39b4-41f6-47a5-b493-2970f38168ac | 0 | public void setRooms(Collection<RoomEntity> rooms) {
this.rooms = rooms;
} |
15e7d186-5d04-4a71-bad0-bb68c9cdc024 | 4 | private static int getMonitorExitSlot(StructuredBlock stmt) {
if (stmt instanceof InstructionBlock) {
Expression instr = ((InstructionBlock) stmt).getInstruction();
if (instr instanceof MonitorExitOperator) {
MonitorExitOperator monExit = (MonitorExitOperator) instr;
if (monExit.getFreeOperandCount() ==... |
5dc7d5b9-f216-492b-aaab-869953574cb1 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Book other = (Book) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
i... |
4db29f49-7a9e-414f-a142-ba8eff16649f | 5 | public void remove(final Superiority sup) {
Set<Superiority> list = superiors.get(sup.getSuperior());
if (null != list) {
if (list.remove(sup)) superiorityCount--;
if (list.size() == 0) superiors.remove(sup.getSuperior());
}
list = inferiors.get(sup.getInferior());
if (null != list) {
list.remove(su... |
494d208a-1ca9-4982-854a-c93c968d924b | 6 | public void exportMatrix(String outputFile) {
try {
PrintWriter pw = new PrintWriter(outputFile);
pw.println("\"Step\",\"Server\",\"Application\",\"Links\"");
for (int step = 0; step < bpgHistory.getStepNumber(); step++) {
for (int i = 0; i < bpgHistory.getApp... |
3fdd77ff-08e7-4088-9ec7-c39af9f33ea8 | 4 | @RequestMapping("/discountList.do")
public ModelAndView discountList(Device device, HttpServletRequest req) throws Exception {
int rows = 16;
int pageBlock = 10;
String path = "discountList.do";
String pageCode;
String cPage = req.getParameter("cPage");
ModelAndView mav = new ModelAndView();
if (cPage =... |
ed13faf2-8d9d-430d-804c-4adaa492996d | 7 | @Override
public Parameter getParameter(final int parameterIndex) {
Parameter parameter;
switch (parameterIndex) {
case 0:
case 1:
parameter = super.getParameter(parameterIndex);
break;
case 2:
parameter = fc;
... |
b88cca7b-fc67-490c-b508-975b16007c7c | 2 | private void fill(InputStream in, byte[] buf, int len) throws JSchException, IOException{
int s=0;
while(s<len){
int i=in.read(buf, s, len-s);
if(i<=0){
throw new JSchException("ProxySOCKS5: stream is closed");
}
s+=i;
}
} |
096b34cc-1e36-4b8a-9e1a-4344297e77be | 0 | public static void main(String[] args) {
// 不需要执行额外方法的
ITalk people = new PeopleTalk("湖海散人", "18");
people.talk("No ProXY Test");
System.out.println("-----------------------------");
// 需要执行额外方法的
TalkProxy talker = new TalkProxy(people);
talker.talk("ProXY Test", "七里香");
} |
3c7005c7-daae-4d13-b7c3-178caeec9993 | 4 | public static void readFile(String fileName) {
if (fileName == null) // Go back to reading standard input
readStandardInput();
else {
BufferedReader newin;
try {
newin = new BufferedReader( new FileReader(fileName) );
}
catch (Exception e) {
... |
3b7483e9-11fa-4f4e-8266-1ebf648ed433 | 0 | public long getCode() {
return this._code;
} |
2944a01a-703c-4f4e-bcde-e9ab86227c6f | 9 | public static boolean add(Task task) throws Exception {
// check whether the task object is null.
if (task == null) {
throw new Exception(StringFormat.STR_ERROR_NULL_TASK_OBJECT);
}
// check whether task has task name.
if (task.getTaskName().equals("")) {
throw new Exception(StringFormat.STR_ERROR_NO_TA... |
b32b420b-e9ae-4092-9f80-82681c24c981 | 2 | public void getTrames()
{
//On crée une List contenant tous les noeuds "etudiant" de l'Element racine
List listEtudiants = racine.getChildren("trame");
//On crée un Iterator sur notre liste
Iterator i = listEtudiants.iterator();
while(i.hasNext())
{
//On recrée l'Element courant à chaque... |
d0a3b088-4741-4cef-b5fa-857c7456fa4f | 6 | public ArrayList<Double> run(){
for(int i = 0; i<connections.size(); i++){
if(connections.get(i).getGiveNeuron()==null) System.out.println("Error 1:: NeuralNetwork 368");
if(connections.get(i).getRecieveNeuron()==null) System.out.println("Error 2:: NeuralNetwork 369");
if(con... |
f4e9f54c-963e-416e-8b5c-4cc5f2cdabd6 | 8 | private static Normalization determineNormalization(Element model) {
Normalization normMethod = Normalization.NONE;
String normName = model.getAttribute("normalizationMethod");
if (normName.equals("simplemax")) {
normMethod = Normalization.SIMPLEMAX;
} else if (normName.equals("softmax")) {
... |
f68c98b3-6789-4bbc-a4fc-5bc2b6d4bb70 | 1 | public boolean contains(int v)
{
return v >= 0 && v < V();
} |
76fc8f5c-b511-4497-8db0-480f071fe473 | 3 | private void initComponentsEast() {
eastPanel = new JPanel();
// Layout für 15 Zeilen und 2 Spalten
eastPanel.setLayout(new GridLayout(15, 2));
// Unsichtbarer Rahmen wird gesetzt, um Abstand zum Frame zu bekommen
eastPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 15));
ActionListener myAction... |
683193f8-7608-487e-a999-10a0a09b4803 | 9 | static byte TripWireHookFix(byte data, String kierunek)
{
if (kierunek.equals("right"))
{
if (data == 2) {
return 5;
}
if (data == 4) {
return 2;
}
if (data == 5) {
return 3;
}
if (data == 3) {
return 4;
}
}
else
{
... |
1f62618e-5d29-4a97-9316-a9066c11b0a5 | 2 | public static SpellChecker getInstance(){
if (instance == null){
synchronized (SpellChecker.class) {
if (instance == null){
instance = new SpellChecker();
}
}
}
return instance;
} |
98d108bc-93eb-4964-a3ba-9ac00d18b42c | 4 | public final void schedule() {
if (factors() && Settings.wmanager) {
for (String s : Settings.worldz) {
writeLog("(" + s + ") will always stay: "
+ Settings.time);
}
getServer().getScheduler().scheduleSyncRepeatingTask(this,
new Runnable() {
@Override
public void run() {
Tim... |
64bc2579-8b1f-4c13-8b56-cd0847100074 | 8 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
project=jTextField1.getText();
component=jTextField2.getText();
String sql= "select * from polishing where project='"+project+"' and component='"+component+"'";
try{
... |
2254c817-1813-4b07-9289-1773d99d4bdb | 6 | private ListNode merge (ListNode h1, ListNode h2) {
ListNode p1 = h1;
ListNode p2 = h2;
ListNode head = null;
ListNode tail = head;
while ( p1 != null && p2 != null) {
if ( p1.val > p2.val ) {
if ( head == null ){
h... |
7785c406-f7ac-4255-ac44-151314f5e605 | 5 | private static double[] getResistPoints(int lineNumber, double[] highPrices) {
double[] rPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 0;
for(int j=-5;j<=0;j++){
if((i+j>=0) && (i+j<lineNumber-1) && highPrices[i+j]>price){
... |
83f21be0-b062-4e98-9bae-00d853984e49 | 3 | @Override
protected Value evaluate(ExecutionContext context) throws InterpretationException {
Value val = ((AbsValueNode) this.getChildAt(0)).evaluate(context);
if (val.getType() == VariableType.ARRAYLIST) {
ArrayList<Value> list = (ArrayList<Value>) val.getValue();
return l... |
941f2293-73e1-4a17-964d-cda9a81449f9 | 9 | private void syncDatabase() {
/* Obtain connection to forum. */
ForumSQLConnector ct = new ForumSQLConnector(mHost, mPort,
mUserName, mPassword, mDbName);
Connection con = null;
con = ct.getConnection();
if(con == null) return;
/* Get map of forum group names -> ids */
Map<String, Integer> group_forum... |
91ef200f-d1a2-4741-872c-4bfd6c03f27c | 1 | public String getHeader(String name)
{
if ( !headers.containsKey(name) )
return "";
return headers.get(name);
} |
d0b40c2e-4fa1-438f-80d6-4c0526c371b6 | 1 | public void show()
{
for(PostGeneral post: posts){
post.display();
System.out.println();
}
} |
1f3c1fca-64ef-4e60-b7eb-0b81a60726f6 | 9 | public int []nextMove(int token) {
/* lucky position in the center of board*/
if(getBoardValue(1, 1)==EMPTY) return new int[]{1,1};
/* if we can move on the next turn */
int winMove[] = nextWinningMove(token);
if(winMove!=null) return winMove;
/* choose the move that p... |
d0246001-0a40-4789-9d84-6daaaa1f78d4 | 1 | public String toString() {
final List children = ssaGraph.children(node);
String s = "<" + node + ", hash=" + hash;
final Iterator iter = children.iterator();
while (iter.hasNext()) {
final Node child = (Node) iter.next();
s += ", " + child + "{" + child.valueNumber() + "}";
}
s += ">";
... |
5c37c777-019f-46d2-a771-9d331cef791d | 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... |
be7f82de-808e-43d9-8eeb-7750479a8417 | 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... |
7c865e7d-56c5-40fc-979d-acc6f55b8847 | 8 | private String getRequestParams() throws UnsupportedEncodingException {
String parameters = keywords;
parameters = URLEncoder.encode(keywords, "utf-8");
parameters = parameters.replaceAll("\\+", "%20");
parameters = URLEncoder.encode(parameters, "utf-8");
if (province != null && province != "") {
if (distr... |
87d5f543-445d-4a92-af0f-55a2b3c6b274 | 3 | public void stopDestroy(Player p) {
if (p == registry.getPlayerManager().getCurrentPlayer()) {
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
placeable.setDes... |
440c1680-9e57-4823-bf1a-df80468a58e3 | 9 | public static void main(String[] args) {
Connection con = null;
Statement st = null;
ResultSet rs = null;
String url = "jdbc:postgresql://localhost/postgres";
String user = "postgres";
String password = "super";
try {
con = DriverManager.getConnect... |
aefc328c-b45a-4208-9e06-a555a9185b7b | 5 | public ConcurrentSkipListSet<Double> factorise(int significant_figures) {
ConcurrentSkipListSet<Double> factors = new ConcurrentSkipListSet<>();
int maxFactors = this.getOrder();
System.out.println("\nFACTORISING {");
DoubleFunction<Boolean> test = (n) -> {
double factor = n... |
5a77e931-a3c4-4b0b-8e8c-e3e7a055877e | 0 | public FileWrapper(File file, int id){
this.file = file;
this.id = id;
} |
cc194ac3-64dc-4e54-a943-6d3c14be35a4 | 8 | public static String convert_to_postfix(String expr) {
Stack<Character> op_stack = new Stack<Character>();
StringBuilder out = new StringBuilder();
String opers = "+-*/()";
char top_sym = '+';
boolean empty;
String[] tokens = expr.split(" ");
for (String token : t... |
6b8eabd1-09bd-4ffe-b2d1-a7771faca3c7 | 2 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int lowest=Integer.MAX_VALUE;
for (int i = 0; i < 100000; i++) {
GraphOperation obj = new GraphOperation();
obj.readFileIntoMemory("kargerMinCut.txt");
int retval =obj.kargerRandomMinCut();
if(retval<... |
e8f4cb9b-e108-4259-b63a-af9053180e3c | 5 | public void export() {
File f = Tools.showSaveDialog(Tools
.getLocalizedString(ActionType.EXPORT.name() + ".Name"));
if (f != null) {
try {
String url = Tools.getApplicationFolder() + "temp/temp.html";
File file = new File(url);
if (file.exists()) {
url = file.toURI().toURL().toString();
... |
08b5f04d-61db-4de4-a995-2c0cf9996fa5 | 3 | private List<StatisticDto> filterStatistic(List<StatisticDto> rawStatistic, long fromTimestamp, long toTimeStamp) {
List<StatisticDto> filteredStatistic = new ArrayList<StatisticDto>();
for (StatisticDto statisticDto : rawStatistic) {
if (statisticDto.timestamp > fromTimestamp && statisticDto.timestamp < toTimeS... |
03deb0b4-671e-4806-bd9a-eb9ef5be3e4c | 8 | public boolean moveRight() {
// Block invalid moves
if (!canMoveRight)
return false;
boolean result = false;
for (int i = 0; i < dim; i++) {
for (int j = dim-2; j >= 0; j--) { // We can skip the right most column
// Skip empty tiles
if (isTileEmpty(i, j))
continue;
// Ste... |
a492dcdb-7a54-4619-832e-190b141d8458 | 8 | ApacheHTTPResponse(
final HttpClient client,
final BOSHClientConfig cfg,
final CMSessionParams params,
final AbstractBody request) {
super();
this.client = client;
this.context = new BasicHttpContext();
this.post = new HttpPost(cfg.getURI()... |
33ec5e72-ecc3-40c1-8985-53109321ef99 | 3 | public void update(int x, int y) {
currentX = (x <= maxMapMovementToLeft) ? maxMapMovementToLeft : x;
if (x <= maxMapMovementToLeft) {
currentX = maxMapMovementToLeft;
} else if (x >= maxMapMovementToRight) {
currentX = maxMapMovementToRight;
} else {
... |
472ea228-8d6e-4e43-9908-be5cb897c602 | 2 | @Override
public void render(float delta) {
// TODO Auto-generated method stub
Gdx.gl.glClearColor(0, 1, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
boolean xPressed = input.buttons[Input.X];
if (xPressed != false && input.oldButtons[Input.X]) {
game.splash = new SplashScreen(game);
game.setScr... |
d72956a8-cfcb-4e2c-a1ab-10d34f388ecf | 6 | private synchronized IndexPair[] getOrLoadPairs() {
IndexPair[] pairs;
if (cache != null && (pairs = cache.get()) != null) {
hitCount.incrementAndGet();
return pairs;
}
missCount.incrementAndGet();
pairs = new IndexPair[size];
FileInputStream in = null;
try {
in = new FileInputStream(file);
/... |
b00be2ac-0571-4af2-a2b0-8edba433b093 | 2 | private int heuresAccumuleesSurGroupe(String[] listeCategorie,
boolean inclureHeuresExtra) {
int total;
if (inclureHeuresExtra) {
total = heuresExtra;
} else {
total = 0;
}
for (String categorie : lis... |
830c08c7-e63d-4a5a-a2b9-b4a571726ffc | 6 | private static void readObjectFile(Path path){
ObjectInputStream dataIn=null;
try {
//apertura del stream
dataIn= new ObjectInputStream(Files.newInputStream(path));
try{
while (true){
//lectura de objetos (thorws ClassNotFoundException):
P... |
17449eca-d995-4fd3-becc-3a0cfa9975ff | 2 | public void GenerateQuiz()
{
TitleEntry = TitleEntry_textbox.getText();
Quiz newQuiz = new Quiz(TitleEntry);
newQuiz.navigationEnabled = NavigationEnabled_chkbox.isSelected();
newQuiz.showPracticeQuestion = ShowPracticeQuestion_chkbox.isSelected();
String enteredTime = TimeAllotte... |
a83b5bc4-3db5-44a6-9e90-fac4536e2ab6 | 7 | public ArrayList<Product> getSelectedProduct() {
ArrayList<Product> products = new ArrayList<Product>();
NodeItem selectedNode = getSelectedNode();
if(selectedNode == null){
return products;
}
Object o = selectedNode.getStoredObject();
if(!(selectedNode == root)){
//if it's a single node, re... |
cb532c14-2155-4e64-a3bc-fad070d7454d | 7 | private String addOptionalsToReadable() {
String palautettava = "";
if (volume != 0) {
palautettava += "\nVolume: " + volume;
}
if (series != null) {
palautettava += "\nSeries: " + series;
}
if (address != null) {
palautettava += "\nAdd... |
2556d1f2-b539-4bff-a160-07edab990455 | 4 | public boolean containsMove(Move move)
{
boolean contains = false;
if (getSize()==0 && move==null) {
contains = true;
}
for (Iterator iter = this.getIterator(); iter.hasNext(); ) {
if (move.equals(iter.next())) {
contains = true;
break;
}
}
return contains;
} |
5103bc40-9066-4831-a6fe-aa3ae35df078 | 2 | public String concatenarTablespaces(){
String ret="";
if(getTablespaces().size()>0){
ret+=getTablespaces().get(0);
for(int i=1;i<getTablespaces().size();i++){
ret+=","+getTablespaces().get(i);
}
}
return ret;
} |
0a5904f6-0d56-411d-b06b-4a7b1b43039e | 8 | public QRDecomposition (Matrix A) {
// Initialize.
QR = A.getArrayCopy();
m = A.getRowDimension();
n = A.getColumnDimension();
Rdiag = new double[n];
// Main loop.
for (int k = 0; k < n; k++) {
// Compute 2-norm of k-th column without under/overflow.
double n... |
cbd28fe4-1717-4eec-a5ae-b8aabc073685 | 8 | public String toString() {
String sql = "";
sql = "SELECT ";
sql += ((distinct != null)?""+distinct+" ":"");
sql += ((top != null)?""+top+" ":"");
sql += getStringList(selectItems);
sql += " FROM " + fromItem;
if (joins != null) {
Iterator it = joins.iterator();
while(it.hasNext()) {
Join join ... |
9a8d4374-a477-44e2-b987-f8a0013c0d55 | 9 | public static double decrementPrice(double price) {
double newPrice;
if (price > 100.0) {
newPrice = price - 10.0;
} else if (price > 50.0) {
newPrice = price - 5.0;
} else if (price > 30.0) {
newPrice = price - 2.0;
} else if (price > 20.0) {
... |
0cec8f05-eec1-40aa-9b61-d797ac01255a | 9 | private String builtInToString() {
String result = "";
if (modName.atom.equals("TRUTH-VALUE")) {
result += "dth TRUTH-VALUE is\n";
result += " sort Bool .\n";
result += " op true : -> Bool .\n";
result += " op false : -> Bool .\n";
result += "end\n";
} else if (modName.atom.equals(... |
6363f6fd-79fa-4f85-8561-46b0c7bc4ce7 | 9 | private void senaoEspecial() {
if (comparaLexema(Tag.SENAO)) {
consomeToken();
if (comparaLexema('{')) {
consomeToken();
boolean c = true;
while (c) {
c = comeco();
}
if (numeroErro == 0) {
if (comparaLexema(Tag.PARE) || comparaLexema(Tag.CONTINUE)) {
consomeToken(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.