method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d7500bc9-6155-427f-bbb2-791db318c36e | 7 | private String scanBlockScalarIgnoredLine(Mark startMark) {
// See the specification for details.
int ff = 0;
while (reader.peek(ff) == ' ') {
ff++;
}
if (ff > 0) {
reader.forward(ff);
}
if (reader.peek() == '#') {
ff = 0;
... |
72918eae-65a4-4db6-b4d5-d96807f376be | 1 | private void refreshDevices_settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshDevices_settingsButtonActionPerformed
if (debug)
logger.log(Level.DEBUG, "Setting preference \"refreshDevices\" from " + settings.refreshDevices() + " to " + refreshDevices_settingsBut... |
fcf85b4b-d2eb-4d98-9ace-b49d65f04551 | 2 | @Override
public void execute(DebuggerVirtualMachine dvm) {
for (Map.Entry<String, Integer> e : variablesWithNewValues.entrySet()) {
dvm.pushRunTimeStack(e.getValue());
dvm.storeRunTimeStack(variablesWithOffsets.get(e.getKey()));
}
for (int offset : variablesWithOffse... |
ec8bd8a9-df9a-421d-9c55-190af50e1b5a | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ActionTypeAndLocation other = (ActionTypeAndLocation) obj;
if (actionType == null) {
if (other.actionType != null)
return false;
} else ... |
42f16da5-2fb7-4b23-a2c9-8a67b906cfaa | 8 | private void ReadVideo(String fileName, int primary) throws FileNotFoundException, IOException{
byte[] videoFile;
byte r, g, b;
System.out.println(fileName);
File file = new File(fileName);
InputStream is = new FileInputStream(file);
int offset ... |
df3b1002-f415-45bc-91ec-d12f02d366ba | 2 | public boolean init(String args[])
{
app_instance = this;
String fpath = parseArgs(args);
frame = new JFrame();
// get the static parameters
os_type = getOSType();
settings = new Settings();
settings.load();
/*
// set the application icon
final String[] icon_nam... |
e8b39df0-16c3-450d-beb0-a5237fa2f0fc | 5 | public String leerLinea(int linea, String archivo){
try {
String sCurrentLine;
this.br = new BufferedReader(new FileReader(Carpeta.combinarPath(this.rootFolder, archivo)));
int i = 1;
while((sCurrentLine = br.readLine()) != null) {
... |
78ec4c34-eb32-4851-bbfc-76aa70a50da4 | 5 | public BTURL(String loc, String ...params) throws Exception {
if((params.length % 2) != 0) {
throw new Exception("Parameters should be key, value array, length is not divisible by 2");
}
String p = "";
if(params.length > 0) {
p += "?";
for (int i = 0; i < params.length; i += 2) {
if(params[i+... |
95a465e8-9b08-4baf-a929-8ac8f5611945 | 9 | public String[] getColumnsNames(String columnType)
{
String[] data = null;
if(columnType.equalsIgnoreCase("auto makers"))
{
String[] name = {"Auto Makers"};
data = name;
}
else if(columnType.equalsIgnoreCase("model"))
{
String[] nam... |
bc7fb0fe-d02c-4de2-a579-b03559a56629 | 5 | public static void main(String[] args){
long a = 600851475143L;
boolean newF = true;
long max = 0;
while(newF){
newF = false;
for (int i=2;i<a;i++){
if (a % i == 0){
newF = true;
a /= i;
if (i>max) max = i;
}
}
}
if (a > max) max = a;
System.out.println(max);
} |
34cae730-0732-40c8-94c9-b303b6ec4271 | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof XYAreaRenderer)) {
return false;
}
XYAreaRenderer that = (XYAreaRenderer) obj;
if (this.plotArea != that.plotArea) {
return false;
... |
033b81b7-8b27-40ef-9fde-c05b6e9dc215 | 7 | public int nbytesPerImage(){
try{
if(isValid(_validStatus)){
// time bytes
int n = 24;
if(applicationTemplate.equals("Fullframe + clear") || applicationTemplate.equals("Fullframe, no clear")){
n += 12*(512/xbin)*(1024/ybin);
}else if(applicationTemplate.equals("Fullframe with overscan") ... |
c4be661a-41fb-40ef-b47a-62afae3823e0 | 8 | @Override
public boolean onCommand(CommandSender cs, Command cmnd, String string, String[] strings) {
LocalPlayer player = plugin.getWorldEditPlugin().wrapCommandSender(cs);
try{
CommandHandler cmdHandler = new CommandHandler(strings);
Method subCommand = this.plugin.getSubC... |
018c2019-62e7-46fa-a7db-1fe719383d51 | 5 | int time_seek(float seconds) {
// translate time to PCM position and call pcm_seek
int link = -1;
long pcm_total = pcm_total(-1);
float time_total = time_total(-1);
if (!seekable) {
return (-1); // don't dump machine if we can't seek
}
if (seconds < ... |
d5492837-d53f-4df5-a88e-3f620f32828b | 8 | public PrimitiveOperator combineRightNLeftOnLeft(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
// the other gate is on the left side - on the MSB
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 4 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[2]) ? 4 : 0... |
63bc7268-fe77-4406-9926-b10b660c53e4 | 6 | private boolean r_main_suffix() {
int among_var;
int v_1;
int v_2;
// (, line 40
// setlimit, line 41
v_1 = limit - cursor;
// tomark, line 41
if (cursor < I_p1)
{
... |
6a4e25ce-dcd6-4ad8-aa76-bd09c1a3d032 | 5 | @Override
public void actionPerformed(ActionEvent arg0) {
// Verif base de donnee LOGIN ET MDP
// ETUDIANT etudiant = UTILISATEUR(BASE DE DONNEE)....
if (arg0.getSource() == valider) {
if(estInscrit(loginText.getText(), mdpText.getPassword())){
System.out.println("OK");
JoueurDIXIT j = null;
// modi... |
00fe90eb-c7e2-4806-86cb-93d853d2d6df | 8 | public QRDecomposition(Matrix A) {
// Initialize.
QR = A.getArrayCopy();
m = A.getRowDimension();
n = A.getColumnDimension();
Rdiag = new double[n];
// Main loop.
for (int k = 0; k < n; k++) {
// Compute 2-norm of k-th column without under/overflow.
double nrm = 0;
for (in... |
ca3fc8cb-26e5-4bf6-9327-c0fe027cdca5 | 8 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if((affected instanceof MOB)
&&(!msg.amISource((MOB)affected))
&&(msg.tool() instanceof Ability)
&&(msg.tool().ID().equals("Fighter_SmokeSignals"))
&&(msg.sourceMinor()==CMMsg.NO_EFFECT)
&&(msg.targetMinor()==CMMsg.NO_EFFECT)
... |
470ad96c-13f6-476d-99c5-26c77986b75b | 3 | public final void removeBlock() {
if (outer instanceof SequentialBlock) {
if (outer.getSubBlocks()[1] == this) {
if (jump != null)
outer.getSubBlocks()[0].moveJump(jump);
outer.getSubBlocks()[0].replace(outer);
} else
outer.getSubBlocks()[1].replace(outer);
return;
}
EmptyBlock eb = ne... |
2a89aff8-d5ac-4179-9fd3-3112982ac698 | 4 | @Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
if (currentSelection != null)
{
g2d.setColor(CURRENT_COLOR);
currentSelection.draw(g2d);
}
g2d.setColor(showingSolutions ? SOLUTIONS_COLOR : FIXED_COLOR);
for (Selection s : showingSol... |
1f96a819-6b58-4222-a37c-e9f6adbca120 | 8 | private void fisher(String conceptId, HashMap conceptDictionary, HashMap a, HashMap g, HashMap e, HashMap i, boolean isPrivate) throws SQLException
{
String compareConceptId = "";
String compareDictionaryId = "";
String query = sql.getString("insertFisherStats");
// Local variable declaration
// *******... |
a940c5ed-e52b-419d-aac2-6c8aad0efd20 | 3 | private int getUnvisitedChildNode(int node) {
// more simple logic, but in list_adj now more iterations to check
int result = -1;
for (int i = 0; i < N; i++)
if (isAdjacency(node, i) && !isVisited[i]) {
return i;
}
return result;
} |
fec5e68d-1852-43fe-8b90-8e27edb6d494 | 6 | public static void initDBFactory(String environment, String db) throws Exception{
if (db.equals("Projects")){
try{
String resource = "com/cds/mybatis/mybatis-config-projects.xml";
Reader reader = Resources.getResourceAsReader(resource);
if (sqlPro... |
4841909c-3e31-467a-9e00-4b251a94d541 | 1 | @Override
public void initGraphicalInterface() {
setBounds(100, 100, 640, 480);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
panel.setBounds(10, 10, 32*16, 32*9);
contentPane.add(panel);
addObject.setBounds(... |
47c0076d-457d-4619-abcb-799183254943 | 8 | private DataSet ReduceRedundantData(DataSet dataset){
DataSet ReducedSet = new DataSet("ReducedSet");
int c=0,h=0;
int superCount=0;
int count=0;
for(DataRow datarow : dataset.Rows()){
if(ReducedSet.Rows().getCount() < 1 ){
... |
1583e549-8e5f-4e72-a585-f9294eeaecfa | 9 | @Override
public void update() {
int xa = 0;
int ya = 0;
if (input.up.isPressed()) {
ya--;
}
if (input.down.isPressed()) {
ya++;
}
if (input.left.isPressed()) {
xa--;
}
if (input.right.isPressed()) {
xa++;
}
if (xa != 0 || ya != 0) {
move(xa, ya);
isMoving = true;
} else {
... |
6c49cbfc-e489-45d9-949a-422cd49e5557 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
f4e73348-e399-480f-a9a0-75290c2acfaf | 9 | protected int[] getWinners(String[] hands)
{
int j, k, compare_result, nr_winners = this.nrPlayers;
boolean[] eliminated = new boolean[this.nrPlayers];
int[] winners;
for (j = 0; j < this.nrPlayers; ++j) {
eliminated[j] = false;
}
for (j = 0; j < this.nr... |
4cd3495f-4a71-43c7-8ae8-a327cd4899d0 | 9 | @Override
public void draw(Graphics2D g) {
g.drawImage(gui.getSubimage(0, 0, 125, 90), GamePanel.WIDTH/2 - 150/2, GamePanel.HEIGHT/2 - 75/2 ,null);
for(int slot = 0; slot < player.getInventory().getItems().length; slot++){
ItemStack i = player.getStackInSlot(slot);
if(i != null){
int x = slot < 5 ? (c... |
007eeb78-6c34-4486-bd8b-5fa2af480d48 | 5 | public static boolean isEnabled()
throws JSONException, IOException {
future = Deserializer.readJsonObjectFromURL("http://" + IP
+ ":" + PORT + "/wm/firewall/module/status/json");
try {
obj = (JSONObject) future.get(5, TimeUnit.SECONDS);
} catch (InterruptedException e1) {
// TODO Auto-generated cat... |
fb576839-5c50-421b-90a8-8292aedc6f22 | 4 | public void storeClasses() {
if (destDir.endsWith(".jar") || destDir.endsWith(".zip")) {
try {
ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(
destDir));
basePackage.storeClasses(zip);
zip.close();
} catch (IOException ex) {
GlobalOptions.err.println("Can't write zip file: ... |
5271ee3f-9136-4d8e-98b4-0ea37982315d | 9 | public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_F1) {
if (Main.debug == false) {
Main.debug = true;
} else {
Main.debug = false;
}
}
if (key == KeyEvent.VK_W) {
up = true;
}
if (key == KeyEvent.VK_A) {
left = true;
}
if (key == KeyEvent.VK_S) ... |
ebd2029e-ccdf-4fd9-854b-473ff81d1e87 | 6 | public void mapreduce(Mapper map, Reducer reduce,
int numReduceQs, int numSetupNodes, Reducer combiner) {
this.numReduceQs = numReduceQs; // TODO, move it into the constructor??
SimpleQueue masterReduceQueue = queueManager.getQueue(getReduceQueueName(jobID), false, 1, QueueManager.QueueType.MASTERREDUCE... |
ece42e87-0085-4a53-bf25-3629005d0fde | 1 | public boolean saveScreenshot(BufferedImage screenshot, long seconds) {
try {
String outputFilename = String.format(
"%s/%s_%s.png",
outputDirectory,
filePrefix,
seconds
);
// Dump file to disc
Image... |
865813d4-9429-41fe-acb4-cf5cddd07124 | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In monopoly handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
exchange.getResponseHeaders().set("Content-Type", "appliction/json");
try {
//TODO veri... |
c7c0f4cf-bd08-4f35-abba-d629282da5e0 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Amistad)) {
return false;
}
Amistad other = (Amistad) object;
if ((this.id == null && other.id != null) || (thi... |
075de257-4626-4600-aacc-9d239cc69c71 | 9 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
// Entering a sub-command without parameters is assumed to be a request
// for information. So display some detailed help.
if (args.length == 0) {
sender.sendMessage(plugin.t... |
a17d4e2c-249f-4217-8e11-883567333f53 | 1 | public Element toElement(Seance seance) {
Element seanceElement = new Element("seance");
try {
seanceElement.setAttribute("startDateTime", new SimpleDateFormat(XML_DATE_FORMAT).format(seance.getStartDateTime().getTime()));
seanceElement.addContent(new MovieTranslator().toElement(seance.getMovie()));... |
b5428756-4bc4-468e-89ed-28ff35391478 | 0 | private void controlsStructLength(){
final int MIN_DIAPASON = 0; /*Minimum value of slider position */
final int MAX_DIAPASON = 10000000; /*Maximum value of slider position */
final int KIT_OF_ELEMENTS_HEIGHT = 300; /*Height of joined graphical components*/
... |
f4f115cd-5046-44db-b564-c44814b5aac9 | 7 | public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
int alength = getLength(headA);
int blength = getLength(headB);
if (alength > blength) {
for (int i = 0; i < alength - blength; i++) {
headA = headA.next;
}
} else if (blength > alength) {
for (int i = 0; i < blength - alength; i... |
cfabf190-4ed0-4ffb-bef5-e6516f4274c9 | 6 | public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
this.req = request;
this.resp = response;
initialize();
resp.getWriter()
.println(
"<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />");
if (nameArray[1] == null || nameArray[2... |
1ac2132c-f054-4422-a78b-290ea2c31f3e | 9 | public static Class<? extends Message> getMessageClass(int code) {
if (isRequest(code)) {
switch (code) {
case METHOD_GET:
return GETRequest.class;
case METHOD_POST:
return POSTRequest.class;
case METHOD_PUT:
return PUTRequest.class;
case METHOD_DELETE:
return DELETERequest.class;
... |
a80f1440-466e-42ca-afd6-87623a66c3b5 | 2 | @Override
public void pack() {
int n, i=0, h = 0;
synchronized (TimerController.getInstance().timers){
n = TimerController.getInstance().timers.size();
}
n = (int) Math.ceil(Math.sqrt((double)n/3));
for(Widget wdg = child; wdg != null; wdg = wdg.next) {
if(!(wdg instanceof TimerWdg))
continue;
... |
a229fc8e-a321-459c-a98c-97e21c2cd072 | 8 | public static String urlEncode(String baseUrl, Map<String, String> parameters, boolean utf8Encode) {
if (parameters != null && parameters.size() > 0) {
StringBuilder paramBuilder = new StringBuilder();
for (Map.Entry<String, String> entry : parameters.entrySet()) {
Strin... |
26a5fe1b-276c-4694-9db0-351ef8fe9bd4 | 1 | @Override
public Answer getRightAnswer() {
return isKeyword ? YesAnswer.getInstance() : NoAnswer.getInstance();
} |
36be3389-4012-4288-9231-02a5466b1490 | 3 | public static Calendar getLastBackupDate() {
final Calendar backupDate = Calendar.getInstance();
backupDate.setTimeInMillis(0); // Default value
final String dateString = Controller.getProperty(ApplicationProperties.LAST_BACKUP_DATE);
if (dateString == null || "".equals(dateString)) {
return null;
}
... |
c40ac0d8-8245-4970-9ee3-ba587c13f8d1 | 8 | @Override
public String toString()
{
StringBuilder sb = new StringBuilder(80);
sb.append("Dest=");
if (pthnam != null) {
sb.append(pthnam);
} else if (strm == System.out) {
sb.append("stdout");
} else if (strm == System.err) {
sb.append("stderr");
} else if (strm == null) {
sb.append("SINK");
... |
7712ef07-3f53-42f6-a43c-6bfed3f40727 | 6 | public int getValue(int x, int y, int z)
{
if (x >= getWidth() || y >= getHeight() || z >= getDepth() || x < 0 || y < 0 || z < 0)
{
return 0;
}
return rawData[x][y][z];
} |
d7fcab45-ad74-4b7d-8117-ebeb40045e48 | 2 | public String[][] getAllValues() throws IOException {
ArrayList<String[]> v = new ArrayList<String[]>();
String[] line;
while((line = getLine()) != null){
v.add(line);
}
if (v.size() == 0){
return null;
}
String[][] result = new String[v.si... |
f3b3081d-dd91-4649-8f8e-cf9052dc743b | 2 | public String getParametersFrom(int i) {
if (parameters == null)
initParameters();
StringBuffer params = new StringBuffer();
for (i--; i < parameters.length; i++)
params.append(parameters[i] +" ");
return params.toString();
} |
607ffe01-ddeb-4d1e-81bd-ec87b96dae13 | 2 | public static Float toFloat(Object obj) {
if(obj==null)
return null;
String string=StringUtils.trimNonNumeric(obj.toString());
Float o=null;
try {
o=new Float(Float.parseFloat(string));
} catch (NumberFormatException ex) {
}
return o;
} |
0aa43adc-a2aa-467d-b185-e50ede8a593b | 1 | public List<SettingQuestion> getAllFIBQuestion() throws Exception {
List<SettingQuestion> list = new ArrayList<>();
Statement myStmt = null;
ResultSet myRs = null;
Statement myQtmt = null;
ResultSet myQs = null;
try {
myStmt = co... |
324632de-483b-4ee6-959e-19a8943e1c02 | 1 | public String toString() {
try {
java.io.StringWriter strw = new java.io.StringWriter();
jode.decompiler.TabbedPrintWriter writer = new jode.decompiler.TabbedPrintWriter(
strw);
writer.println(super.toString());
writer.tab();
dumpSource(writer);
return strw.toString();
} catch (java.io.IOExce... |
68d93df1-b88a-4dd6-a2b1-78cf58d18776 | 6 | public void dispatch(Command command) throws IOException {
Socket socket = null;
BufferedReader in = null;
PrintWriter out = null;
try {
socket = new Socket(client.getHost(), client.getPort());
in = new BufferedReader(new InputStreamReader(socket.getInputStream())... |
729b40af-0011-4558-9743-b51f5c25f349 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SimpleCall other = (SimpleCall) obj;
if (code == null) {
if (other.code != null)
return false;
} else if (!code.equals(other.code))
r... |
7066a638-22bb-4952-9034-f5a11d760dde | 2 | public static void publishOutput(Object[] what) {
//String text, String title.
String text = (String)what[0];
String file = (String)what[1];
FileWriter w = null;
try {
w = new FileWriter(file);
} catch (IOException ex) {
L... |
b542cdc9-684a-4576-a6b5-0797ed98d391 | 7 | private WriteResponseList processRecordsInBatchMode(Record[] records, String methodName, int batchSize, Preferences preferences) {
ArrayList<WriteResponse> responses = new ArrayList<WriteResponse>();
Record[] batch = new Record[batchSize];
for (int i=0; i<records.length; i++) {
if (i != 0 && ... |
19de56d6-cc3f-4f34-a889-229f64d448c1 | 4 | private void findPlacement(Node tobeAdded)
{
Node u = root;
while (true)
{
if (comparator.compare(tobeAdded.key, u.key) < 0)
{
if (u.left == null)
{
u.left = tobeAdded;
tobeAdded.parent = u;
... |
d166dd10-3560-4165-9ca6-be47da3f567a | 9 | @Override
public URL getResource(String path) {
// check if file-based path
if (path.startsWith("file:")) {
File file = new File(path.substring(5));
if (!file.exists()) { return null; }
try { return file.toURI().toURL(); }
catch (MalformedURLExceptio... |
4a46b594-222b-4a36-9b6f-733a7c76e634 | 1 | public void paint(Graphics g1) {
Graphics2D g = (Graphics2D) g1;
g.setColor(Color.darkGray);
g.fillRect(0, 0, W, H);
for (DataPointGraphic dg : charts) {
dg.drawMe(g);
}
drawTextInBackground(g);
drawDateLines(g);
} |
b51e1584-29d6-4a14-9935-994947454510 | 7 | public void move(ArrayList<Player> allPlayers, boolean didCollide)
{
Player closestPlayer = searchClosestPlayer(allPlayers);
if ((coolDownTimer <= 0) && (!didCollide)){
if (closestPlayer.getX() > this.getX()){
this.directionX = 1;
}
else if (closestPlayer.getX() < this.getX()){
... |
9a876ee1-e1c5-44c5-a0ac-d437416c1768 | 5 | public static void saveDocToFile(Document doc, IFile file) {
OutputStream os = null;
try {
File renewFile = file.getLocation().toFile();
if (!renewFile.exists()) {
renewFile.createNewFile();
}
if (!renewFile.canWrite()) {
renewFile.setWritable(true);
}
os = new BufferedOutputStream(new Fil... |
47fe7c11-0f37-47b5-8c05-5cb534750057 | 4 | @Override
@SuppressWarnings("unchecked")
public List<mxGraphAbstractHierarchyCell> getNextLayerConnectedCells(int layer)
{
if (nextLayerConnectedCells == null)
{
nextLayerConnectedCells = new ArrayList[1];
nextLayerConnectedCells[0] = new ArrayList<mxGraphAbstractHierarchyCell>(connectsAsTarget.size());
... |
444a8f50-8c6b-4e09-835b-de410e1cfd72 | 1 | public void setValueAt(Object aValue, int row, int col) {
// data[rowIndex][columnIndex] = (String) aValue;
try {
People element = peopleResultList.get(row);
element.setColumnData(col, aValue);
fireTableCellUpdated(row, col);
} catch (Exception err) {
err.toString();
}
} |
0e6bf820-0568-49cd-ba85-6363353c7b71 | 1 | @Override
public String toString() {
String returnString = "";
returnString += "LIT " + new Integer(literalValue).toString();
if (identifier != null) {
returnString += " " + identifier + " int " + identifier;
}
return returnString;
} |
476d3746-3938-4a7d-8542-6252b488953b | 9 | private void printDeltas(long l) {
ArrayList<Facility> facilities = Factory.getInstance().getFacilities();
int i = 0, o = 0, r = 0;
for (Facility facility : facilities) {
for (int d = 0; d < facility.getNumberDigitalIns(); d++) {
int v = facility.getDigitalIn(d) ? 1 : 0;
if (inputs.elementAt(i).intValu... |
2c3ad410-d2f0-4596-8673-8cc71a310d17 | 1 | public static void main(String[] args) {
ExecutorService exec = Executors.newSingleThreadExecutor();
for (int i = 0; i < 5; i++)
exec.execute(new LiftOff());
System.out.println("Waiting for LiftOff");
exec.shutdown();
} |
beec95c3-c0e5-46fe-a507-f0fbf62378bd | 2 | private void jTextFieldCmdCliQte1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldCmdCliQte1FocusLost
mondecimal = new DecimalFormat("#######.00");
// mise ajour qte + calcule
if (!(jTextFieldCmdCliQte1.getText().equals(""))) {
int qte = I... |
f414e287-6605-4540-b147-f91b81d33a1f | 4 | public void putScore(final Integer newScore) {
//берем все результаты, которые уже есть
List<Integer> newScores = getScores();
//добавляем туда новый счет
newScores.add(newScore);
//сортируем все это дело
Collections.sort(newScores, new Comparator<Integer>() {
... |
3c99bdac-0160-4836-a395-aab47d8d7cb0 | 3 | private float limit(float eq)
{
if (eq==BAND_NOT_PRESENT)
return eq;
if (eq > 1.0f)
return 1.0f;
if (eq < -1.0f)
return -1.0f;
return eq;
} |
55fa917a-81d0-4597-a8b8-0857eb2d40b2 | 7 | private void checkCollisions(JixelEntity entity) {
List<JixelEntity> collisions = new ArrayList<JixelEntity>();
JixelCollidable collidableEntity = ((JixelCollidable) entity);
for (JixelEntity e : entityList) {
if (e.intersects(entity)) {
if (e != entity) {
collisions.add(e);
}
}
}
List<Jix... |
7d30aea1-7142-4b77-906b-8a52dc80f615 | 3 | public double[][] getEigenVectorsAsRows(){
if(!this.eigenDone)symmetricEigen();
double[][] ret = new double[this.numberOfRows][this.numberOfRows];
for(int i=0; i<this.numberOfRows;i++){
for(int j=0; j<this.numberOfRows;j++){
ret[i][j] = this.eigenV... |
a7635c7b-3a74-4a34-a989-d7c7a445c30a | 4 | @Override
public boolean containsIntegerArray(String name) {
JOSObject<? , ?> raw = this.getObject(name);
if(raw == null) return false;
if(raw.getName().equalsIgnoreCase(INTEGER_ARRAY_NAME)) return true;
return false;
} |
669163db-0db7-4ed1-b8b9-61b38d75be3c | 8 | @Override
public MessageResponse upload(UploadRequest request) throws IOException
{
setQuorums();
if(username.equals(""))
{
return new MessageResponse("Please log in first.");
}
else
{
synchronized(serverIdentifier)
{
if(serverIdentifier.isEmpty())
{
return new MessageResponse("No se... |
8ad04363-8088-40b5-8e59-9cc904da7de2 | 4 | public synchronized void threadFinished(QueuedPage qp,
LinkedList<String> links) {
Page currentPage;
Page temp;
currentPage = pages.get(qp.url);
for (String s : links)
if (s.startsWith(filter)) {
// System.out.println("[" + qp.depth + "]" + currentPage.url +
// " -> " + s);
if (pages.contains... |
a65c7381-f74a-4607-a114-2654aa9cbcf2 | 7 | public static JSONObject QueryData(Socket s) {
JSONObject query = new JSONObject(); //sent to server
JSONObject params = new JSONObject(); //placed into object sent to server
JSONObject returned = new JSONObject(); //from server
JSONArray group_ids = new JSONArray(); //all of the require... |
65ce5a25-f8eb-4d18-aff6-ec18c7b8b2e7 | 5 | public void printstack(String[] split)
{
if (split.length != 2)
{
PrintMessage("Syntax:!score [player]");
return;
}
Player p = (Player) getPlayer(split[1]);
if (p == null)
{
PrintMessage(split[1] + " does not exist");
return;
}
int cur = 0;
String s = "";
for (Moneys m : p.money)
{
... |
c42be3ae-fffb-48c4-aa58-69629429b4d7 | 2 | private void writeTypeInfo(int tag, int data) {
output.write(tag);
if (tag == OBJECT || tag == UNINIT)
write16(data);
} |
20f9c6d7-f3e6-42b7-9d35-9d3973f78b09 | 5 | public static double[] doLinearRegressionFromTo(int start,int end,double[][] args) //input int start, int end
{ //input double[1]=array of prices
double[] answer = new double[3];
int ... |
fac91b7d-fb58-45a6-9b1a-bb1c9f67cb8a | 7 | @Override
public int getInput() {
Paddle player = state.players.get(pos);
Ball ball = state.ball.get(0);
if(player.pos == PaddlePosition.TOP)
{
if(ball.getPosition().subtract(player.getPosition()).x <10 &&
ball.getPosition().subtract(pl... |
6ddf20e6-1d80-449a-97da-31a54356fc75 | 0 | @RequestMapping("/listar")
public ModelAndView listarProductos() {
Stock stock = Stock.getInstance();
ModelMap model = new ModelMap();
model.put("productos", stock.listarProductosDisponibles());
return new ModelAndView("agregarProductos", model);
} |
89175be5-8e7b-4ad2-ba86-90340e985f5e | 5 | public void writeDocType(String name, String pubId, String sysId)
throws IOException, XMLWriterException {
if (!bDocumentOpen) {
throw new XMLWriterException(
"Can't write DocType, no open document.");
} else if (!openElements.isEmpty()) {
throw ne... |
a7a5c22d-0fc2-4f58-83bc-8e971d7649d5 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final PersonMock other = (PersonMock) obj;
if (this.m_id != other.m_id) {
return false;
}
... |
2a1bcb6d-8055-4574-bfbb-f9374a4d7a7c | 2 | public String fetchJTextValue(String componentName) {
String result = null;
Component comp = fetchComponent(null, componentName);
if (comp instanceof JTextField) {
result = ((JTextField) comp).getText();
} else if (comp instanceof JTextArea) {
result = ((JTextArea) comp).getText();
}
return result;
} |
940fb4ca-8a9b-453c-bf10-5ca0b05b4089 | 3 | @Override
public void detectCollision() {
for(int i=0; i<EntityManager.getEntityList().size(); ++i) {
if(EntityManager.getEntityList().get(i) instanceof Mob) {
if(this.getGlobalBounds().intersection(EntityManager.getEntityList().get(i).getGlobalBounds()) != null) {
... |
2124732c-33fa-4bf3-998c-29da7d8b5554 | 4 | @Override
public boolean run() {
// Read config (it doesn't matter which genome)
genomeVer = "hg19";
loadConfig(); // Read config file
// Get all genome names and sort them
nameByGenomeVer = new HashMap<String, String>();
for (String genVer : config)
nameByGenomeVer.put(genVer, config.getName(genVer));... |
516ad6de-3850-443a-b25c-4c848a2aacc3 | 7 | public File find(LibraryDef libraryDef) throws IOException {
String resourceName = String.format("net/rubygrapefruit/platform/%s/%s", libraryDef.platform, libraryDef.name);
if (extractDir != null) {
File libFile = new File(extractDir, String.format("%s/%s/%s", NativeLibraryFunctions.VERSION,... |
69c3225a-73a4-48d9-be11-d84ca9c5a292 | 7 | public static String decomposeInternetUrl(String url, Object [] MV_returnarray) {
{ int fieldStart = 0;
int fieldEnd = Native.stringSearch(url, Native.makeString(1, ':'), 0);
String protocol = "";
String userInformation = "";
String domainName = "";
String portNumber = "";
String... |
b9a5f3a5-a005-4279-b227-eec81fcbeec0 | 0 | public void setAge(String age)
{
this.age = age;
} |
c426585a-a25d-4b02-ae4d-35954cdedfd4 | 5 | @Override
public String getColumnName(int columnIndex) {
if (columnIndex == DELIVERY_PACKET_ID) {
return "№";
} else if (columnIndex == MEMBER_NAME) {
return "Кому выдано";
} else if (columnIndex == EVENT) {
return "Мероприятие";
} else if (columnI... |
4fb2dda6-6a14-44b5-8686-bada5214f70b | 1 | public Integer call() {
int sum = 0;
for (int i = 0; i < 100000; i++) {
sum += i;
}
System.out.println(numberOfThread);
return Integer.parseInt(word);
} |
962f84ed-edbb-49d0-981b-01c6a4af2dc6 | 9 | public void actionPerformed(ActionEvent a) {
Object b = a.getSource();
if (b == maj) {
Game.gamedata.set_majmin(true);
}
if (b == min) {
Game.gamedata.set_majmin(false);
}
if (b == reset) {
Game.gamedata.set_bpm(120);
speed.setValue(120);
speedL.setText("Speed: 120 bpm");
Game.gamedata.set... |
166bcf42-06ca-44a4-8c17-afedbeac1e09 | 2 | public String getBookSource(int book, int chapter) {
StringBuilder sb = new StringBuilder();
String filename = "unv_" + TITLE_SHORT_EN[book] + "_" + chapter + ".html";
Path file = Paths.get(CBOL_HOME + filename);
Charset charset = Charset.forName("UTF-8");
try (BufferedReader r... |
e237eefc-35da-46e0-8520-639f973e3e61 | 4 | public int searchInsert(int[] A, int target) {
if(A == null){
return 0;
}
int low = 0;
int high = A.length - 1;
while(low <= high){
int mid = low + (high - low)/2;
if(A[mid] == target){
return mid;
}else if(A[mid] > target){
high = mid -1;
}else {
low = mid +1;
}
}
re... |
13c2ec4a-6780-4492-9109-004ccbf57310 | 3 | @Override
public boolean process(HttpServletRequest request) {
String type = request.getParameter("type");
HttpRequest req = Enum.valueOf(HttpRequest.class, type.trim());
switch (req) {
case addtimenode:
Addtimenode1(request);
break;
case deletetimenode:
Deletetimenode(request);
break;
case edi... |
6bfaf1aa-a4c8-44c0-a017-a75a539ebf21 | 4 | public Double calc(int n1, String op, int n2) {
double num1 = (double)n1;
double num2 = (double)n2;
if (op.equals("+")) {
return (num1 + num2);
} else if (op.equals("-")) {
return (num1 - num2);
} else if (op.equals("*")) {
return (num1 * num2);
} else if (op.equals("/")) {
// Note: This do... |
7abc06a4-6f97-4dcd-9219-40fc21838a9f | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
OFError other = (OFError) obj;
if (!Arrays.equals(error, other.error))
... |
2638522c-bb49-48de-b2b6-9b8034753408 | 4 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String serverID = null;
if(jComboBox1.getSelectedIndex() > -1) {
serverID = ((String[]) serverMap.get((Integer) jComboBox1.getSelectedIndex()))[1];
}
System.out.pri... |
9864b961-1c7b-412e-bd3d-25bddc36e00a | 7 | private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) {
int mark = src.position();
try {
while (src.hasRemaining()) {
char c = src.get();
if (Surrogate.is(c)) {
if (sgp.parse(c, src) < 0)
return sgp.error();
return sgp.unmappableResult();
}
if (c >= '\uFFFE')
return Co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.