method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e086a5d6-b381-429b-bbab-7be68e53829e | 3 | private boolean isToken(HttpServletRequest request) {
HttpSession session = request.getSession();
String token_cline = request.getParameter("token");
if(token_cline == null){
return false;
}
String token_server = (String) session.getAttribute("token");
if(token_server==null){
return false;
}
... |
bff43ef2-1fcc-47ae-a8d0-8d313a9fd3e4 | 5 | public ParamsParse (String filePath) throws Exception {
// Инициализация объекта
db = new DBParams();
try {
// Откроем файл
File fXmlFile = new File(filePath);
// Подготовим парсер
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newIn... |
63597169-17a2-40a4-9b9a-1399f6bbc66a | 3 | public static List<UserTrend> constructTrendList(Response res) throws WeiboException {
try {
JSONArray list = res.asJSONArray();
int size = list.length();
List<UserTrend> trends = new ArrayList<UserTrend>(size);
for (int i = 0; i < size; i++) {
tre... |
1a99d2c2-7c6e-441a-ace5-6d1c20756c86 | 0 | public void setKey(String key) {
this.key = key;
} |
df92ce21-8d3c-41f3-9e21-b09f27dac05d | 7 | public void actionPerformed(ActionEvent e) {
if(e.getSource()==btnDmarrerSimulation){
new Thread(new Runnable() {
public void run() {
controleur.configurerSimulation(genererDonnees(),spinner.getValue().toString());
}
}).start();
}
else if(e.getSource()==btnEditerPosteur){
... |
596e8b27-e665-434f-b50a-f515df06937a | 6 | public void seCacher()
{
int nombreAtrouver, nombreDuJoueur = 100, nombreEssais = 0;
String nombreString;
nombreAtrouver = (int) (Math.random() * 50);
System.out.println("Pour vous cacher à temps, il faut que vous trouviez le nombre recherche en moins de 5 essais"
... |
d91bea9b-1606-40a1-9876-abfce8154437 | 0 | public Context(List tokens, int center, List[] results) {
this.tokens = tokens;
this.center = center;
this.results = results;
} |
d145efe4-7119-4106-b7f4-b282390d7a7c | 6 | public void edit(int index, String subject, String text, int priority) {
if(index<0 || index==this.size()) { // Reveals if the number exists
return;
}
boolean a;
for(int i = 0; i<this.size(); ++i) {
a = true;
for(int j = 0; j<this.size(); ++j) { // Makes the subject unique
if(subject.equals(get(j).... |
50644050-36b2-496d-90b8-a801a104ec0e | 5 | private void removeBrokenMTWCs(MTWData data) {
Set<Set<Tuple<Integer, Integer>>> set;
if (data.player == playerID) {
set = data.mTWCFP2;
} else {
set = data.mTWCFP1;
}
Iterator<Set<Tuple<Integer, Integer>>> combinations = set.it... |
5994b7c1-2234-46dc-ae77-5d7bc6c62347 | 1 | public void tableChanged(TableModelEvent e) {
try {
// get the index of the inserted row
// tableModel.getRowSet().moveToCurrentRow();
int firstIndex = e.getFirstRow();
// create a new table model with the new data
tableModel = new ProjectTableModel(tableModel.getList(),
tableModel.getEntityManag... |
685d8a50-badd-4f8b-910f-e50acd477679 | 2 | @Override
public Iterator<Integer> iterator()
{
ArrayList<Integer> nonNullProperties = new ArrayList<Integer>();
for (int x = 0; x < this.values.size(); x++)
{
if (values.get(x) != null)
{
nonNullProperties.add(x);
}
}
return nonNullProperties.iterator();
} |
2c3ccd98-de6a-4ff2-9c4b-d01b68da8bed | 2 | public static void main(String[] args) {
Collection<Integer> c = new ArrayList<Integer>();
for (int i = 0; i < 10; i++)
c.add(i); // Autoboxing
for (Integer i : c)
System.out.print(i + ", ");
} |
87723ae7-077e-473b-abe1-9430d68dd8ff | 9 | public boolean addItem(String description, String pwd){
String newItem;
String [] existDesc;
if(description.isEmpty() || description == null || description.length() < 1) return false;
// Create the XML tags and enclose the description and password separated
// by a comma.
... |
3aff0bc1-c6fb-4db4-b265-3db4cd293131 | 4 | public static boolean accept(AbstractSyntaxNode node, TokenReader reader)
{
boolean result = false;
final Term term = new Term();
if (Factor.accept(term, reader))
{
while (reader.accept(Token.TIMES) || reader.accept(Token.DIVIDE)
|| r... |
fca4ea36-0bf1-404d-a1e9-aa08348c370e | 6 | @Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
doAction(Action.MOVE_LEFT);
break;
case KeyEvent.VK_RIGHT:
doAction(Action.MOVE_RIGHT);
break;
case KeyEvent.VK_... |
20e613fe-a626-4c9d-9520-0859d1d14999 | 4 | * @return The double[] that the buffer has been converted into.
*/
private double[] bytesToDoubleArray(byte[] bufferData){
final int bytesRecorded = bufferData.length;
final int bytesPerSample = getAudioFormat().getSampleSizeInBits()/8;
final double amplification = 100.0; // choose a number as you like
... |
8cf33d61-3afc-4ca0-829f-0d76886c0d9e | 1 | public void transfer(int from, int to, double amount)
{
if (accounts[from] < amount) return;
System.out.print(Thread.currentThread());
accounts[from] -= amount;
System.out.printf(" %10.2f from %d to %d", amount, from, to);
accounts[to] += amount;
System.out.printf(" Total Balance:... |
280bb8ae-2e30-4656-bfd7-a52d5debb1d6 | 6 | @Override
public synchronized void execute(final Runnable r)
{
queue.offer(new Runnable() {
public void run()
{
runs = true;
try
{
r.run();
// to fire up the exception if there was one.
if( r instanceof SwingWorker )
((SwingWorker<?,?>)r).get();
} catch... |
7b7d0362-39dc-4467-a747-98f0793764af | 7 | private void create(String[] args) {
boolean clientOnlyMode = false;
boolean useAWT = false;
System.setErr(System.out);
SplashScreen splashScreen = new SplashScreen("/images/welcome.gif");
splashScreen.setVisible(true);
for (String arg : args) {
if (arg.equ... |
1727ac87-c0ef-4e04-bbf7-8e6bd663d5f5 | 3 | public void paintComponent( Graphics g )
{
super.paintComponent( g );
Graphics2D g2d = (Graphics2D) g;
for(int i =0; i < NUM; i++)
{
g2d.setColor( pelotas[i].col );
pelotas[i].draw(g2d);
}
g2d.setColor(Color.GRAY);
raqueta.dibuja(g2d);
g2d.setColor(Color.ORANGE... |
8e2a643a-2903-400a-b399-252a935ae250 | 4 | private static boolean isaffected( int[] cellrc, int[] arearc )
{
if( cellrc[0] < arearc[0] )
{
return false; // row above the first ref row?
}
if( cellrc[0] > arearc[2] )
{
return false; // row after the last ref row?
}
if( cellrc[1] < arearc[1] )
{
return false; // col before the first ref ... |
fbf0b648-5bc3-4e5c-adda-5816d8b83732 | 1 | public BufferedImage loadImage(String fnm) {
try {
BufferedImage im = ImageIO.read(ImageLoader.class.getResource(fnm));
//ImageIO.read(Art.class.getResource(fileName));
int transparency = im.getColorModel().getTransparency();
BufferedImage copy = gc.createCompati... |
d2b204d3-689a-46fa-8167-212f63617ec7 | 6 | public boolean AfegirRestriccioGrupSessio(String nomA, int grup, String dia, int hora) {
int d;
if ( dia.equals("dilluns") ) d = 0;
else if ( dia.equals("dimarts") ) d = 1;
else if ( dia.equals("dimecres") ) d = 2;
else if ( dia.equals("dijous") ) d = 3;
else if ( dia.equa... |
d3bcaad5-e4a0-4525-92aa-4a23cba85763 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Group other = (Group) obj;
if (idGroup != other.idGroup)
return false;
if (name == null) {
if (other.name != null)
return false;
} ... |
4c2ca1ae-75c7-4909-b3e8-1d9e9598c5cb | 0 | public String getCalle() {
return addressCompany.getCalle();
} |
ab5ec025-1e62-4694-80a3-532a362fe8ea | 3 | final public Link get() {
Link retVal = null;
String url = null;
try {
Memcached cache = Memcached.getInstance();
@SuppressWarnings("unchecked")
ArrayList<String> cacheValue = (ArrayList<String>) cache
.get("jPapayaUrlList");
while (cacheValue == null || cacheValue.size() < 3) {
cache... |
4204a0d2-5d1e-43b3-8892-da6593b10965 | 9 | public String match(String query, String fullLine){
int qTextLen = query.length();
int fLineLen = fullLine.length();
int[][] opt = new int [qTextLen + 1][fLineLen+1];
if(qTextLen == 0 || fLineLen == 0){
return null;
}
// Build the table
for (int i = qTextLen - 1; ... |
6ef1dc7f-40ab-4bd7-a5c9-4b88d0f87c6c | 8 | public void onReceive(Object msg) {
if (msg.equals("start")) {
// start by depositing enough money in the account to cover the
// txfrs
accountA.tell(new BankAccount.Deposit(taskCount * 100),
getSelf());
probe.tell("started", getSelf());
} else if (msg.equals(BankAccount.TransactionStatus.... |
948ad419-a2db-4eca-8ba9-5cb84353ebf8 | 5 | final public java.util.Map.Entry < FtanString, FtanValue > KeyValuePair() throws ParseException {
FtanString key;
FtanValue value;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SQ_STRING_START:
case DQ_STRING_START:
key = String();
break;
case NAME:
key = Name();
break;
de... |
0bb7a98d-36f8-43fb-91f7-614465379a2c | 8 | public void insertIntoPosition(HTreeNode node, int position){
/* Checks if node is null. */
if (node == null)
return;
/* Creates a new node from node; designates a null next() link. */
HTreeNode newNode = new HTreeNode(node);
/* The iterator node for the insertion. */
HTreeN... |
9dc6776b-4cd8-4a14-a32c-354d8b2a4c4d | 2 | private Vector getResultant() {
Vector resultant = new Vector(myUniverse.getDimension()); //TODO Bit of a hack here, consider cleaning
for(Vector element: forceList) {
try {
resultant = Vector.add(resultant,element);
} catch (DimensionMismatchException e) {
e.printStackTrace();
}
}
return resul... |
cbb53eaa-faca-40b3-b456-0b778d9617c3 | 3 | @Override
protected void updateAnimation() {
if (left || right) {
if (currentAction != 0) {
currentAction = 0;
getAnimation().setFrames(entityTexture);
getAnimation().setDelay(75);
}
}
getAnimation().update();
} |
979129b1-6697-48b1-8b93-c90095085604 | 0 | public NamePrinter(SharedObject counter) {
this.counter=counter;
} |
bb510f9b-3721-4c94-8240-14c1e34344e8 | 7 | public void mousePressed(MouseEvent e)
{
Point click = e.getPoint();
int xIndex = click.x/TILE;
int yIndex = click.y/TILE;
Tile clicked = campus.getTile(xIndex+screenX, yIndex+screenY);
System.out.println("Clicked: " + xIndex + "," + yIndex + ", Tile: " + clicked);
if (e.getButton() == Mous... |
5b7921f3-e473-4231-a11a-46e0ab1d0a92 | 5 | public void selectNone() {
expandMenu();
for(int i = 0; i < methodTree.getRowCount(); i++) {
TreePath path = methodTree.getPathForRow(i);
if(path == null) return;
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) path.getLastPathComponent();
if(tr... |
bc263b92-5206-4859-a291-c55cb1d1f03b | 3 | public int getOil(int size){
if (resource1==2){
if (size==1){
return sgenrate1;
}
else if (size==2){
return mgenrate1;
}
else {
return lgenrate1;
}
}
else{
return 0;
}
} |
c15c23e6-9948-474e-83b0-b2c9e60485e7 | 2 | public int getLevel() {
// Level not calculated yet?
if( level < 0 ) {
level = 0;
// Level = max(parent's level) + 1;
for( GoTerm parent : parents )
level = Math.max(level, parent.getLevel() + 1);
}
return level;
} |
495791f4-83e4-4e73-95c0-508e80e54dc7 | 7 | public static void sortMaps() {
mapPanels.clear();
maps.removeAll();
currentMaps.clear();
int counter = 0;
selectedMap = 0;
maps.repaint();
LaunchFrame.updateMapInstallLocs(new String[]{""});
mapInfo.setText("");
HashMap<Integer, List<Map>> sorted = new HashMap<Integer, List<Map>>();
sorted.put(0... |
82f62370-980a-46d8-b6ab-282b913bf75d | 0 | public String getSampleOutput() {
return this.sampleOutput;
} |
6a92f6a9-694f-4610-a105-e8afc736fa98 | 2 | private double normalisoi(double kulma){
if (kulma < 0){
return kulma + Math.PI*2;
} else if (kulma > Math.PI*2) {
return kulma - Math.PI*2;
} else {
return kulma;
}
} |
a0e5081c-244f-41ff-abc6-629055a2bc56 | 9 | public static void main(String[] args) throws Throwable{
StringBuilder sb = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int caso = 1;
for(String str1; (str1=in.readLine())!=null; caso++){
sb.append((caso<10?" ":"") + caso + ". ");
String str2 = in.readLin... |
796f130c-c1e8-4da0-94db-b52ed86dfa22 | 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... |
869797f0-08fd-4897-b4e7-fe4849fc3f2f | 4 | public void setConfigSize(Integer w, Integer h) {
if (w == null && h == null)
return;
if (w == null)
w = getSize().width;
if (h == null)
w = getSize().height;
setSize(w, h);
} |
713c6638-1700-4b04-9c72-d84bede5003a | 0 | public Target(String ip, int dv) {
this.ip = ip;
this.dv = dv;
} |
eaf2a707-8473-42c0-bdc1-a1af64a498f4 | 2 | public Iterator<Compound> col_wise() {
return new Iterator<Compound>() {
int y = 0;
int x = 0;
int idx = 0;
public boolean hasNext() {
if ((x == cols-1) && (y < rows-1)) {
x = 0;
}
... |
a4b320dc-4a7b-4643-ac11-974ed2278a30 | 1 | private static void putInput(Comparable[] a, String type)
{
try
{
SortHelper.class.getMethod("put" + type + "Input",
Comparable[].class).invoke(null, (Object) a);
}
catch (Exception e)
{
System.out.println(e + "\n" + e.getCause());
System.exit(1);
}
} |
9b2e1b5b-5650-475d-887a-97018214c98d | 8 | private void applyMovement() {
if (isGoLeft() && isCanLeft()) {
getGame().setxOffset(getGame().getxOffset() + getMovementSpeed());
}
if (isGoRight() && isCanRight()) {
getGame().setxOffset(getGame().getxOffset() - getMovementSpeed());
}
if (isGoUp() && isCanUp()) {
getGame().setyOffset(getGame().gety... |
e5cd9567-9475-4633-be0a-3a8b516a4d3b | 0 | public String getType() {
return "pda";
} |
173ab78f-1dd3-44ab-824e-3a785d34225f | 2 | @Override
public Boolean needScrolling(ViewEventArgs args){
Boolean needScrolling = false;
int totalHeight = 0;
for (Row row : this.document.getRows()){
totalHeight += row.getHeight();
}
if (totalHeight > args.getFrameHeight()){
needScrolling = true;
}
return needScrolling;
} |
2e8d33ad-e520-48c1-8e2a-56330d3c24c0 | 7 | public void generate_signals(Instruction current_instruction){
clear_signals();
switch(current_instruction.get_format()){
case 0:
set_reg_write(true);
break;
case 1:
set_reg_write(true);
set_mem_read(true);
set_mem_to_reg(true);
break;
case 2:
set_mem_write(true);
break;
case 3:
s... |
31a3d3c5-aa07-4323-8a8b-e8d77c1651a4 | 1 | private void peopleProjectComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int index = peopleProjectComboBox.getSelectedIndex();
if (index != -1) {
String projID = projectTableController.getTableM... |
b5b302a7-2680-409d-92be-94637b8c9adf | 8 | private void processGridlet(Sim_event ev, int type)
{
int gridletId = 0;
int userId = 0;
try
{
// if a sender using gridletXXX() methods
int data[] = (int[]) ev.get_data();
gridletId = data[0];
userId = data[1];
}
// i... |
c57012a8-7f49-4408-9b9d-a9849e85b630 | 7 | @Override
public void alreadyExists(User user) throws EntityAlreadyExistsException, UnablePerformDBOperation, CantGetDBConnection {
log.info("Searching user " + user.toString() + " in DB");
checkConnection();
String queryLogin = "select * from users where login = ? ";
String query... |
d3dfb552-5d8e-4ee0-8c41-8ab7c2721c25 | 7 | private void mode() {
Stopwatch.start();
Boolean moreThen0 = false;
Map<Integer, Integer> freqs = new HashMap<Integer, Integer>();
for (Integer val : _myBigArray) {
Integer freq = freqs.get(val);
if (freq == null) {
freq = 1;
} else {... |
22f70377-e76b-4ec6-9faa-1ff62f917281 | 6 | public List<Map<Double,Double>> getNormalDataSet(int saptak) {
List<Map<Double,Double>> dataList = new ArrayList<Map<Double,Double>>();
//DataSet Map
double maxTimeValue = 0;
Map<Double,Double> map = new LinkedHashMap<Double,Double>();
if (pointFramesMap != null) {
for(String _po... |
cc4d2331-6eee-4961-90df-822a9b18e1bb | 6 | public final void statement() throws RecognitionException {
ParserRuleReturnScope labelfield1 =null;
try {
// C:\\Users\\Shreeprabha\\Documents\\GitHub\\CecilRPi\\src\\org\\raspberrypi\\cecil\\model\\grammar\\Cecil.g:140:3: ( ( '.' labelfield )? mnemonicdata )
// C:\\Users\\Shreeprabha\\Documents\\GitHub\\Ce... |
b9fdbf7d-5e4c-47c7-b5f2-816e7d40fd95 | 1 | public Complex getElem(int ri, int ci) {
try {
return matrix[ri][ci];
} catch (Exception e) {
System.out.println("Invalid indices in getElem(int ri, int ci)");
e.printStackTrace();
}
return null;
} |
b803ee9f-8b7c-460d-a34c-a3c794ca0f72 | 3 | public static Graph<Vertex, Edge<Vertex>> FileToGraph(String dat, boolean directed) {
int[][] GArray = FileToGraphArray(dat);
int n = GArray[0][0];
int m = GArray[0][1];
Graph<Vertex, Edge<Vertex>> G = new Graph(n);
// Knoten hinzufuegen
for (int i = 0; i < n; i++) {
G.addVertex(new Verte... |
b63b0bcc-548c-44cf-bc0e-ca1c886f472b | 2 | public static void main(String args[])
{
In in = new In(args[0]);
int N = in.readInt();
UnionFindWQU qf = new UnionFindWQU(N);
while (!in.isEmpty())
{
int p = in.readInt();
int q = in.readInt();
if (qf.connected(p, q))
continue;
qf.union(p, q);
System.out.println(p + " " + q);
}
Syst... |
0475535a-f5fb-48af-992b-010c2f31b38f | 3 | private void butterflyStage(double[] from, double[] to, int numFftPoints, int currentDistance) {
int ndx1From;
int ndx2From;
int ndx1To;
int ndx2To;
int ndxWeightFft;
if (currentDistance > 0) {
int twiceCurrentDistance = 2 * currentDistance;
for ... |
c16bf415-8200-4c01-ad78-6aff67aaa526 | 9 | public void readCarvia(String tipo) throws IOException{
InputStream inputStream = null;
if (tipo.equals("UR"))
inputStream = new FileInputStream(Config.get("UrbanoSHPPath") + "/CARVIA/Carvia.DBF");
else if (tipo.equals("RU"))
inputStream = new FileInputStream(Config.get("RusticoSHPPath") + "/CARVIA/Carvia.... |
cc5bdf5b-7249-4801-af99-c6c3503f2dd4 | 6 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Random rand = new Random();
// The default ranges
int[][] ranges = {{0,10}, {0,100}, {0,500}, {0,1000}};
try {
do {
int[] range = getRange(scan, ranges);
in... |
9f831649-6a9e-42bd-837e-4978fc25e888 | 0 | public List<Park> getParkList() {
List<Park> list = new ArrayList<Park>();
list.addAll(this.parkList);
return list;
} |
ff995590-3967-4cc3-8fd2-dd63bf8e94ac | 1 | public void process() {
for (int i = 0; i < 1000; i++) {
stageOne();
stageTwo();
}
} |
a3209cd7-620f-46a7-8de9-e45c58d18289 | 8 | public static Double calcLogSumOfLogs(Double logX, Double logY) {
if (logX == null && logY == null) {
return null;
} else if (logX == null) {
return logY;
} else if (logY == null) {
return logX;
}
if (logX >= 0 || logY >= 0) {
double x = Math.pow(2, logX);
double y = Math.pow(2, logY);
d... |
0a0c1189-829e-460d-b315-2f2aa0018886 | 2 | public void setFocused(Configuration configuration) {
ConfigurationButton button = (ConfigurationButton) configurationToButtonMap
.get(configuration);
if (button == null)
return;
if (button.state == ConfigurationButton.NORMAL) {
//System.out.println("Setting color");
button.setState(ConfigurationButt... |
164a1a53-c12d-4084-8877-49b2bed03dc6 | 5 | private void drainOutput() {
try {
LOGGER.debug("Draining Output");
if ((readyOps & SelectionKey.OP_WRITE) != 0) {
Message msg;
while ((msg = outQueue.poll()) != null) {
LOGGER.debug("Sending message " + msg.toString());
ByteBuffer buffer = msg.toByteBuffer();
channel.write(buffer);
}... |
ad144528-8fc5-46f7-bb0a-1f7e9c2fde44 | 2 | public FriendsList() {
loaded = false; //it's currently not loaded
lastMessage = new Date(Calendar.getInstance().getTimeInMillis());
//create friends list
friendsList = new JFrame();
//menubar for exit and information
menubar = new JMenuBar();
icon = new Image... |
92b2315e-f9eb-4488-b05e-b81e320cda57 | 6 | public RoundLcdClock() {
hColor = new SimpleObjectProperty<>(this, "hourColor", Color.BLACK);
mColor = new SimpleObjectProperty<>(this, "minuteColor", Color.rgb(0, 0, 0, 0.5));
m5Color = new SimpleObjectProperty<>(this, "5MinuteColor", Color.BLACK);
sColor = ne... |
e0f02023-9b9a-43d9-a122-e25b01d55cdc | 3 | public static List fromArray(Object[] array) {
if ((array == null) || (array.length == 0)) {
return new ArrayList();
}
List list = new ArrayList(array.length);
for (int i = 0; i < array.length; i++) {
list.add(array[i]);
}
return list;
} |
61044e49-468c-4a65-9782-e94fc6382099 | 8 | final public void WhileExp() throws ParseException {/*@bgen(jjtree) WhileExp */
SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTWHILEEXP);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
jj_consume_token(WHILE);
Expression();
jj_consume_token(DO);
Expression... |
cad0e9f3-3694-42ce-963c-b47b7cd72456 | 5 | public void ThreateningScore(Board b) {
char c;
if (color == 'W')
c = 'B';
else
c = 'W';
int score = 0;
int best = -10;
System.out.println(c);
checkThreats(b, c);
printThreats();
for (int i = 0; i < numThreatened; i++) {
score = toInt(threatened[i]);
if (isThreatened(locThreatening[i])) {... |
5c950c8d-83af-49b9-8c2f-490e54fb6516 | 4 | @Override
public void compileClicked(ArrayList<ArrayList<String>> code) {
if(checkCorrectInput(code)) {
model.compile(new Program(code));
this.setViewOutput();
if(model.isCompileSuccess()){
view.setButtonsEnabled(model.isCompileSuccess());
if(sendToIO)
for(int i = 0; i < 10; i++)
opin.... |
7030920f-5220-4397-ba52-23887c3895c3 | 3 | public int getMaxPacketSize ()
{
int field = getU16 (4);
int size = field & 0x3ff;
String type = getType ();
boolean highspeed = iface.getDevice ().getSpeed () == "high";
// "high bandwidth" mode may use multiple packets per microframe
if (highspeed && (type == "iso" || type == "interrupt"))
size *= 1 + (f... |
b2fd84e3-3173-4772-82b2-588927d99e8e | 1 | public void visitNewArrayExpr(final NewArrayExpr expr) {
print("new " + expr.elementType() + "[");
if (expr.size() != null) {
expr.size().visit(this);
}
print("]");
} |
7c7253e2-9301-4a17-be98-e5dad85bd443 | 3 | public SearchedTrainListFrame(Title myTitle, TrainSchedule TS, String searchTerm) throws IOException {
setBackground(new Color(173, 216, 230));
setLayout(null);
//===================================== THIS SHOULD TAKE THE OUTPUT FROM THE SEARCH METHOD INSTEAD OF AN IMAGE ==========================
JTable ... |
92d28cf6-942a-45f6-9c4e-c48ead8293d3 | 5 | public static void moveSubArray(int[] arr, int from, int to, int offset){
int iters=0;
if(from>to){
iters=((arr.length-from)+to)+1;
} else {
iters=(to-from)+1;
}
if(offset==1){
int previous=circleIncrement(to, arr.length);
for(int i=0;i<iters;i++){
swap(arr,to,previous);
previous=to;
t... |
5b199b24-df2c-4a67-b339-6a5127e6f753 | 8 | protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
// if (!AbstractLookAndFeel.getTheme().isDarkTexture()) {
// super.paintBackground(g, c, x, y, w, h);
// return;
// }
JMenuItem b = (JMenuItem) c;
ButtonModel model = b.getModel();
... |
8a405809-533d-4ebe-9ae9-3457eb274f9c | 8 | final public void Insert() throws ParseException {
/*@bgen(jjtree) Insert */
ASTInsert jjtn000 = new ASTInsert(JJTINSERT);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(INSERT);
jj_consume_token(INTO);
... |
f88acd12-b3bb-4f6d-94c3-0cb86f7e0214 | 6 | public Boolean find(int[] arrA, int x, int y) {
int range = y - x;
for (int i = 0; i < arrA.length; i++) {
if (arrA[i] >= x && arrA[i] <= y) {
int z = arrA[i] - x;
if (arrA[z] > 0) {
arrA[z] = arrA[z] * -1;
}
}
}
// for(int i=0;i<arrA.length;i++){
// System.out.print(" " + arrA[i]);
... |
0c25e702-d348-48ec-a084-a02a31ca5f76 | 4 | public void saveSongs(List<String> songLinkList, SongParserForOneGenre songParser) {
if (songParser != null) {
for (String songLink : songLinkList) {
if (!DataUtils.isEmpty(songLink)) {
try {
songParser.pasrePage(songLink);
... |
4ffe504c-ab85-46f2-a2c7-3a4b24c2d9be | 3 | public static void initWindowGL(int width, int height, String title)
{
try
{
Display.setTitle(title);
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
}
catch (LWJGLException e)
{
e.printStackTrace();
... |
4f1a9603-5ede-4691-b71f-bd4955463b16 | 1 | public JSONObject optJSONObject(String key) {
Object object = this.opt(key);
return object instanceof JSONObject ? (JSONObject)object : null;
} |
f3ade82c-0847-4349-9810-f79ebe75ed98 | 2 | private void updateGame()
{
// If no current block, generate new one
if (gameBoard.getCurrentBlock() == null)
{
gameBoard.completeRows();
gameBoard.newBlock();
gameBoard.setRow(0);
gameBoard.setCol(4);
if(gameBoard.isValidMove(Direction.DOWN) == false)
{
isRunning = false;
}
... |
8c64cfeb-e5ac-4fcc-928c-24d8a7d528b7 | 6 | private void handleCheck( CommandSender sender, String label, String[] args)
{
Collection<GroupSettings> allGroups = mPlugin.getGroups(true);
LinkedList<GroupSettings> matching = new LinkedList<GroupSettings>();
for(int i = 0; i < args.length; ++i)
{
boolean found = false;
for(GroupSettings group : al... |
c0b71b74-214c-435e-9832-bb3af211f1eb | 3 | private void formatClassFeatures(StringBuilder formatted, List<String> features) {
if (!features.isEmpty()) {
formatted.append("\\n|");
boolean first = true;
for (String feature : features) {
if (first) {
first = false;
}
... |
eeb5cbc9-6a45-4987-9476-fff1ffa50722 | 5 | direction NNIEdgeTest(edge e, double[][] A, double[] weight, int wIndex )
{
int a,b,c,d;
edge f;
double[] lambda;
double D_LR, D_LU, D_LD, D_RD, D_RU, D_DU;
double w1,w2,w0;
if ( e.tail.leaf() || e.head.leaf() )
return direction.NONE;
lambda = new double[3];;
a = e.tail.parentEdge.topsize;
f =... |
ef450e60-4413-4756-82af-b73137ca8ba0 | 7 | public static void main(String []args) throws ParseException, IOException, WrongArgumentException
{
CommandLineParser parser = new PosixParser();
Options options = new Options();
HelpFormatter f = new HelpFormatter();
options.addOption("h",false,"Print The help infomation");
options.addOption("s", true, "Chunk S... |
3fb62a61-a0d0-44cf-8cef-884ec8882b33 | 4 | public BlockFace faceFromYaw(int yaw){
int cYaw = cardinalYaw(yaw);
switch (cYaw){
case 0: return BlockFace.SOUTH;
case 90: return BlockFace.WEST;
case 180: return BlockFace.NORTH;
case 270: return BlockFace.EAST;
default : return BlockFace.SOUTH;
}
} |
3bab1883-df7d-4d68-9778-13463dada6c8 | 2 | public void selectMode()
{
String[] modes = {"Play New Game", "Load Saved Game/Level", "Open Level Creator"};
String mode = (String)JOptionPane.showInputDialog(
null,
"Select mode:\n",
"Kraft Dinner Table Game",
JOptionPane.QUEST... |
d6607df9-cc65-4350-9bfc-59ab1592bd8e | 3 | protected void populateButtons()
{
int month = lMonths.getSelectedIndex();
int year = lYears.getSelectedIndex() + mStartYear;
GregorianCalendar gc = new GregorianCalendar(year, month, 1);
// Get which day of week is the first day of the month
int firstDay = gc.get(Calendar.DAY_OF_WEEK) - 1;
// System.ou... |
9d53fa1c-3088-48be-b643-c93a97f18027 | 4 | @Override
public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attrs, int pos) {
logger.info("SimpleTag: " + tag);
HTMLComponent comp = null;
for (HTML.Tag t : wantedSimpleTags) {
if (t == tag) {
comp = HTMLComponentFactory.create(tag, attrs);
break;
}
}
if (comp == null && !totall... |
4a920b36-8caa-4c3f-be65-2d2ade3fe6e3 | 1 | public void load() {
if (!new File(plugin.getDataFolder(), "config.yml").exists()) {
plugin.saveDefaultConfig();
}
configLoader = (YamlConfiguration) plugin.getConfig();
} |
846474c0-1825-4e29-b117-59b87fb7a9c7 | 7 | public boolean validate () {
// check primes.
BigInteger mm = p.multiply(q);
if (!mm.equals (m))
return false;
BigInteger pm1 = p.subtract (BigInteger.ONE);
BigInteger qm1 = q.subtract (BigInteger.ONE);
BigInteger r = pm1.multiply(qm1).divide(pm1.gcd(qm1));
// check public expo... |
403bdbd7-32a5-42dc-ab4c-18c8b1a47cd0 | 6 | @Override
public void render(RenderContext renderContext) {
// System.out.println(getCurrentMatrix().toString());
glMatrixMode(GL_PROJECTION);
glLoadMatrix(toFloatBuffer(renderContext.getCamera().getProjection(getViewport().getSize()).m));
glMatrixMode(GL_MODELVIEW);
glLoadMatrix(toFloatBuffer(renderContex... |
6442f2a0-753f-466f-88a2-998c3b418ee7 | 2 | private void saveAs_buildPropButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAs_buildPropButtonActionPerformed
JFileChooser buildChooser = new JFileChooser();
buildChooser.setDialogTitle(parser.parse("buildProp:saveAs_title"));
buildChooser.setApproveButtonText(parse... |
cc34457c-7235-43b3-ad4d-39775200876a | 7 | @Override
protected TreeNode<K,V> delete(TreeNode<K,V> deleteNode) {
TreeNode<K,V> spliceNode = null; // either replacement or deleted !
//case 1, 2
if (deleteNode.left == null || deleteNode.right == null){
spliceNode = deleteNode;
} else //case 3
spliceNode ... |
8251d8bf-27cc-48a5-b652-cc62ba1a34f3 | 9 | public int insertarTipoMovimiento(String codigo, String descripcion, String accion, String estado) {
if(codigo.trim().length()==3 && descripcion.trim().length()>0 && descripcion.trim().length()<=40
&& accion.trim().length()>0 && accion.trim().length()<=10 &&
estado.trim().length(... |
a554ce9c-3eaa-4053-b611-758d9f3e93bb | 4 | @SuppressWarnings({ "rawtypes", "unchecked" })
public PersonRegister() {
setBounds(7, 55, 1290, 600);
setResizable(false);
setModal(true);
setLocationRelativeTo(null);
// dim = super.,getToolkit().getScreenSize();
// super.setSize(dim);
// setLocationRelativeTo(null);
getContentPane().setLayout(new Bor... |
992fed05-e4e9-433f-b69a-117749da7e41 | 2 | private static String makeUrl(String filename) throws MalformedURLException {
final String url;
if (filename.indexOf("://") > 0 || filename.startsWith("file:")) {
url = filename;
} else {
url = new File(filename).toURI().toString();
}
return url;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.