method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a03e160f-4d89-437b-9c06-25af1374e350 | 0 | public ConcreteCommand(Receiver receiver) {
this.receiver = receiver;
} |
aadd7355-a11d-4f41-b278-43db5264e1fe | 0 | public void testFirstDay() {
Date date = new Date();
Date r = DateUtils.getFirstDayOfTheMonth(date);
System.out.println(r);
} |
390d3c23-838d-4a91-a055-4b6f741f9c56 | 4 | public static void main(String[] args) {
int N = 1_000_000;
int total = 0;
for(int i = 10; i < N; i++) {
List<Integer> digits = EulerMath.intToDigits(i);
int sum = 0;
for(int j = 0; j < digits.size() && sum <= i; j++)
sum += EulerMath.fact( digits.get(j) );
if( sum == i )
total += i;
}
... |
0df9db94-2f2e-4ef0-92c9-81e904276b45 | 7 | @SuppressWarnings("RedundantIfStatement")
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GitUpdate gitUpdate = (GitUpdate) o;
if (folder != null ? !folder.equals(gitUpdate.folder) : gitUpdate.folder != null) return false;
i... |
d6b66d79-86a2-4ea7-aeb8-af105ec3cf0d | 2 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
long activeUserId = session.getActiveUserId();
long appointmentId = Long.valueOf(params.get("id"));
Appointment a = Appointment.findById(appointmentId);
if(a==null){
rtn.p... |
e1d12541-07c8-41a0-9e13-5186f74f79fb | 4 | public void popularCmbDepartamentoBuscar() {
ArrayList<String> Departamentos = new ArrayList<>();
DepartamentoBO departamentoBO = new DepartamentoBO();
if (userLogado.getTipo().equals("Diretor")) {
try {
Departamentos = departamentoBO.ComboBoxDepartamentos();
... |
a5490b59-1608-4592-adc0-ad67a15e0b4c | 1 | private void drawPercentComparisonLines(Graphics2D g) {
// System.out.println(
// PERCENT_CHANGE_COMPARISON_LINES.size()+" < --------------------- size");
for (Entry<Line2D.Float, Color> comparison : PERCENT_CHANGE_COMPARISON_LINES
.entrySet()) {
Stroke original = g.getStroke();
// System.out.print... |
ce056554-8601-480c-bb2e-ec957ca04b91 | 8 | public static void setProjection(Inputs projection, float left, float right, float bottom, float top, float near, float far) {
if (Float.isNaN(Transformations.left)) {
Transformations.left = left;
}
if (Float.isNaN(Transformations.right)) {
Transformations.right = right;
}
if (Float.isNaN(Transformation... |
de41a3b8-7b2a-4a49-b77a-a6c69f96f124 | 7 | private TableParser init() {
final Table tableAnnotation = mClass.getAnnotation(Table.class);
final String tableName = tableAnnotation.value();
PrimaryKeyDef primaryKeyDef = null;
ColumnDef uniqueKeyDef = null;
final List<ForeignKeyDef> foreignKeyDefs = Lists.newArrayList();
... |
591ed478-53df-410e-9ce5-934bd86d761e | 4 | public void addCoverage(BranchData branchData) {
if (!NO_CONDITIONS_ARE_COVERED.equals(source) && !NO_CONDITIONS_ARE_COVERED.equals(branchData.source))
if (position != branchData.position || nodeLength != branchData.nodeLength)
throw new IllegalStateException("Merging non-matching br... |
fa13def3-eab9-4e9c-8def-e487f3fc2dc4 | 6 | public void nextStep() {
// handle timing and onEntryStepEnd
if (sold != null) {
final long t = System.currentTimeMillis() - told;
final double progress = 1 - (double) stepsToComplete.size() / (double) totalSteps;
for (final ProgressListener l : progressListeners) {
l.onEntryStepProgress(this, sold, ... |
0576e207-66ff-4c64-af34-9652bbfaa189 | 8 | final void method3669(Canvas canvas, int i, int i_231_) {
do {
try {
anInt7701++;
long l = 0L;
if (canvas != null && aCanvas7626 != canvas) {
if (aHashtable7577.containsKey(canvas)) {
Long var_long = (Long) aHashtable7577.get(canvas);
l = var_long.longValue();
}
} else
l = aLong755... |
9e4a5539-d01d-43c0-b308-4e030213045b | 1 | public void testWithFieldAdded2() {
DateMidnight test = new DateMidnight(2004, 6, 9);
try {
test.withFieldAdded(null, 0);
fail();
} catch (IllegalArgumentException ex) {}
} |
d18c77cb-027f-4c65-b53d-0356eb89ba5f | 2 | private void gameUpdate() {
loops = 0;
while( System.currentTimeMillis() > next_game_tick && loops < MAX_FRAMESKIP) {
board.poll();
mousey.poll();
processInput();
/*==================================================================
* GAME UPDATE METHODS
*======================================... |
80c4de3f-2998-4bea-ac4a-b4d7a5aedacc | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Workstation)) {
return false;
}
Workstation other = (Workstation) object;
if ((this.idWorkstation == null && ot... |
8fe6eefc-90c8-4949-aca0-dea914d61d0f | 8 | public void setFolded(boolean folded) {
if (isDecrypted || folded) {
super.setFolded(folded);
return;
}
ControllerAdapter browseController = (ControllerAdapter) mModeController;
// get password:
final EnterPasswordDialog pwdDialog = new EnterPasswordDialog... |
fca03324-7413-4531-bdf3-11f3f5abcf9c | 5 | public void killHost(String hostname) {
if (hostname == null || hostname.isEmpty()) {
return;
}
Host hostToKill = null;
for (Host host : network_) {
if (host.getAddress().getHostName().equals(hostname)) {
hostToKill = host;
}
}... |
a0120f2b-1b1a-445b-8932-999b3d6add7b | 5 | public PublicKey decodePublicKey(byte[] k) {
// magic
if (k[0] != Registry.MAGIC_RAW_DH_PUBLIC_KEY[0]
|| k[1] != Registry.MAGIC_RAW_DH_PUBLIC_KEY[1]
|| k[2] != Registry.MAGIC_RAW_DH_PUBLIC_KEY[2]
|| k[3] != Registry.MAGIC_RAW_DH_PUBLIC_KEY[3]) {
throw new IllegalArgumentExce... |
349879d2-efa1-4674-85cc-4640997b5e11 | 7 | public void printPercentages() {
// -- Percentages --
System.out.println(" == Percentages for individual elements ==");
System.out.println();
// Codon percentages
System.out.println(" -- Percentages for each codon composition --");
System.out.println("| - | -AA | ... |
102b7471-52a8-40b1-ba58-3f0652edffa1 | 3 | @SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerDamage (EntityDamageByEntityEvent event) {
Entity entity = event.getEntity();
Entity damager = event.getDamager();
if (entity instanceof Player) {
if (damager instanceof Skelet... |
39d593af-58e1-4f3d-9dee-8d62e560ecc8 | 7 | private void createSecondActiveCluster(double[] timeVector, String user) {
double[] post_count = timeVector;
double totalPost = 0.0;
for (double i : post_count) {
totalPost += i;
}
double threshHold = (20 * totalPost) / 100;
double firstClusterSize = post_count[0] + post_count[1] + post_count[2]
+ ... |
8a726eb0-02b1-43ce-a4f9-32706bfa78db | 7 | @Override
public void keyPressed(KeyEvent ke) {
if(showScore)
return;
if(stopThread){
newGame();
}
switch (ke.getKeyCode()) {
case KeyEvent.VK_LEFT:
slider.buttonPressed = Slider.button.LEFT;
break;
case ... |
564b26c1-314e-4a67-b738-fc269b027dee | 0 | public void setMana(int mana)
{
this.mana = mana;
} |
c3ca77d6-5daa-4254-8894-cc5d445d875c | 8 | public void move(){ //move function, when uses keyboard to control
if(ifLeft == true && ifPu == false){
moveLeft();
}
if(ifRight == true && ifPu == false){
moveRight();
}
x += dx;
if(ifJump == true){
currentSpeed += 0.2;
y += currentSpeed;
}
if(y == 500){ //on ground
ifJump = fa... |
b0138ecd-1669-4008-bd38-8cd7ed6cab3a | 2 | @Override
public ArrayList<ClienteBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> hmFilter, HashMap<String, String> hmOrder) throws Exception {
ArrayList<Integer> arrId;
ArrayList<ClienteBean> arrCliente = new ArrayList<>();
try {
oMysql.conexion(enumTipoConex... |
2b96ccc6-e283-4437-8b73-691281225b97 | 0 | @Test
public void virheellinenFormaattiTapausC() {
Este s = new Este(200, 100, 100, 200);
Este r = new Este(100, 100, 200, 200);
assertTrue("Este ei muuttanut kulmia oikeiksi. " + s.toString(),
s.toString().equals(r.toString()));
} |
8ac0a40d-cad0-41fb-9574-0519fafbdae2 | 8 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == showPitch) changeDataType(PITCH);
if (e.getSource() == showRhythm) changeDataType(RHYTHM);
if (e.getSource() == showDynamic) changeDataType(DYNAMIC);
if (e.getSource() == showPan) changeDataType(PAN);
if (e.getSour... |
6156afa4-97ab-4ad1-adb4-6a4a2fad5743 | 1 | public boolean end() {
return eof && !usePrevious;
} |
9044df00-16d8-467f-825c-7739c26ce8d9 | 1 | public String getRequests() {
String res = "";
for (Iterator<String> e = requests.iterator(); e.hasNext();) {
res += e.next();
}
return res;
} |
e07f5079-2b1f-4b73-9fed-dbbd2e3f05fe | 3 | public void remove() {
EntityManager em = conecta();
try {
if (em != null) {
Exame e = em.find(Exame.class, idExame);
em.getTransaction().begin();
em.remove(e);
em.getTransaction().commit();
}
} catch (Except... |
6a60ce3e-253a-488f-a270-07d63dd72135 | 8 | private boolean tarkistaValkoinen(Sotilas sotilas, Kentta kentta, int xa, int ya, int xl, int yl) {
if(ya == yl) {
if(xl - xa == 1 && kentta.nappulaKoordinaatissa(xl, yl) == null) return true;
if(avausSiirtoValkoinen(sotilas, kentta, xa, ya, xl, yl)) return true;
}
if( (y... |
6cba588e-38f3-4a0a-9e9a-e908c4076919 | 6 | public void updatePlacement(Joueur joueur){
panelResumePerso.removeAll();
JPanel unPerso;
for(Personnage p : joueur.getPersonnages()){
if(p.getPositionX() == -1) {
unPerso = new JPanel();
unPerso.setLayout(new BoxLayout(unPerso, BoxLayout.PAGE_AXIS))... |
fc1a70db-10df-4b85-96da-b0404bf53ba2 | 5 | public static void convertFile(File csvFile) {
CSVReader csv = new CSVReader(csvFile);
csv.sep = ",";
String[] d = csv.readRow();
int width = Integer.parseInt(d[0]);
int height = Integer.parseInt(d[1]);
int depth = Integer.parseInt(d[2]);
Block[][][] blocks = new Block[width][width][width];
Str... |
27d24bf2-a0d4-4e62-9c95-bbb889f54680 | 8 | private List<Class<?>> getAllNeedTestCase(Class<?> clazz) throws ClassNotFoundException {
List<Class<?>> classes = new ArrayList<Class<?>>();
for (Class<?> c: getClasses(clazz)) {
if (clazz.isAssignableFrom(c) && !clazz.equals(c)) {
classes.add(c);
}
}
return classes;
} |
b2c9bbdb-00a3-4cb4-922e-f8a8c252da32 | 4 | public void updateStatus() {
long lastPing = mainController.getZeppelinController().getLastPing();
long diff = System.currentTimeMillis() - lastPing;
String newText = "<html>BT Zeppelin status: ";
if(mainController.getZeppelinController().isSearching()) {
newText += "<f... |
52e19029-a49b-4ae8-a326-34973c636f94 | 8 | public WeatherMetaDataVO createMetaDataObject(HashMap<String,String> metaInfo,
Integer counter){
WeatherMetaDataVO metaDataObj = new WeatherMetaDataVO();
// metaDataObj.setId(counter);
metaDataObj.setPrimary_id(metaInfo.get("primary_id").toString());
meta... |
e1d815f9-30ce-487d-bb44-065cd46bd03d | 2 | public JSONArray names() {
JSONArray ja = new JSONArray();
Iterator keys = this.keys();
while (keys.hasNext()) {
ja.put(keys.next());
}
return ja.length() == 0 ? null : ja;
} |
5ca206f2-b554-478f-8894-b947be92be8c | 5 | static boolean KMP(char[] p, char[] t, int size) {
int i = 0, j = 0, m = p.length, n = size, c = 0;
while (i < n) {
while (j >= 0 && p[j] != t[i])
j = b[j];
i++;
if (++j == m) {
j = b[j];
if (i == m)
return false;
}
}
return true;
} |
e64c0d5e-b729-4f04-93c7-fe45d072c14b | 8 | public void actionPerformed(ActionEvent e) {
boolean hasNext = rIterator.hasNext();
if(!hasNext) {
if(!process.isRunning()) {
stop();
}
return;
}
if(hasNext) {
Pair<Crossing, Crossing> pair = rIterator.next();
gu... |
910d9c4f-1eec-4dce-91c5-ab6ce5fd2c47 | 7 | public FileMenu() {
super("File");
JMenuItem saveImage = new JMenuItem("Save image");
JMenuItem cropImage = new JMenuItem("Crop image");
this.setEnabled(true);
JMenuItem undo = new JMenuItem("Undo");
undo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Panel pane... |
c0548774-bd7c-438b-b73a-81e204b89177 | 9 | public void addNewStudent(String username, String password ,String firstName, String lastName, String teacherUserName) {
PreparedStatement newData1 = null;
PreparedStatement newData2 = null;
PreparedStatement teacherIDFinder = null;
int teacherID = -1;
try {
newData... |
2594f977-aeb8-4b88-8f09-56130c6dbe89 | 5 | public static boolean isSolved(Cube cube) {
for (int i = 1; i < 6; i = i == 2 ? i + 2 : i + 1) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
if (cube.getList(TileColor.get(i)).get(j).get(k) != new Cube(TileColor.blue, TileColor.yellow).getList(TileColor.get(i)).get(j).get(k))
return ... |
01c74e7c-3ee5-48f5-8619-e76ca22767a8 | 5 | @Override
public String getColumnName(int column){
String name = "??";
switch (column){
case 0:
name ="KundeId";
break;
case 1:
name ="FirmaNavn";
break;
case 2:
name ="KontaktNavn";
break;
case 3:
name ="TelefonNr";
break;
case 4:
name ="Status";
break;
}... |
50ef7807-768b-434f-9f7a-4fde158cbb0a | 3 | public void move(Map currentMap){
double xm = Math.cos(heading*Math.PI)*vel;
double ym = Math.sin(heading*Math.PI)*vel;
if(!currentMap.locWalkable(x+xm, y+ym)){
heading+=1;
}
if(currentMap.locWalkable(x+xm, y)){
x += xm;
}
if(currentMap.locWalkable(x, y+ym)){
y += ym;
}
} |
89229b47-8a1d-4fad-84cd-e7cad8d8efe2 | 3 | public void setarSenhaFuncionario(Funcionario f, String senha, String senhaAntiga)throws ExceptionGerentePessoa{
if(senha == null){
throw new ExceptionGerentePessoa("Valor da senha inv��lido");
}else if(f.getSenha() == null || f.getSenha().equalsIgnoreCase(senhaAntiga)){
f.setSenha(senha);
}... |
251b2c34-9335-4972-bb23-44f03d998be0 | 6 | private int AddToLogList(List<Log_record> l_list)
{
for(Log_record lr : l_list)
{
for(int i = 0; i < log_list.size(); i++)
{
if(lr.equals(log_list.get(i)))
break;
if(lr.GetDate().getTime() < log_list.get(i).GetDate().getTim... |
322fe752-f01d-412a-a08a-0569df36f69a | 8 | public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray) other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.g... |
8e887e7d-d003-4374-89a5-1b65732aecdf | 2 | @Override
public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling)
throws IOException {
if (kind != Kind.CLASS) {
throw new IOException("Only class output supported, kind=" + kind);
}
try {
MemoryOutput... |
647d5c80-12bc-4fe5-9f3f-bd4cb90313b4 | 3 | @Override
public Boolean read(Class type, CommandInvocation invocation) throws ReaderException
{
String flag = invocation.currentToken();
if (flag.startsWith("-"))
{
flag = flag.substring(1);
if (this.name.equalsIgnoreCase(flag) || this.longName.equalsIgnoreCase(f... |
f41b9ddc-331b-49e4-82db-7223563d2ae0 | 4 | private UserActionResult genUserAction(EntityAction action) {
UserActionResult userActionResult = new UserActionResult();
userActionResult.setActionType(action.getActionType());
userActionResult.setTime(action.getTime());
Id actorId = action.getActorId();
if (actorId != null) {
userActionResul... |
a92a31bb-3d86-45d8-8bbd-66866bbfa880 | 0 | public Fabrique(ArrayList<Message> filemessages){
this.filemessages = filemessages;
} |
0f1dae64-0188-429f-8a5d-75d445a0567a | 1 | public void resume_egress() {
synchronized(egress_paused) {
if (!egress_paused) {
get_logger().warn("resuming egress but egress not paused");
}
egress_paused = false;
}
} |
2a9063a1-4f5a-4609-871f-9a1a00d1b9fd | 9 | public static void main(String[] args) {
sc = new Scanner(System.in);
System.out.println("Entre com a idade do nadador:: ");
Long idade = sc.nextLong();
if (idade >= 5 && idade <= 7) {
System.out.println("Infatil A");
} else if (idade >= 8 && idade <= 10) {
System.out.println("Ifantil B");
} else if (... |
a4fd6f41-052a-43e3-be09-236a1a996373 | 4 | private boolean isPawnPromotion( Move move ) {
return ( isPawnMove( move ) && ( ( move.to() >= A1 && move.to() <= H1 ) || ( move.to() >= A8 && move.to() <= H8 ) ) );
} |
982a3702-19e9-41b9-96c6-9ab365639102 | 8 | public List<StudentCatBean> fetchStudentCatMapping(String userid){
List<StudentCatBean> catMap = new ArrayList<StudentCatBean>();
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
try{
String sql="SELECT cat.CATEGORY_NAME,map.s_cat_id,map.c_id,map.s_id,p.userId "
+ "FROM CATEGORY c... |
cd161ab5-2b28-4be0-8770-b7a0029c84c7 | 3 | @Override
public void run()
{
synchronized (numberOfActiveProducersLock) {
numberOfActiveProducers++;
}
Random r =new Random();
try{
for(int i=0 ; i<maxItemsToProduce ; i++)
{
if(sharedQueue.isFull()){
break... |
4bfca1c8-b1b5-4da4-8da0-285692de1173 | 0 | private ClientFinder(String username, String interfaceName)
{
probeData = username.getBytes();
selectInterface(interfaceName);
} |
4f071158-f059-439c-8859-302d075c7eeb | 4 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(false);
String userPath = request.getServletPath();
// ist der Nutzer nicht angemeldet, schicke ihn zur Login-Seite
... |
e619df4c-55d4-4b25-bb16-672cafa1dbe9 | 4 | public int getJobCount() {
int count = -1;
if(daily) {
count = 0;
} else if (weekly) {
count = 1;
} else if (monthly) {
count = 2;
} else if (atStart) {
count = 3;
}
return count;
} |
67b2f336-fda6-4871-8a74-b79860214edf | 6 | @Override
public int compareTo(SemanticVersion o) {
if (major < o.major) {
return -1;
} else if (major > o.major) {
return 1;
} else if (minor < o.minor) {
return -1;
} else if (minor > o.minor) {
return 1;
} else if (micro < o.micro) {
return -1;
} else if (micro > o.micro) {
return 1;
... |
bf50994a-0ad5-4f3a-b1c7-e0c86933d429 | 1 | public synchronized void closeAllConnections() {
for (Socket socket : openConnections) {
safeClose(socket);
}
} |
5365e789-1972-43dd-be94-1f5c3d57aaff | 9 | public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor) {
if (lastDelay != null) {
return "You cannot Activate/Deactivate just after a ...";
}
if (lifeEventType == LifeEventType.CREATE) {
pendingCreate = new LifeEvent(p, lifeEventType, backcolor);
return null;
}
if (la... |
ecbba5fa-4dca-4f0d-8431-4e1253f95fb1 | 0 | public Spieler(Color c, String n, Fraktion f, Brett b) {
farbe = c;
name = n;
fraktion = f;
brett = b;
} |
aba571b5-565f-4944-9cfe-d9fcf66289e4 | 7 | public static Rule_dirSuper parse(ParserContext context)
{
context.push("dirSuper");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
... |
051551b1-3214-4f6d-818c-69bade560083 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TaxonObservationDownload)) {
return false;
}
TaxonObservationDownload other = (TaxonObservationDownload) object;
... |
ed9c1dbb-1283-413e-bd49-29a0a698e598 | 1 | public void testParseStandardFail4() {
PeriodFormatter parser = ISOPeriodFormat.standard();
try {
parser.parsePeriod("PXS");
fail();
} catch (IllegalArgumentException ex) {}
} |
0ddc01e0-6736-42c5-b648-0f885250a2bb | 0 | @Override
public void addQuestAnswer(String answ) {
questAnswer.add(answ);
} |
589977d0-81f1-4994-9318-df0f31efd7bf | 1 | private void addRelacao(Attributes attr) {
try {
bd.get(bd.size() - 1).addRelacao(attr);
} catch (Exception e) {
System.out.println("Erro ler tag \'relacao\': " + e.getMessage());
}
} |
f9bae15f-6556-4d7b-a4a8-168b2aca6b8b | 6 | public void save()
{
Configuration config = this.plugin.getConfig();
if (this.sp1 != null)
config.set("map." + this.game.getName() + ".sp1", SerializableLocation.locationToString(this.sp1));
else {
config.set("map." + this.game.getName() + ".sp1", null);
}
if (this.sp2 != null)
c... |
3a344a54-27fb-4b0e-8e26-4e990cd755c6 | 5 | public static void stripFileFromWrap(File file, String wrap)
throws FileNotFoundException, IOException, Exception {
BufferedReader in = null;
BufferedWriter out = null;
File _file = new File(file.getAbsolutePath() + "~");
if (file.exists()) {
log(" Stripping from " + wrap);
... |
adcf0ac4-524a-45e3-9065-ef8181cb902f | 3 | public static Class<?> getParameterGenericType(Method method, int paramIndex) {
Type[] paramTypes = method.getGenericParameterTypes();
Assert.notNull(paramTypes, "方法必须包含泛型参数");
Assert.isTrue(paramIndex < paramTypes.length, "参数索引不能大于参数总数");
Type genericType = paramTypes[paramIndex];
Class<?>[] classes = getAct... |
d357148f-973c-43d2-911f-6f71cef1e2aa | 5 | private void buildPopupMenu() {
// Construct components
popupMenu = new JPopupMenu();
JMenu viewAs = new JMenu("View as");
JRadioButtonMenuItem raw = new JRadioButtonMenuItem("Raw", true);
JRadioButtonMenuItem decimal = new JRadioButtonMenuItem("Decimal");
... |
a7b900c5-90e9-4c63-b5a0-d87347947611 | 7 | public boolean equals(Object _other)
{
if (_other == null) {
return false;
}
if (_other == this) {
return true;
}
if (!(_other instanceof Friends)) {
return false;
}
final Friends _cast = (Friends) _other;
if (userId != _cast.userId) {
return false;
}
if (userIdModified != _... |
71c88660-9de2-4139-a133-2379ace0a765 | 5 | public static PreparedStatement createStatement(Connection con, String query, Object... params) throws SQLException
{
PreparedStatement ps = con.prepareStatement(query);
int index = 0;
for(Object o : params)
{
index++;
if(o instanceof Integer)
ps.setInt(index, (Integer)o);
else if(o instanceof Dou... |
ceaf9b7c-564c-4662-9de3-11763bfa6fcd | 1 | private String showSaveDialog() {
File file;
String filename;
JFileChooser fc = new JFileChooser();
int rc = fc.showDialog(null, "Select file");
if (rc == JFileChooser.APPROVE_OPTION){
file = fc.getSelectedFile();
filename = file.getAbsolutePath();
return filename;
}else {
return null;
}... |
9123e3a3-1368-44b6-a1b5-2da3faafd28d | 3 | public void onDisconnect() {
// Autoreconnect with 30 second pauses between retries.
while(!isConnected()) {
try {
reconnect();
}
catch(Exception e1) {
try {
Thread.sleep(30000);
} catch (Exception e2... |
024ace08-86d9-496f-a82e-09b2523640ed | 3 | @Override
public void actionPerformed(ActionEvent e)
{
Object s = e.getSource();
if (s == previewButton)
{
WorldGenerator wg = new WorldGenerator(p.getOutput().output);
WorldPreviewer wp = new WorldPreviewer();
wg.addChunkOutput(wp);
JFra... |
9b0257fc-7f4a-4252-9cf8-73be958b920c | 3 | @Test
public void test_allFunctionality() {
File file = new File(filePath);
if (file.exists()) {
for (SortingAlgorithm algorithm: algorithmList) {
// loading list from file and asserting target list
List<Integer> unsortedListFormFile = appUtil.loadArray... |
23c664aa-f5bc-4857-8b44-e0e6679d6245 | 3 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("rowset") && oldRoles || newRoles) {
oldRoles = false;
newRoles = false;
}
} |
075c1a58-a899-4202-ad46-726a8d81df58 | 6 | public boolean playerLost(int p){
// If sentinel won
if(winner == 1)
{
// Check whether player was on team sentinel
for(int s:scourge)
{
if(s == p)
return true;
}
}
// If scourge won
if(wi... |
6c50b9b0-c0b9-4f11-875f-8abc16548a51 | 2 | public void run() {
res = "";
while (!stop) {
try {
reader.read(buf);
res += new String(buf);
} catch (IOException ex) {
//Logger.getLogger(SennaReader.class.getName()).log(Level.SEVERE, null, ex);
... |
4e13f8f7-39a1-424d-b604-774162797a3f | 4 | private void sfoSet(){
sfo = 0;
if (statechecks[4].getState()){sfo += 1;}
if (statechecks[3].getState()){sfo += 2;}
if(clearflag){ sfo = 4; clearflag = false;}
if(invflag){sfo = 5; invflag = false;}
} |
3d6882c7-dc98-4fa1-bbbf-6b80d166ae15 | 4 | public void cleanUpMapping() {
// Remove tabs you have no items for
if (!removedInvalidTabs) {
int i = 0;
final Iterator<LinkedHashSet<Integer>> iterator = mapping.iterator();
while (iterator.hasNext()) {
final LinkedHashSet<Integer> next = iterator.next();
if (i > 0) {
if (ctx.bank.select().s... |
524a8fa1-f7b4-412e-9de2-f656248a1bdf | 8 | public void menuGenKey() {
int choice;
do {
System.out.println("\n");
System.out.println("Select Key Generator");
System.out.println("--------------------\n");
System.out.println("1 - SHA3-Keccak Key as Text");
System.out.println("2 - SHA3-Kec... |
bfcfabfc-e98f-49f9-b26d-e9a4875e373b | 8 | ClientGUI(String host, int port) {
super("jChat Client (Build " + Client.clientVer + " -- https://www.github.com/ipavl/javachat)");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(590, 480);
setResizable(false);
getContentPane().setLayout(null);
JLabel lblServer = new... |
a83e803f-64c2-4f10-852b-1debef4b0b89 | 9 | public void createContactURL( GenKbAuthorization Authorization,
GenKbContactURLBuff Buff )
{
GenKbContactURLPKey pkey = schema.getFactoryContactURL().newPKey();
pkey.setRequiredContactURLId( schema.nextContactURLIdGen() );
Buff.setRequiredContactURLId( pkey.getRequiredContactURLId() );
GenKbContactURLByCo... |
3595ae54-12d4-4248-8f6c-522ba02b2c81 | 1 | private TestBuilder(Supplier<BeanType> constructor) {
if (constructor == null) throw new NullPointerException();
this.constructor = constructor;
} |
50153a23-ebc3-4e4d-953a-5eff3ee3581b | 7 | public int minDepth(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
Queue<TreeNode> q = new LinkedList<TreeNode>();
if (root == null)
return 0;
q.offer(root);
int depth = 1;
while (true) {
int n = q.size();
while ((n--) > 0) {
TreeNode tmpNode = q.pol... |
65d567e9-54e2-44f4-9bf2-edeaec969796 | 7 | static public String columnToAction(int column)
{
switch (column) {
case 0:
return "a";
case 1:
return "b";
case 2:
return "c";
case 3:
return "d";
case 4:
return "e";
case 5:
return "f";
case 6:
return "g";
default:
return "x";
}
} |
d71ca2cb-a796-44bf-8f48-70a66bdece74 | 9 | @Override
public boolean handle(Length length, Object value) {
if (length != null && value != null) {
boolean bool = false;
if (value instanceof Collection) {
bool = (((Collection<?>) value).size() > length.value());
} else if (value instanceof Map) {
bool = (((Map<?, ?>) value).size() > length.val... |
17480f29-c99e-4233-9e3a-73eac3452987 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
builder.append(chr);
break;
... |
af160f7a-c9c5-4fd7-b593-8410066a0280 | 1 | public int getLineNumber() {
if (lineCounter > -1) {
return lineCounter;
} else {
return -1;
}
} |
a02dff18-8609-4ee2-a8cb-3f8bab08a25b | 3 | public ClassMetadata getClassMetadata(final Class<?> clz) throws ClassNotFoundException {
if (clz == null) return null;
// Check cache
String clzName = clz.getCanonicalName();
if (classMetadataCache.containsKey(clzName)) return classMetadataCache.get(clzName);
// Build new metadata and put them into cac... |
7a6d3995-f47d-4130-9d02-d5a04769a332 | 7 | private void activateDnD() {
this.tagPanel.addStyleName( Resources.INSTANCE.style().tagEditable() ); //Change cursor on hover
//DnD
this.getElement().setDraggable( Element.DRAGGABLE_TRUE );
this.dndHandlers.add( this.addDomHandler( new DragStartHandler() {
@Override
... |
4d108f76-d839-49b2-93b4-be302057e67b | 1 | @Test
public void testSort1() {
Integer array[] = {9,2,1,90,25,10};
Integer sorted[] = {1,2,9,10,25,90};
Bubblesort<Integer> mysort = new Bubblesort<>();
mysort.sort(array,0,5);
for (int i = 0; i < array.length; i++) {
System.out.print(array[i]);
}
assertArrayEquals(sorted, array);
} |
eee00d87-8f0c-4c58-bb3a-8cbcf7c14150 | 2 | public void Update() {
File scriptFile = new File("scripts", filename);
if (scriptFile.exists()) {
if (olderThen(scriptFile)) {
LoadFromFile(scriptFile);
}
} else {
RemoveStartMenuElement();
script_list.remove(scriptFile.getName());
}
} |
2f46cd8e-fb98-41e9-93f5-25fd1c2be1e8 | 4 | private void statusLineStuff(String editorText, boolean isCanChangeStatusLine) {
if (lastSearchingPosition >= 0) {
vermilionCascadeNotebook.getEditor()
.setSelection(new Point(lastSearchingPosition, lastSearchingPosition + searchingText.length()));
if (isCanChangeStatusLine) {
OccurrenceReport ... |
f8f3852e-66f0-47ab-bed3-3a1dfd3da5f8 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Telefone)) {
return false;
}
Telefone other = (Telefone) object;
if ((this.codtelefone == null && other.codtele... |
44b38272-3588-4c17-9657-926405aa410c | 7 | public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;integratedSecurity=true;";
// Declare the JDBC objects.
Connection con = null;
Stateme... |
936fb1e4-643e-4aab-894c-719afdd92c84 | 9 | @Override
public int compareTo(Carta c1) {
if(this.eTrunfo()&&!c1.eTrunfo())
return 1;
if(!this.eTrunfo()&&c1.eTrunfo())
return -1;
char naipePuxado = this.um.puxada().getNaipe();
if(naipePuxado == getNaipe() && c1.getNaipe() != naipePuxado)
return... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.