method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
567a2b44-f8e5-483b-bcb0-60c39e970616 | 7 | public static void matMultiply(Matrix A, Matrix B, Matrix C) {
int rowsOut = B.height;
int innerProdDim = B.width;
int colsOut = C.width;
if ((A.height != rowsOut) || (A.width != C.width) || (B.width != C.height)) {
throw new RuntimeException("Error: The matrices have inconsi... |
0caee412-c677-4f00-9f77-2f72508ea38c | 3 | private String replaceInString(final String regex,
final String srcString,
final String replacement) {
// Exit
if (srcString == null || "".equals(srcString)) { return null; }
// Replace all found files with the value of
// <code>ApplicationProperties.LOG_FILE_PATH.getDefaultValue()</code>
final Patte... |
ebd51882-7191-48c2-bf6a-b13bcc9d40fe | 3 | public synchronized byte[] getMessage() {
if(pendingMessage != null) {
// Padding has already been applied earlier, so we can just return the pending message.
return pendingMessage;
} else if(!messageBuffer.isEmpty()) {
// Fetch the last message from the buffer and apply padding
pendingMessage = P... |
f4adb434-4925-4fb3-becb-12d0b40767ce | 8 | public ShowCompanyPanel() {
super(null);
this.setBackground(Color.black);
model = new CompanyTableModel();
sorter = new TableRowSorter<CompanyTableModel>(model);
companyTable = new JTable(model);
companyTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
companyTable.setFillsViewportHeight(t... |
ed50bb58-01e6-41e8-8466-60ff4e0476d8 | 6 | @Override
public void playCard(int playerId, int cardId) throws ActionNotAllowedException {
Card cardPlayed = cardDAO.getCard(cardId);
if (!gameStatus.beginningCardDrawn && playerOnTheMove(playerId)) {
throw new ActionNotAllowedException(EXCEPTION_PLAY_CARD_BEGINNING_CARD_NOT_DRAWN);
... |
ce34272e-df71-499f-a7ae-17ceff6710a3 | 2 | public void draw( Graphics2D g, Scale s){
int numPoints = 10;
for( int i=0; i<numPoints; i++){
for( int j=0; j<numPoints; j++){
drawSlope( g, s.new Converter( numPoints,
new Point(i,j) ) );
}
}
} |
9faa5588-f798-4215-bb2b-79cc37699b15 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!(obj instanceof RGB)) return false;
return ((RGB) obj).r == r && ((RGB) obj).g == g && ((RGB) obj).b == b && ((RGB) obj).a == a;
} |
e58dd768-d1c7-471e-bae9-60d3454967ea | 0 | public static int contains(String text, String match) {
return StringTools.contains(text, match);
} |
7b09d638-4e24-4814-9634-8c14543e6717 | 2 | public void playSounds(){
if(LockedPlaylistValueAccess.lockedPlaylist) {
ArrayList<Sound> soundList = currentSlide.getSoundList();
if(!soundList.isEmpty())
{
Sound sound = soundList.get(0);
audioPlayer.prepareMedia(sound.getFile(), sound.getStart());
audioPlayer.playMedia();
}
}
} |
380bb7c3-23b9-47f1-a2c2-4b690df0865a | 3 | private void btnSwitchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSwitchActionPerformed
UsuariosCRUD udao = new UsuariosCRUD(MyConnection.getConnection());
if(btnSwitch.getText().equals("Actualizar")){
Usuarios u = new Usuarios(
edtCodigo.getText().t... |
539dc075-0fc4-402a-8183-c8c5db9915a5 | 1 | public static void insert(Girl newNode){
if(head == null){
head = newNode;
tail = newNode;
}
else{
tail.next = newNode;
tail = tail.next;
}
} |
ee15984b-43b0-4891-806c-e31a53c8c664 | 1 | public FlacHeader(int sampleRateHz, byte numChannels, byte bitsPerSample,
long numSamples,byte[] md5,int numMetadataBlocks, long frameDataStart) {
super();
this.sampleRateHz = sampleRateHz;
this.numChannels = numChannels;
this.bitsPerSample = bitsPerSample;
this.numSamples = numSamples;
this.numMetadataB... |
6700afd4-d2d3-436f-bbbe-b6529ceb5df0 | 2 | private void insert(int put) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < n; i++) {
if ((put & 1) == 1)
sb.append('Q');
else
sb.append('.');
put >>>= 1;
}
oneSolution[row] = sb.toString();
row++;... |
8e4349cb-ed78-4ec5-a128-4bf9e8be7adb | 8 | public static boolean isValidDate(String dateString){ //for checking if date is a valid date, surprise surprise
if (dateString == null || dateString.length() != "yyyyMMdd".length()){
return false;
}//end of if statement
int date;
try{
date = Integer.parseInt(dateString);
}//en... |
93a35127-66df-4495-bdde-bf6c122c9c22 | 2 | public Sentence getSentence(String id) {
for (Sentence sentence : sentences) {
if (sentence.getId().equals(id))
return sentence;
}
return null;
} |
4cc89e03-a33d-45e7-af22-6da95da157eb | 6 | public boolean canSupport(Territory territory, int SeatNum) { //!territory.getOrder().getUse() semble pas fonctionner
return (territory2.getNeighbors().contains(territory)&& territory.getOrder()!=null && territory.getFamily().getPlayer()==SeatNum && territory.getOrder().getType()==OrderType.SUP && (!territory.getOrd... |
87cce1be-5784-45c2-934d-4b411f1dddab | 7 | public void setFontSmoothingValue(Object sv)
{
if(sv == RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)
{
font_smoothing_value = 1;
}
else if(sv == RenderingHints.VALUE_TEXT_ANTIALIAS_ON)
{
font_smoothing_value = 2;
}
else if(sv == RenderingHints.VALUE_TEXT_ANTIAL... |
d82568f5-83ce-4a26-878d-6ebb5972a0ae | 1 | public void testConstructor_ObjectStringEx2() throws Throwable {
try {
new LocalDate("1970-04-06T10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {}
} |
8df4e19d-aa84-414c-8f9b-c56b9c21f0ad | 5 | @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (qName.equals("onStandingDrop")) {
response.setOnStandingDrop(getCombatSetting(attrs));
} else if (qName.equals("onStatusDrop")) {
response.setOnStatusDrop(getCombatSetting(attrs));
} ... |
91090383-d298-4b9f-90fe-40eabc0f64e4 | 5 | public float GetLineThickness(){
switch (LineWidthComboBox.getSelectedIndex()) {
case 0:
return 1.00f;
case 1:
return 2.00f;
case 2:
return 3.00f;
case 3:
return 4.00f;
case 4:
... |
4b4aa5c0-45b7-464a-bf2c-ffed63409575 | 8 | private boolean r_tidy_up() {
int among_var;
// (, line 183
// [, line 184
ket = cursor;
// substring, line 184
among_var = find_among_b(a_7, 4);
if (among_var == 0)
{
... |
db25d186-92f5-4bde-bb12-6fd8f47905ab | 5 | @Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
// Invoke the painter for the background
if (painter != null)
{
Dimension d = getSize();
Graphics2D g2 = (Graphics2D) g;
g2.setPaint(painter);
g2.fill( new Rectangle(0, 0, d.width, d.height) );
}
// Draw the im... |
626ee9e3-c40b-4507-b504-2f6b3997311b | 0 | private void Initialize() {
//initialize cars
playerCar = new Car();
enemyCar = new EnemyCar();
//create the course
CreateCourse();
//create the background
movingBg = new MovingBackground();
} |
38af909d-b0a1-4472-9bb2-a2707b6ba788 | 0 | void f() {
print("Pie.f();");
} |
a288e45d-6c14-4edd-8c2a-f21af3855977 | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
669ae8b2-e9e9-4798-9009-503f7372ffd1 | 2 | public final LogoParser.statement_return statement() throws RecognitionException {
LogoParser.statement_return retval = new LogoParser.statement_return();
retval.start = input.LT(1);
Object root_0 = null;
LogoParser.singleLine_return singleLine8 =null;
try {
// ... |
248e3c26-8c2a-4b4a-9f70-74462b620e07 | 3 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Produto)) {
return false;
}
Produto produto = (Produto) obj;
if (this.id == produto.getId()) {
return true;
}
return false;
} |
8044e28f-3d68-44ac-a43e-c190d8acfeb9 | 8 | @EventHandler(priority = EventPriority.LOW)
public void onPlayerMove (PlayerMoveEvent event) {
//plugin.log.info("active " + plugin.active);
if(plugin.active == false)
return;
Player p = event.getPlayer();
//plugin.log.info("cacheVar " + plugin.cacheage);
//plugin.log.info("p... |
fdfad5e6-8415-465d-9d98-b16bd5f710ac | 3 | @Override
public void dragGestureRecognized(DragGestureEvent dge) {
if (mSortColumn != null && mOwner.allowColumnDrag()) {
mOwner.setSourceDragColumn(mSortColumn);
if (DragSource.isDragImageSupported()) {
Point pt = dge.getDragOrigin();
dge.startDrag(null, mOwner.getColumnDragImage(mSortColumn), new Po... |
77fd732e-700d-40fb-94a3-f0b7221d4a87 | 9 | public SegmentGroup joinSplines() {
long startTime = System.currentTimeMillis();
System.out.println("Sorting and joining Splines...");
SegmentGroup s = new SegmentGroup();
recalculateAllSplines(splines, sGroups, HIGH_RES);
printl(currentID + " curr Id");
... |
a8c35012-6c89-4452-a3d1-6ac84b4d252c | 4 | @Override
public boolean monkeyTrouble(boolean aSmile, boolean bSmile) {
if (aSmile && bSmile) {
return true;
}
if (!aSmile && !bSmile) {
return true;
}
return false;
// The above can be shortened to:
// return ((aSmile && bSmile) || (!aSmile && !bSmile));
// Or this very ... |
2847e718-42bb-45b0-aaf5-4db97225b2c9 | 5 | public void cancel(){
synchronized (this) {
log("Cancelled");
isCancelled = true;
if (youtubeProc!=null)
youtubeProc.destroy();
if (convertThread!=null)
convertThread.interrupt();
if (downloadThread!=null)
downloadThread.interrupt();
if (ffmpegProc!=null)
ffmpegProc.destroy();
son... |
2691839f-82a6-49d1-93e0-d4442f60d37f | 5 | private void sysCallOpen()
{
//Get the device ID
int deviceID = m_CPU.popStack();
//SOS.debugPrintln("sysCallOpen");
//Add the current process to the device to indicate that it's using the device
//If the device exists
DeviceInfo di;
if((di = findDevice(device... |
63ab4af1-6f50-4beb-9477-68e3e49e7adb | 6 | private void transverseStation(RailwayStation currStation,
RailwayStation prevStation,
final RailwayStation toStation,
int distanceTraveled,
String transversedStation,
TreeMap<Integer, String> bestSolution) throws NoSuchRouteException {
int maxEffort... |
eff5b0d8-fc00-446d-8f48-35c55e9aa57c | 5 | private static void loadFEP() {
try {
FileInputStream fstream;
fstream = new FileInputStream("fep.conf");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
... |
c42aaa0a-24b8-432e-9f2c-1ce651af6a38 | 6 | protected void mouseClicked(int par1, int par2, int par3)
{
super.mouseClicked(par1, par2, par3);
int var4 = (this.width - this.xSize) / 2;
int var5 = (this.height - this.ySize) / 2;
for (int var6 = 0; var6 < 3; ++var6)
{
int var7 = par1 - (var4 + 60);
... |
a6511420-fd0e-4c39-a9e8-05d1383bd317 | 2 | public void addTryCatch(final TryCatch tryCatch) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
if (ClassEditor.DEBUG) {
System.out.println("add " + tryCatch);
}
tryCatches.add(tryCatch);
this.... |
ca7c7730-790c-41bb-a9af-fae44a9f312c | 5 | public String getRepTitle() throws SQLException
{
if (!getFormat().getBaseFormat().equals("CD"))
return getTitle();
// Check the database for other titles
List<Record> recs = GetRecords.create().getRecords(this.getTitle());
int count = 0;
for (Record rec : recs)
if (r... |
5daab485-ebaf-4b83-b96c-95d5dd19e1cf | 6 | public static String qualifyCellAddress( String s )
{
String prefix = "";
if( !s.contains( "$" ) )
{ // it's not qualified yet
int i = s.indexOf( "!" );
if( i > -1 )
{
prefix = s.substring( 0, i + 1 );
s = s.substring( i + 1 );
}
s = "$" + s;
i = 1;
while( (i < s.length()) && !Cha... |
9a1cd7ae-7b66-4085-b0d5-3ba44ed141b4 | 3 | public List<String> retrieve(String extension) throws Exception {
List<String> filelist = new ArrayList<String>();
try {
ResultSet rs = stmt.executeQuery("SELECT filepath from "
+ tablename + " WHERE filepath LIKE '%." + extension + "'");
try {
while (rs.next()) {
String sResult = rs.getString... |
140e045d-dc1f-4e55-805b-17865a1c930a | 6 | public ViewMap(Tile[][] fullMap,Point centerPosition) {
map = new Tile[DrawUtil.TILES_WIDTH][DrawUtil.TILES_HEIGHT];
Point topLeft = new Point(centerPosition.x-DrawUtil.TILES_WIDTH/2,centerPosition.y-DrawUtil.TILES_HEIGHT/2);
for(int i = 0;i<DrawUtil.TILES_WIDTH;i++){
for(int j = 0;j... |
5113bcaa-1d43-4c23-bd35-5d4f9b519471 | 9 | public void act() {
switch(state) {
case WAITING: // if he is waiting
// he will stop waiting if you command him to walk
if(Keyboard.keyCheck(KeyEvent.VK_RIGHT)) {
state = State.WALKING;
dx = +mov_speed;
col = 1;
dir = RIGHT;
break;
} else if(Keyboard.keyCheck(KeyEvent.VK_LEFT)) {
s... |
db16ab2c-b1bc-43e3-8708-5f48da62747d | 1 | protected void btnAdicionarEnderecoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdicionarEnderecoActionPerformed
Endereco temp = new Endereco();
temp.setBairro(txtBairro.getText());
temp.setCep(txtCep.getText());
temp.setCidade(txtCidade.getText());
... |
c3be02f5-dbbf-4392-966f-3338cc4809f5 | 1 | @Override
protected Statement methodInvoker(FrameworkMethod method, Object test)
{
try {
return new JCheckStatement((Configuration) configuration.clone(),
classGenerators,
method, test);
}
catch (C... |
ad3c3a4e-fd77-4f88-acb7-7c363f89bedd | 4 | public void executeOnAllAccounts(Method action, BigInteger bonus) {
if (bonus.compareTo(BigInteger.ZERO) <= 0)
throw new IllegalArgumentException();
for (BankAccount account: getAllAccounts())
try {
action.invoke(account, bonus);
} catch (IllegalAccess... |
fbe53dff-e79e-4a19-a5c2-c393740e3874 | 8 | public boolean makeTurn(){
ArrayList<Player> winners = new ArrayList<Player>();
for (Player p : this.players) {
if (p.getTurn() == 1) this.displaySet();
int current_dice = this.dice.randomNumber();
System.out.println(p.getPseudo() + " is throwing a dice : " + current_dice);
p.goForward(current_dice);
... |
3d5bb60a-302d-4975-b155-36d5054b98b3 | 7 | public static char[] replaceSpacesInStr(char[] str, int true_length){
System.out.print("\"");
System.out.print(str);
SOP("\"");
SOP(true_length);
//first get pos of last char
//then we'll go through and figure out num spaces from start to last char
//if true_length != (last_char_pos+1) ... |
a59132b7-6ac6-4059-9bde-08511301cc4f | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj.getClass() != getClass()) {
return false;
}
Contact otherContact = (Contact) obj;
return new EqualsBuilder().append(firstName, otherContact.firstName).append(lastName, oth... |
d64d624b-7d76-4a1a-a8bc-b87654a12d99 | 7 | public void tick(Point point){
if(point != getLocation()){
double nx = (int)(point.getX() - x) * .04;
double ny = (int)(point.getY() - y) * .04;
if(y + ny >= 0 && y + ny <= maxY - height){
y += ny;
}
if(x + nx >= 0 && x + nx <= maxX -width){
x += nx;
}
this.setLocation(x, y);
}
if... |
15e62014-defb-43a7-8f32-da58b4693054 | 2 | protected boolean isDeprecated(String fieldKey) {
boolean isDeprecated = false;
for (Pattern deprecatedKey : deprecatedKeys) {
if (deprecatedKey.matcher(fieldKey).find()) {
isDeprecated = true;
break;
}
}
return isDeprecated;
} |
470cca5d-5eb9-4da8-b0dc-ee55516d2d72 | 3 | public static final String[] getLinesAndClose(Reader reader) throws IOException {
if(reader != null) {
try {
final BufferedReader input = new BufferedReader(reader);
ArrayList<String> lines = new ArrayList<String>();
while(true) {
String line = input.readLine();
if(line == null) {
brea... |
198dcfba-f6bd-4704-b92f-201ec122cb0f | 5 | private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
String s = (String) listaSecretari.getSelectedValue();
liceu.Administrator admin = new liceu.Administrator();
admin.delUser(s);
BufferedReader fisier;
try { ... |
2c151e17-c25a-4a23-ad0d-8155cc86dd9b | 7 | public JsonElement toJSON() {
JsonObject obj = new JsonObject();
String[] properties = new String[]{"prefix", "name", "title", "pagebreak", "notitle", "noheader", "wiki", "entrypicture"};
for(String prop: properties) {
try {
Field field = this.getClass().getDeclaredField(prop);
Object v1 = field.get(t... |
1f2ef3ec-58f3-476e-844f-75d6e05f66cf | 1 | public void initTableModel(JTable table, List<Client> list) {
//Формируем массив клиентов для модели таблицы
Object[][] clientArr = new Object[list.size()][table.getColumnCount()];
int i = 0;
for (Client client : list) {
//Создаем массив для клиента
Object[] row =... |
9a003cde-b5bf-46e6-a3d3-07d0610eceaf | 7 | public void getKeyPath(GraphList glf)
{
Stack<GraphPoint> s = TopologicalSort(glf);
Integer i;
for(i=0;i<ltv.length ;i++)
{
ltv[i] = etv[etv.length-1];
}
while(!s.isEmpty())
{
GraphPoint gp = s.pop();
EdgePoint e = gp.firstEdge;
while (e!=null)
{
int k = e.index;
if(l... |
c0ffc9b7-a3b4-4c35-b128-8a72196d11cb | 6 | @EventHandler
public void CaveSpiderPoison(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCaveSpiderConfig().getDouble("CaveSpi... |
f88d2d06-336a-4fd9-bcc7-545ba54ca45a | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
8c6caf6b-f425-48d6-b7a8-50f87163538e | 1 | private void onOpen(){
FileNameExtensionFilter filter = new FileNameExtensionFilter(".wav files", "wav", "mp3");
fileChooser.setFileFilter(filter);
if(fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){
File file = fileChooser.getSelectedFile();
controller.open(file);
}
} |
ab2369ce-c6e6-4ebf-b441-67d50b17b738 | 3 | public Paintimator() throws IOException, UnsupportedAudioFileException, LineUnavailableException{
super();
this.setLayout(new BorderLayout());
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setTitle(FRAME_TITLE);
//create a contentPane that can hold an image
contentPane = new Ba... |
32708702-07c3-40a4-8ae8-c4b7bbdb4509 | 1 | private void compute_pcm_samples5(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[5 + ... |
dd02b5ae-d1f7-4442-882d-2fc095a28c23 | 1 | public boolean isUpdating() {
return db != null && db.isForceEnabled();
} |
02f370db-be4c-49aa-8a74-220062f3c9d7 | 8 | public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7)
{
if (par3ItemStack != null &&
par3ItemStack.getItem() != null &&
par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlaye... |
81370037-558b-4dd8-b55c-9704a90b5145 | 8 | public void saveGame()
{
File file = new File("Saved_Games.txt");
FileWriter writer;
boolean flag = false;
ArrayList<String> data = new ArrayList<String>();
ListIterator<String> iterator;
String currentPuzzle = getCurrentPuzzle();
try
{
Scanner s = new Scanner(file);
while(s.hasNextLine())
{
... |
3ca1fcd0-3006-42a7-9c4e-8cac2a973877 | 7 | private String addSocialComponent(DialogState dialogState, String output) {
//String keyword = dialogState.getOutputKeyword();
JSONParser parser = new JSONParser();
boolean addBefore = true;
try {
//Location of sentences.json file
Object obj = parser.parse(new FileReader("resources/nlg/soc... |
b5e718fb-2f4a-4cfc-83cc-18a792358aee | 0 | public static void setMaxAge(int newMAX_AGE)
{
MAX_AGE = newMAX_AGE;
} |
bf619def-7620-4f04-8641-c48cb3484c43 | 6 | @Override
public int hashCode() {
int result = benchmarkClass != null ? benchmarkClass.hashCode() : 0;
result = 31 * result + (benchmarkMethod != null ? benchmarkMethod.hashCode() : 0);
result = 31 * result + (heapMemoryFootprint != null ? heapMemoryFootprint.hashCode() : 0);
result ... |
b1aeb506-5660-4c39-9c0f-10ded3ad4029 | 8 | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
DbfTable resultTable;
DbfViewer dbfViewer;
response.setCharacterEncoding("utf-8");
String file = request.getParameter("file");
String encoding;
int recordsOnPage = 0;
try{
... |
3c05922c-88ca-4b39-b9d2-467f156325cb | 6 | public static Stella_Object accessParametricTypeSpecifierSlotValue(ParametricTypeSpecifier self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_SPECIFIER_BASE_TYPE) {
if (setvalueP) {
self.specifierBaseType = ((Surrogate)(value));
}
else {
... |
03a32675-f378-4fad-af27-278d37d237da | 5 | @Override
public void setAge(int age) {
String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
/* save all arguments into an array */
Object[] args = new Object[]{age};
Class<?>[] argsType = new Class<?>[]{int.class};
try {
super.invokeMethod(methodName, args, argsType);
} cat... |
98dc2dfe-c025-46cf-8b1b-caa6a2a54546 | 2 | public double getDouble(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number
? ((Number)object).doubleValue()
: Double.parseDouble((String)object);
} catch (Exception e) {
throw new JSONEx... |
ff1d0c5f-6b8f-42bf-8cc3-6e0571f77699 | 3 | @Test
public void testOrdered()
{
// For reporting errors: an array of operations
ArrayList<String> operations = new ArrayList<String>();
// Add a bunch of values
for (int i = 0; i < 100; i++)
{
int rand = random.nextInt(1000);
ints.add(rand);
operations.add("ints.add("... |
291fb631-46d9-430c-bc92-bbc42552eab1 | 8 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == this) {
this.faceUp();
}
else {
// the faceUp() method has a delay so the user can see the card, then this code block executes
selfTimer.stop();
Game.getThis().TimerRunning = false;
// Keep track if Herobrine was revealed before ... |
896c83c2-b4d5-4b7a-8be5-aee64380427c | 7 | private void updateMinMax(Instance ex) {
Instances insts = ex.relationalValue(1);
for (int j = 0;j < m_Dimension; j++) {
if (insts.attribute(j).isNumeric()){
for(int k=0; k < insts.numInstances(); k++){
Instance ins = insts.instance(k);
if(!ins.isMissing(j)){
if (D... |
08431725-b2af-442f-860e-d7cdf43f5139 | 1 | public boolean hasNext() {
if (index < ballContainer.getCount()) {
return true;
} else {
return false;
}
} |
9e8880e9-0dbd-432d-b6d5-ce9e1dc04383 | 6 | public Result ValidarEdicionRol(Rol pRol)
{
StringBuilder sb = new StringBuilder();
sb.append((Common.IsMinorOrEqualsZero(pRol.getCodigoRol()))?".Código inválido\n":"");
sb.append((Common.IsNullOrEmpty(pRol.getNombreRol()))?".Nombre inválido\n":"");
sb.append((Common.IsN... |
188e897d-8a60-48c4-9150-e99872b2ad56 | 0 | @Test
public void testConnected() {
assertThat(uf.connected(0, 1), is(false));
} |
3e75fc48-39e8-4dcc-b644-608f1230f6bc | 0 | public void setSpeaker(final Speaker speaker) {
this.speaker = speaker;
} |
e5d86790-ab5e-4168-b8e9-b75ea9e8aeb2 | 9 | @Override
public void update() {
if (!isRegistered) {
isRegistered = true;
pathID = TDPanel.registerPath(MonsterPath.getPatrol(patrolRad, (Point2D.Double) loc.clone()));
}
if (isFailing())
return;
if (!isReloading()) {
Mob closestMob = super.nextMob();
if (closestMob != null) {
SoundEffect.B... |
8bd1453f-626a-4628-8c56-f439e87a50ff | 8 | public static double[][] rref(double[][] mat)
{
double[][] rref = new double[mat.length][mat[0].length];
/* Copy matrix */
for (int r = 0; r < rref.length; ++r)
{
for (int c = 0; c < rref[r].length; ++c)
{
rref[r][c] = mat[r][c];
}
}
for (int p = ... |
6a31b74c-ab13-4a65-99a6-731a80215abc | 4 | public void getInput(){
String userCommand;
Scanner inFile = new Scanner(System.in);
do {
this.display();
userCommand = inFile.nextLine();
userCommand = userCommand.trim().toUpperCase();
switch (userCommand) ... |
350ad200-35bd-46b4-94c8-74e9aa116813 | 7 | private Point[] drawSquare(Point center, double sideLength, Color color){
ArrayList<Point> changedPoints = new ArrayList<Point>();
int x = center.getX();
int y = center.getY();
if (sideLength == 0 && checkPointInBounds(center)){
board[x][y] = color;
Point[] singl... |
263a6aae-e7bc-4301-aafb-241adc9153de | 5 | public static double[] doLinearRegression(double[][] args) //input double[0]=array of day number
{ //input double[1]=array of prices
double[] answer = new double[3];
int n = 0;
double[] x = new dou... |
e6368b01-defb-46e7-a20c-71cdb8749c9f | 7 | @Override
public boolean okMessage(Environmental oking, CMMsg msg)
{
if((oking==null)||(!(oking instanceof MOB)))
return super.okMessage(oking,msg);
final MOB mob=(MOB)oking;
if(msg.amITarget(mob)
&&(((msg.sourceMajor()&CMMsg.MASK_MOVE)>0)||((msg.sourceMajor()&CMMsg.MASK_HANDS)>0)))
{
if(!msg.amI... |
57837c1e-0fca-47ef-9fd7-4a7cee8b995e | 0 | public Iterator<Land> iterator() {
return laenderMap.values().iterator();
} |
78315549-55ee-447d-afa8-78d8210e078d | 5 | public String[] getColumnStr(int colNum)
{
int nRows = 0;
int i = 0;
String[] ret;
if(colNum > 0){
try {
//get amount of rows
while(result.next()){
nRows ++;
}
//Check if there are more then 0 rows
if(nRows == 0)
return null;
ret = new String[nRows]; //create the Stringarra... |
7d6d0014-0dbb-4b88-8d3c-42aa392012b5 | 4 | public short[] assemble(Map<String, Integer> labelMap) {
int op = 0;
if (this.opcode.isExtended()) {
op |= (this.opcode.getCode() & 0x3f) << 4;
op |= (this.b.getRawValue() & 0x3f) << 10;
if (this.b.getSize() > 0) {
return new short[] { (short)op, this.b.getNumber(labelMap) };
} else {
r... |
832a3615-39b4-454d-9051-65d0077408fe | 2 | public Component getListCellRendererComponent(
JList list, Object value, int index,
boolean isSelected, boolean cellHasFocus)
{
super.getListCellRendererComponent(list, value, index,
isSelected, cellHasFocus);
if (value != null)
{
ComboBoxInterface it... |
b3e3018d-e6ec-4330-a900-89aee26354ec | 5 | public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer)value).intValue() + 1);
} else if (value instanceof Long) {
... |
c6a08915-d3cf-4b00-839b-360495daa8f2 | 7 | static private int jjMoveStringLiteralDfa10_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(8, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(9, active0, act... |
53015e91-3f07-402d-a858-4cab29ac83df | 2 | @Override
public void handleRequest(int request) {
if (request == 3) {
System.out.println("ConcreteHandlerC handleRequest " + request);
} else if (mSuccessor != null) {
mSuccessor.handleRequest(request);
}
} |
8116f5e0-a855-4fd3-a96d-df27c2773a0e | 3 | private int findIndex(Object item){
int keyPosition = 0;
for (int i = 0; i < numItems; i++) {
if (items[i] != null && items[i].equals(item)){
keyPosition=i;
}
}
return keyPosition;
} |
d54b3a9e-95f6-4c29-a59a-adb5473a1ded | 0 | public static void main(String[] args)
{
String fileName = args[0];
int numCoefficient = Integer.parseInt(args[1]);
// /*---------------Test DCT----------------*/
// imageReader _image = new imageReader(new File(fileName), 512, 512);
// _image.ImageSetNormalColor();
// ... |
0aa3c6d2-0ff8-4df8-bcde-1a761492cc5f | 2 | private void dataMiningForProtonPatterns(){
ProtonPatternDetector protonPatternDetector;
for(int startRow=0;startRow<get_rows()-protonPatternEncoder.getRows();startRow++){
for(int startColumn=0;startColumn<get_columns()-protonPatternEncoder.getColumns();startColumn++){
proton... |
e0167d4b-8885-4054-a430-46130157dc8d | 2 | protected void verifyPossibleDenotationalTerm(CycObject cycObject) throws IllegalArgumentException {
if (!(cycObject instanceof CycDenotationalTerm || cycObject instanceof CycList)) {
throw new IllegalArgumentException("cycObject must be a Cyc denotational term " + cycObject.cyclify());
}
} |
90b4315f-7916-481c-877b-d7c39d02f4a7 | 5 | @Override
public Event createEvent(Event event) {
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_INSERT_EVENT,
new String[] { "event_id" })... |
c3fa8d3c-d64c-4cf8-bd5a-2ce452bb2e05 | 9 | public static boolean isAnagramms(String str1, String str2){
if( str1 == null ){
return str2 == null ? true : false;
}
final int str1Length = str1.length();
final int str2Length = str2.length();
if( str1Length != str2Length ){
return false;
}
Map<Character, Integer> charsMap = new Ident... |
2e73e9a7-6a63-4e37-b12f-b777d087814d | 6 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
String command = cmd.getName();
if (command.equalsIgnoreCase("lteams")) {
return onLteamsCommand(sender, cmd, label, args);
}
else if (command.equalsIgnoreCase("leave")) {
return onLeaveCommand(sender, cmd, lab... |
7714fbd0-67e3-4336-af42-411ad8a65416 | 8 | public void addQuizPermutation(String title,int quizId,ArrayList<String> imageList, ArrayList<Boolean> imageInventoryList,ArrayList<String> soundList,
ArrayList<Boolean> soundInventoryList, int narration,
String paragraphList, String preNote, String postNote, String goTo, int points,
String date... |
7268ec6b-d73f-4787-be9c-10452438126e | 0 | private static void comparableExanple() {
NextGenericExample<Person> o = new NextGenericExample<>();
o.setInternal(new Person());
} |
e196d6df-313b-4a68-a460-c0d2483b1afa | 6 | @Override
protected Class<?> loadClass(String name, boolean resolve)
{
try {
if ("offset.sim.Player".equals(name) ||
"offset.sim.Point".equals(name) || "offset.sim.Pair".equals(name) ||"offset.sim.movePair".equals(name))
return parent.loadClass(name);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.