method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cbf4e197-b3ca-4442-8fe3-091f367b30a8 | 3 | protected synchronized void execute(boolean synchronous) {
// see if we're already running
if (thread != null) {
// we're already running. Make sure we wake up on any change.
synchronized (statusLock) {
statusLock.notifyAll();
}
return;
... |
6a4c5305-2438-4071-9b42-5d1dc5ffb3b9 | 9 | private void adjustMinPrefForSpanningComps(DimConstraint[] specs,
Float[] defGrow, FlowSizeSpec fss,
ArrayList<LinkedDimGroup>[] groupsLists) {
for (int r = 0; r < groupsLists.length;
r++) {
ArrayList<LinkedDimGroup> groups = groupsLists[r];
for (... |
57fe976e-1082-4b3e-b997-17c024d5264c | 3 | public void SendText(){
String x = Tinput.getText ();
//Checks to see if it is a server command
if(x.length() > 5 && x.substring(0,5).equals("serv.")){
send(x);
}
else if (!x.equals(""))
{
x = Username + ": " + Tinput.getText (... |
c52a1ea1-3e09-4636-9870-b1781ac84ee2 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
int completion=16;
final Item fire=getRequiredFire(mob,0);
if(fire==null)
return false;
final PairVector<EnhancedExpertise,Integer> enhancedTypes=enhancedTypes(mob,commands);
buildingI=null;... |
fa91e3f8-ed7c-4aa7-bf10-57d560e1c56a | 4 | public static User readFrom(HttpServletRequest request) throws Exception {
Cookie[] cookies = request.getCookies();
if (cookies == null || cookies.length == 0) {
return null;
}
for (Cookie cookie: cookies) {
if ("FB_ID".equals(cookie.getName())) ... |
a3fbe555-6aed-4bc6-a7ea-15004b271ee0 | 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... |
36c20584-bb07-438f-9ed9-3346e97e98ae | 1 | public SampleComperator(boolean decreasing_order) {
order = decreasing_order ? -1 : 1;
} |
d8100547-cc0c-438a-b4ed-cabaa8342d0d | 0 | public int getUpcomingEventsCount() {
return upcomingEventsCount;
} |
e4d4c45e-940a-43ac-82aa-ddb6d47c1752 | 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... |
29dcb135-0915-49d7-a0c5-1eccc8e67c8d | 3 | public boolean isElementPresent(By by) {
try {
List allElements = driver.findElements(by);
if ((allElements == null) || (allElements.size() == 0))
return false;
else
return true;
}
catch(java.util.NoSuchElementException e)
... |
a0f279d4-6ae0-45bd-9b2e-96a45815503d | 9 | private boolean checkClass(HashMap<String, ClassInfo> db, ClassInfo info) {
if(info == null) {
return false;
}
/* check extends */
for(String cls : classes) {
if(cls.equals(info.superName)) {
return true;
}
}
/* check implements */
String[] clsImpl = info.getInterfaceNames();
for(String r... |
e17bad66-6607-4a5e-8f5c-0577cab2e09e | 8 | @EventHandler(priority = EventPriority.LOWEST)
public void PlayerCommand(PlayerCommandPreprocessEvent event) {
DwDPlayer pCheck = DwDPlayers.getPlayer(event.getPlayer().getUniqueId());
DwDBridgePlugin plugin = DwDBridgePlugin.getPlugin();
if (event.getMessage().toLowerCase().startsWith("/co... |
86ba8d53-134a-4521-9e64-11915d06468d | 0 | public ZoomPane(SelectionDrawer drawer) {
super(drawer);
drawer.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
transform = null;
}
});
} |
e2e6585a-0f5e-4952-bc92-b492a475e4cb | 0 | public int run()
{
qSortMedianThree(aInt, 0, aInt.length-1);
return 0;
} |
77b84657-7473-4939-9f2f-e64b1e56bdce | 6 | public void dispose(boolean cache) {
// dispose the nameTree
if (nameTree != null) {
nameTree.dispose();
namesTreeInited = false;
if (!cache)
nameTree = null;
}
if (pageTree != null) {
pageTree.dispose(cache);
i... |
9baaf3bc-9276-4c7e-bc94-7d90c110b2c7 | 2 | @Test
public void testCmd() throws Exception
{
for (CommandBase command : container.getCommands())
{
try
{
assertTrue(command.execute(new CommandInvocation(null, command.getDescriptor().getDescription(), scm.getProviderManager())));
}
... |
aaf88564-9eec-498b-888b-fa57582a912d | 1 | private String formatNoteElementLabel(NoteElement element) {
String noteText = ensureTextIsValid(element.getText().toString());
// does the note provides its own wrap
if(noteText.contains("\\n"))
return noteText;
return wrap(noteText, noteWrapLength, "\\n", false);
} |
03fbd677-cbd2-442f-a2b2-c6c6e520c329 | 2 | public void PrintMe(String _title)
{
System.out.println(_title);
for(int i=0;i<Block.N;i++)
{
System.out.println();
for (int j = 0; j < Block.N; j++)
{
System.out.print(this.block[i][j] + " ");
}
}
} |
b8958f9d-4935-4ca8-b379-584d73864852 | 5 | @Override
public int compareTo(final Version other) {
if (this == ALL || other == ALL) {
return 0;
}
int c = modifier.compareTo(other.modifier);
if (c != 0) {
return c;
}
c = major - other.major;
if (c != 0) {
return c;
}
c = minor - other.minor;
if (c != 0) {
return c;
}
return rev... |
60d1e436-115a-4647-94fe-f40387256190 | 4 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityDeath(EntityDeathEvent event){
//check if the entity is tagged
Entity dead = event.getEntity();
int id = dead.getEntityId();
if(plugin.getMobsTagged().containsKey(id)){
Player killer = plugin.getSer... |
dfa90311-8e4a-4e19-a6c9-804ee66a67e9 | 0 | public static void main(String[] args) {
// TODO Auto-generated method stub
} |
efdd2f23-7d59-4aec-8605-0c8a17449290 | 3 | public double interpolate(double xx){
double h=0.0D,b=0.0D,a=0.0D, yy=0.0D;
int k=0;
int klo=0;
int khi=this.nPoints-1;
while (khi-klo > 1){
k=(khi+klo) >> 1;
if(this.x[k] > xx){
khi=k;
}
else{
klo=k;
}
}
h=this.x[khi]-t... |
621a15a8-da4c-4c49-8f7f-1beec257bf29 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Reference")
public JAXBElement<ReferenceType> createReference(ReferenceType value) {
return new JAXBElement<ReferenceType>(_Reference_QNAME, ReferenceType.class, null, value);
} |
8af57ca6-62de-4f76-8742-e825faa8d7ea | 7 | public static Cons matchPatternElement(Symbol patternElement, Stella_Object datumElement) {
if (Stella_Object.isaP(datumElement, Stella.SGT_STELLA_CONS)) {
{ Stella_Object datumType = ((((Cons)(datumElement)).value == Stella.SYM_STELLA_SPECIAL) ? ((Cons)(datumElement)).rest.value : ((Cons)(datumElement)).valu... |
d0df60e0-539f-408e-81b9-2e91035acbac | 9 | private T getHermanoABBUtil(NodoArbol <T> nodo, T dato) {
int i;
if(nodo == null || nodo.dato == null)
return null;
if(containsABBRecursivo(dato) == false)
return null;
if(dato == this.raiz.dato)
return null;
if(nodo.der.dato.compareTo(dato)... |
f2fbea2e-135b-4a7e-b836-ccd1f695d2ca | 9 | public static Rate parse(final String name, byte[] rateBytes) throws ParseException {
Rate rate;
int rateUnit = rateBytes[4] + rateBytes[5] * 16;
if (rateUnit == 0) {
int frequency = 0;
for (int i = 0; i < 4; i++) {
frequency += (rateBytes[i] * Math.pow(16... |
e81a38e7-8a0b-416e-8fb6-a346f19232b9 | 4 | private Entity getEntityAt(Position pos, Environment enviro) {
ArrayList<Entity> entities = enviro.getEntities();
Entity closest = entities.get(0);
for(int i = 1; i < enviro.getEntityAmount(); i++){
Entity x = entities.get(i);
if(x.getPosition().x()-pos.x() < closest.getPosition().x()- pos.x()){
if(x.ge... |
849b2e20-7a16-4ec5-aeb0-cb3ae9e916bb | 4 | public void atNewArrayExpr(NewExpr expr) throws CompileError {
int type = expr.getArrayType();
ASTList size = expr.getArraySize();
ASTList classname = expr.getClassName();
ASTree init = expr.getInitializer();
if (init != null)
init.accept(this);
if (size.leng... |
3374b015-8337-46bc-a4a0-003555c2607f | 9 | String getCurrentOrientation() {
axisangleT.set(matrixRotate);
float degrees = axisangleT.angle * degreesPerRadian;
StringBuffer sb = new StringBuffer();
if (degrees < 0.01f) {
if (matrixRotate.m00 == -1.0f || matrixRotate.m11 == -1.0f || matrixRotate.m22 == -1.0f) {
sb.append(" 1000 0 0 -180"); // rear ... |
5c7e3ed7-3ca9-4645-8d19-7f0c3dba211b | 1 | static final void indent(Writer writer, int indent) throws IOException {
for (int i = 0; i < indent; i += 1) {
writer.write(' ');
}
} |
a6ae6ad3-34e0-4df7-b357-511d364a38df | 1 | public void clear (int color){
for(int i = 0; i < pixels.length; i++){
pixels[i] = color;
}
} |
a0c48bb8-b64a-4546-a854-b8d00fb3e848 | 8 | public boolean processRead(SocketChannel sc) throws IOException,
RemoteSocketClosedException {
final String socketAddresss = ServerLogger.parseSocketAddress(sc);
if (disconnectionRequested) {
// Block the reads if a disconnect was requested, let the outbound
// buffer clear itself.
LOGGER.log(new Clien... |
d89091bd-f4c8-402b-8ad8-fbe3651d83b3 | 5 | public void setLocationFromPriority(){
switch(priority){
case 1:{
setxCoord(1600);
setyCoord(40);
break;
}
case 2:{
setxCoord(1640);
setyCoord(90);
break;
}
... |
d789889b-f0b9-432e-98ba-d98269f46ac6 | 0 | public void setSignDatetime(Date signDatetime) {
this.signDatetime = signDatetime;
} |
5b4f895c-4bef-4183-9f36-fd64a146123d | 1 | public boolean isSymmetric(treeNode root) {
if(root == null)
return true;
return treesSymmetric(root.leftLeaf,root.rightLeaf);
} |
960bc9cd-1596-48f6-ac0a-437c5f610f55 | 9 | private void jTextFieldSearchEmpruntKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldSearchEmpruntKeyTyped
// TODO add your handling code here:
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
String toSearch = jTextFieldSearchEmprunt.getText();
if (jRadioButtonIdEm... |
cc28652f-2db7-4725-bb9b-6a7a1b06a2eb | 8 | static int f(int x,int y,int z){
LinkedList<int[]> cola=new LinkedList<int[]>();
cola.add(new int[]{x,y,z,0});vis[x][y][z]=true;
for(int[] u;!cola.isEmpty();){
u=cola.pollFirst();
if(mat[u[0]][u[1]][u[2]]=='E')return u[3];
for(int i=0;i<3;i++)
for(int h=-1;h<2;h+=2)
if(u[i]+h>=0&&u[i]+h<t[i]){
... |
47eabfcf-55c3-4a62-b20a-99da54259650 | 4 | protected static boolean isAListChar(char character) {
switch (character) {
case ':':
case ';':
case '#':
case '*':
return true;
}
return false;
} |
30992f62-ce22-4360-98fe-b8410ad3e94f | 4 | public void fireSubLWorkerDataAvailableEvent(SubLWorkerEvent event) {
if (event.getEventType() != SubLWorkerEvent.DATA_AVAILABLE_EVENT_TYPE) {
throw new RuntimeException("Got bad event type; " +
event.getEventType().getName());
}
synchronized(listeners) {
Object[] curListeners = listeners... |
4352ffe8-8d8b-48ce-a564-6b2ddf01cf78 | 9 | public void update() {
super.update();
if(fireRate>0) fireRate--;
int xa = 0, ya = 0;
if(anim < 7500)
anim++;
else
anim = 0;
if(input.up.down) ya--;
if(input.down... |
70901f75-762d-4559-935f-55ddc1043d84 | 6 | public static void loadBinary(LC3Bridge bridge, String filename) throws IOException
{
FileInputStream stream = null;
byte[] buffer = null;
try
{
File handle = new File(filename);
stream = new FileInputStream(handle);
buffer = new byte[(int)handle.length()];
stream.read(buffer);
}
catch ... |
3874847a-bd99-495d-b825-c57d241b5efb | 4 | protected int read_(long pos, byte[] b, int offset, int len) throws IOException {
file.seek(pos);
int n = file.read(b, offset, len);
if (debugAccess) {
if (showRead) System.out.println(" **read_ " + location + " = " + len + " bytes at " + pos + "; block = " + (pos / buffer.length));
debug_nseeks... |
dd106559-d769-472d-ae16-c453cf800ab0 | 2 | public void multiply() {
System.out.println("Enter the range ");
int n=in.nextInt();
int[][] multTable=new int[n+1][n+1];
for (int i=1;i<=n;i++)
{
System.out.println("Multiplication table of " + i);
for (int j=1;j<=n;j++)//j<=10
{
multTable[i][j] = i*j;
System.out.println(i + "*" + j + " = " ... |
e9e4bde1-fd44-46cb-b637-3ba6abd19c58 | 4 | private void saveParagraph(org.w3c.dom.Document xmlDoc, Paragraph para, Element paraElt) {
for (Sentence sent : para.getSentences()) {
Element sentElt = xmlDoc.createElement("sentence");
sentElt.setAttribute("id", Integer.toString(sent.getId()));
// prepare plain text
Element plainTextElt = xmlDoc.createE... |
ed44096b-b162-45f5-a4d8-40f9a244474f | 9 | public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
if (args.length == 0){
sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
} else {
StringBuilder... |
6d50708f-4ee1-4bf2-a92c-3aa2b474b0bf | 4 | public boolean SetTime(int responseTime){
boolean test = false;
if (test || m_test) {
System.out.println("OthelloAI :: SetTime() BEGIN");
}
m_time = responseTime;
if (test || m_test) {
System.out.println("ConnectFourAI :: SetTime() END");
}
return true;
} |
38b69e7a-976f-4f71-95b2-7bebe9a8990e | 0 | public void setAge(int age) {
Age = age;
} |
69d85089-e0b9-4b8a-9b67-85c86eb03f6c | 0 | private PublicStaticFieldSingleton () {}; |
f8121456-6c10-456c-8ec5-70a71b239dfa | 4 | public String toFirstUpperCase(String title)
{
char[] c = title.toCharArray();
for(int i = 0; i < c.length; i++)
{
if(c[i] != ' ' && (i == 0 || c[i - 1] == ' '))
c[i] = (char)(c[i] - 32);
}
return new String(c);
} |
36370c1b-f4e0-437e-ba15-a1a44ddd3ba0 | 3 | private CtClass searchImports(String orgName)
throws CompileError
{
if (orgName.indexOf('.') < 0) {
Iterator it = classPool.getImportedPackages();
while (it.hasNext()) {
String pac = (String)it.next();
String fqName = pac + '.' + orgName;
... |
bdf36945-6ace-481f-b9f2-e4f3047363dd | 4 | protected void stableRun() {
// Timing varibles
long startTime = System.nanoTime(), waitTime, urdTime = 0;
int targetTime = 1000 / targetFramerate;
long tTime = 0;
int fCount = 0;
while (running) {
// Increment the amount of frames that have passed by one
fCount++;
// Add the time it took to com... |
c9a24562-243e-4e5b-a7dd-7a50a6dd0c20 | 0 | Caller(Incrementable cbh) {
callbackReference = cbh;
} |
53d3a86e-b1d7-4e29-89b4-b6ca40c572f5 | 3 | private double[] calculateNetworkConsumption(Message message, SoftwareSystem system) {
double consumption[] = { 0, -1 };
for (Connector connector : project.getConnectors())
if (connector.getComponent().equals(message.getSender()) && connector.getToInterface().equals(message.getSignature())) {
consumption[0] ... |
9f3c0585-a76c-430c-9115-992d665c418e | 7 | private boolean playerAttackCollision(){
if(!weapon){
CollisionResults [] results = new CollisionResults [4];
for(int i = 0; i < results.length; i++){
results[i] = new CollisionResults();
}
BoundingVolume bv = ((Node)getStageNode().getChild("Play... |
01a8cc92-1c25-4a26-8789-237b128c24c7 | 5 | @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerBetInteract(PlayerInteractEvent event) {
ItemStack itemInHand = event.getItem();
if(event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
Block clickedBlock = event.getClickedBlock();
if(! FancyRoulette.instance.tableManager.isBlockTile(cli... |
03536735-c536-4e48-b18d-f8a091b9dea6 | 3 | public void dostepnyFilm(Osoba osoba, Film film) {
osoba = em.find(Osoba.class, osoba.getId());
film = em.find(Film.class, film.getId());
Film usun = null;
// lazy loading here (person.getCars)
for (Film filmy : osoba.getFilm())
if (filmy.getId().compareTo(film.getId()) == 0) {
usun = filmy;
brea... |
2a1e6e99-38fc-4ce7-86ba-5cd350cde827 | 9 | public AlphabetDialog() {
this.setTitle("Customize Alphabet");
this.getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
this.setModal(true);
this.setBounds(200, 200, 400, 600);
this.changed = false;
//Initialize the alphabet combobox
final JTextArea taSymbols = new JTextArea()... |
d02775dc-874d-47f3-bece-515addb886d0 | 1 | public int[] generate(int nplayers, int bowlsize) {
int nfruits = nplayers * bowlsize;
int[] dist = new int[12];
int unit = nfruits / 12;
dist[0] = nfruits - unit * 11;
for (int i = 1; i < 12; i++)
dist[i] = unit;
return dist;
} |
f6b34ffd-dc61-4671-87b1-7e462dad3fc8 | 1 | public static double calGain(double rootEntropy, ArrayList<Double> subEntropies, ArrayList<Integer> setSizes, int data) {
double gain = rootEntropy;
for(int i = 0; i < subEntropies.size(); i++) {
gain += -((setSizes.get(i) / (double)data) * subEntropies.get(i));
}
return gain;
} |
cbb178b4-a575-434f-bea2-3547e14098ca | 3 | public static JSONObject toJSONObject(String string) throws JSONException {
String name;
JSONObject jo = new JSONObject();
Object value;
JSONTokener x = new JSONTokener(string);
jo.put("name", x.nextTo('='));
x.next('=');
jo.put("value", x.next... |
eabf6d0e-dd87-4be9-900f-e7382be4aad5 | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
2872fa7c-0e16-49cc-89a2-4a88b079b43c | 7 | public void increaseRope(int x , int y) {
if (ropelength < 125){
ropelength ++;
}
x += 1;
y += 2;
switch (ropelength) {
case 1: getWorld().addObject(rope, x, y); getWorld().addObject(ropeman, x, y+3); break;
case 25: y+= 2; getWorld().addObject... |
d9b0c734-b09f-4e2a-9a17-ce44d8bb3732 | 6 | public static int minCut4(String s) {
int length = s.length();
int[] dp = new int[length + 1];
boolean[][] parlin = new boolean[length][length];
for (int i = length; i >= 0; i--) {
dp[i] = length - i;
}
for (int i = length - 1; i >= 0; i--) {... |
b616d768-8969-4850-bd11-1b0531f7d241 | 5 | public void convertInfixArrayToPostFixArray(List<BaseOperClass> infixEquationArray)
{
Stack<BaseOperClass> tempStack = new Stack<BaseOperClass>();
for(BaseOperClass token : infixEquationArray)
{
if(token instanceof Operator)
{
while(tempStack.size() != 0 && tempStack.peek().getPrecedence() >= token.... |
07b92b6a-948b-4275-b874-0580342e6456 | 9 | private double runBestAlgorithm(String feature) {
// TODO Auto-generated method stub
//String language, double np, CoNLLHandler ch, String trainingCorpus, String rootHandling
File f=new File(feature);
if (f.exists()) {
CoNLLHandler ch=new CoNLLHandler(trainingCorpus);
AlgorithmTester at=new AlgorithmTester(... |
02c10883-3d9e-4d7a-b2ca-5f337d0cef88 | 7 | private long set_clock_time(String config_value)
{
String value = "0";
String identifier = "";
long time = 0;
/* loop to split string into value and identifier */
for (int i = 0; i < config_value.length(); i++)
{
if( (config_value.charAt(i) >= '0')
... |
131fb6b3-f1f4-4744-9636-5bb33f4912ac | 8 | private static void BinaryTreeMenu(BinaryTree<Integer> BinaryTree){
System.out.println("\nWhat do you want to do ?");
System.out.println(" 1) Insert");
System.out.println(" 2) Search");
System.out.println(" 3) Delete");
System.out.println(" 4) Print");
System.out.println("Enter your option and hit enter: (f... |
341ff00c-c6c2-459d-ac4e-4c2ba2ad0533 | 1 | public static void spawnSkeletonWarriorGold (Location loc, int amount) {
int i = 0;
while (i < amount) {
Skeleton SkeletonWarriorIron = (Skeleton) loc.getWorld()
.spawnEntity(loc, EntityType.SKELETON);
SkeletonWarriorIron.getEquipment().setChestplate(
... |
5f0b5e65-cb07-421e-8f82-8aeeaa04d4c4 | 7 | public boolean equals (Particulier part)
{
boolean exists = false;
if ((this.getNom().equals(part.getNom())) && (this.getPrenom().equals(part.getPrenom())) && (this.getCivilite().equals(part.getCivilite())) && (this.getAdresse().equals(part.getAdresse()))
&& (this.getTelD().equals(part.g... |
38798f23-f1e5-4cd0-965e-cd76a7bb1438 | 4 | public void move(String dir) {
if (dir.equalsIgnoreCase("up")) {
ypos--;
}
else if (dir.equalsIgnoreCase("down")) {
ypos++;
}
else if (dir.equalsIgnoreCase("left")) {
xpos--;
}
else if (dir.equalsIgnoreCase("right")) {
xpos++;
}
} |
21d3ea3b-fc99-4bef-85df-0a166dd52e69 | 8 | public void lookForConstructorCall() {
type01Count = cons.length;
for (int i = 0; i < type01Count;) {
MethodAnalyzer current = cons[i];
FlowBlock header = cons[i].getMethodHeader();
/* Check that code block is fully analyzed */
if (header == null || !header.hasNoJumps())
return;
StructuredBlock ... |
40044155-d874-4e4e-804e-1e8451308fcf | 6 | public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner s = new Scanner(System.in);
double a = s.nextDouble();
double b = s.nextDouble();
double c = s.nextDouble();
if(Math.abs(b-c) < a && a < b+c && Math.abs(a-c) < b && b < a+c && Math.abs(a-b)... |
97e36f13-aeef-4124-ba4a-3bc7593538c8 | 6 | private void avaliarCaso(boolean avaliacao) {
try {
admin.avaliarCaso(avaliacao);
removerPainelCaso();
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this, "Erro ao atualizar a base de dados... Por favor contacte um administrador.\nA sair do programa...");
... |
b927c93a-443d-478a-9b5c-3bd912923d11 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[41];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 15; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... |
668853ca-e79f-4cca-83e2-1538be754ef1 | 5 | private void loadTowerPref() {
Scanner scanner = null;
try {
scanner = new Scanner(new FileInputStream("res" + File.separator + "towerPref.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String currentLine;
String[] lineTowerLevelArray;
String[] lineTowerPrefArray;
ArrayList<A... |
5eb50d18-06b8-4d36-bf04-a02c879f7b78 | 8 | private StringBuilder add(CharSequence num1, CharSequence num2) {
StringBuilder builder = new StringBuilder();
int maxLen = Math.max(num1.length(), num2.length());
boolean carryOne = false;
for (int i = 0; i < maxLen; i ++) {
char c1 = '0';
char c2 = '0';
... |
0846b2ad-5a6f-426c-bfa7-52f5d649a59f | 5 | public void mouseMoved(MouseEvent e) {
if (shiftPressed) {
int oldMouseX = mouseX;
int oldMouseY = mouseY;
mouseX = e.getX();
mouseY = e.getY();
if (mouseX > oldMouseX) {
// Mouse moved right
// scene.adjustCameraX(.01f);
} else if (mouseX < oldMouseX) {
// Mouse moved left
// scene.... |
407c59a2-a127-4160-bf2e-388fb4feb5a1 | 5 | @Override
public void actionPerformed(ActionEvent arg0) {
// Making a lot of assumptions about what could possibly result in an event
String command = ((JMenuItem) arg0.getSource()).getText();
if(command.equals(HIDE_MENU_ITEM_TEXT)) {
toggleVisible();
} else if(command.equals(SAVE_MENU_ITEM_TEXT)) {
... |
8e9a98c5-ce87-4c08-b397-05666d8c9468 | 6 | public ListFiles(String wd){
thisFolder=new File(wd);
listOfFiles= thisFolder.listFiles();
int jj=0,ii=0;
System.out.println("Directories");
for (int i = 0; i < listOfFiles.length; i++)
{
if (listOfFiles[i].isDirectory())
{
jj++;
System.out.println("["+jj+"] "+ listOfFiles... |
c15fe874-266d-4155-a5e1-23038b4c50b3 | 4 | public static boolean Connect(String connection, String user, String password){
boolean result = false;
try {
//String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
// String url = "jdbc:odbc:northwind";
//String username = "";
//String password = "";
... |
fa2cdf0c-7df9-4197-97cc-c1bab823eb3e | 7 | @Override
public List<Integer> getTopRankedRoles(Function func)
{
final List<ClanPosition> allRoles=new LinkedList<ClanPosition>();
for(final ClanPosition pos : govt().getPositions())
{
if((func==null)||(pos.getFunctionChart()[func.ordinal()]!=Authority.CAN_NOT_DO))
allRoles.add(pos);
}
final List<In... |
e05a8791-f13c-40fc-a25b-937ae70da18c | 0 | private void timetablePage(){
timetablePane = new JPanel();
timetablePane.setBackground(SystemColor.activeCaption);
timetablePane.setLayout(null);
JLabel lblTimetable = new JLabel("Timetable");
lblTimetable.setHorizontalAlignment(SwingConstants.CENTER);
lblTimetable.setFont(new Font("Arial", Font.BOLD, 3... |
0398cec1-3b86-4f1c-99ac-27750b85d644 | 5 | public Object getProperty(Class<?> clazz, Object key) {
Object value = this.systemProperties.get(key);
if (value != null) {
return value;
}
if (customConfigurator != null) {
value = customConfigurator.apply(key);
if (value != null) {
re... |
a1c6a641-d695-43e2-a7ee-51c20c56c224 | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... |
f7f1f891-8256-453e-b2e5-5582fd10ecc8 | 8 | public int pointsPulled(){
int sum = 0;
for(int n : toPar){
if(n > 2) sum += -1;
if(n == 2) sum = sum;
if(n == 1) sum += 1;
if(n == 0) sum += 2;
if(n == -1) sum += 4;
if(n == -2) sum += 8;
if(n == -3) sum += 10;
... |
f4489c7c-b9ee-4ab0-96a2-35109830bf29 | 8 | public static void main(String ar[])
{
try{
int k=1;
int numD;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
numD=Integer.parseInt(br.readLine());
int y=0;
while(k-1 < (numD + y))
{
y++;k<<=1;
}
System.out.println("Y Out" + y);
k>>>=1;
in... |
5e21856b-0bbc-4de3-a10c-fc9f646afb02 | 9 | public static Map<String, String> simpleCommandLineParser(String[] args) {
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i <= args.length; i++) {
String key = (i > 0 ? args[i - 1] : null);
String value = (i < args.length ? args[i] : null);
if (key == null || key.star... |
52c6df8a-ff10-48dc-958d-ad65635d770e | 0 | public void mouseExited(MouseEvent e) {
} |
cdcc8ddd-a733-4033-93f4-53f1193d4035 | 4 | private static boolean canDecrease(int[] A, int index, int leng){
int cnt = 0;
int secondMax = Integer.MIN_VALUE;
for(int k=0;k<leng-1;k++){
if(A[index-k-1]>=A[index]) cnt++;
if(k==1) secondMax = A[index-k-1];
}
return cnt<2 && secondMax<A[index]-1;
} |
c2179901-8d13-4d21-9c03-c06436050c42 | 7 | public Window() throws IOException {
//Window creation start
super(WordUtils.capitalizeFully(properties.propertiesInit("resources/universe.txt", "universe", 0)));
Main.setUniverse(WordUtils.capitalizeFully(properties.propertiesInit("resources/universe.txt", "universe", 0)));
setSize(800, 600);
setResizable(tr... |
60b18e4a-e562-4a3c-8333-de4ab5bdc070 | 2 | @Override
public void finishTurn(IPresenter presenter) {
MoveResponse response = presenter.getProxy().finishTurn(presenter.getPlayerInfo().getIndex(), presenter.getCookie());
if(response != null && response.isSuccessful()) {
presenter.updateServerModel(response.getGameModel());
presenter.setVersion(presen... |
3c7d440e-37a3-4e20-af30-31fba53af655 | 8 | private void performOperation(List<String> values){
for(int i = 0;i<values.size();i++)
{
char[] c = values.get(i).toCharArray();
char previousChar = ' ',currentChar=' ';
switch(c[0]){
case 'A':
System.out.println("A found");
break... |
4cc31e85-2e84-4b7e-88da-8adfd33db726 | 9 | public static void registerExceptionHandler() {
Logger.getLogger(ExceptionHandler.class.getName()).entering(ExceptionHandler.class.getName(), "registerExceptionHandler");
Enumeration<String> loggers = LogManager.getLogManager().getLoggerNames();
while (loggers.hasMoreElements()) {
Lo... |
527fdc9d-7d71-446f-97a6-87f0aa30d8dd | 2 | private void checkportfolio() {
String response = "Your current balance is $" + user.getBalance();
System.out.println("Your current balance is $" + user.getBalance());
ArrayList<UserStocks> portfolio = user.getUserStock();
if (portfolio != null) {
System.out.println("Your portfolio is as follows :");
Sys... |
5d89ebb2-150d-4232-97ca-e65d4536b566 | 8 | public static String getMessage(int status) {
// method from Response.
// Does HTTP requires/allow international messages or
// are pre-defined? The user doesn't see them most of the time
switch (status) {
case 200:
if (st_200 == null)
st_200 = sm.getString("sc.200");
return st_200;
case 302:
... |
0058a1c0-8676-41ba-99ce-d30cef0405bc | 7 | public synchronized Connection getConnection()
{
Connection connection = null;
// Check if there is a connection available. There could be times when all the
// connections in the pool may be used up
if (connectionPool.size() > 0)
{
connection = connectionPool.get(0);
... |
3a38e2c8-b6ff-4924-a337-409d98888e7b | 2 | private void initFond(Graphics2D g) {
if (!initiated) {
InputStream is = this.getClass().getClassLoader()
.getResourceAsStream("fonts/TechnoHideo.ttf");
try {
font = Font.createFont(Font.TRUETYPE_FONT, is);
} catch (Exception e) {
e.printStackTrace();
font = new Font(Font.SANS_SERIF, 4, 4)... |
26ff439a-9eb0-45b4-a97a-6795255eca85 | 9 | public static void main(String[] args) {
Deck deck = new Deck();
deck.shuffle();
PokerHand hand = deck.deal(5);
hand.shuffle();
hand.print();
if (hand.isStraight()) System.out.println("straight");
if (hand.hasStraightFlush()) System.out.println("straight flush");
i... |
474fb142-12d7-468b-8dec-e3f2287b6f59 | 0 | public void setY2Coordinate(double y)
{
this.y2Coordinate=y;
} |
1ac70d7c-5bc1-4d0d-b3ad-946008a9e4d2 | 3 | @Override
public void run() {
while(true){
// If we us the HMI at all process inputs
if(hmi.useHMI){
// First process commands from remote control, which is more important than sending data for visualization.
processInputs();
}
try{
Thread.sleep(100);
} catch(Interrupte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.