method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4388b843-8788-484c-85ef-bdbada1acb71 | 1 | public int randomMod(int k) {
if (k < 0)
throw new IllegalArgumentException("negative modulus");
return (int) (nextUnsignedLong() % k);
} |
4f101f48-9fd1-4a52-8f42-76be960ef3fe | 9 | private List<Set<Integer>> enlargeAggregates(List<Set<Integer>> C,
List<Set<Integer>> N, boolean[] R) {
// Contains the aggregates each node is coupled to
List<List<Integer>> belong = new ArrayList<List<Integer>>(R.length);
for (int i = 0; i < R.length; ++i)
... |
4dffdfb9-fb50-4fd2-bc0b-e2c30aacfec1 | 9 | protected void initSpecialParameters() throws MaltChainedException {
if (getConfiguration().getOptionValue("singlemalt", "null_value") != null && getConfiguration().getOptionValue("singlemalt", "null_value").toString().equalsIgnoreCase("none")) {
excludeNullValues = true;
} else {
excludeNullValues = false;
... |
fce3d9d4-c189-4abb-bf51-7a9323dd170a | 6 | public static void main(String[] args) {
System.out.println("- - Multibox - -");
Integer nbrProductor = 0;
Integer nbrConsumer = 0;
try{
nbrProductor = Integer.parseInt(args[0]); // cast
nbrConsumer = Integer.parseInt(args[1]); // cast
}catch (ArrayIndex... |
afe1fb71-8bac-41bb-9190-2ac7d70fb60e | 8 | public void kaynnista() throws Exception {
tulostaAloitusTekstit();
while (true) {
int valinta = Integer.parseInt(lukija.nextLine());
if (valinta == 1) {
luoUusiPeli();
break;
} else if (valinta == 2) {
avaaTallennettuP... |
0ca87f4e-33d8-40b9-ad70-15f3e9488d99 | 2 | private static void prepare(){
if (!SystemUtil.getModulesDirectory().exists()) SystemUtil.getModulesDirectory().mkdirs();
WebLookAndFeel feel = new WebLookAndFeel();
try {
UIManager.setLookAndFeel(feel);
} catch (UnsupportedLookAndFeelException e) {
DebugUtils.error(e.getMessage());
e.printStackTrace()... |
6a4c25d6-0269-48bf-b61e-332219f349ce | 9 | public PumbTransaction parsePumbSms(String msg) {
Matcher m = transactionSmsPattern.matcher(msg);
if (m.find()) {
// for (int i = 0; i <= m.groupCount(); i++) {
// System.out.println("group " + i + " " + m.group(i));
// }
PumbTransaction pumbTransaction ... |
df7cf62e-d5d7-4c52-bfe0-c7794db90d08 | 6 | public ImageIcon createLargeImage(double[][] vectors)
{
BufferedImage neuronImage = neuronImage = new BufferedImage(402, 81, BufferedImage.TYPE_INT_RGB);
for (int j = 0;j<vectors.length;j++)
{
double[] vector = vectors[j];
int firstX = 0, firstY = 0;
if (... |
3b083c05-df45-4504-bd65-3121763cb856 | 6 | private void queryDb(ActionEvent event) {
String query = hqlQuery.getText();
String[] meta;
java.util.List<String[]> data = new ArrayList<String[]>();
try {
SQLResultInterface res = mdi.executeHqlQuery(query, c_deref.isSelected());
if (res == null)
return;
List<String> header = res.getHeader();
... |
0936e0fd-6994-4f84-a5da-328639381bc7 | 9 | final void method2654(int i, OggPacket oggpacket) {
anInt9943++;
if ((anInt7234 ^ 0xffffffff) <= -4) {
if ((aVorbisBlock9951.synthesis(oggpacket) ^ 0xffffffff) == -1) {
aDSPState9935.blockIn(aVorbisBlock9951);
}
float[][] fs = aDSPState9935.pcmOut(aVorbisInfo9931.channels);
aDouble9949 = aDSPState99... |
68d0c6bd-5000-4cfa-ac09-f5f3322e4a98 | 8 | private void nodeId(String s,int t) {
nextToken("error occurred in node_id");
if (m_st.ttype == '}') {
//creates a node if t is zero
if (t == 0) {
m_nodes.addElement(new InfoObject(s));
}
m_st.pushBack();
}
else if (m_st.ttype == '-') {
nextToken("error occurred chec... |
44a2dcd8-1951-4cf9-bec8-30a83ef67f77 | 4 | public void savePossibleTreasure() throws IOException
{
numberOfTreasures = possibleTreasures.size();
FileOutputStream fos = new FileOutputStream(TreasureHunt.getInstance().getDataFolder() + "/numberOfTreasures.xml");
if(fos == null) return;
ObjectOutputStream oos = new ObjectOutputStream(... |
9356a410-608f-43be-85af-8675238b3a79 | 4 | public static GameStage getFrom(String args) {
switch (args.toLowerCase()) {
case "waiting":
return GameStage.Waiting;
case "lobby":
return GameStage.Lobby;
case "pregame":
return GameStage.PreGame;
case "ingame":
return GameStage.I... |
945ab086-5198-42a3-9232-fa56ba42427c | 3 | public boolean update() {
response = null;
--remainingTime;
if(remainingTime <= 0) {
response = "Removing timer, " + Stopwatch.timeToString(baseTime) + " has elapsed";
return false;
}
if(period != 0 && Stopwatch.dv(remainingTime, period) == 0)
... |
ea6a9fa9-9c62-4c21-bc32-d63d94b6ced3 | 3 | public boolean equals(Object o) {
if (o == this)
return true;
if (o instanceof IntegerType) {
IntegerType other = (IntegerType) o;
return other.possTypes == possTypes && other.hintTypes == hintTypes;
}
return false;
} |
de679530-3822-485c-8faa-67e234420507 | 6 | @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
// make sure the player is vanished before we do anything
if(!isVanished(player)) {
return;
}
// deal with right click
if(event.getAction() == Action.RIGHT_CLIC... |
34b5ade2-72cd-4d8e-b822-2810512328f3 | 6 | @Override
public final String generateHtmlCode() {
final StringBuilder sb = new StringBuilder();
sb.append("<!-- TableHelper Generated Code -->\n");
sb.append("<table " + "cellpadding=\"0\" cellspacing=\"0\" " + "id=\""
+ this.tableHtmlId + "\" " + "class=\"" + this.tableHtmlClass
+ "\">\n");
if (th... |
1bd5e362-a1e7-413d-8aa9-3066cd5504f3 | 8 | public String tryInviteNewMember(String account, int cid) { // needs dao's isMember & isInviting
int user = this.userDao.findUidByAccount(account);
// if that guy already existed in the club's member list
for (int existedMember : this.userDao.clubMembersUid(cid)) {
if (user == existedMember)
return "member... |
c3938e9f-3c51-4bd2-a15b-4ad000f8352c | 1 | public void playFade() throws InterruptedException{
try
{
in = new FileInputStream(fade);
as = new AudioStream(in);
ap.player.start(as);
}
catch(Exception e)
{
System.out.println("Got an IOException: " + e.getMessage());
e.printStackTrace();
}... |
3213c3be-0954-410b-95f2-01015088679e | 8 | public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
String baseDir = args[0];//"C:\\Users\\Playtech\\New Folder\\gc\\hl";
String outFile = args[1];//"C:\\Users\\Playtech\\New Folder\\gc\\hl\\texts.dump";
Path base = Paths.get(baseDir);
List<HomelandStrin... |
4c79ec96-3c4d-47f4-b810-909667e53185 | 0 | public static void main(String[] args) throws IOException, ClassNotFoundException {
SerialCtl sc = new SerialCtl("Test1", "Test2");
System.out.println("Before write \n" + sc);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buf);
... |
21ed290d-eeb8-4702-a59f-0b3115f15336 | 3 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Address address = (Address) o;
return abonentId == address.abonentId;
} |
a01fd8dd-be6a-4d8c-bdd1-4f31e4cf4abd | 4 | public static String fetchURLPost(final String u, String parameters) {
String returnedString = "";
try {
final URL url = new URL(u);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("POST");
OutputStreamWriter wri... |
da196eca-9459-4726-b6a8-0f1ddd95701a | 9 | @Override
public void run() {
try {
// Eclipse doesn't support System.console()
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
ConfigManager config = NetBase.theNetBase().config();
String targetIP = config.getProperty("net.server.ip");
if ( targetIP == null ) {
... |
75f7cb71-20d9-4ac9-b8d5-048ecf8f361a | 4 | private void rotate()
{
//orient++;
if (orient%4==0)
{
litPositions=new int[][] {{0,0,0,0},
{0,0,0,0},
{1,1,1,1},
{0,0,0,0}};
}
if (orient%4==1)
{
litPositions=new int[][] {{0,1,0,0},
{0,1,0,0},
{0,1,0,0},
{0... |
f051842a-b6f3-41cb-94f6-8eeac8dcedfe | 4 | public static void acceptTradeRequest(Player player, String partner) {
Player target = Bukkit.getPlayer(partner.toLowerCase());
if (target != null && target.isOnline()) {
TradeRequest tr = Storage.getTradeRequest("target", player.getUniqueId().toString());
float balance = BankManager.getBalance(player);
... |
969843a5-09ec-4c9e-bdd5-ded33a1058d5 | 1 | public void initializeId() {
String hashSequence = "";
for (DeployedComponent dc : deployedComponents)
hashSequence += dc.getId();
id = Utils.getHash(hashSequence);
} |
33ce5a23-10bb-4ac5-988f-1feb68ec8772 | 5 | private static User getUserById(Integer id){
Element rootElement = dom.getDocumentElement();
NodeList nodeList = rootElement.getElementsByTagName("user");
if(nodeList != null && nodeList.getLength()>0) {
for(int i=0; i<nodeList.getLength();i++){
Element element = (Ele... |
e16eb0c6-14d8-4302-9c63-178c2bc83432 | 8 | @Override
public void draw(Graphics2D g) {
g.drawImage(img.getSubimage(0, 0, 100, 108), GamePanel.WIDTH/2 - 150/2, GamePanel.HEIGHT/2 - 75/2 ,null);
int time = lantern.burnTime/20;
int minutes = time/60;
int seconds = time%60;
String sec = seconds < 10 ? "0"+seconds : ""+seconds;
g.drawString(minutes+":... |
7b0be31a-f783-440c-a756-9ba83d8ee347 | 6 | private void doDrawing(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.black);
Dimension size = getSize();
Insets insets = getInsets();
int w = size.width - insets.left - insets.right;
int h = size.height - insets.top - insets.bottom;
/* Фоку... |
be7411df-f65c-4dae-9c9d-48dd5e672b3d | 0 | public Teacher(){
super("N/A");
} |
347ad94f-ac5e-41f9-aa52-b683de83b060 | 0 | private void cancel() {
hide();
} |
be4e1483-c148-47fe-b267-192c5c223970 | 4 | @Override
public void performStep() {
if(checkIfTargetNearby())
return;
turnRight();
if (!goForward()) { // can go right?
turnLeft();
if (!goForward()) { // can go straight?
turnLeft();
if (!goForward()) { // what about left?
turnLeft();
goForward(); // OK, dead end
}
}
}
} |
16424ab3-b6b9-4bf2-ba6d-2007ebf08651 | 7 | @Before
public void setUp() {
calendarUsers = new CalendarUser[numInitialNumUsers];
events = new Event[numInitialNumEvents];
eventAttendees = new EventAttendee[numInitialNumEventAttendees];
this.calendarUserDao.deleteAll();
this.eventDao.deleteAll();
this.eventAttendeeDao.deleteAll();
for (int i = ... |
6d32feff-7c59-48aa-8af5-a294d93b6f92 | 8 | @Override
public double getPrecision(String classValue)
throws IllegalArgumentException {
if( classValue == null)
throw new IllegalArgumentException("Error: null class value");
if( this.valueToIndex.get(classValue) == null)
throw new IllegalArgumentException("Error: state = " + classValue + " didn't fo... |
e5efc82b-e56d-416d-84d5-8346bebadd8d | 5 | public static double norm_rmse(double[] obs, double[] sim, double missing) {
double sum = 0, size = 0;
for (int i = 0; i < obs.length; i++) {
if (obs[i] > missing) {
sum += obs[i];
size++;
}
}
double measuredMean = sum / size;
... |
26bb874f-030e-460e-ac5d-19d6ef52afcf | 6 | public void dumpCode(java.io.PrintWriter output) {
for (Iterator iter = instructions.iterator(); iter.hasNext();) {
Instruction instr = (Instruction) iter.next();
output.println(instr.getDescription() + " "
+ Integer.toHexString(hashCode()));
Instruction[] succs = instr.getSuccs();
if (succs != null)... |
88bbd4cb-61ad-4da0-81f0-18e4fef780c1 | 3 | @SuppressWarnings("unchecked")
public String getTeamMatchTable() {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT m.id, m.event_id, e.name, m.match_num... |
957177cc-e4cc-4ad9-b503-230f8973665b | 8 | public void train() {
Arrays.fill(theta, 0.0);
theta0 = 0.0;
double error = getCEError();
double deltaEta = DELTA_ETA;
if(lambda >= 100) {
deltaEta /= lambda;
}
while(true) {
double[] delta = new double[trainSet.nFeatures];
double delta0 = 0.0;
for(int i = 0; i < trainSet.m; i++) ... |
e3da994b-b6a1-4d9b-b39f-940426f802f9 | 9 | public void onRender(GameContainer gc, Graphics g, StateBasedGame game){
float scale = 1;
float mouseX = gc.getInput().getMouseX();
float mouseY = gc.getInput().getMouseY();
boolean scaled = false;
if(mouseX >= x && mouseX <= x + levelWidth && mouseY >= y && mouseY <= y+levelHeight && !c.equals(levelLocked)){... |
5b43ba4a-ef0e-42bd-bd61-48917563d94f | 4 | @Override
public Vector normalize() {
double length = 0;
for (int i = 0; i < getFieldsNumber() - 1; i++) {
try {
length += (getElementAt(i + 1) * getElementAt(i + 1));
} catch (OutOfBoundsException e) {
// Też nie ma prawa się wydarzyć
e.printStackTrace();
}
}
Math.sqrt(length);
length ... |
0bead9bd-1994-4e9f-b392-0c444bc22477 | 4 | public void saveText(String conversation, boolean appendToEnd)
{
String fileName = "/Users/jhaf4009/Documents/saved text.txt";
PrintWriter outputWriter;
if(appendToEnd)
{
try
{
outputWriter = new PrintWriter(new BufferedWriter(new FileWriter(fileName, appendToEnd)));
outputWriter.append(con... |
b266ea84-eb51-46cf-9fc3-03c81d61b6f3 | 0 | public SelfManaged() {
t.start();
} |
01c07c7b-15a7-4edf-905f-1ee5af9511ac | 0 | public void setKind(String kind){
this.kind = kind;
} |
7d4f10f0-d715-4671-955b-dce83d62c41e | 4 | @Override
public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000.0 / TICKS_PER_SECOND;
double unprocessed = 0;
int ticks = 0;
int frames = 0;
long lastTimer1 = System.currentTimeMillis();
init();
while (running) {
long now = System.nanoTime();
unprocessed += (... |
e246a4ff-d5cf-4888-915a-6d5967da7f10 | 8 | public void showFilePopupMenu(JButton fileOperations, boolean layoutsaving) {
JPopupMenu menu = new JPopupMenu();
JMenuItem item = new JMenuItem("Export Graph As JPEG");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
JFil... |
23817f71-e762-4fba-8546-d3fd7c40b134 | 6 | private void reflectInvokeMethod(Object invokeVictim, Method method,
String[] args) throws Exception
{
Class[] parameterTypes = method.getParameterTypes();
Object[] conformingArguments = new Object[parameterTypes.length];
if (args.length < parameterTypes.length) {
th... |
d0217bb7-9d53-423d-849f-d7ffa775deb3 | 8 | private void acceptButtonInsertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonInsertActionPerformed
boolean error = false;
String errorString = "";
Object[] what = new Object[7];
what[0] = enabledConnectionInsert.isSelected();
if (!userDataInsert.g... |
4adfd7c4-7583-41a1-96f0-b003bae37b7d | 4 | public static JavaArchive getRuntimeArchive() {
for (File jarFile : FileUtils.listFiles(new File(
System.getProperty("java.home")), new String[] {"jar"}, true)) {
String jarFileName = jarFile.getName();
if (jarFileName.equals("rt.jar") || jarFileName.equals("classes.jar"))
try {
return new JavaArch... |
24bc51df-dc02-4799-80ce-25d9484cfbc7 | 7 | public void makePots() {
while (notZero(bets)) {
int min = bets[0];
for (int i = 1; i < bets.length; i++) {
if (min == 0 || (bets[i] < min && bets[i] != 0)) {
min = bets[i];
}
}
ArrayList<Integer> elig = new Arra... |
db7943be-44c7-4560-b05f-292774a12d68 | 0 | public void setPrecio(double precio) {
this.precio = precio;
} |
89e83db3-1285-4fee-bbe6-f74a5a60cd04 | 9 | private Arc pairToArc( Pair p, HashMap<Pair,Arc> pnts,
HashMap<Pair,Arc> kids )
{
nArcs++;
char[] pData = (p.isChild()||p.isHint())?null:p.getChars();
Arc a = new Arc( cloneVersions(p.versions), pData );
if ( p.isChild() )
{
// we're a child - find our parent
Pair parent = p.getParent();
Arc b = ... |
0747ca1c-38c4-4e06-93de-9ab763ee1d7c | 1 | public static List<Point> listify(int[] points, int width) {
List<Point> list = new ArrayList<Point>();
int x, y;
for (int i = 0; i < points.length; i++) {
x = points[i] % width;
y = points[i] / width;
list.add(new Point(x, y));
}
return list;
} |
6cb6029f-ce86-4b39-aa41-aef08784c1ce | 9 | public void printRecord (String rec,JFrame JFMainParent) {
StringReader SRReader = new StringReader (rec);
LineNumberReader LNRReader = new LineNumberReader (SRReader);
Font typeface = new Font ("Courier New", Font.PLAIN,10);
PrintJob PJPrint = Toolkit.getDefaultToolkit().getPrintJob (JFMainParent, "", new Pro... |
aa8e7cfb-a28c-432d-8047-63d857e0b383 | 6 | public static void internalBuildGeneratedFileFrom(
final String[] descriptorDataParts,
final FileDescriptor[] dependencies,
final InternalDescriptorAssigner descriptorAssigner) {
// Hack: We can't embed a raw byte array inside generated Java code
// (at least, not efficiently), bu... |
651baa36-821e-499f-9b9a-109eb80e2c4c | 5 | private void atomicSaveFile(InputStream is, String fullPath, long fileSize,
long lastModifiedTime, boolean isDir, TextProcessor textProcessor) throws Exception {
DropboxFileUtil util = new DropboxFileUtil(this.rootDirAddr);
String relativePath = util.getFileRelativePath(... |
a2ee5dd4-7b86-4dea-997a-a87e12c654b7 | 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... |
28509732-eaf0-4204-8ee4-02a60cebdce8 | 1 | public String getLabel() {
if (label == null)
label = "flow_" + addr + "_" + (serialno++) + "_";
return label;
} |
a23b2203-ce1e-4416-b3f6-ffa232615081 | 4 | public static void reverse(int[] arr, int from, int to){
int iters=0;
if(from>to){
iters=((arr.length-from)+to+1)/2;
} else {
iters=(to-from+1)/2;
}
while(iters>0){
swap(arr,from,to);
iters--;
if(++from>=arr.length){ from=0; }
if(--to<0){ to=arr.length-1; }
}
} |
d83dc07f-79da-44b2-ab3d-6ecf1b7aa392 | 5 | public void applyMove(int player, Move m)
{
if (m != null) {
if (player==0)
m.sortDescend();
else
m.sortAscend();
Iterator iter = m.getAtomicMoves();
try {
while (iter.hasNext()) {
AtomicMove am = (AtomicMove) iter.next();
if (verbose) {
out_stream.println("Agent"+ player... |
2a9101ae-d04c-4072-90ab-37c6a627c33d | 1 | private void loop() throws Exception {
buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.enableRenderer(IRenderer.RENDERER_OPENGL);
while (!org.lwjgl.opengl.Display.isCloseRequested()) {
box.rotateY(0.01f);
buffer.clear(java.a... |
8c2d32d4-9c7e-41ab-809f-c808204bb499 | 4 | private static void Quicksortusinglastpivot(int l, int k) {
// TODO Auto-generated method stub
if(l==k){
return;
}
if (k>l){
int i=l+1; // startelement
int j=l+1; //
int temp;
temp = array[l];
array[l] = array[k];
array[k]=temp;
int pivot = 0;
pivot = array[l];
for(j=l+1;j<k+1... |
164a1bc8-ee52-41a3-8a9f-62a4c06b18cc | 7 | @Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (o.getClass() != this.getClass()) {
return false;
}
Project pr = (Project) o;
if (pr.projectId != this.projectId) {
return false;
}
if (... |
ee583d35-4eda-4aa1-90a0-3ad08b7fe56c | 2 | @Override
public void run() {
for (String lst : testList){
if (lst.equals(x)) {
System.err.println("Duplicate found " + testList.size());
}
}
} |
fab2c58f-36e8-45d1-83b7-3415bd0bc37c | 9 | public double applyMinMaxRescaleCast(double prediction) throws Exception {
if (m_optype != Optype.CONTINUOUS) {
throw new Exception("[TargetMetaInfo] target must be continuous!");
}
if (!Utils.isMissingValue(m_min) && prediction < m_min) {
prediction = m_min;
}
if (!Utils.isMissingValue... |
788d710d-aeef-472b-b92c-53542664a55a | 5 | public int aktuelleWertung() {
int wert, anzahl;
boolean istAss;
wert = 0;
istAss = false;
anzahl = getAnzahlKarten();
Karte karte;
int kartenWert;
// wir durchlaufen unseren aktuellen Kartenstapel
for (int i=0; i < anzahl; i++) {
karte = ge... |
e1ddf317-43e7-4168-ab30-21dc3291f1cf | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == viewBarChartButton) {
BarChartSales demo = new BarChartSales("Sales History", account.getFirstquarter2014(),
account.getSecondquarter2014(), account.getThirdquarter2014(), account
.getFourthquarter2014(), account.getFirstquar... |
aabcae07-bfbe-4d34-9e51-254229384095 | 9 | private static String[] getDefaultFontSearchPath()
{
String osName = null;
try {
osName = System.getProperty("os.name");
} catch (SecurityException e) {
// preserve null osName
}
if (osName == null) {
// Makes it a bit tricky to figure out... |
f4b90350-bdd0-4f36-af3c-58a1fca49eb2 | 0 | public void setPolicy(PolicyType value) {
this.policy = value;
} |
f38234d9-b293-405e-844e-3d7c9168989a | 4 | public ChampionSelect (Container mainPanel) {
SelectListener selectListener = new SelectListener();
HoverListener hoverListener = new HoverListener();
Dimension spacer = new Dimension (0, 12);
Box allyPositions = new Box (BoxLayout.PAGE_AXIS);
allyPositions.setBorder (new EmptyBorder (0, 6, 6, 6));
a... |
ad138480-72d9-4d61-8516-8f60d06368e5 | 2 | private void showStock(List<StockItem> stock) {
System.out.println("-------------------------");
for (StockItem si : stock) {
System.out.println(si.getId() + " "
+ si.getName() + " "
+ si.getPrice() + "Euro ("
+ si.getQuantity() + " items)");
}
if (stock.size() == 0) {
System.out.println("\... |
20cf5c58-8c11-402f-84ee-0c83184821d2 | 5 | private void whitePawnMove(Point currentPoint, Piece currentPiece) {
addToMovesLocal(currentPoint, currentPiece);
if (((int) currentPoint.getY() == 6 && currentPiece.getColor())) {
whitePawnMoveFirst(currentPoint, currentPiece);
}
Point targetPoint = pieceMove(currentPoint, 0, -1);
if (isOpen(targetPoint))... |
139eda1c-080d-4222-a402-0a0c196b06b3 | 1 | public void setBaud(int baud) throws ChannelException {
try {
port.setSerialPortParams(
baud,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
}
catch (Exception ex) {
throw new Chann... |
3f0b64ef-dbe0-4fa4-8bda-2f3b08671f96 | 2 | public Money execute() throws IOException {
Currency currency;
Number amount = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
boolean gotCorrect = false;
while(!gotCorrect){
try{
System.out.println("Introduzca una c... |
73063d63-56d0-4916-8db6-9fe5019f44e3 | 4 | @Override
public void run() {
while (isAlive) {
try {
launch();
if (enemy_Launcher.alive() && this.isAlive) {
fly();
}
synchronized (this) {
wait();
}
} catch (InterruptedException e) {
}
}
} |
c18fa39b-e08b-4594-b831-45b63e31f189 | 7 | protected JsonType getType(Object object) {
if (object == null) return JsonType.NULL;
if (object instanceof String) return JsonType.STRING;
if (object instanceof Number) return JsonType.NUMBER;
if (object instanceof Boolean) return JsonType.BOOLEAN;
if (object instanceof Collecti... |
63ea264b-b34f-4749-a56c-5533b2502fd2 | 7 | @Override
public void putChar(char c) throws ParsingException {
switch (c) {
case Characters.SPACE:
context.putSpace();
break;
case Characters.SEPARATOR:
context.putSeparator();
break;
case Characters.END:
context.putEnd();
break;
case Characters.PARAMETER:
context.putParameter();
bre... |
72351d82-27d3-4763-bea7-7ef366aaa0c3 | 4 | public static double normalizeLongitude(double longitude) {
if (Double.isNaN(longitude) || Double.isInfinite(longitude))
return Double.NaN;
double longitudeResult = longitude % 360;
if (longitudeResult > 180) {
double diff = longitudeResult - 180;
longitudeResult = -180 + diff;
} else if (longitudeResu... |
92045a80-5235-4bff-93f6-e87598de117e | 4 | public synchronized boolean cancelReservation(ReservationMessage message) {
ServerReservation sRes = null;
int resId = message.getReservationID();
String msg = "Reservation # " + resId + " cannot be cancelled ";
if(!reservTable.containsKey(resId)
&& !expiryTable.containsKey(resId)) {
logger.info(msg +... |
6bb816f5-481c-49de-aa64-4690f7f38675 | 4 | @Override
public boolean hasNext() {
int available = 0;
try {
available = logFileStream.available();
} catch (IOException e) {
logger.error("Fail to access log file and try to close stream, log file path: " + currentFileName, e);
try {
logF... |
f9a3caf7-4850-4002-accb-d963978e9b16 | 0 | @Override
public void setName(String name) {
this.name = name;
} |
11660dfe-e816-4d68-836d-c5f763c3eb6b | 5 | public static float getFloat(byte[] b, int offset) {
if (isBlank(b)) {
throw new IllegalArgumentException("blank byte array.");
}
if (offset < 0) {
throw new IllegalArgumentException("invalid array offset:" + offset + ".");
}
int out = b[0] < 0 ? -1 : 0;
for (int l = b.length - offset, i = l < FLOAT_B... |
9c463379-9de7-4ca9-84d6-703893123576 | 0 | public boolean containsKey(Object key) {
return this.map.containsKey(key);
} |
e79dd30e-9150-4826-9818-b51efb4c496a | 0 | @Override
public String toString() {
return "info.toegepaste.www.entity.Lid[ id=" + id + " ]";
} |
ab239a3b-8899-4c00-b1b1-43ce275b6eea | 4 | public void writeTimes() {
Path path = Paths.get("Sudoku Saves\\BestTimes");
ArrayList<String> stringList = new ArrayList();
try {
Files.delete(path);
} catch (IOException x) {
System.out.print("ERROR: " + x.getMessage());
}
if (!stringList.isEmpt... |
f42df66d-ea2e-45de-8c10-dbdf1fb784b6 | 8 | public void setDirection(Direction direction)
{
if ((this.direction == Direction.Up && direction != Direction.Down) ||
(this.direction == Direction.Down && direction != Direction.Up) ||
(this.direction == Direction.Left && direction != Direction.Right) ||
(this.direction ... |
7fb12ba1-ec7f-4f7d-92eb-283469549862 | 9 | private String romC(int c) {
switch (c) {
case 1: return "C";
case 2: return "CC";
case 3: return "CCC";
case 4: return "CD";
case 5: return "D";
case 6: return "DC";
case 7: return "DCC";
case 8: return "DCCC";
case 9: return "CM";
default:return "";
}
} |
c69e78d8-f645-4283-9c9e-25e079f1fc5d | 7 | protected void move() {
setNaam("mcAwesome");
PApplet app = getApp();
ellapsed++;
if(ellapsed>60){
lastPosY = getEnemyYPos();
lastPosX = getEnemyXPos();
ox = getEnemyXPos();
oy = getEnemyYPos();
ellapsed = 0;
} else {
float movedX = (getEnemyXPos()/ellapsed)-lastPosX;
float movedY = (getE... |
cb617aa4-939c-44ed-99f9-79a3ac5efe3f | 6 | void shiftPc(int where, int gapLength, boolean exclusive) {
int n = tableLength();
for (int i = 0; i < n; ++i) {
int pos = i * 10 + 2;
int pc = ByteArray.readU16bit(info, pos);
int len = ByteArray.readU16bit(info, pos + 2);
/* if pc == 0, then the local v... |
18f33980-122b-4123-9caf-e8f3f67e44ff | 2 | public Teams getWinner() {
if(this.getScore_res_score_home()>this.getScore_res_score_away())
return Teams.HOME;
else if(this.getScore_res_score_home()<this.getScore_res_score_away())
return Teams.AWAY;
else
return Teams.ALL;
} |
67e72152-9ce2-41ae-9ad2-caf3534274e5 | 1 | public VariableStack mapStackToLocal(VariableStack stack) {
VariableStack newStack;
if (exceptionLocal == null) {
pushedLocal = new LocalInfo();
pushedLocal.setType(exceptionType);
newStack = stack.push(pushedLocal);
} else
newStack = stack;
return super.mapStackToLocal(newStack);
} |
f94e08d8-3652-4f5e-b6ca-4c848a610602 | 6 | public void processFiles(
Boolean outputCounts,
Boolean outputDistances,
File directory,
Dictionary dictionary1,
Dictionary dictionary2,
String delimiter,
Boolean audit,
MainFrame mf,
Writer output) {
... |
ec4cde39-6f8a-4214-96aa-2169dfa7e418 | 6 | public int movingAverageVariablePeriodLookback( int optInMinPeriod,
int optInMaxPeriod,
MAType optInMAType )
{
if( (int)optInMinPeriod == ( Integer.MIN_VALUE ) )
optInMinPeriod = 2;
else if( ((int)optInMinPeriod < 2) || ((int)optInMinPeriod > 100000) )
return -1;
if( (... |
cc55c6db-058c-4e47-85da-83e771ab29de | 6 | @Override
public StringBuffer getOOXML( String catAxisId, String valAxisId, String serAxisId )
{
StringBuffer cooxml = new StringBuffer();
// chart type: contains chart options and series data
cooxml.append( "<c:ofPieChart>" );
cooxml.append( "\r\n" );
cooxml.append( "<c:ofPieType val=\"" + (ofPie.isPieOfP... |
30729fdb-ec9f-42ce-87de-fc0cd601cdaa | 0 | public boolean isFinished() {
return (this.cycles >= DURATION);
} |
0b14222b-8534-4073-9bc4-76199d74ffb3 | 6 | public Socket getanonyMousProt(){
Socket manageSocket = null;
try {
manageSocket = new Socket(manageHost,managePort);
BufferedReader br = new BufferedReader(new InputStreamReader(manageSocket.getInputStream()));
Thread.sleep(1000);
String anonymoutProt = null;
while ((anonymoutProt= br.readLine())!=n... |
ca0fd4c3-2193-4c6f-9bd4-1ffa03f3f4ad | 4 | public void updateBlocks(){
for(int x = getPoint().getBlockX() - getRadius(); x <= getPoint().getBlockX() + getRadius(); x++){
for(int y = getPoint().getBlockY() - getRadius(); y <= getPoint().getBlockY() + getRadius(); y++){
for(int z = getPoint().getBlockZ() - getRadius(); z <= getPoint().getBlockZ() + getRa... |
e20dd739-fb4c-472e-b254-838f91d6cad1 | 4 | public void actionPerformed( java.awt.event.ActionEvent evt )
{
if ( evt.getActionCommand().equals( Wizard.CANCEL_BUTTON_ACTION_COMMAND ) )
{
cancelButtonPressed() ;
}
else if ( evt.getActionCommand().equals( Wizard.BACK_BUTTON_ACTION_COMMAND ) )
{
backButtonPressed() ;
}
else... |
590f38cf-bed7-4342-8ebf-7044526cb965 | 2 | protected int waitForNextFrame() {
long current = System.currentTimeMillis();
// handle first frame case
if (lastUpdate == 0) {
lastUpdate = current;
return 1;
}
long elapsed = current - lastUpdate;
int frames = (int)(elapsed / FRAME_RATE) + 1;
... |
d0f7a001-4db2-4e2f-aa05-3649b69917e8 | 4 | public static void main(String[] args) throws InterruptedException,
TransformerException, IOException {
/*
* Incarca fisierul de config, iar daca citirea fisierului de
* configurare a esuat atunci inchide aplicatia cu mesaj de eroare.
*/
if (Config.load() == false) {
JOptionPane.showMessageDialog(nu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.