method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8912d95c-f112-423d-a160-e824110750b9 | 1 | private void prop(final Expr expr, final Expr source) {
if (TypeInference.DEBUG) {
System.out.println("prop " + expr + " <- " + source);
}
start(expr, source.type());
} |
21a3aa5c-d09e-4c5c-a761-43d7b8fb7de0 | 4 | public void rectangularHyperbolaFit(){
if(this.nAnalyteConcns<3)throw new IllegalArgumentException("Method rectangularHyperbolaFit requres at least 3 data points; only " + this.nAnalyteConcns + " were supplied");
this.methodUsed = 10;
this.sampleErrorFlag = true;
this.titleOne = "Rectang... |
b7da2e29-fc9f-4b32-a1ed-2b183a835665 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Quantum other = (Quantum) obj;
if (coordinates == null) {
if (other.coordinates != null)
return false;
} else if (!coordinates.equals(ot... |
56d7ca5f-52f8-484e-8600-45cb26469da4 | 3 | public void ordena(int[] v, DatosEstadisticos de){
int menor;
int pos = 0;
for (int i = 0; i < v.length; i++) {
menor = v[i];
for (int j = 0; j < v.length; j++) {
if(v[j] < menor){
menor = v[j];
pos = j;
... |
fa386c81-6010-496f-8169-cdba4c7a58ff | 5 | private void fillInventoryPanel(final SimpleEditorTab inventoryTab) {
final TreeMap<String, Integer> storage = new TreeMap<String, Integer>();
try {
final NodeList e = this.getXMLElementsByString("/MLP_Save/PlayerData/Storage/StoredItem[@ID]");
for(int i = 0; i < e.getLength(); i... |
92b63a2e-27a7-4f90-a5fb-46fb7737858e | 0 | public Iterator<String> iterator() {
return new TextFileIterator();
} |
7b865b65-bfda-43fe-bf23-c955fa16d262 | 6 | @Override
public void actionPerformed(ActionEvent e) {
String tipoBoton = e.getActionCommand();
JButton b = (JButton) e.getSource();
Menu framePrincipal = (Menu) SwingUtilities.getAncestorOfClass(Menu.class, b);
switch (tipoBoton) {
case "Jugar":
framePri... |
d2c3622d-2a6d-4bf8-95e6-594c65ee0c02 | 5 | public ArrayList<ArrayList<Integer>> combinationSum2(int[] num, int target) {
ArrayList<ArrayList<Integer>> rst = new ArrayList<ArrayList<Integer>>();
Arrays.sort(num);
if (target == 0)
{
rst.add(new ArrayList<Integer>());
return rst;
}
for (int i= 0 ; i < num.length && num[i... |
8522f298-062a-4ad1-bd10-442a71180c4b | 2 | public static String parseStringObject(Object object) throws InvalidRpcDataException {
if (object == null) {
return null;
}
if (object instanceof String) {
return (String) object;
} else {
throw new InvalidRpcDataException("Expected String, but got:... |
bcb240a8-363f-4fea-a5b4-7a2c6ba7bb3d | 7 | public static void main(String[] args) {
if (args.length != 2) {
System.out
.println("Please enter the ip address and port number correctly!");
return;
}
Client client = null;
try {
client = new Client(args[0], Integer.parseInt(args[1]));
client.service();
} catch (UnknownHostException ex) ... |
772122ca-540d-4c74-bdb9-b364f6245a1e | 8 | public static String convertDecimaltoFraction(double input) {
//TODO Zero equals one when calculating...?
/*
boolean negative = false;
if (input < 0) {
negative = true;
input = 0-input;
}
BigDecimal decimal = new BigDecimal(Double.toString(input));
decimal = decimal.setScale(18, BigDecimal.RO... |
5ca613d5-b101-49b4-b19a-7bcead3a398e | 2 | public String get(String player, AccessoryType type) {
File saveFile = new File(getDataFolder(), "saved.yml");
if (!saveFile.exists()) {
try {
saveFile.createNewFile();
} catch (IOException ex) {
Logger.getLogger(PlayerPlus.class.getName()).log(Level.SEVERE, null, ex);
}
}
YamlConfiguration yFi... |
1672f437-9fc1-429d-b230-a89029fc77b3 | 2 | public static void buildXML(ArrayList<String> column, ArrayList<String> row, ArrayList<String> fixed) {
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
// root elements
Document doc = docBuilder.newDocument();... |
623437a9-05d5-4a87-b7e5-a484694a7b5a | 5 | public String[] getStringArray(String key) {
Object value = getProperty(key);
String[] array;
if (value instanceof String) {
array = new String[1];
array[0] = interpolate((String)value);
} else if (value instanceof List) {
List list = (List)value;
... |
4a44df80-03c1-42ed-a6b7-f63d956d7b78 | 7 | public RateListGUI() {
//Get size of screen without taskbar
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
screenMax = Toolkit.getDefaultToolkit().getScreenInsets(rateDialog.getGraphicsConfiguration());
taskbarSize = screenMax.bottom;
screenWidth = (int)screenSize.getWidth();
... |
0f697df2-dd6e-418f-8482-390ee1b55fcf | 2 | public String toXML() {
Error error = getError();
if(error != null) {
return error.toXML();
}
StringWriter sw = new StringWriter();
String xml = "";
try {
JAXBContext context = JAXBContext.newInstance(this.getClass());
Marshaller marshaller = context.createMarshaller();
marshaller.m... |
48b920e1-7917-4e18-aa5e-3e096105c2a1 | 7 | public void run() {
Logger.logInfo("[i18n] Checking for updates ...");
File dir = new File(root);
File tmp = new File(dir, "locale");
if (!dir.exists() || !tmp.exists()) {
dir.mkdirs();
tmp.mkdirs();
}
cleanUpFiles();
try {
URLConnection connection = new URL(DownloadUtils.getStaticCreeperhostLin... |
d0dd6430-f907-43da-8e22-e4e04831f75e | 0 | public Person getPerson() {
return Person;
} |
12f435cd-a689-45bb-b0dc-001e60b2b8a2 | 9 | final int[][] method2778(int i, boolean bool) {
anInt10120++;
if (bool != true) {
return null;
}
int[][] is = aClass348_7454.method3981(i, 3168);
if (aClass348_7454.aBoolean4300) {
int[][] is_2_ = this.method2777(-93, 0, i);
int[] is_3_ = is_2_[0];
int[] is_4_ = is_2_[1];
int[] is_5_ = is_2_[2]... |
9acf5abe-8841-47e7-9fb7-1476eb446a1b | 3 | public static SourceTypeEnum fromString(String v) {
if (v != null) {
for (SourceTypeEnum c : SourceTypeEnum.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
869e0ab0-fd4d-405a-8fd2-ac58757f4178 | 7 | public static boolean areNotAllOrthologs(String[] alignedNodes, HashMap<String,Double> mapHomology)
{
boolean different=false;
int i=0, j=0;
for(i=0;i<alignedNodes.length-1;i++)
{
boolean hasHomologs=false;
for(j=i+1;j<alignedNodes.length;j++)
{
if(mapHomology!=null && mapHomology.containsKey(alig... |
afbe3b82-447d-4a3a-afd0-f59e5937ae8b | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PreferenceTags other = (PreferenceTags) obj;
if (tag == null) {
if (other.tag != null)
return false;
} else if (!tag.equals(other.tag))
... |
3788dc34-967f-4368-955f-45a07cb7dbc6 | 8 | public ArrayList<String> letterCombinations(String digits){
ArrayList<String> result = new ArrayList<>();
if(digits.length() == 0){
result.add("");
return result;
}
for(int i = 0; i < digits.length(); ++i){
String stringFromButton = getStringFromButton(digits.charAt(i));
int length = stringFromButto... |
17333a61-589d-4e66-97e1-e12eb168e00e | 4 | private void setPredictedWeapon(Weapon predictedWeapon) {
if (predictedWeapon == null) {
this.predictedWeapon = null;
} else {
switch (predictedWeapon) {
case ROCK:
this.predictedWeapon = Weapon.SCISSORS;
break;
... |
fff4d826-bde7-4a06-bb4f-a4407d162bf8 | 7 | @Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
Vector<String> origCmds=new XVector<String>(commands);
if(commands.size()<2)
{
CMLib.commands().doCommandFail(mob,origCmds,L("Serve whom?"));
return false;
}
commands.remove(0);
final MOB r... |
30a11c7b-7eee-43fc-832d-010ae6774851 | 8 | @Override
public final void draw(final Graphics2D g, final int no,
final double rotation) {
if(!doCaching) {
setSeed(no);
drawSegment(g);
return;
}
final Rectangle2D bbox = getBoundingBox(SEG_NORM, rotation);
if(oldBBox == null || !oldBBox.equals(bbox)) {
invalidate();
... |
9368bb15-aace-4f53-8cfc-abf13f4a724a | 2 | public static void main(String[] args) {
Collection<Integer> c = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
c.add(i);
}
for (Integer i : c) {
System.out.print(i + ", ");
}
} |
40177139-6e9e-4995-851c-8ed5dddac6c8 | 3 | public void each(Each each) {
if (isString) {
throw new RuntimeException(JSON__STATUS__ERROR);
}
for (int i = 0; i < array.size(); i++) {
Json json = array.get(i);
each.next(i, isObject ? keys.get(i) : null, json);
}
} |
8d987272-0e3d-49cf-8bd3-4571b78bb96f | 3 | public void reverseEnder(){
if (midPoint){
if (endpointer != 0){
endpointer--;
}
endpointer--;
if (endpointer == -1){
enemyPass();
}
}
} |
fe6392d9-01a8-4bd4-bd07-41c86773bdb8 | 2 | private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
try {
DateFormat datejour = new SimpleDateFormat("dd/MM/yyyy");
String monHeure = datejour.format(new Date());
jTextFieldCmdDate.setText(monHeure);
... |
922d1b84-7918-460f-9e0e-014f449a5b6d | 0 | public void setName(String name) {
this.name = name;
setDirty();
} |
2fd42dc8-60e2-484a-8fb4-79c89a595406 | 4 | @Test
public void testToStringServerMessageQueueWithMessagesCh() {
LOGGER.log(Level.INFO, "----- STARTING TEST testToStringServerMessageQueueWithMessagesCh -----");
try {
server1.setUseMessageQueues(true);
} catch (TimeoutException e) {
exception = true;
}
... |
d677f349-77b8-4dc8-b8e4-71153e917a47 | 9 | public ResponseData getResponseData(int partNum) throws ServerException, BadResumptionTokenException {
if (m_exception != null) {
throw m_exception;
}
// the current request should either be for the last sent part or plus one
int nextPart = m_lastSentPart + 1;
if (pa... |
e9c743c5-30af-4512-b145-1f67c04bbd7d | 5 | public static void sortStoreIncrementsInArray(Comparable[] a)
{
// Sort a[] into increasing order.
int N = a.length;
Vector<Integer> h = new Vector<Integer>();
for (int i = 1; i < N / 3; i = 3 * i + 1)
h.add(i); // 1, 4, 13, 40, 121, 364, 1093, ...
// h-sort the array.
for (int k = (h.size() - 1); k >... |
bf5b6c65-5b6a-4953-8340-e4dabf63c0c3 | 5 | private void parseJstatMetrics(String wholeJstatText, List<JvmModel> list) {
String[] lines = wholeJstatText.split("\\n");
if(lines.length < 5)
return;
String dateStrSec;
if(!lines[0].trim().startsWith("NGCMN"))
return;
String[] gccapacity = lines[1].trim().split("\\s+");
if(gccapacity.length ... |
887425a4-32a9-400b-9dfe-3a3f8af86fc2 | 4 | @Override
public
boolean isSavingNotRequired() {
// return true;
Path p;
try {
p = Paths.get(getChildrenSaveTo());
if (! Files.isDirectory(p)) return false;
p = Paths.get(getCoverSavePath());
if (Files.isRegularFile(p) && Files.size(p) > 0)
return true;
} catch (IOException e) {
Main.log(Le... |
d2db9b44-6713-4df5-9a85-3fb8935eca2a | 8 | private void PesquisaDevolucoesComDadosDeEntrada(){
int idFornecedor = 0;
String nomeFornecedor = "";
int idMateriaPrima = 0;
String nomeMatPrima = "";
String dataDevolucao = "";
String quantiDevolvida = "";
int devolucaoNum = 0;
String opcao... |
54ed8c14-9e7c-4d78-8cd6-6bea6eac1020 | 1 | public void incrementFrames() {
fps++;
if (checkLapsedMillis()) {
System.out.println("FPS: " + fps);
timer += 1000;
fps = 0;
}
} |
a4cd95cd-c483-4b7a-b31d-455a9ac9dacf | 2 | public List<Location> getLocationsEnAttente(){
System.out.println("ModeleLocations::getLocationsEnAttente()") ;
List<Location> locationsEnAttente = new ArrayList<Location>() ;
for(Location location : this.locations){
if(location.estEnAttente()){
locationsEnAttente.add(location) ;
}
}
return location... |
593fc95e-eb49-4df1-afbe-3c51e4ad0b4c | 1 | public void enter(Miner miner){
//on entry the miner makes sure he is located at the bank
if (miner.getLocation() != Location.bank)
{
System.out.println(miner.getName() + " Goin' to the bank. Yes siree");
miner.changeLocation(Location.bank);
}
} |
75879d7f-f04b-4b24-a7e4-055f2b363927 | 9 | public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( (other == null ) ) return false;
if ( !(other instanceof RelRelevoTrabajaderaHermanoId) ) return false;
RelRelevoTrabajaderaHermanoId castOther = ( RelRelevoTrabajaderaHermanoId ) other;
return (this.getIdrel... |
7a821dd1-4367-453f-bf40-b4d82e10c19a | 3 | public static boolean isAssignableFrom(Class<?> k) {
for (JSONValue v : JSONValue.values()) {
if (v.valueClass().isAssignableFrom(k))
return true;
}
return false;
} |
14d4c074-2b81-44e4-9d93-786e828239a1 | 6 | public void useSkillThree(Render render) {
// render.getCSManager().mageSkill3();
int totalXP = 0;
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
Turtle currentTurtle = getGrid().getPatch(i, j).getTurtle();
if (currentTurtle != null
... |
49326322-3aca-4122-921b-b7891e64b773 | 5 | public static ListNode swapPairs(ListNode head) {
ListNode h = null;
ListNode p = head;
ListNode q = head;
ListNode l = null;
while (null != p) {
q = p.next;
if (null != q) {
p.next = q.next;
q.next = p;
if (null == h) h = q;
... |
351cdb9a-3aea-4774-80cd-23d6c7bd70a4 | 0 | public void windowClosing(WindowEvent e)
{
System.out.println("Close Windows !");
System.exit(0);
} |
c4fd0e1e-ed65-4a8e-83c5-31f5b0d73b45 | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
int n = sc.nextInt();
if(n==0)break;
int[] a = new int[n];
for(int i=0;i<n;i++)a[i]=sc.nextInt();
int k = 0;
while(true){
int[] next = new int[n];
int[] c = new int[101];
for(int i:a)c[i]++;
... |
9ee4e8c7-21ba-430e-aa25-900cd40ce17c | 1 | @Override
public void actorDestroyedListener(GameActor actor) {
// just try to remove the actor from EVERYWHERE!
selectedWeapons.remove(actor.getID());
playerWeapons.remove(actor.getID());
buildings.remove(actor.getID());
if(actor.getID() == baseID) {
pla... |
069eab80-87ec-4c51-ac13-30d9edb6f769 | 9 | public static void main( String[] args ) {
int port = defaultPort;
String host = defaultHost;
//Auf Eingabeparameter ueberpruefen und gegebenenfalls setzten.
if ( args.length > 0 ) {
for ( int i = 0;i < args.length;i++ ) {
//Pruefen, ob ein Parameter den Port... |
9e168f56-9828-42fa-8079-437c6b600f97 | 8 | public void adjustRGB(int redOffset, int greenOffset, int blueOffset) {
for (int index = 0; index < myPixels.length; index++) {
int color = myPixels[index];
if (color != 0) {
int red = color >> 16 & 0xff;
red += redOffset;
if (red < 1) {
red = 1;
} else if (red > 255) {
red = 255;
... |
5ce8dc81-e8ef-45c6-8be4-885c2dc37fe4 | 0 | public int getTreatmentMetaSize(){
return treatmentMeta.size();
} |
c1a38173-c3dc-47e0-9d48-d798953bbfa5 | 0 | @Override
public void setAcademicLevel(String academicLevel) {
super.setAcademicLevel(academicLevel);
} |
3feff810-2ab8-439d-be69-cadd1b3687ff | 5 | private void loadConfigButtonActionPerformed(java.awt.event.ActionEvent evt)
{
JFileChooser fc = new JFileChooser();
setFileFilter(fc, "nn", "Neuronales Netz", false);
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
{
String path = fc.getSelectedFile().getPath();
Serializable.deserialize(pa... |
8d7c5835-9b9e-4ab7-84d5-6da237270370 | 3 | protected void addPluginsEventHandler(EventHandler eventHandler) {
eventHandler.setManagedEvent();
Map<Class<? extends Event>, Integer> map = eventHandler
.getManagedEvent();
for (Class<? extends Event> event : map.keySet()) {
addEventHandler(event, eventHandler, map.get(event));
}
} |
124aeffd-ff2e-473e-b131-7742c64fd4e4 | 4 | protected TableColumnModelListener createColumnModelListener() {
return new TableColumnModelListener() {
/** Tells listeners that a column was added to the model. */
@Override
public void columnAdded(TableColumnModelEvent e) {
// quickfix for #192
... |
89aefe7e-6ff9-4c4b-a515-314325cb82ac | 8 | public Iterator adjacentLocations(Location location)
{
int row = location.getRow();
int col = location.getCol();
LinkedList locations = new LinkedList();
for(int roffset = -1; roffset <= 1; roffset++) {
int nextRow = row + roffset;
if(nextRow >= 0 && nextRow <... |
cc8fa3c9-3d3b-4106-8698-7609641b0eeb | 3 | private void checkForPeptides(String rnaString, String peptide, List<String> rnaStringList, boolean reverse) {
int rnaStringLength = rnaString.length();
int peptideLength = peptide.length();
for (int i = 0; i < rnaStringLength - peptideLength * 3 + 1; i++) {
String rnaSubstring = rn... |
50160ed5-1aab-4f56-8611-fb87855c3d52 | 1 | @Override
public void setValueAt(Object value, int row, AttributeTableModel model) {
Node node = doc.tree.getEditingNode();
String key = (String) model.keys.get(row);
boolean readOnly = node.isReadOnly(key);
Object oldValue = node.getAttribute(key);
node.setAttribute(key, value);
model.values.set(row... |
385b9249-ea2f-4934-b009-befbcfe4cf8b | 4 | public void setColorFromState(int state){
switch (state){
case 0: setColor(C_LIBRE); break;
case 1: setColor(Color.black); break;
case 2: setColor(C_START); break;
case 3: setColor(C_ARRIVE); break;
}
} |
89f93bd3-3a20-485a-a986-753ad8c340b2 | 7 | @SuppressWarnings("unchecked")
public int compareTo(Object o) {
int row1 = modelIndex;
int row2 = ((Row) o).modelIndex;
for (Iterator it = sortingColumns.iterator(); it.hasNext();) {
Directive directive = (Directive) it.next();
int column = directiv... |
0b5845a2-700d-4307-86bb-c253947089bc | 9 | public void optimizeParam(int numItns) {
// update histograms and set the max # of times that each topic
// has occurred in any document...
int[] limits = new int[T];
Arrays.fill(limits, -1);
for (int j=0; j<T; j++) {
Arrays.fill(topicDocHist[j], 0);
for (int d=0; d<D; d++)
... |
ff836ff4-b0c2-4006-9f29-632d93145d09 | 8 | protected static boolean spellArmorCheck(StdAbility A, MOB mob, boolean auto)
{
if((!auto)&&(mob.isMine(A))&&(mob.location()!=null))
{
if((!mob.isMonster())
&&(!A.disregardsArmorCheck(mob))
&&(!CMLib.utensils().armorCheck(mob,CharClass.ARMOR_CLOTH))
&&(CMLib.dice().rollPercentage()<50))
{
mob.lo... |
7112d9b3-f8ec-47f9-9560-cf6816c06473 | 1 | public StageMenue(StageManager stageManager, Map<String, String> data) {
super(stageManager, data);
SoundManager.loadClipInCache("chiptune", "chiptune.wav");
SoundManager.play("chiptune", true);
try {
background = ImageIO.read(getClass().getResourceAsStream("/graphics/menue/MenueBackground.png"));
buttons... |
1ff34daa-d4b5-4b9c-be42-0c060bb61b5d | 8 | public void processTile(int r, int c,
int ulx, int uly,
int width, int height,
double left, double bottom,
double right, double top) {
super.processTile(r, c,
ulx, uly,
... |
c93faff4-4af4-4df8-a7dc-c7afbed7fa6d | 1 | public BeanMapper<?> getMapper() {
return mapper;
} |
29766603-2664-44fc-9f50-b41d68c30961 | 4 | public void scan()
throws Exception
{
nextChar();
while (ch != 0)
{ // EOF?
String token = nextToken();
//We don't want to printout the parenthesis
if (token != null && !"()".contains(token))
{
String tokenType = "";
System.o... |
fb79c265-a65a-4fa5-9379-672a53f58002 | 0 | @Override
public boolean execute(CommandSender sender, String[] args) {
return false;
} |
ba489d91-b546-4c34-91bd-abda29d4e9ca | 4 | public int getBlueScoreFromBlocks() {
int b = 0;
if (bLoc1.getBlock().getType() == Material.GOLD_BLOCK)
b++;
if (bLoc2.getBlock().getType() == Material.GOLD_BLOCK)
b++;
if (bLoc3.getBlock().getType() == Material.GOLD_BLOCK)
b++;
if (bLoc4.getBl... |
b8833c44-38f1-4fe2-a6a2-bd0c2a33d086 | 0 | public void setUser(String user) {
this.user = user;
} |
898a2c13-c4be-43ae-9339-bffe8ea37917 | 6 | public Cuboid getNearestCuboid(CuboidType type, Location loc) {
if (type == null || loc == null) return null;
double nearest = 0;
Cuboid cuboid = null;
for (Cuboid c : cuboids.values()) {
if (c.getCuboidType() != type.getTypeID()) continue;
if (nearest == 0) {
nearest = loc.distanceSquared(c.get... |
b1f1001d-a9f9-4774-a615-94eeb3e28fd2 | 6 | public void updateTicketQueue(int id, int queueType) {
PreparedStatement statement = null;
try {
switch (queueType) {
case 0:
statement = conn.prepareStatement("update Tickets set Pending=true,Active=false,Closed=false where TicketID=?");
break;
case 1:
statement = conn.prepareStatement("u... |
60654908-1012-4d34-a277-19091e3528d8 | 4 | public boolean writeToFile(String filename)
{
/* instantiate PrintWriter ofile1 as null, and call getSize() to obtain current
* number of HousePets in hpArray (to be used for FOR loop iteration limit) */
PrintWriter ofile1 = null;
int listSize = getSize();
boolean hasBeenWri... |
21d9af89-e08a-41df-9e10-bc73ba328ad4 | 0 | public void testApp() {
assertTrue(true);
} |
b7931561-6e6f-417c-a3a9-03c8c9e4a2e0 | 8 | public int getMajorityElement(int[] a) {
if (a == null || a.length == 0) { throw new IllegalArgumentException();}
/* Initialize potential majority candidate as element at index 0;
* Update it every time count decreases to 0 */
int count = 1;
int mCandidateIndex = 0;
/* Phase #1: determine a poten... |
7e5a5ad0-7011-4f3d-bcb6-33ce92322b0b | 1 | public ThemeMusic() {
try{
// AudioFile
audioFile = new File("src\\SoundsMusics\\Music\\Tetris.wav");
AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile);
AudioFormat format = audioStream.getFormat();
DataLine.Info info =... |
4605534b-2a41-4528-8b12-a2d0c5e25ebf | 8 | private void loadLogFile()
{
try
{
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setValidating(false);
builderFactory.setNamespaceAware(true);
DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document doc = builder.parse(logFile);
XPath... |
5f94d06a-a178-49bf-8e75-1c87f417fec7 | 1 | public void stop() {
if (t != null) {
t = null;
}
this.keepGoing = false;
} |
7ff13efd-fc8a-44ea-87ca-ba1e4a5c7738 | 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... |
ea80078b-a0aa-42e6-8634-5334ac125472 | 4 | public boolean intersects(GeoBounds other)
{
boolean rv = false;
for (Rectangle2D r1 : rects)
{
for (Rectangle2D r2 : other.rects)
{
rv = r1.intersects(r2);
if (rv)
{
break;
}
}
if (rv)
{
break;
}
}
return rv;
} |
7bb05e1f-4978-47fb-aa44-d2f226a2635d | 2 | public static String parseType(String data) {
String[] lines = data.split("\n");
for (String line : lines) {
String[] parts = line.split(":", 2);
if (parts[0].equals("type")) {
return parts[1];
}
}
return null;
} |
5859167a-7998-4441-8115-b6a86700e88a | 0 | public void mouseClicked(MouseEvent e) {} |
3c13b500-f595-4651-8f13-b96d8c3b0001 | 5 | private static void cicleForToTheGameCom() throws IOException {
//List<String> links = new ArrayList<>();
Set<String> links = new HashSet<>();
SearchInfo search = new SearchInfo();
for(int i = 1; i < 18; i++){
URL url = null;
try {
url = new URL("http://tothegame.com/developer.asp?letter=all&page=" + ... |
7cf03a4f-e531-470e-a5dc-550b22605ff0 | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld settime <worldname> <sunrise|noon|sunset|midnight>");
} else if (args.size() == 0) {
error("No time given.");
re... |
f39c3e1c-ec56-4b52-806a-af2034b198c2 | 6 | @EventHandler
public void MessageParsing(MessageEvent event){
if(event.getMessage().startsWith("Login ")){
new LoginChecker(event.getClientCluster().getClient().getClientCluster()).checkLogin(event.getMessage());
}else
if(ClientHandler.getDataQueuer().isRealUser(event.getClientCluster().getClient())){
i... |
4f7b55bc-7693-4b5f-91c4-38350cfef4cf | 0 | @Override
public IEmailKontaktDao getEmailKontaktDao() {
EmailKontaktDaoSqlite ekds = new EmailKontaktDaoSqlite();
return ekds;
} |
a9470f2f-547e-4129-9597-319c30c11af0 | 2 | @Test
public void test() {
if (!MongoHelper.delete(comment, "comments")) {
TestHelper.failed("delete failed");
}
if (MongoHelper.fetch(comment, "comments") != null) {
TestHelper.failed("comment was not deleted");
}
System.out.println("Deleted sugges... |
3e2dbb25-c33d-4d94-a3af-0f73fcb04e4c | 4 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if(args.length==1){
BansManager.kickPlayer(sender.getName(), args[0], "");
return true;
}
if(args.length>1){
String msg = "";
for(String data: args){
if(!data.equals(args[0])){
msg+=... |
8f7fbf2c-2eed-4edd-b416-99b01f29fc0d | 7 | private SyncConfig getInput() {
final SyncConfig config = new SyncConfig();
boolean more = false;
final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try {
do {
final FolderConfig folderConfig = new FolderConfig();
System.out.print("Enter the artist url to sync: ");
... |
2613d212-b0ed-4558-872f-67a2d857de47 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Artista other = (Artista) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
... |
a8ffc8be-e64f-4142-86ff-46ddb38198d5 | 6 | public int checkInBetweenHorizontal(int originLetter, int originNum, int newLetter, int newNum, Board b)
{
valid = 0;
this.board = b;
if(originLetter > newLetter)
{
int leftValid = 0;
int horizontalLeftNum = originLetter;
for(int counter = 0; counter < ((originLetter-newLetter)-1); counter++)
{
... |
486f251e-f3e5-4e06-8189-68179b4d60e9 | 8 | private void receiveDatafromServer()
{
while(true)
{
try {
DatagramPacket receivePacket = new DatagramPacket(rx_buff, rx_buff.length);
clientReceiver.receive(receivePacket);
rx_buff = receivePacket.getData();
//check checksum here
dataReceived = true;
currentData = r... |
6f1c836d-79c1-455e-a934-6341fd851f50 | 4 | @Override
public synchronized boolean unregisterListener(EventListener observer)
{
boolean res = false;
if(observers != null) {
synchronized (observers) {
// are we currently in a list iteration process?
if(loopCounter > 0) {
// yes! -> remove observer later
res = observers.contains(observ... |
3e822421-4cf2-4e9a-8ebc-e1a23ab28582 | 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 && string.indexOf('E') < 0) {... |
330a69bd-ad7b-430e-bc3d-7cd46ecdb784 | 9 | public static Map<String, List<String>> createMapping(List<String> allWords) {
Map<String, List<String>> mapping = new TreeMap<>();
Map<Integer, List<String>> wordsByLength = new TreeMap<>();
for (String word : allWords) {
int length = word.length();
if (wordsByLength.ge... |
1e78d72d-af3c-4835-9dfe-8fd9aab85a0d | 2 | public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(10);
for (int i = 0; i < 100; i++) {
final int no = i;
Runnable runnable = new Runnable() {
@Override
public void run() {
... |
b068e031-e204-4c84-986e-f00d14b0de2e | 2 | public static void demoteText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
if (currentNode.isFirstChild()) {
return;
}
// Abort if node is not moveable
if (!currentNode.isMoveable()) {
return;
}
// Put the Undoable onto the UndoQueue
Node targetNode = currentNode.prevSibling();... |
fc8b0906-08af-469a-b338-d7c9f178b5e4 | 5 | private void renderStationaryGraphics() {
StationaryGraphic stationaryGraphic = (StationaryGraphic) stationaryGraphicQueue
.peekLast();
for (; stationaryGraphic != null; stationaryGraphic = (StationaryGraphic) stationaryGraphicQueue
.reverseGetNext())
if (stationaryGraphic.z != plane
|| stationaryGr... |
d4aaa40f-2ad6-435e-8bed-c4a21a578246 | 1 | public String getPlayersInWorld(World world, Player player){
List<Player> players = world.getPlayers();
String playerString = "";
for (Player playerList : players){
playerString += playerList.getPlayerListName() + ", ";
}
return playerString;
} |
712b1e30-8499-4c32-8c8f-693ca4d2dfa0 | 8 | @Override
public void processPacket(Client c, int packetType, int packetSize) {
c.wearId = c.getInStream().readUnsignedWord();
c.wearSlot = c.getInStream().readUnsignedWordA();
c.interfaceId = c.getInStream().readUnsignedWordA();
int oldCombatTimer = c.attackTimer;
if (c.playerIndex > 0 || c.npcIndex > 0)... |
6a968940-874c-4b6e-9920-4dab2fb55d81 | 7 | private void initTable(){
TableCellEditor nonSelEditor = new TableCellEditor() {
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
return null;
}
@Override
publ... |
40fdf576-ded4-4779-824c-170a51402927 | 3 | public TMSimulator(Automaton automaton) {
super(automaton);
if (!(automaton instanceof TuringMachine))
throw new IllegalArgumentException(
"Automaton is not a Turing machine, but a "
+ automaton.getClass());
// //MERLIN MERLIN MERLIN MERLIN MERLIN// //this code is only for show, it should be m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.