method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
efd7a846-5377-4e0d-8a99-92e083c66133 | 8 | public void disconnected(Connection c) {
Player buff = null;
/* buscamos que el player se elimine de la lista de players del servidor */
for( Player p : GeoConflictServer.playerList ){
/* si no esta conectado sacamos una referencia a el */
if( !p.getConnection().isConnected() ){
buff = p;
break;
... |
5d292d1e-0675-468e-87ab-e372204574ec | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(mob.isInCombat()&&(mob.rangeToTarget()>0))
return Ability.QUALITY_INDIFFERENT;
if(!Druid_ShapeShift.isShapeShifted(mob))
return Ability.QUALITY_INDIFFERENT;
if(mob.charStats().getBodyPart(Race.BODY_LEG)<=0)
... |
2bf7f81b-df8e-4584-bc8d-f1de671524d3 | 2 | public CurrentQuest(UQuest plugin, LoadedQuest theQuest, int level) {
this.name = theQuest.getName();
this.startInfo = theQuest.getStartInfo();
this.finishInfo = theQuest.getFinishInfo();
for(Reward reward : theQuest.getRewards()){
this.rewards.add(new Reward(reward));
}
for(Objective objective : theQues... |
416a11ae-c465-4d2f-8507-670418786e27 | 2 | public void addLink(GraphNode destiny, int weight) { //adds the link with the param destiny and its weight or price.
if (actual_links == -1) {//if there are not links.
links.append(new Link(this, destiny, weight));//creates new link and adds it to the list of links of this node.
actual_l... |
a4fbe98c-226d-4bc8-880b-18a37eaf20d2 | 0 | public int GetTime()
{
return time;
} |
2e969d85-7dc5-4648-b4c3-6a2214acf8b4 | 4 | public void compareRoomInventoryItems()
{
int ArrayListID = 0;
if(player.getInventorySize() > 0)
{
for (Iterator it = rooms.get(player.getCurrentRoomID()).getItems().iterator(); it.hasNext();)
{
Item roomItem = (Item) it.next();
... |
7a11695b-cc48-4157-84aa-a667e8418f27 | 9 | private Student statsLE(Student s) {
double creditsSci = 0.0;
double creditsUpper = 0.0;
double credits_NonCSEMath = 0.0;
ArrayList<Course> courses = s.getCourses();
for (Course course : courses) {
String grade = course.getGrade();
if (YORK_GRADES.contai... |
09c2b9b0-e965-42cf-848e-e249a5783732 | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
if (commandLabel.equalsIgnoreCase("mcrp")) {
if (args.length == 0) {
commands.get(2).run(sender, args);
return true;
}
if (args.length >= 1) {
... |
a63bd036-14fb-4029-9d6f-d79d308177e4 | 6 | private String getScoreList(int position) throws Finished {
StatisticsInterface stats = d.getUIData().getStats();
int c = stats.getCurrentRoundNo();
if (position + 1 > c) {
throw new Finished();
} else if (c > MAX_SCORE_LINES) {
c = c - MAX_SCORE_LINES + position ... |
4b4abade-c1a9-4577-9edb-0c600f69911d | 3 | public CodeEditor(){
JMenu jMenu1 = new JMenu("File");
jMenu1.add(jmiOpen);
jMenu1.add(jmiSave);
jMenu1.add(jmiClear);
jMenu1.addSeparator();
jMenu1.add(jmiExit);
JMenu jMenu2 = new JMenu("Edit");
jMenu2.add(jmiBackground);
jMenu2.add(jmiForeground);
jMenu2.add(jmiCaret);
JMenuBar jMenuBar1 ... |
41814955-eef6-406e-b442-95f109e4fe4b | 0 | public JTextField getjTextFieldNum() {
return jTextFieldNum;
} |
992cbd40-2db1-4140-a852-bde1e5ef486d | 9 | public void paintSillasArriba(Graphics g) {
//Color c = new Color(6, 100, 6, 100);
//g.setColor(c);
//g.fillRect(getPosX() - 25, getPosY() - 30, getAncho() + 50, getAlto() + 40);
if (tipo == 2) {
paintMonitoArriba(g);
} else if (tipo == 1 || tipo == 3 || tipo == 4 || ... |
4ef139a7-2d9d-4fa3-8a01-ac3a8802c470 | 3 | @Override
public void serialize(Buffer buf) {
buf.writeInt(mapId);
buf.writeUShort(npcsIdsWithQuest.length);
for (int entry : npcsIdsWithQuest) {
buf.writeInt(entry);
}
buf.writeUShort(questFlags.length);
for (GameRolePlayNpcQuestFlag entry : questFlags) {... |
102185bb-d2df-4c01-906c-e7e6d1e1586a | 8 | public List<Entry> searchEntries(String searchItem, List<Entry> journal) {
List<Entry> includedEntries = new ArrayList<Entry>();
for (Entry entrie : journal) {
if (searchItem.matches("\\d{4}-\\d{1,2}-\\d{1,2}")) {
if (searchItem.equals(entrie.getDate().stringDate())) {
... |
0eb67eb0-e3f5-4b31-9faa-ecc80d113bc1 | 1 | public MenuConsulter() {
initComponents();
if (MainProjet.lesOffres.size() != 0){
OffreStage OS = MainProjet.lesOffres.get(0);
jTextNom.setText(OS.getEntreprise().getNom());
jTextVilleStage.setText(OS.getEntreprise().getAd... |
0b67957d-651a-4769-95e7-88218103fcea | 7 | * integer.
*/
public static float floor_f(final float a) {
// Derived from StrictMath.floor(double):
// Inline call to Math.getExponent(a) to
// compute only once Float.floatToRawIntBits(a)
final int doppel = Float.floatToRawIntBits(a);
final int exponent = ((doppel & ... |
f7b9ba1d-8898-4f6e-8a16-36ef16142f66 | 9 | protected Module addAnnotation(String name, Map env)
throws SignatureException
{
if (modName.op == ModuleName.ANNOTATE) {
return (Module)this.clone();
}
Module result = new Module(type, modName.addAnnotation(name));
// clone module parts
result.protectImportList = (ArrayList)(protectImportList.clon... |
aed3815b-6558-4457-ae46-452af1427941 | 3 | public static void main(String[] args)
{
ArrayToolBox tool = new ArrayToolBox();
int[] A = {1,4,72,65,23,17,57,94,54,10,100,3,22,1001,34,8};
boolean flag = tool.search(A,3,0);
boolean flag2 = tool.searchRecurse(A,1001,0);
if(flag) System.out.println(3+ " was found!... |
deb3920b-f1bc-4600-a098-20901993efe0 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (hashCode() == o.hashCode()) return true;
InhabitedPlanet that = (InhabitedPlanet) o;
if (population != that.population) return false;
... |
ca5f7b46-57da-4358-bf23-e5103ab0a28b | 5 | private ScriptRunner(CommandLineWrapper pCommandLineWrapper) {
mCommandLineWrapper = pCommandLineWrapper;
String lSourceLocation = mCommandLineWrapper.getOption(CommandLineOption.RUN);
//Validate source location is not null
if(XFUtil.isNull(lSourceLocation)){
throw new ExFatalError("-" +... |
b7d91bb3-5956-40fb-8dbe-a27c4c8327c3 | 7 | public String toString() {
if (m_weights == null) {
return "SPegasos: No model built yet.\n";
}
StringBuffer buff = new StringBuffer();
buff.append("Loss function: ");
if (m_loss == HINGE) {
buff.append("Hinge loss (SVM)\n\n");
} else {
buff.append("Log loss (logistic regressio... |
11c0e1ac-3516-4d80-9719-30d765c64dc8 | 3 | public static boolean entreDate(Calendar ajdh, Calendar dateDebut, Calendar dateFin)
{
return ajdh.equals(dateDebut) || ajdh.equals(dateFin) || (ajdh.after(dateDebut) && ajdh.before(dateFin));
} |
2e516d26-69ab-414f-8aa5-e701fcaa0850 | 8 | public void receive(){
boolean tcpComplete = false;
ArrayList<byte[]> fileParts = new ArrayList<byte[]>();
byte responseBuffer[];
DatagramPacket responsePacket;
Packet responsePacketData;
int currentSequenceNumber = 1;
try {
if(logFileName.equals("stdout")){
this.logger = new PrintWriter(System.... |
6c7d070b-83a0-4d8b-ae99-0d494af76d4c | 1 | public static void main(String[] args) throws Exception {
FileReader fr = new FileReader("src\\ioTest\\FileReader1.java");
BufferedReader br = new BufferedReader(fr);
String str;
while(null != (str = br.readLine()))
{
System.out.println(str);
}
br.close();
} |
0aef8bea-65fe-441e-ba20-3de3c6d37319 | 3 | private int findNombreSousClasse(Model m, String c) {
for(Generalization g : m.getGeneralization()){
if(g.getIdentifier().equals(c)){
for(String sousclasse : g.getArrayIdent()){
return findNombreSousClasse(m, sousclasse) + 1;
}
}
}
return 1;
} |
814d79c5-dccb-4653-b873-79696d6eaeaf | 8 | static boolean buildTree()
{
double min1, min2;
int i, j, minat1, minat2;
HuffmanNode[] work = new HuffmanNode[256];
HuffmanNode tmp = new HuffmanNode();
for(i = 0;i < 256;i++)
{
work[i] = myWork[i];
work[i].val = (char) i;
work[i].freq = freq[i];
work[i].zero = null;
work[i].one = null;
... |
1fab6055-a6a0-401b-847c-e748ff231396 | 2 | public int maxSubArray(int[] A) {
if(A.length == 0)
return 0;
int max = A[0];
int cur = A[0];
for(int i = 1; i< A.length;i++){
cur = Math.max(cur + A[i],A[i]); // 如果 cur + A[i] < A[i]的时候,表示cur 为负数,负数不可能是最大值的前缀。
max = Math.max(cur,max);
}
... |
56ce1104-11f8-4a96-a82d-c35da3c6f822 | 6 | public CloseView() {
setTitle("Algorithme Close");
setLocation(150, 250);
setSize(1000, 290);
setDefaultCloseOperation(EXIT_ON_CLOSE);
//Création des éléments pour importer un fichier
tfParcourir = new JTextField(20);
btParcourir = new JButton("Parcourir");
... |
ef4f5e8f-4b97-40e1-9c69-c090635e2284 | 4 | public void onInvite(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String channel) {
if (targetNick.equalsIgnoreCase(getNick())) {
if (sourceNick.equalsIgnoreCase("ChanServ")) {
channel = channel.replace("ChanServ!ChanServ@Services.GameSurge.net INV... |
40adcd82-e7f4-436f-bb92-4a56864de7aa | 3 | @Override
public void run() {
startFood();
while(true){
moreFood();
envi.repaint();
if(envi.getCritters().size() == 0){
break;
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
15b02ad9-894e-4d29-9aa0-c040a2bf0fe9 | 5 | private void writeMethods(final DataOutputStream out, final Set onlyMethods)
throws IOException {
if (onlyMethods != null) {
out.writeShort(onlyMethods.size());
} else {
if (Method.DEBUG) {
System.out.println("Writing " + methods.length + " methods");
}
out.writeShort(methods.length);
}
for... |
c503ff04-1673-4741-a9a5-80c9b23dbcf7 | 8 | public boolean checkPassword(int accountId, String checkPass) {
String realPass = "";
PasswordType type = PasswordType.DEFAULT;
Connection conn = plugin.getDbCtrl().getConnection();
PreparedStatement ps = null;
ResultSet rs = null;
try {
String sql = String.format("SELECT `password`, `pwtype` FROM `%s`... |
954e9e56-f063-4bf4-879b-7983df518db7 | 5 | void initializeSortState (final Tree tree) {
/* Reset to known state: 'down' on column 0. */
tree.setSortDirection (SWT.DOWN);
TreeColumn [] columns = tree.getColumns();
for (int i = 0; i < columns.length; i++) {
TreeColumn column = columns[i];
if (i == 0) tree.setSortColumn(column);
SelectionListener ... |
c9c04a3c-b81b-4e13-90d6-b35649ecb2db | 2 | private void beforeCall(String command) {
if (remoteClientCall == null) {
throw new IllegalStateException("RemoteClientConnection is not initial.");
}
if (command == null) {
throw new IllegalArgumentException("aMethodName is null");
}
} |
3cf510f8-22ac-4913-babf-f7cf2e278e05 | 9 | @Override
public int classDurationModifier(MOB myChar,
Ability skill,
int duration)
{
if(myChar==null)
return duration;
if((((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_CRAFTINGSKILL)
||((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_BUILDINGSKILL))... |
3363243e-9e97-4842-a9c5-2dab05a0767e | 1 | @RequestMapping(value="/{tripID}/editTravelTripForm", method=RequestMethod.GET)
public String ediTravelTripForm(@PathVariable("tripID") String tripID, Model model){
TravelTrip tempTravelTrip = travelTripService.findById(Integer.parseInt(tripID));
if(tempTravelTrip == null){
... |
babadffe-8b19-488f-8680-b2af20ef2b18 | 5 | public static BigInteger sqrtMod(BigInteger val, BigInteger modulus) {
BigInteger b, x, y, exp, exp2;
BigInteger[] lm;
int i, n;
int K[] = new int[300];
val = val.mod(modulus);
if (val.equals(ZERO))
return ZERO;
if (modulus.equals(TWO))
return ONE;
do {
b = randomBetwe... |
ebeccd28-bf28-4ccf-8553-3771dc4490f5 | 3 | private void appendDecimalSeparator(String str) {
switch (StringUtils.countMatches(str, ".")) {
case 0:
return;
case 1:
if (!ds) {
ds = true;
return;
}
}
throw new IllegalArgumentExcep... |
80cd425f-bae9-4d2e-ac96-24570c717848 | 5 | private void statement() throws Exception
{
if(scan.sym == Token.let) {
scan.next();
assignment_rest();
} else if(scan.sym == Token.call) {
scan.next();
funcCall_rest();
} else if(scan.sym == Token.if_t) {
scan.next();
i... |
c72e0632-4050-415e-a11c-6ef442ae3940 | 5 | private boolean isPrime(Integer number) {
if ( (number > 2 && number % 2 == 0) || number < 2) {
return false;
}
for (long i = 3; i <= Math.sqrt(number); i += 2) {
if (number % i == 0) {
return false;
}
}
return true;
} |
b789a42b-3552-4503-9103-85f9c36f15db | 4 | private double medianOfFour(ArrayList<double[]> puntos, int axis, int start){
if(puntos.get(start)[axis]>puntos.get(start+1)[axis])
swap(puntos,start,start+1);
if(puntos.get(start+2)[axis]>puntos.get(start+3)[axis])
swap(puntos,start+2,start+3);
if(puntos.get(start)[axis]>puntos.get(start+2)[axis])... |
7d45bed3-e391-40ca-bf08-f4da9e679e98 | 5 | public static String largestNumber(int[] nums) {
StringBuffer sb = new StringBuffer();
qsort(nums);
int i = 0;
for (i = 0; i < nums.length; i++) {
if (nums[i] != 0) break;
}
for (; i < nums.length; i++) {
sb.append(nums[i]);
}
String res = sb.toString();
return (res == nu... |
7778d44d-beab-4c70-804b-7d247dffd125 | 7 | private void processPatBlt(RdpPacket_Localised data, PatBltOrder patblt,
int present, boolean delta) {
if ((present & 0x01) != 0)
patblt.setX(setCoordinate(data, patblt.getX(), delta));
if ((present & 0x02) != 0)
patblt.setY(setCoordinate(data, patblt.getY(), delta));
if ((present & 0x04) != 0)
patblt... |
206ba8bc-85a6-4e38-be73-c64d432c93de | 7 | public void split(Component newComp, Component child, DockingConstants.Split position) {
SplitContainer split;
if(position == DockingConstants.SPLIT_TOP || position == DockingConstants.SPLIT_BOTTOM) {
split = new SplitContainer(JSplitPane.VERTICAL_SPLIT);
} else /*if (position == DockingConstants.SPLIT_LEFT
... |
52bb7424-1937-4a15-8edf-f7f2d67bd3df | 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_... |
88708158-e215-492f-bcde-3f09dc3867fc | 0 | public boolean isInverted() {
return inverted;
} |
6f819b9d-5c6a-487b-aeaa-9b48c18f54d0 | 2 | public Boolean matchNameExists(String hostName){
try {
cs = con.prepareCall("{call GET_MATCHNAME(?)}");
cs.setString(1, hostName);
if(!cs.executeQuery().next()){
return false;
}
} catch (SQLException e) {
e.printStackTrace();
}
return true;
} |
a400418d-96e3-48c0-8056-47c465072158 | 7 | protected void buildWhirl()
{
int[] curXY=new int[]{xsize-1,0};
int dirs[]=new int[]{Directions.WEST,Directions.SOUTH,Directions.EAST,Directions.NORTH};
int num=xsize-1;
Room lastRoom=null;
while(num>0)
{
for(int dir : dirs)
{
for(int i=0;i<num;i++)
{
if(!linkRoomOpen(curXY,dir))
{
... |
188c791d-2aa7-4714-9c1a-00b879b54a09 | 8 | public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
if (disableValidation)
{
return true;
}
if (par5 == 0)
{
return false;
}
else if (par5 == 1)
{
return false;
}
... |
871b71fc-261b-4957-b26a-770d629db032 | 2 | private void updateCritereList(boolean selectEnd) {
critereList.setModel(new CritereListModel(domaine.getCriteres()));
try {
critereList.setSelectedIndex((selectEnd)?critereList.getModel().getSize()-1:0);
} catch (IllegalArgumentException e) {
System.err.println("Erreur lors du chargement des critères, sans... |
bbfa9396-384d-491d-982c-336bc46d146e | 6 | private int getPing(Player player) {
try {
Class<?> entityCraftPlayer = Class.forName(plugin.craftBukkitClassName.concat(".entity.CraftPlayer"));
Method getHandle = entityCraftPlayer.getMethod("getHandle", new Class[0]);
Object playerHandle = getHandle.invoke(player);
Object craftPlayer = craftBukk... |
c3673296-2b94-4359-8320-e3f330b8749b | 3 | @Override
public double playLevel(Map toPlay, boolean visuals) {
int w = toPlay.getWidthInTiles();
int h = toPlay.getHeightInTiles();
int noSolid = 0;
for (int x = 0; x < w; x++)
for (int y = 0; y < h; y++)
noSolid += toPlay.blocked(null, x, y) ? 1 : 0;
double solidRatio = (double) noSolid / (double) ... |
fc63343b-3dcf-45a7-8f77-dd1f6c8bda81 | 5 | public PlayerSettings(Game game, boolean isOthello) {
boolean test = false;
if (test || m_test) {
System.out.println("PlayerSettings :: PlayerSettings() BEGIN");
}
ISOTHELLO = isOthello;
if (isOthello) {
PLAYERCOLOUR_A1 = new JRadioButton("Black");
PLAYERCOLOUR_B1 = new JRadioButto... |
1e2ba9d3-8b73-4d86-8bda-1f216dae23c5 | 0 | //@Test(expected=ReaderException.class)
public void testReadCastFail() throws ReaderException {
ConfigurationManager.init("src/test/resources/test.json");
// Cast exceptions expected
ConfigurationManager.read.getIntegerItem("test", "double");
} |
242cf9ba-2148-4e1d-aa3d-f369c7e59573 | 0 | @Override
public String getTmp() {return String.valueOf(tmp);} |
ff0d262b-9850-491c-9105-53d32a4eb7d3 | 2 | private static PixImage array2PixImage(int[][] pixels) {
int width = pixels.length;
int height = pixels[0].length;
PixImage image = new PixImage(width, height);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setPixel(x, y, (short) pixels[x][y],
(short) pixels[x][y], (sh... |
1c8a72ae-831c-4eca-8042-ff796a48f336 | 7 | public static boolean isValidBST(TreeNode root) {
if (root == null) {
return true;
}
TreeNode nodeL = root.left;
TreeNode nodeR = root.right;
if (nodeL != null) {
if (nodeL.val >= root.val)
return false;
else {
if (!isValidBSTHelper(nodeL, root, true))
return false;
}
}
if (nodeR ... |
3f1ef433-f2a6-47e4-80cb-e2bf4a24e357 | 0 | public void earnBonus() {
int bonus = numGen.nextInt(100)+101;
this.setTotal(this.getTotal()+bonus);
} |
55020999-4f42-4ce2-8af5-98088cb496eb | 7 | public void compFinalResult() {
do {
iStage++;
compAllocation();
if (compDistribution()) {
/* deadline can not be satisfied */
if (!bDeadline) {
System.out.println("THE DEADLINE CAN NOT BE SATISFIED!");
return;
} else {
System.out.println("\nNEW ROUND WITHOUT CHECKING:");
dEv... |
bba89f8f-68f0-49c0-9fda-3f4b1356c3a3 | 9 | private void Upload(ByteBuffer packet) throws RuntimeException, IOException{
// given packet w/no header!
// (for uploading request c->s) [header | filesize(8) | filename(?)]
// (for upload acknowledgement s->c) [header | already exists (1) | file id (4)]
// parse the req
if (packet.capacity() < 4)
thro... |
7f649907-80b9-4532-8d35-c3a4c64a6c8b | 5 | public File getRessourceFile(int id)
{
String req;
Statement st = null;
ResultSet result;
File f = null;
try
{
req = "SELECT * FROM t_medias WHERE id='"+id+"'";
st = cnx();
if(st == null) return null;
result = st.executeQuery(req);
if(result.last() && result.getRow() == 1)
... |
2c6c36c3-fc71-4974-b66a-73be4b8117e7 | 9 | public void setOptions(String[] options) throws Exception {
String tmpStr;
super.setOptions(options);
tmpStr = Utils.getOption('N', options);
if (tmpStr.length() != 0)
setNumInstances(Integer.parseInt(tmpStr));
else
setNumInstances(20);
tmpStr = Utils.getOption("n... |
52799174-e3e8-4393-a338-a62724ca16de | 7 | @Override
public double[] updatePlanes(ArrayList<Plane> planes, int round, double[] bearings) {
// if any plane is in the air, then just keep things as-is
for (Plane p : planes) {
if (p.getBearing() != -1 && p.getBearing() != -2) return bearings;
}
// if no plane is in the air, find the one with th... |
0bc078ff-0e34-4612-a69e-6068856c1283 | 2 | public static void main(String[] args) throws IOException {
File activeUsersFile = new File("activeUser.txt");
if (!activeUsersFile.exists()) {
throw new IOException("Active users file does not Exists!!");
}
String outDIr = "./Users-trimmed/";
if (!new File(outDIr).exists()) {
new File(outDIr).mkdir();
... |
e22e9088-5b5d-42b1-b71c-754c64a31dc3 | 8 | public long nextLong() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
if (p == PEEKED_LONG) {
peeked = PEEKED_NONE;
return peekedLong;
}
if (p == PEEKED_NUMBER) {
peekedString = new String(buffer, pos, peekedNumberLength);
pos += peek... |
775b0b2c-e2c5-4a1c-adb5-a66534ee9466 | 5 | private void preCalculateHeuristics() {
heuristics = new double[adjacency.length];
for (int i = 0; i < heuristics.length; i++) {
double minimum = Double.MAX_VALUE;
for (int j = 0; j < adjacency[i].length; j++) {
if (i != j && adjacency[i][j] >= 0 && adjacency[i][j] < minimum) {
minimum = adjacency[i]... |
ef7f7671-3c87-4078-8748-aa2a812bbebd | 8 | public void destroy() {
if (homeAction == null)
return; // already destroyed
if (Modeler.isMac()) {
enabledComponentsWhenRemote.clear();
enabledComponentsWhenLocal.clear();
}
actionMap.clear();
deadLinks.clear();
popupMenu.destroy();
PopupMenuListener[] pml = comboBox.getPopupMenuListeners();
i... |
7d476eb6-f499-4add-b254-ddcd9aeead2b | 5 | private CFGResult ifStatement(Block lastBlock) throws IOException, SyntaxFormatException {
if (checkCurrentType(TokenType.IF)) {
moveToNextToken();
ArithmeticResult cond = relation(lastBlock);
if (cond == null) {
throwFormatException("if statement relation expression expected");
}
assertAndMoveNext... |
1a20afb5-0a09-42c1-8031-867d90c9d6ee | 7 | @Override
public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException
{
DataTable dataTable = null;
try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream()))))
{
TableRow row = new TableRow ();
... |
be0aa48f-6b38-45e6-bd5f-26cf1947e2d0 | 4 | public static final synchronized StdImage createFadedImage(StdImage image, int percentage, boolean useWhite) {
String name = REVERSE_MAP.get(image);
StdImage img = null;
if (name != null) {
name = name + percentage + useWhite + FADED_POSTFIX;
img = get(name);
}
if (img == null) {
img = FadeFilter.cre... |
c2107c23-9eb6-43e9-b547-8bd19f307d52 | 4 | private boolean checkAndSaveGroup()
{
boolean check = true;
String error = "";
if(txtName.getText().length() < 1)
{
lblName.setForeground(Color.RED);
error += " - Name \n";
check = false;
}else lblName.setForeground(Color.BLACK);
if(txtCapacity.getText().length() < 1)
{
lblCapacity.setForegro... |
00e19c01-c1b3-447b-809d-23dc48f6bff7 | 0 | @Override
public boolean isManagingFocus() {return true;} |
d6f28085-0e00-491f-b53a-806a0c462dd0 | 8 | private static void setField(Message msg, String str) {
String[] strs = str.split(":");
strs[1] = strs[1].trim();
if(strs[0].equals("Host")) {
msg.setHost(strs[1]);
} else if(strs[0].equals("Port")) {
msg.setPort( Integer.valueOf(strs[1]) );
} else if(strs[0].equals("Title")) {
msg.setTitle(strs[1])... |
1ea92812-72a7-4d7d-8632-dc671f29c0f7 | 6 | @Override
public boolean equals(Object obj)
{
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
Semaphore other = (Semaphore) obj;
if(id == null)
{
if(other.id != null)
return false;
}
else
{
if(!id.equals(other.id))
... |
f8f9377b-2b6c-40a9-b816-e2726f0c25e1 | 0 | public void setMaxLength(Long value) {
this.maxLength = value;
} |
46ad6a5b-98d1-43e6-8772-fc86c243cb8b | 5 | public static boolean run(CommandSender sender, boolean isPlayer, String[] args, Logger log) {
if (!isPlayer){sender.sendMessage(notPlayer);return false;}
if (args.length < 1) {sender.sendMessage(ChatColor.RED+"Needs a World argument");return false;}
Player p = (Player)sender;
Location to = p.getLocation(... |
5d7fba11-e1f3-41c1-9153-103400ce42c2 | 9 | static final void setHslTable() {
anInt6112++;
if (Class126.hslColorTable == null)
Class126.hslColorTable = new int[65536];
else
return;
double d = 0.7 + (0.03 * Math.random() - 0.015);
int i_5_ = 0;
for (int i_6_ = 0; (i_6_ ^ 0xffffffff) > -513; i_6_++) {
float f = (((float) (i_6_ >> -1851515709)... |
9ce552cf-969d-46c3-a72d-fb82eedbba9e | 3 | public SingleTreeNode expand() {
int bestAction = 0;
double bestValue = -1;
for (int i = 0; i < children.length; i++) {
double x = m_rnd.nextDouble();
if (x > bestValue && children[i] == null) {
bestAction = i;
bestValue = x;
... |
15065799-6661-4233-bc83-1e35f6f2d371 | 2 | private void openFile(int fileIndex){
if(quick_launch_files[fileIndex].canExecute()){
try {
System.out.println("Attempting to open: "+quick_launch_files[fileIndex].getAbsolutePath());
Desktop.getDesktop().open( quick_launch_files[fileIndex] );
} catch (IOException e) {
e.printStackTrace();
}
} ... |
e9fd999b-fea6-4906-ae97-8743b8be9d40 | 4 | private void actionAdd( )
{
DefaultMutableTreeNode selNd = getSelectedNode();
if ( selNd == null )
{
audioVectors.add(new LinkedList<double[]>());
DefaultMutableTreeNode newNd = new DefaultMutableTreeNode("Collection");
dataRootNd.add(newNd);
dataTr.scrollPathToVisible(new TreePath(newNd.getPath()));
dataT... |
c33e933a-19fa-472c-bfa6-53d61ada1c17 | 6 | private String getTripleListFromTripleVector( Vector<Vector<String>> tripleVector )
{String tripleList="<triple_list>";
for(int i=0; i< tripleVector.size() ;i++)
{String s=tripleVector.elementAt(i).elementAt(0);
String p=tripleVector.elementAt(i).elementAt(1);
String o=tripleVector.elementAt(i).elementAt(2);
Str... |
946b28ca-d572-469f-9b00-aedba9902ead | 9 | public void run()
{
MensajeServidor("Procesando conexion");
try
{
//Entrada es el input del cliente, es decir la request en su respectivo formato.
BufferedReader entrada = new BufferedReader(new InputStreamReader(cliente.getInputStream()));
//Salida es para enviar la response.
sali... |
21999360-e6d7-4871-930c-e3d5357f7148 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
36dd7f14-7a8e-4eb6-bbad-354009fbc0ee | 2 | public void init(String className) {
imports = new TreeMap(comparator);
/* java.lang is always imported */
imports.put("java.lang.*", new Integer(Integer.MAX_VALUE));
int pkgdelim = className.lastIndexOf('.');
pkg = (pkgdelim == -1) ? "" : className.substring(0, pkgdelim);
this.className = (pkgdelim == -1)... |
522b21be-9245-44f1-9c92-2b236b55c337 | 4 | @Override
public Answer getAnswer(String gameid, Combination<Colors> combi) {
HttpGet request;
try {
request = new HttpGet(new URI("http", null, SERVER, PORT, TRY_URL,
String.format("gameid=%s&combi=%s", gameid, combi.toString()), null));
} catch (URISyntaxException e) {
throw new Ru... |
dbe458a0-cb40-4a4b-a2d3-9ae9ba30c7b8 | 5 | public returnTypes deleteChunk(byte[] fileID, int chunkNo) {
String recID = Packet.bytesToHex(fileID);
for(BackupChunk chunk : backedUpChunks) {
String comID = Packet.bytesToHex(chunk.getFileID());
if(comID.equals(recID) && chunk.getChunkNo() == chunkNo) {
String filepath = "storage/";
filepath += chu... |
0745690f-3821-402e-bc10-7be3b77051f0 | 2 | private void encodePositions(int number,int posS,int posE,int[] encoding)
{
String bin = Integer.toBinaryString(number);
System.out.println("In encodePositions "+bin);
System.out.println("start"+posE);
while(bin.length()<=posE-posS)
{
bin = 0+bin;
}
... |
093e7593-485b-4122-97a4-87e51491082b | 3 | private static void compareListToMvd( byte[] list, MVD mvd )
throws MVDTestException
{
String response = new String( list );
String[] parts = response.split("\n");
if ( parts.length==0 ||parts[0].indexOf('\t')!=-1 )
throw new MVDTestException("Invalid list versions header");
for ( int i=1;... |
c844e5af-7a56-4d7c-ba2c-ef7dd78feff1 | 1 | public void testPlus_Days() {
Days test2 = Days.days(2);
Days test3 = Days.days(3);
Days result = test2.plus(test3);
assertEquals(2, test2.getDays());
assertEquals(3, test3.getDays());
assertEquals(5, result.getDays());
assertEquals(1, Days.ONE.plus(Days.... |
9517315e-ebfa-4fc2-a204-1158beb0d82d | 1 | public static void defineFloors(int level){
if (level == 1){
createFloor(0, 600, 800, level);
createFloor(700, 475, 800, level);
createFloor(1650, 500, 500, level);
createFloor(2300, 650, 1000, level);
createFloor(3400, 500, 600, level);
createFloor(4050, 600, 900, level);
levelEnd = new Rectangl... |
f501f0aa-8776-455a-b6e6-706ec7d283dc | 7 | public static String getCState(char c, HTTPRequest httpReq)
{
boolean changes = false;
final CharState adjCState=(CharState)CMClass.getCommon("DefaultCharState");
adjCState.setAllValues(0);
if(httpReq.isUrlParameter(c+"CSTATE1"))
{
int num=1;
String behav=httpReq.getUrlParameter(c+"CSTATE"+num);
whi... |
b9961a98-0311-4fdc-9c39-dfdcc6606331 | 3 | @Override
public void deserialize(Buffer buf) {
short flag1 = buf.readUByte();
isOnSale = BooleanByteWrapper.getFlag(flag1, 0);
isSaleLocked = BooleanByteWrapper.getFlag(flag1, 1);
houseId = buf.readInt();
if (houseId < 0)
throw new RuntimeException("Forbidden val... |
70961dcf-7d3a-42a1-a68d-b9d336b96442 | 3 | public ClassBuilder method( MethodBuilder methodBuilder ) {
if ( methodBuilder == null ) {
return this ;
}
MethodMetadata metadata = methodBuilder.build() ;
for ( MethodMetadataBuilder method : builder.getDeclaredMethods() ) {
if ( metadata.getMethodName().equals( method.getMethodName()))
return th... |
a789f0cb-e4c1-4e6a-a131-9dca6aae13cd | 5 | @Override
protected Void doInBackground() throws Exception {
// Convert known data text files to treeset dictionaries
// (because String.hashCode() is really slow)
dictionaries = new ArrayList<>();
if (fields != null && !fields.isEmpty()) {
... |
6409f28c-e978-4535-9c9b-8f7dd731459d | 8 | public void actionPerformed(ActionEvent e){
if(e.getSource() == midiMuteButton){
// test case
if(Debug.sound)System.out.println("Mute Button Pressed");
if(isMidiMute() == false){
midiMuteButton.setIcon(new ImageIcon("icons/grey/Midi off.png"));
SlideRenderer.muteBackground();
setMidiMute(true);... |
555b3bb6-acec-4442-b17b-1b2c5445c724 | 8 | public boolean isSameTree(TreeNode p, TreeNode q) {
if (p == null && q == null)
return true;
if (p == null && q != null)
return false;
if (p != null && q == null)
return false;
if (p.val != q.val)
return false;
return isSameTree(p.... |
45563f58-c341-4907-afa3-4e9e2161e54d | 0 | public int size() {
return N;
} |
aa503b0d-11c7-4bab-97d3-6160ffea3222 | 8 | private void checkAnswer(){
if(tabIndex == 0){//Tab <code> TAB_MAIN </code> is chosen
if(index == -1){
index++;
setQuestion();
}
String trueAnswer = words.get(index).getEWord().toLowerCase().trim();
String thisAnswer = answer.getTe... |
9a3a4bbb-44c4-4fb0-8f1f-56124a8e5e46 | 8 | public static MapleReactorStats getReactor(int rid) {
MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid));
if (stats == null) {
int infoId = rid;
MapleData reactorData = data.getData(StringUtil.getLeftPaddedStr(Integer.toString(infoId) + ".img", '0', 11));
MapleData link = reactorData.getChild... |
919a692f-d812-49d1-87c8-7b2abc6ac748 | 6 | public static String escape(String string) {
StringBuffer sb = new StringBuffer();
for (int i = 0, length = string.length(); i < length; i++) {
char c = string.charAt(i);
switch (c) {
case '&':
sb.append("&");
break;
cas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.