method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b7eae0fa-3d58-467c-ab1d-d786a2eb46f1 | 8 | public void evaluateTighterInterval() {
{ IntervalCache interval = this;
if ((interval.lowerBound != null) &&
(interval.upperBound != null)) {
if (Stella_Object.eqlP(interval.lowerBound, interval.upperBound)) {
if (interval.strictLowerBoundP ||
interval.strictUpperBo... |
48b72db8-a6d0-4006-b9be-f1bcffc1a36f | 0 | public void mouseReleased(MouseEvent event)
{
editState(state);
} |
d4d6e3ce-83c1-4800-a798-ad47c6e395a0 | 0 | public boolean deleteDirectory(String path) throws IOException {
return fs.delete(new Path(path), true);
} |
e242ec82-ee5e-40c8-a122-e500e61d890d | 0 | @Override
protected void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
piirtaja.piirra(graphics);
} |
e1b72846-235b-47c8-8315-640558a23a87 | 8 | private void fft(double re[], double im[], int direction)
{
int n = re.length;
int bits = (int)Math.rint(Math.log(n) / Math.log(2));
if (n != (1 << bits))
throw new IllegalArgumentException("fft data must be power of 2");
int localN;
int j = 0;
for (int i = 0; i < n-1; i++)
{
if (i < j)
... |
8c14f0af-7f81-4db0-ad31-e892e1a574f3 | 4 | private void unlock(Location l) {
if (board.containsLocation(l) && board.tileAt(l).getOn() != null
&& board.tileAt(l).getOn() instanceof Lockable) {
((Lockable)board.tileAt(l).getOn()).setLocked(false);
for (int id: playerIDs.keySet()) {
server.queuePlayerUpdate(new UnlockEvent(l), id);
}
}
} |
227054ee-9b50-4a7c-a8d6-ff83e6fc26a7 | 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... |
aef41310-a14d-407f-9489-b0ebe3449548 | 2 | public List<Planet> EnemyPlanets() {
List<Planet> r = new ArrayList<Planet>();
for (Planet p : planets) {
if (p.Owner() >= 2) {
r.add(p);
}
}
return r;
} |
6f5c6745-26df-4c44-8a2f-c46523dc829d | 0 | private void setPropertyFromProduct() {
this.name = this.product.getName();
this.quantity = this.product.getQuantity();
this.price = String.valueOf(this.product.getPrice());
this.code = this.product.getCode();
this.desc = this.product.getDescription();
} |
9804cec7-9697-4a7e-bf1d-697c32604e74 | 0 | protected void addRtnCode(int codeNum, String info) {
this.rtnCodes.put(codeNum, String.valueOf(codeNum) + " " + info);
} |
a8542ab1-fe66-4c51-8dad-d1fccf6e0b38 | 1 | public void setPosition( TextPositionStrategy position ) {
if( position == null ) {
throw new IllegalArgumentException( "position must not be null" );
}
this.position = position;
regraph();
} |
0e17e262-5378-4b1b-87ad-24de97d1a408 | 3 | private static void generateHuffmanCodeLengths (final int alphabetSize, final int[] symbolFrequencies, final int[] codeLengths) {
final int[] mergedFrequenciesAndIndices = new int[alphabetSize];
final int[] sortedFrequencies = new int[alphabetSize];
// The Huffman allocator needs its input symbol frequencies to... |
976a180c-7a20-4539-84d0-962d8ce874dd | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
fb4415a4-8f5a-4ef6-bcbc-ba3d4166ad7a | 1 | public void setNumber(int number) throws TrainException {
if (number > 0) {
this.number = number;
} else {
throw new TrainException("Id is under zero");
}
} |
3cea1889-19e5-41a9-bc3d-faa5c3825f75 | 3 | public void run() {
long lastLoopTime = System.nanoTime();
final int TARGET_FPS = 60;
final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;
while (!Thread.currentThread().isInterrupted()) {
long now = System.nanoTime();
long updateLength = now - lastLoopTime;
... |
3c23684f-d0f0-40db-93e6-963382856bfb | 8 | private Grammar trim(Production[] prods)
{
char ch='A';
for (int i=0; i<prods.length; i++)
{
String lhs=prods[i].getLHS();
if (ch=='S' || ch=='T')
{
ch++;
}
int aa=lhs.indexOf("V(");
while (aa>-1)
{
// System.out.println("in 1st "+lhs+"===> ");
int bb=lhs.indexOf(")");
... |
133c0df4-61fa-4d82-ac1a-e2585b02b4d6 | 2 | public String getParameterString(){
String retString = super.getParameterString();
try{
if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
}
catch(UnsupportedEncodingException e ){
retString = "";
}
return retString;
} |
3f194a43-577a-40e4-9c37-6b5b976588fc | 6 | private void FillTable() throws UnknownHostException {
MongoClient mongoClient = new MongoClient(database.getInstanceAddress());
DB db = mongoClient.getDB(database.getDatabaseName());
DBCollection collection = db.getCollection(database.CollectionName);
DBObject dbObject = collection.find... |
16921dd0-8258-435a-9b76-41a2df1c54ec | 1 | @Override
public void mouseEntered(MouseEvent event) {
//Handle tile mouse hovering.
if (event.getSource() instanceof Tile) {
Tile tile = (Tile)event.getSource();
Tile selectedTile = match.getSelectedTile();
match.getPanel().setTile(tile, selectedTile, match.getTileOwner(tile), match.getTileOwner(selected... |
8b02dbaa-5c77-43d7-b597-93ee642128b2 | 1 | public static Connection getConnection() {
Connection connection = null;
try {
Class.forName(DRIVER).newInstance();
connection = DriverManager.getConnection(URL, USUARIO, SENHA);
} catch (Exception e) {
throw new RuntimeException(e);
}
return... |
bf051697-5822-4f29-bdf3-92c1a172eb9c | 1 | public String makeHandMove(int indexFrom, int indexTo) {
List<Card> handList = hand.getList();
Card card = handList.remove(indexFrom);
if (indexTo < handList.size()) {
handList.add(indexTo, card);
} else {
handList.add(card);
}
return "";
} |
20e1b9f7-7061-458b-9942-b8313912614c | 5 | public void checkGetDocIDFiled() {
if (getDocByID.getText() != "" && getDocByID.getText() != null && getDocByID.getText().length() != 0) {
List<String> docsID = Arrays.asList(getDocByID.getText().split("\\s*,\\s*"));
for (int i = 0; i < docsID.size(); i++) {
String regex ... |
b61c717f-27eb-4f7b-98dd-79c73ae1bf21 | 8 | public static double pow_lo(double x,double y) {
if (x < 0)
return Double.NaN;
else if (x == 0.0)
return 0.0;
else if (y > 0) {
if (x >= 1)
return exp_lo(mul_lo(y,log_lo(x)));
else if (x==1)
return 1.0;
else
return exp_lo(mul_lo(y,log_hi(x)));
}
... |
22419581-57cb-4d13-a90c-c1e1e0f45f67 | 8 | public void listen() {
while (true) {
String userInput = keypad.nextLine();
int[] money;
if (userInput.equals("Penny")) {
money = cashier.addMoney(1);
int[] penny = {0, 1};
System.out.println(cashier.returnChange(penny));
System.out.println(Cashier.showCash(cashier.currentValue()));
} else... |
781eded3-8763-4638-93bb-ff5e7ce1dc00 | 0 | public String getName() {
return name;
} |
84781f4d-df52-4522-b049-a46e61cb89e7 | 0 | public void update(Observable o, Object arg) {
// TODO Auto-generated method stub
} |
da89410b-0777-4f25-9354-39d2352fbcdd | 6 | public static HashMap<String, ContextCount>
getContextMap( File fastQFile, int leftHashLength,
int rightHashLength) throws Exception
{
HashMap<String, ContextCount> map = new HashMap<String, ContextCount>();
BufferedReader reader = new BufferedReader(new FileReader(fastQFile));
int numLines=0;
... |
28c73d92-8211-4ca9-8b11-b06f345472b4 | 7 | public static String getCRC32(String fileUri) {
CRC32 crc32 = new CRC32();
FileInputStream fileinputstream = null;
CheckedInputStream checkedinputstream = null;
String crc = null;
try {
fileinputstream = new FileInputStream(new File(fileUri));
checkedinputstream = new CheckedInputStream(fileinputstream,... |
6a99fb9a-1213-45e5-b5ef-2c0f6345fa19 | 2 | * @return a list of the backchaining implication rules which might apply to the given predicate
*
* @throws UnknownHostException if cyc server host not found on the network
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
... |
7af0aa69-23d7-45db-8e35-f5ef98851f5b | 8 | public final static List<String> parseSafeSemicolonList(final String list, final boolean ignoreNulls)
{
if(list==null)
return new Vector<String>(0);
final StringBuilder buf1=new StringBuilder(list);
int lastDex=0;
final Vector<String> V=new Vector<String>();
for(int l=0;l<buf1.length();l++)
switch(buf... |
2b9edec7-61f4-41ee-9ee7-e072e3a220a6 | 0 | public void setGenes(List<T> genes) {
this.genes = genes;
} |
bc2e6499-a9e9-4ee8-91e4-9f5ec251c799 | 0 | public MainInterface() {
System.out.println("DCnet command line interface, v" + DCConfig.VERSION);
System.out.println("2014, Moritz Neikes, m.neikes@student.ru.nl");
msi = new MultiStationInterface();
Action forwardAction = new CommandAction(msi);
setDefaultAction(forwardAction);
mapCommand("dc", forwardAc... |
16050df9-4082-4ffc-8f16-7518bfda1071 | 0 | public boolean isLive() {
return isLive;
} |
8244980f-10f8-491a-b7ef-3ef756c659c4 | 6 | public List<List<Object>> getQueryResult(String query){
ResultSet rs = execQuery(query);
if (rs == null)
return null;
List<List<Object>> result = new ArrayList<List<Object>>();
try {
while (rs.next()) {
List<Object> objList = new ArrayList<Object>();
for (int j = 1; j <= rs.getMetaData().getColumn... |
5c6a8927-0853-402b-b061-6704669df611 | 5 | public synchronized void shutdown(String data, String errmsg) { // synchronized???
try {
String log;
StringTokenizer ST = new StringTokenizer(data);
String name = ST.nextToken();
int player = Integer.parseInt(ST.nextToken());
int gameID = Integer.parseInt(ST.nextToken());
for (i... |
64c4fc6c-42c7-4dcc-9209-6300d872a081 | 0 | public void setName(String name) {
this.name = name;
} |
9967af88-7a9c-4c24-b33f-0fde4fce9d07 | 6 | private static EnumOS1 getPlatform()
{
String var0 = System.getProperty("os.name").toLowerCase();
return var0.contains("win") ? EnumOS1.windows : (var0.contains("mac") ? EnumOS1.macos : (var0.contains("solaris") ? EnumOS1.solaris : (var0.contains("sunos") ? EnumOS1.solaris : (var0.contains("linux") ... |
0b6b8272-3c6b-4ce1-be3a-7cc25be302b9 | 9 | @Override
public synchronized void run(){
if(myRequests.isEmpty()){
this.writeLog("R"+id+" has finished!\n");
building.checkCompletion();
return;
}
Request next = myRequests.remove();
this.setStartDest(next.getFrom(),next.getTo());
Elevator e;
if(to > from){
this.writeLog("R"+id+" pushes "+"... |
8e6990d4-f553-44bb-8137-6b5c37a0cd3f | 2 | private void takeQuiz()
{
practiceQuestion = getPracticeQuestion();
if (quiz.randomiseQuestions)
{
Collections.shuffle(quiz.questionList);
}
if (!quiz.navigationEnabled)
{
PrevBtn.setVisible(false... |
c359db28-f522-410e-ab9a-f23553c12efb | 3 | public void waitForFinish() {
synchronized (statusLock) {
while (!isFinished() && getStatus() != Watchable.STOPPED) {
try {
statusLock.wait();
} catch (InterruptedException ex) {
// ignore
}
}
... |
89752a48-1b6b-41ab-8195-5da93b8fd486 | 7 | public DocLine getContent( int windowIndex )
{
if ( windowIndex >= m_windows.length )
return null;
DocLine firstLine = null;
DocLine line = null;
DocLine prevLine = null;
int lineIndex = 0;
String textLine;
ContentWindow window = m_windows[windowIndex];
try {
InputStreamRe... |
65be0452-5641-436d-b4d5-5b299a4c7c63 | 9 | SpecialItem getSpecialItem() {
SpecialItem si;
int i = rnd.nextInt(5);
int value;
switch (i) {
case 0:
if (rnd.nextFloat() > 0.9f)
value = -1 * rnd.nextInt(10);
else
value = rnd.nextInt(20);
si =... |
3a40f060-9857-4eec-a6e7-2613c8c74643 | 1 | public Item(ItemLoader lookup, int iD)
{
try
{
ResultSet rs = lookup.search(iD);
this.iD = iD;
this.type = iD / 10000; //Gets first two digits of iD
this.name = rs.getString("NAME");
this.minRange = rs.getInt("MINRANGE... |
5337b7f5-7967-497d-ba83-e3fe05d72d0d | 5 | public void laseritAmpuu() {
for (Laser laser : lauta.getLaserit()) {
if (laser.getRuutu().onRobotti()||!laser.getRuutu().getHolorobot().isEmpty()) {
if (laser.getRuutu().onRobotti()) {
laser.getRuutu().getRobotti().otaVahinkoa(1);
}
... |
a949fb44-563c-4965-842c-1cf68ef01cab | 7 | public String getEmbed()
{
String embed = null;
// Have a shape with an embed?
OOXMLElement oe = getObject( SP );
if( oe != null )
{
embed = ((Sp) oe).getEmbed();
}
// how's about a picture?
if( embed == null )
{
oe = getObject( PIC );
}
if( (oe != null) && (embed == null) )
{
embed = ... |
8feae445-1357-49c0-ad2c-10d1ac890662 | 7 | private void typeCheckAccessMethods() {
Environment env = arch.globalEnv;
// first step: resolve all read methods by type
JIGIRTypeEnv te = arch.typeEnv;
for ( OperandTypeDecl ot: arch.operandTypes ) {
for ( OperandTypeDecl.AccessMethod m : ot.readDecls )
ot.r... |
07ccc2b8-d217-4600-b3eb-32689dbc0b9b | 4 | public synchronized void endBatch() {
if (isEnabled()) {
if (--mBatchLevel < 1) {
if (mCurrentBatch != null) {
for (BatchNotifierTarget target : mCurrentBatch) {
target.leaveBatchMode();
}
mCurrentBatch = null;
}
}
}
} |
8b36d6c5-89df-4750-9dfc-13d6304e47f8 | 4 | private void kwitansiTablePropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_kwitansiTablePropertyChange
// TODO add your handling code here:
if (kwitansiTable.getSelectedRowCount()>0){
if (kwitansiTable.getSelectedColumn()==0){
String kode_buku = "";
... |
de891e61-ea5b-4c82-bd65-1a5d15d3cc78 | 0 | public static Test suite()
{
return new TestSuite( AppTest.class );
} |
fec50a43-fd2f-4835-aba5-4d97d5ba9818 | 0 | public void setClient(Client client) {
this.client = client;
} |
239e2c6d-7d3b-4f69-832c-b7575faecd0a | 8 | private Coordinate inputPosition() {
int x = 0;
int y = 0;
String[] str;
String input;
while (true) {
System.out.println("Please input a Coordinate for droping Bomb !");
System.out.println("Enter position (wie 9,8) : ");
scPosition = new Scanne... |
6cb9ad95-77c8-435e-891b-4e131a03fef1 | 2 | @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
try {
Player player = event.getPlayer();
PermissionUser user;
if (plugin.isUseUUID()) {
user = plugin.getDataManager().getUser(event.getPlayer()... |
1d5e0224-7d42-4a48-80fc-51542bc2e130 | 7 | private void SubmitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SubmitButtonActionPerformed
label:{
if(validateField()){
String userId=userIdtext.getText();
int length = userId.length();
int findcharIndex=0;
for(int i=0;... |
dffd82b1-9287-4d25-905d-04688eaf0e7e | 0 | private Combination<Colors> generateAttemptCombination8() {
List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>();
attemptTokens.add(new Token<Colors>(Colors.R));
attemptTokens.add(new Token<Colors>(Colors.R));
attemptTokens.add(new Token<Colors>(Colors.R));
attemptTokens.add(new T... |
5062cd90-5188-432d-824f-cc2d9d21a807 | 7 | private String getChapter(String wikiText, int headerIdx){
int startIdx = wikiText.lastIndexOf('\n', headerIdx) + 1;
int endIdx = wikiText.indexOf('\n', headerIdx);
if(endIdx == -1){
return wikiText.substring(startIdx);
}
String header = wikiText.substring(startIdx, e... |
9a671658-14b2-413a-ae70-909cfcc79e1d | 5 | private void jCheckBox1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jCheckBox1KeyPressed
if (evt.getKeyCode() == 37) {
jTextField2.grabFocus();
} else if (evt.getKeyCode() == 40) {
jTextField3.grabFocus();
} else if (evt.getKeyCode() == 10) {
if (jCheckBox1.isSelected()... |
63f66e01-7cfe-4486-8598-c63ce8f379ee | 6 | private void verifyRequest(String unitRequest) {
//if (unitRequest.contains("Lamp") || unitRequest.contains("LAMP")|| unitRequest.contains("lamp")) {
/*
* Now we know which device we are supposed to send the command to.
*/
if (unitRequest != null) {
this.unitRequest = un... |
96301cbf-f986-4f64-a7d1-808c1561e595 | 6 | public void mousePressed(MouseEvent evt)
{
requestFocus();
// Focus events not fired sometimes?
setCaretVisible(true);
focusedComponent = JEditTextArea.this;
if((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0
&& popup != null)
{
popup.show(painter,evt.getX(),evt.getY());
return;
... |
4390cc5a-449b-40ef-bf88-69fc53166e27 | 3 | public Boolean copyWorldAllowed(World world, String name){
worlds = Bukkit.getServer().getWorlds();
World new_world;
if (plugin.mainWorlds.contains(world.getName())){
new_world = Bukkit.getWorld(world.getName() + "_" + name);
}else{
new_world = world;
}
if (worlds.size() <= plugin.maxWorlds || new_wor... |
975d6ba4-bca4-48e0-a2e1-bb22c83519d6 | 6 | public ListNode partition(ListNode head, int x) {
// Start typing your Java solution below
// DO NOT write main() function
ListNode small1 = null, small2 = null, big1 = null, big2 = null;
while (head != null) {
if (head.val < x) {
if (small1 == null) {
small1 = small2 = head;
} else {
smal... |
e6ae4cc9-fb0b-4a6e-a18b-e66e24f88aff | 5 | @Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (e.getSource() == canvasMain || e.getSource() == canvasGame) {
cameraMain.setZoom(cameraMain.getZoom()
+ e.getWheelRotation() * 5.0);
} else if (e.getSource() == canvasOrtho1) {
cameraOrtho1.setZoom(cameraOrtho1.getZoom()
+ e.getWheelRot... |
fdf64a89-4ef6-4bd6-9fe9-6e2217dad2fe | 1 | public void enqueue(Item item) {
Node<Item> oldlast = last;
last = new Node<Item>();
last.item = item;
last.next = null;
if (isEmpty()) first = last;
else oldlast.next = last;
N++;
} |
92a556ca-b7c1-46de-a44d-7f9aa17dd8ad | 1 | public boolean mousedown(Coord c, int button) {
if(hit) {
wdgmsg("click", c, button, ui.modflags());
return(true);
}
return(false);
} |
55500b25-12a4-40e9-af59-70e939b2d0e4 | 6 | private void addPage(Element parent) {
Element pageNode = doc.createElementNS(getNamespace(), DefaultXmlNames.ELEMENT_Page);
parent.appendChild(pageNode);
//Image filename
addAttribute(pageNode, DefaultXmlNames.ATTR_imageFilename, page.getImageFilename());
//Width/height
addAttribute(pageNode, Default... |
2a7d09d9-d92f-4e26-9cf5-990a337006d6 | 8 | @Override
public double calculateFractalWithoutPeriodicity(Complex pixel) {
iterations = 0;
double temp = 0;
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));
Complex[] complex = new Complex[2];
complex[0] = tempz;
complex[1] = new Complex(... |
b0c5133a-7c51-4ba7-a44e-a9d58ebd6cc8 | 9 | public static ScoreLog loadScoreLog(String inputFilePath)
throws XMLStreamException, FileNotFoundException, IOException {
ScoreLog scoreLog = null;
List<RobotScore> robotScores = null;
int numRounds = 0;
long time = 0;
XMLEventReader eventReader =
XMLInputFactory.newInstance().createX... |
614ab5e9-beb1-49ad-905e-6aa6c911d92e | 9 | final public void line() throws ParseException {
Token t1,t2,t3;
double[] p1,p2;
Token consTok=null;
Token csTok=null;
Token cs2Tok=null;
String cs=null,cs2=null,cons=null;
jj_consume_token(LINE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
consTok ... |
5fdf0e6e-73dd-4451-a8fb-855921cf6c00 | 8 | protected void actionPerformed(GuiButton par1GuiButton)
{
switch (par1GuiButton.id)
{
case 0:
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
break;
case 1:
this.mc.statFileWriter.readStat(StatList.leaveGa... |
a2ac75b2-cf8c-495b-bc5f-d75bdbfffb69 | 0 | @Override
public String toString() {
return "fleming.entity.Prueba[ idPrueba=" + idPrueba + " ]";
} |
be5ff20d-5527-4de4-9d9b-991a7275d1a1 | 3 | public Collection<String> getExtractFiles(OperatingSystem os) {
Collection<Library> libraries = getRelevantLibraries();
Collection result = new ArrayList();
for (Library library : libraries) {
Map natives = library.getNatives();
if ((natives != null) && (natives.containsKey(os))) {
res... |
43f2e582-9c97-4f0c-89b4-ca7c29eb5ee9 | 0 | private void jButtonPreviousActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPreviousActionPerformed
ctrlCR.precedent();
}//GEN-LAST:event_jButtonPreviousActionPerformed |
2ef68a53-aef5-4bcc-9aac-3580864c813c | 3 | public static TeleportManagerPlugin getPlugin() {
if (instance == null) {
Plugin plugin = Bukkit.getPluginManager().getPlugin("TeleportManager");
if (plugin != null && plugin instanceof TeleportManagerPlugin) instance = (TeleportManagerPlugin)plugin;
}
return instance;
} |
b0c1e4af-af61-471f-8918-21c4091c3016 | 1 | private void btnRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoverActionPerformed
if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja "
+ "remover o item? ", "",JOptionPane.OK_CANCEL_OPTION) == 0){
this.venda.getItens... |
7a0b0bf2-b6f8-48e0-b89b-c7ebd7f55641 | 0 | @Test
public void testGetName()
{
assertNotNull(_underTest);
assertEquals("Tester", _underTest.getName());
} |
66aca9cc-0dd3-4299-b22a-0cb727c14d34 | 1 | public void changeState(IState newState) {
if(currentState != null)
currentState.exit(follower);
newState.enter(follower);
currentState = newState;
} |
f5dcc0c0-22b4-458b-a6e4-3783506e1446 | 2 | public void addValue(double value, int condition) { // BETTER NAME?
assert (NumVals < NumChannels);
if (NumVals == 0) // if this is the first value for the current
Condition.add(condition); // row, then set row's condition
// number
Sum += value; // add this value to the total
NumVals++; // inc... |
e21552b6-5f58-49f9-aa0a-cf064d988d08 | 1 | public boolean isSonEmplacement() {
if (this.origEmplacement == this.nvEmplacement) {
return true;
} else {
return false;
}
} |
dd747911-7173-4881-b86e-06e587e89415 | 1 | public static void redirectTo(Pages page)
{
try
{
ExternalContext ec = FacesContext.getCurrentInstance()
.getExternalContext();
HttpServletRequest req = (HttpServletRequest) ec.getRequest();
String urlRequest = req.getRequestURL().substring(0, ... |
f08c316b-aaf7-4c0c-9478-621a4ee33a0e | 2 | public void forfeitGame() {
if (this.isActive) {
if (JOptionPane.showConfirmDialog(null, "Are you sure?", "Forfeit game", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
this.isActive = false;
}
} else {
JOptionPane.showMessageDialog(null, "No active game.");
}
} |
3bb25b9a-6af1-40a2-8acb-14e9c3771fee | 4 | public static void main(String[] args) {
String input = "doodle.txt";
try {
Board originalBoard = Board.fromFile(input);
for (int blur = 1; blur < 10; blur++)
for (int excess = 1; excess < (2*blur+1)*(2*blur+1); excess++)
{
Board board = new Board(originalBoard);
Solution solution = n... |
fcf6896f-9a39-499d-80da-643bc76b5bbb | 3 | static MVD loadMVD() throws Exception
{
MVD mvd;
File m = new File( mvdFile );
if ( m.exists() || (dbConn != null && dbConn.length()>0) )
mvd = MVDFile.internalise( m, Utilities.loadDBProperties(dbConn) );
else
throw new FileNotFoundException( "Couldn't find "+mvdFile );
mvd.setDirectAlign( direc... |
029b0ec0-3b97-4be9-b423-777feecabb5a | 9 | public final void importacoes() throws RecognitionException {
try {
// fontes/g/CanecaSemantico.g:189:2: ( ^( IMPORTACOES_ ( importacao )* ) )
// fontes/g/CanecaSemantico.g:189:4: ^( IMPORTACOES_ ( importacao )* )
{
match(input,IMPORTACOES_,FOLLOW_IMPORTACOES__in_... |
4041339d-e5e2-4915-9772-f0a469ff6f8c | 9 | @Override
public LegendItemCollection getLegendItems() {
LegendItemCollection result = new LegendItemCollection();
if (this.plot == null) {
return result;
}
int index = this.plot.getIndexOf(this);
CategoryDataset dataset = this.plot.getDataset(index);
if (... |
2c183eda-e635-4936-a5d8-b8980449dea4 | 7 | public boolean commit(){
if(writes.size()==0)
return true;
Write primary=writes.get(0);
if(!prewrite(primary,primary))
return false;
for(int i=1;i<writes.size();i++){
if(!prewrite(writes.get(i),primary))
return false;
}
commit_ts=OracleTimestampEmu.getCurTimestamp();
Write p=primary;
BigTab... |
3e898ee4-aea1-49fa-9004-e5971bc08eab | 7 | private boolean getWordsFromExcel (File file) {
boolean importOK = false;
try {
Workbook workBook = Workbook.getWorkbook(file);
Sheet sheet = workBook.getSheet(0);
int rows = sheet.getRows();
motherLangWordList = new ArrayList<String>(rows);
tr... |
5e6a1317-9a6f-4901-a198-c3117e645161 | 9 | private void doZoomOperations( int ychange ) {
if (proportionalZoom) {
if (reverseZoom) {
if ((distanceFromCenter -
(zoomMul*ychange*distanceFromCenter/100.0)) >
minRadius) {
distanceFromCenter -= (zoomMul*ychange*
distanceFromCenter/100.0);
}
else {
distanceFromCenter = min... |
4d7ff889-9f10-43b6-8cd5-b7cd5ea9d66c | 6 | @Override
public void mouseClicked(final MouseEvent e) {
this.e = e;
player.setActivityTimer(400);
//if(player.getActivityTimer()==0){
new Thread(new Runnable(){
@Override
public void run() {
DJOverlay overlay = (DJOverlay)((JButton) e.getSource()).getParent().getParent().getParent().getP... |
2c121c32-9977-446e-b6f0-d49585f8b581 | 4 | public void tokenise(){
while (!scanner.isEOF()){
String word = scanner.getWord();
if (!"".equals(word)){
tokens.addAll(Token.buildTokens(word, scanner.lineNumber, scanner.position));
if (scanner.current == '\n'){
tokens.add(Token.createNewlineToken(scanner.lineNumber, scanner.position));
}
... |
b6a0eb66-2800-4c62-ac70-79639f1b7e87 | 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... |
d8f670ed-1387-4457-81f5-bc12d91cc75e | 3 | @SuppressWarnings("unchecked")
public void itemStateChanged(ItemEvent e) {
System.out.print("Adicionado: ");
if (e.getStateChange()!= ItemEvent.SELECTED) return;
JComboBox<ContaComposite> comboBoxSelec = (JComboBox<ContaComposite>)e.getSource();
while (cbList.indexOf(comboBoxSelec)<cbList.size()-1) {
... |
d738414e-6930-46aa-aa1b-83a748bdc173 | 5 | public static void main(String[] args)
{
if(args.length < 1)
{
usage();
System.exit(1);
}
if(args[0].equals("2"))
{
Homework2 hw2 = new Homework2();
hw2.Process();
}
else if(args[0].equals("3"))
{
Homework3 hw3 = new Homework3(args[1]);
hw3.Process();
}
else if(... |
befe0cc0-2b31-46dc-9ecb-56481a3ccfd1 | 8 | public void waitUntilFinished() {
try {
while (m_runningCount > 0) {
Thread.sleep(200);
}
// now poll beans to see if there are any that are still busy
// (i.e. any multi-threaded ones that queue data instead of blocking)
while (true) {
boolean busy = false;
... |
f45a898d-cc5b-4c0a-b80e-cba4f8213f3c | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 62
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 62
... |
7a1b512d-8825-4655-b1db-1825b36b8d24 | 6 | public void sendPackage(long packNumber, double x, double y,
RemoteEventListener<TrackPackage> nodeListener)
throws RemoteException {
final long getPackNum = packNumber;
try {
this.route(getPackNum, x, y, nodeListener);
} catch (Exception e) {
// Report a TrackPackage to Headquarters remote event li... |
8be00e05-e309-4cf1-b99b-555fc210e24f | 5 | public void transferPEs(int partId, PERangeList list) {
if (partId < 0 || partId >= rangesParts.length) {
throw new IndexOutOfBoundsException("Partition " +
partId + " does not exist");
}
for(PERangeList range : rangesParts) {
if(range != null) {
range.remove(list);
}
}
if(rangesParts[part... |
24aba71e-9dec-46eb-975e-d8cf8e17e14d | 8 | public Map<String, Object> getAnalyzedScores(String weibo) {
Map<String, Object> ret = new HashMap<String, Object>();
if (weibo == null)
return ret;
try {
Map<Integer, Double> rates = raterSenti.predict(weibo);
double positive = rates.get(1);
double negative = rates.get(-1);
double neutral = rates.... |
9b614540-16f5-4383-ac14-2445f775ea2b | 8 | static float lpc_from_data(float[] data, float[] lpc, int n, int m) {
float[] aut = new float[m + 1];
float error;
int i, j;
// autocorrelation, p+1 lag coefficients
j = m + 1;
while (j-- != 0) {
float d = 0;
for (i = j; i < n; i++) {
... |
dd7b7bc5-4d18-4843-974e-c2a494098e56 | 0 | public String toString() {
String affiche = "";
return affiche;
} |
22642006-4b62-407d-9766-46c472402ca7 | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof DefaultHeatMapDataset)) {
return false;
}
DefaultHeatMapDataset that = (DefaultHeatMapDataset) obj;
if (this.xSamples != that.xSamples) {
... |
16692326-2253-471c-b30b-51e59837f9a7 | 0 | @Test
public void runTestButton2() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_Button2.apk");
Assert.assertNotNull(res);
Assert.assertEquals(4, res.size()); // 3 + (strong alias update not supported)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.