method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bd88f3c7-cc0d-4985-b3d7-61318e70a0fe | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
58999ab7-6389-4f8e-ac6f-a75daf25339b | 4 | public void keyReleased(KeyEvent e){
KeyEvent nextPress = (KeyEvent)Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent(KeyEvent.KEY_PRESSED);
if ((nextPress == null) || (nextPress.getWhen() != e.getWhen()) || (nextPress.getKeyCode() != e.getKeyCode()))
{
for(ListenerQueuePair pa... |
31cd9ddb-7e90-4d49-b1cd-07d6ce403320 | 0 | public void setSomeObjArray(SomeBean[] someObjArray) {
this.someObjArray = someObjArray;
} |
0070ab7c-5cef-49dd-9905-67808b7a8e87 | 0 | public String getEmail() {
return email;
} |
a3aba442-fe7e-4608-9aad-783f29e29188 | 5 | private void deliver (Message m) {
int source = m.getSource();
int destination = m.getDestination();
if (destination != -1) {
unicast(m, getDelay());
} else {
int delay;
boolean drop = false;
boolean first = true;
/* Broadcast. */
for (int i = 1; i <= r.n; i++) {
drop = (source == i ... |
541dabe3-e857-4997-b72c-601d8e1cd320 | 7 | protected int completeLineComment(TokenizerProperty prop) throws TokenizerException {
String[] images = prop.getImages();
int len = images[0].length();
while (_currentReadPos + len < _currentWritePos || readMoreDataFromBase() > 0) {
switch (getChar(_currentReadPos + len)) {
case '\r':... |
3802e99d-f8e2-4811-9d58-9084537b6498 | 5 | public byte[] readArchive(ArchiveRequest query) {
int currentChunk = 0;
int nextSectorId = query.getStartSector();
ByteBuffer outputBuffer = ByteBuffer.allocate(query.getFileSize());
while (nextSectorId != 0) {
Sector sector;
try {
sector = readSector(query.getFileId(), nextSectorId);
} catch (IOEx... |
5111c6ba-2b2b-4a29-ab17-97fbe36700ca | 9 | public void elevatorBoundary(Character c1)
{
if(c1.xCord<506)
{
c1.xCord = 506;
}
if(c1.xCord>782)
{
c1.xCord = 782;
}
if(c1.yCord < 349)
{
c1.yCord = 349;
}
... |
e90678af-432c-464c-8f3c-c5a89b1ce27d | 9 | public FacesContext getFacesContext(Object context, Object request,
Object response,
Lifecycle lifecycle) throws FacesException {
// Select the appropriate MockExternalContext implementation class
Class clazz = MockExternal... |
fceb59f8-2cc4-4b00-8a94-5b81587fa943 | 7 | private boolean isOtherPunctuation(String str) {
char ch = str.charAt(0);
return ch == '~' || ch == '`' || ch == '!' || ch == '@' || ch == '#' || ch == '$' || ch == '%' || ch == '?';
} |
ee7f3bcd-7e2a-44b6-bb75-7b306dbd9ab6 | 2 | @Transient
public List<LabelValue> getRoleList() {
List<LabelValue> userRoles = new ArrayList<LabelValue>();
if (this.roles != null) {
for (Role role : roles) {
// convert the user's roles to LabelValue Objects
userRoles.add(new LabelValue(role.getName(),... |
e6cb7e79-fd90-4304-b6db-d7c48509940d | 3 | public boolean equalsIntensities(Run r){
if (getRed() == r.getRed() && getGreen() == r.getGreen() && getBlue() == r.getBlue()){
return true;
}
return false;
} |
84600923-5066-4894-a9e5-aab55c923d74 | 2 | private void checkName(final String name) {
if (named && name == null) {
throw new IllegalArgumentException(
"Annotation value name must not be null");
}
} |
53dcbf5d-2016-4959-8b7e-418603cdc497 | 5 | public static Kind parse(HtmlElement element, String str){
switch(str){
case "captions":
return CAPTIONS;
case "chapters":
return CHAPTERS;
case "descriptions":
return DESCRIPTIONS;
case "metadata":
return METADATA;
case "subtitles":
return SUBTITLES;
defa... |
03f51866-4eb6-46a9-8d87-8bcdd575341a | 6 | public void keyReleased(KeyEvent event) {
switch (event.getKeyCode()) {
case KeyEvent.VK_SHIFT:
b1 = false;
break;
case KeyEvent.VK_CONTROL:
b2 = false;
break;
case KeyEvent.VK_LEFT:
bl = false;
break;
case KeyEvent.VK_UP:
bu = false;
break;
case KeyEvent.VK_DOWN:
bd... |
795c0063-574c-4cfe-9a54-748b0f1a2fab | 4 | public static void main(String[] args) {
//This program determines the even factorial of an even positive integer
//ie: n(n-2)(n-4)....4*2
int positiveInt;
Scanner input = new Scanner(System.in);
for (;;) {
System.out.print("Please enter a positive even integer (0 to exit): ");
positiveInt ... |
807abcc7-e6e1-4318-8a87-0198aceffe63 | 1 | public List<User> getAll() {
Enumeration<User> elements = USER_MAP.elements();
List<User> users = new ArrayList<>();
while (elements.hasMoreElements()) {
users.add(elements.nextElement());
}
return users;
} |
88ec47be-9111-4832-81d6-7f767726ad45 | 7 | private final double[][] readMatrixFromFile() throws IOException {
final BufferedReader br = new BufferedReader(new FileReader(new File("C:/Users/Christina/Java1-workspace/AntColonyTest/src/AntColony/test.tsp")));
final LinkedList<Record> records = new LinkedList<Record>();
... |
d3968fed-3fdf-4856-a721-0ee73974b58f | 8 | @Override
public void run() {
Graphics g = bstrategy.getDrawGraphics();
if(bstrategy.contentsLost() == false){
Insets insets = frame1.getInsets();
g.translate(insets.left, insets.top);
if(isgameover == true){
g.setColor(Color.RED);
g.setFont(new Font("Sanserif", Font.BOLD, 80));
draw... |
c6863d4b-100c-4864-98c1-c1df4ae2ddd0 | 1 | public void write(String fileName) throws IOException {
try (BufferedWriter bw = new BufferedWriter(new FileWriter(fileName))) {
Iterator<Entry<String, String>> it = map.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> pair = it.next();
String line = pair.getKey() + "=" + pair.getValu... |
889a2cac-105b-4e76-a4fe-4ba93d061add | 1 | public synchronized void editar(int i)
{
try
{
new PesquisadorView(this, list.get(i));
}
catch (Exception e)
{
}
} |
dbd7c910-8524-41bd-a89b-3ebb0f3829b2 | 7 | String assemble(Decomp d, String reply[], Key gotoKey) {
String lines[] = new String[3];
d.stepRule();
String rule = d.nextRule();
if (EString.match(rule, "goto *", lines)) {
// goto rule -- set gotoKey and return false.
gotoKey.copy(keys.getKey(lines[0]));
... |
03eda7d9-4319-414d-87db-1da142b7ff0c | 4 | public static void main(String[] args) {
int N = 12;
double[] X = new double[N];
double sum = 0.0;
for(int i = 1; i < N-1; i ++){
X[i] = poisson(10, i);
sum += X[i];
System.out.println(i + " "+ X[i]);
}
for(int i = 1; i < N-1; i ++){
X[i] = X[i]/sum;
}
System.out.println("Normali... |
4d0ebc29-31ca-4bf9-a1ec-71810bcd2916 | 6 | public static void getFeaturesFromCDD(String queryString, Map<String, CyIdentifiable> reverseMap,
Map<CyIdentifiable, List<CDDFeature>> featureMap) throws Exception {
BufferedReader in = queryCDD("feats", queryString);
List<String> inputLines = new ArrayList<String>();
Strin... |
4ca65743-7580-4bc8-97d3-2918dc24f078 | 0 | public void testGoodAnswerGameToBeWon() {
System.out.println("Test 1 : gameToBeWon");
Game gameToBeWon = new Game(new GameMaster(
DefaultValues.DEFAULTATTEMPTCOMBINATION1), new Board());
int attemptsCount = 0;
// 1. Wrong combinations input.
Answer answer = gameToBeWon
.giveAnswer(D... |
bef81198-5119-4287-976e-e7c81d78fe2a | 3 | public static void exit() {
if (Game.client != null && Game.client.isConnected()) Game.client.disconnect();
if (Game.server != null) Game.server.shutdown();
running = false;
UpdateThread.requestStop = true;
Settings.saveSettings();
System.exit(0);
} |
3b65581e-20ad-493f-a073-811381620683 | 4 | private long getCPtrAddRefMarketData(MarketData element) {
// Whenever adding a reference to the list, I remove it first (if already there.)
// That way we never store more than one reference per actual contained object.
//
for(int intIndex = 0; intIndex < elementList.size(); intIndex++)
{
Object theObject = ele... |
9649bcf8-675b-4542-ae9f-2a048b22a4c0 | 8 | private void CheckConnection() throws IOException {
if(!ClientSocket.isConnected()){
String username = null;
for(int i=0 ; i<goChatServer.connectedSockets.size();i++){
if (goChatServer.connectedSockets.get(i) == ClientSocket){
goChatServer.connectedSockets.remove(i);
}
}
for(Map.Entry<Str... |
181e242d-e483-4e68-bce8-3eff1d0badf5 | 1 | private static URLConnection fetchClass0(String host, int port,
String filename)
throws IOException
{
URL url;
try {
url = new URL("http", host, port, filename);
}
catch (MalformedURLException e) {
// should... |
fe91f031-fba1-40cf-bd0c-660af20a0201 | 7 | public Behaviour jobFor(Actor actor) {
if (! structure.intact()) return null ;
//
// First and foremost, check to see whether a meltdown is in progress, and
// arrest it if possible:
final Choice choice = new Choice(actor) ;
if (meltdown > 0) {
final Action check = new Action(
ac... |
c313601c-37e0-424a-a22d-3de2eab70db2 | 4 | public static long pop_xor(long A[], long B[], int wordOffset, int numWords) {
int n = wordOffset + numWords;
long tot = 0, tot8 = 0;
long ones = 0, twos = 0, fours = 0;
int i;
for( i = wordOffset; i <= n - 8; i += 8 ) {
/*** C macro from Hacker's Delight
#define CSA(h,l, a,b,c) \
{unsigned u = a... |
7774514e-b506-4a65-97d4-40b35c39c17b | 1 | public void RemoveStartMenuElement() {
if (elementStart != null) {
elementStart.RemoveFromMenu();
elementStart = null;
}
} |
eb699bbd-928b-4006-a576-12fd4068f8fd | 0 | @Override
public boolean isActive() {
final ReentrantLock l = lock;
l.lock();
try {
return active;
}
finally {
l.unlock();
}
} |
93a47bb1-74c0-4e53-95e8-2dc918a67fda | 6 | private void makeDropTarget( final java.io.PrintStream out, final java.awt.Component c, boolean recursive )
{
// Make drop target
final java.awt.dnd.DropTarget dt = new java.awt.dnd.DropTarget();
try
{ dt.addDropTargetListener( dropListener );
} // end try
catch( ... |
0b2381b4-eba1-49a6-a402-d33f10be5b70 | 5 | public boolean placeBet(Bet bet) {
boolean succes = false;
for (Player p : players) {
if(p.getId() == bet.getPlayerId()) {
if ((p.getStash() - bet.getValue()) >= 0
&& bet.getValue() >= minBet && bet.getValue() <= maxBet) {
bets.add(bet);
p.removeFromStash(bet.getValue());
succes = true;
... |
57df885b-6b9b-4c46-a2df-280e77702404 | 5 | public static ArrayList<String> makePanDigitals() {
char arr[] = new char[10];
for (int i = 0; i < 10; i++) {
arr[i] = (char) (i + 48);
}
ArrayList<String> retarr = new ArrayList<String>(3628800);
for (int i = 0; i < 3628800 - 1; i++) {
int j = arr.length - 1;
while (arr[j - 1] >= arr[j]) {
j--;
... |
7a8061ce-9d8f-4230-96c6-1f2a68e9d0c8 | 5 | private void HTTP2WebApplication(String HostPath, String MODE) {
Connection conn = null;
PreparedStatement ps_http = null;
PreparedStatement ps =
null;
Statement s = null;
ResultSet rs = null;
String HTTP_REQUEST_HOST = "", HTTP_REQUEST_PATH = "", HTTP_... |
25d08ae4-dc7a-44ab-817a-41ee0e040d21 | 1 | public void updateImage()
{
//we will update animation when delay counter reaches delay, then reset delay counter
delayCounter++;
if(delayCounter>delay)
{
delayCounter=0;
frameNumber++;//updates frame to next frame
frameNumber%=totalFrame;// if surpass 3rd frame, back to frameNumber 0
//sets image to s... |
92b37c28-4418-460c-aa32-271721f4a0a1 | 3 | @Override
public SnpEffectPredictor create() {
// Create chromo
chromo = new Chromosome(genome, 0, 2 * maxGeneLen, 1, "chr1");
genome.add(chromo);
// Create sequence
chromoSequence = GprSeq.randSequence(random, chromo.size());
// Create gene
int start = random.nextInt(maxGeneLen);
int end = start + M... |
fc349c98-e8fe-4cf8-9e77-b497d24e6183 | 5 | public boolean isMatch(String s, String p) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < p.length(); ++i){
if(p.charAt(i) != '*') sb.append(p.charAt(i));
else {
if(i == 0 || i > 0 && p.charAt(i-1) != '?'){
sb.append("?*");
... |
5fa7880e-608e-4a78-847a-77d5f73e11c7 | 1 | public static int getFByYaw(float yaw) {
float f = (yaw * 4.0f / 360.0f);
if (f < 0) {
f = 4 - Math.abs(f);
}
return Math.round(f);
} |
67d30847-9083-43a6-b951-d22a51622937 | 4 | public double getValueRomberg(double a, double b, double eps) {
int m, n, i, k;
double h, ep, p, x, s, q = 0;
double[] y = new double[10];
// 迭代初值
h = b - a;
y[0] = h * (func(a) + func(b)) * 0.5;
m = 1;
n = 1;
ep = eps + 1.0;
// 迭代计算
while ((ep >= eps) && (m <= 9)) {
p = 0.0;
for (i = 0; i... |
11cef6d7-a471-4d55-a8a5-384cd8c89e55 | 3 | public void testCustomBroadcast () throws IOException {
ServerDiscoveryHandler serverDiscoveryHandler = new ServerDiscoveryHandler() {
@Override
public boolean onDiscoverHost (DatagramChannel datagramChannel, InetSocketAddress fromAddress,
Serialization serialization) throws IOException {
DiscoveryRes... |
7cd252c1-2d93-41af-b899-2bf87b9e354f | 9 | private void drawAllBonds() {
for (int i = 0; i < bonds.length; i++) {
int n = Integer.parseInt(bonds[i][0]);
if (bonds[i][1].equals("R")) {
drawBond(n, 0, false);
} else if (bonds[i][1].equals("L")) {
drawBond(n, Math.PI, true);
} else if (bonds[i][1].equals("D")) {
drawBond(n, Math.PI / 2, f... |
51965a10-6312-4fb2-8a08-09d5dd654491 | 8 | protected boolean writeDailyLog(String logStr, Time logTime) {
boolean ret = false;
Path logFilePath;
if ((logStr != null) && (logTime != null)) {
try {
if ((m_curLog == null) || (m_curLogTime == null) || (!m_curLogTime.isSameDay(logTime))) {
if (m_curLog != null) {
m_curLog.close();
... |
306424ea-8a38-41f5-b1b7-9db9111f3392 | 9 | private void ChooseAction(Socket s) throws IOException, ClassNotFoundException {
ObjectInputStream in = new ObjectInputStream(s.getInputStream());
Message msg = (Message) in.readObject();
if (msg.getType().equals("CONNECT")) {
mypeer.addNeighbor(msg.getHost(), msg.getPort());
... |
e383b8c0-9fba-4ccf-a828-61712d96bad5 | 4 | public int divide(int dividend, int divisor) {
if (divisor == 0)
throw new ArithmeticException("devide by zero");
// convert dividend and divisor to negative numbers a and b
int a = (dividend < 0) ? dividend : (0 - dividend);
int b = (divisor < 0) ? divisor : (0 - divisor);... |
9029ee8a-f539-4d04-b175-5c5adca5c71b | 1 | public void getTickets(String fechaDesde, String fechaHasta, String lineaAerea, String nfile, String numeroTicket) throws SQLException {
tickets = TicketDAO.getInstance().getTickets(fechaDesde, fechaHasta, lineaAerea, nfile, numeroTicket);
if (tickets.isEmpty()) {
JOptionPane.showMessageDia... |
9f507d5b-6c31-486f-84dd-0b227c968a3b | 1 | @Test
public void func1() throws Exception {
List<Compound> l = new ArrayList<Compound>();
for (int i = 0; i < 10; i++) {
HRU c = new HRU();
c.in = "1-" + i;
l.add(c);
}
// long start = System.currentTimeMillis();
// Runner.parallel2(l);
// long end = System.currentTimeMillis();
HRU c = new ... |
68b5507b-5d83-4c2e-aebe-332d0fcd4fb0 | 6 | public void createRoster()
{
Calendar today = (Calendar) startDate.clone();
int count;
for(int i=0; i<numberOfDays; i++)
{
count = 0;
numberOfServices = getNumberOfServices(today.getTime());
driversUsed = new driverUsed[numberOfServices];
busesUsed = new busU... |
9c20877f-7b85-4568-99b1-eaa6646fa342 | 8 | private boolean checkStop(double[] rst, double minDL, double dl){
if(dl > minDL+MAX_DL_SURPLUS){
if(m_Debug)
System.err.println("DL too large: "+dl+" | "+minDL);
return true;
}
else
if(!Utils.gr(rst[2], 0.0)){// Covered positives
if(m_Debug)
System.err.println("Too few positives.")... |
f19093e4-2a3d-415a-8c27-17e5702ad26c | 2 | @Override
public void actionPerformed(ActionEvent event) {
if ((event.getSource().equals(btnOk)) || (event.getSource().equals(btnCancel))) {
modalResult = (event.getActionCommand().equals("ok"));
MainWindow.setupData.setEventStartDate(eventStart.getTime());
MainWindow.setupData.setEventEndDate(e... |
c343530a-c79e-4028-98b3-825b7466bdf5 | 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... |
161e7c8a-bc79-4991-84b1-58a1044c161b | 8 | public boolean containsAndDeletes(int fRow, int fCol, int toRow, int toCol, int [][] a) {
for (int i = 0; i < moveList.size(); i++){
if (moveList.get(i).getFromRow() == fRow && moveList.get(i).getFromCol() == fCol && moveList.get(i).getToRow() == toRow && moveList.get(i).getToCol() == toCol){
for (int p = 0... |
3c2ee87b-e7e1-4b58-b37d-19ba8f20b5dc | 4 | public void attackBuilding(Unit attacker, Building toBeAttacked,
boolean aiMove) {
if (aiMove || Teams.comparePlayers(this.getOwner(),game.getCurrentPlayer())) {
HashSet<Player> tmp = Teams.getTeamFriends(Teams
.getTeamOfPlayer(owner));
if (attacker.getAtt... |
8d78ae0a-e25c-479c-af83-456b8d0597ba | 7 | protected List refreshTicksVertical(Graphics2D g2,
Rectangle2D dataArea,
RectangleEdge edge) {
List result = new java.util.ArrayList();
Font tickLabelFont = getTickLabelFont();
g2.setFont(tickLabelFont);
i... |
c19c3da0-4097-4bf2-917a-1ca86dbc8ddb | 4 | public List<Dependency> getRelocatedArtifacts() {
List<Dependency> artifacts = new ArrayList<Dependency>();
if (relocate != null) {
for (String element : relocate.split(",")) {
String[] coordinates = element.split(":");
if (coordinates.length < 2) {
... |
36331aeb-9517-46fe-a46f-da34627d0055 | 1 | @Test
public void branchInstrInvalidOpcodeTest_BRE() { //Tests instruction isn't created with illegal opcode for format
try {
instr = new BranchInstr(Opcode.BRE, 0); //BRE requires 3 parameters; the third representing a register
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
a... |
8baffb16-1289-4bbd-bf74-d40173e0baa0 | 5 | public void enrgOffre(String v_titre, String v_region, int v_exp, int v_salMin, int v_salMax, HashMap<Competence, CompType> tblComps) {
try {
int compsSize = tblComps.size();
System.out.println("size" + tblComps.size());
System.out.println(tblComps);
String compst... |
b5b87d52-7358-47d9-9957-9fe9c0d9b1b6 | 9 | public Tree<String> buildAST( StringTokenizer st ) {
// make our tree... the root is the string "root"
// if a node has children then it is an application
// if not then it is a value
Tree<String> tree = new Tree<String>("root");
Tree.Node<String> node = tree.getNode();
... |
ed540c7c-5432-4983-9e9e-a962afcabca9 | 8 | public static String printCFGBody(Block root, String blockName, boolean wholeGraph) {
StringBuilder sb = new StringBuilder();
if (wholeGraph) {
sb.append("graph: {title: \"").append(blockName).append("CFG\"").append('\n');
// sb.append("layoutalgorithm:bfs").append('\n');
sb.append("manhattan_edges:yes").a... |
97a38945-ae37-4359-b25b-b08f2e87c7cc | 3 | public final void cleanUp() {
Bucket died;
while ((died = (Bucket) queue.poll()) != null) {
int diedSlot = Math.abs(died.hash % buckets.length);
if (buckets[diedSlot] == died)
buckets[diedSlot] = died.next;
else {
Bucket b = buckets[diedSlot];
while (b.next != died)
b = b.next;
b.next ... |
ef2479ae-e82c-4ba2-b5ca-f2d750026d33 | 1 | public void click() {
JPopupMenu menu = new JPopupMenu();
List<DockTab> tabs = new ArrayList<>(mHidden);
Collections.sort(tabs);
for (DockTab tab : tabs) {
JMenuItem item = new JMenuItem(tab.getFullTitle(), tab.getIcon());
item.putClientProperty(this, tab.getDockable());
item.addActionListener(this);
... |
6683bde4-213b-48d7-9824-75aecd796045 | 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 Customer)) {
return false;
}
Customer other = (Customer) object;
if ((this.id == null && other.id != null) || (... |
953ff03e-b06d-40b8-90ef-72bfaa67c0e4 | 5 | public static void main(String[] args) {
String[] hexList;
Scanner scanner = new Scanner(System.in);
do {
// Read input, until it has correct length (normally 8 bytes = 16 hex digits)
do {
// Read line
System.out.println("Please enter " + numberOfRows + " hexadecimal bytes:");
String line = s... |
dba812b6-bd82-4db6-8255-44d8f5d18814 | 1 | public static TunableParameters getInstance(){
if(_currentInstance == null)
_currentInstance = new TunableParameters();
return _currentInstance;
} |
0f2fd8b7-ffa6-4a5e-8804-698c871cd14c | 7 | @Override
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if (isVisible()
&& (e.getSource() == optionPane)
&& (JOptionPane.VALUE_PROPERTY.equals(prop)
|| JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
... |
4dd83be4-47f8-4eae-8c48-cf135adf08a9 | 9 | @Override
public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel)));
Complex[] complex = new Complex[2];
complex[0] = tempz;//z
complex[1] = new Complex(pixel);//c
... |
cb7ada70-2d50-4b6b-bc00-df84d5843368 | 0 | public void setId(int id) {
this.id = id;
} |
34d07464-4620-4fdd-ba6f-f826572f9ec8 | 2 | public int nextIndex() {
if (next == null) {
return size();
}
if (cache == null) {
cache = toArray();
}
return next.index;
} |
abea7be0-32b1-4325-ad6a-892430d14119 | 8 | public T getAt(int row, int col) throws ArrayIndexOutOfBoundsException {
if (row>rows || col>columns || row<0 || col<0)
throw new ArrayIndexOutOfBoundsException();
if (RList.getHead()==null && CList.getHead()==null)
return null;
if (RList.isInList(row) && CList.isInList... |
3832afb7-d3a9-49c2-aed6-60a61938acbf | 5 | @Override
public Usuario findByLoginSenha(Usuario usuario) {
EntityManagerFactory factory = Persistence
.createEntityManagerFactory("classeEncanto");
EntityManager em = beginTransaction(factory);
try {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<Usuario> criteria = builder
... |
3b61c912-4621-4113-a399-bb4debff320c | 1 | public Object getValueAt(int row, int column) {
if (column == 0)
return variables[row];
return spaceSet(entries[row][column - 1]);
} |
860ba563-3178-4431-966b-98ab9259cc15 | 4 | public boolean addSignalisationRoute(String nomR, Signalisation s) {
if (mapRouteSignalisation.containsKey(nomR)) {
int index = 0;
boolean b = false;
for (int i = 0; i < this.listeRoutes.size(); i++) {
if (this.listeRoutes.get(i).getNomRoute().equals(nomR)) {
... |
445cc640-6919-44c5-be80-e91f0566629a | 9 | public void runFixedTimeSteps() {
long lastTime = System.nanoTime();
double lag = 0;
isPreRendering(true);
boolean doRendering = false;
while (isRunning && !Display.isCloseRequested()) {
long currentTime = System.nanoTime();
double timeDiff = (currentTime - lastTime) / 1000000d;
lastTime = currentTim... |
02ad00c5-6839-416d-a02f-b493d6ce16fe | 6 | public static int isVersionGreater(String base, String test)
{
base = convertOldReleases(base);
test = convertOldReleases(test);
if(base.equalsIgnoreCase(test))
return 0;
StringTokenizer t1 = new StringTokenizer(base, ".");
StringTokenizer t2 = new StringTokenizer(test, ".");
while(t1.hasMoreTokens() ||... |
f94437ce-f7de-4db6-869c-01e4c7f1c2e9 | 6 | private void paintWrappedLineNumbers(Graphics g, Rectangle visibleRect) {
// The variables we use are as follows:
// - visibleRect is the "visible" area of the text area; e.g.
// [0,100, 300,100+(lineCount*cellHeight)-1].
// actualTop.y is the topmost-pixel in the first logical line we
// paint. Note that w... |
2940a949-80de-444b-bcd8-5111c2659790 | 4 | public String getScript(String scriptName) {
InputStream stream = null;
try {
stream = ClassLoader.getSystemResourceAsStream(scriptName);
@SuppressWarnings("resource")
Scanner s = new Scanner(stream).useDelimiter("\\A");
return s.hasNext() ? s.next() : "";
} catch (Exception e) {
_logger.error("F... |
ac788ef1-15b8-404f-b0f7-cec7d78ba2ea | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Antwort))
return false;
Antwort other = (Antwort) obj;
if (antwort == null) {
if (other.antwort != null)
return false;
} else if (!antwort.equals(other.antwort))
... |
b902a0f9-5801-4e72-ab8f-9161bb78dc4b | 2 | private static boolean isInUsefulVariableSet(char ch, Set set) {
Iterator it = set.iterator();
while (it.hasNext()) {
String variable = (String) it.next();
char var = variable.charAt(0);
if (ch == var) {
return true;
}
}
return false;
} |
5e8581b6-8c0a-4286-a879-b48421efcdd0 | 3 | @SuppressWarnings("unused")
private void Chrwood() {
if(this.vie <= 0){
this.killAgent(this);
this.curent.personne.remove(this);
}
switch(this.al.IA){
case 2 : IA2(); break;
case 3 : IA3(); break;
default : IA1(); break;
}
} |
d62101f5-0b35-45d5-b418-0c84b9179800 | 4 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
JTextField editor = new JTextField();
if (value != null) {
editor.setText(value.toString());
}
... |
7e71aeaf-02e1-4dea-aad5-a71401893f6f | 1 | public List<PlayerInfo> getPlayers() {
List<PlayerInfo> playersInfo = new ArrayList<PlayerInfo>();
for (Player p : players)
playersInfo.add(new PlayerInfo(p));
return playersInfo;
} |
4aa22a42-7fe6-45c7-a8b8-1f491a7de8a4 | 9 | public static void main(String[] args) {
ArrayList newWordList = new ArrayList();
ArrayList filteredWordList = new ArrayList();
try {
FileInputStream fstream = new FileInputStream("newword.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamR... |
01090c95-84f9-4c03-9c38-dfe73a5c43e2 | 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... |
8f548cb2-86f0-4cc6-b4ed-9b185e4982c3 | 8 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
if (request.getParameter("question") != null
&& !request.getParameter("question").isEmpty()
&& request.getParameter("reponse") != null
&& !request.getParameter("reponse").isEmpty()) {
... |
a083aad9-5956-4912-bb56-3ca8e4d2fcfc | 9 | private static void loot() throws Exception
{
int goldLooted = 0;
if(killConfirmed == true)
{
switch(enemyNumber)
{
case 0:
{
goldLooted = generator.nextInt(10) + 5;
}
break;
case 1:
{
goldLooted = generator.nextInt(10) + 20;
currentMessage = "You have absorbed the... |
37d5b9a5-ee25-4831-aa48-6846288415ee | 2 | public synchronized void init() throws ServerAlreadyStartedException {
if (alreadyStarted) {
throw new ServerAlreadyStartedException();
}
// queue = new ArrayBlockingQueue<Runnable>(10);
// threadPool = new ThreadPoolExecutor(1,1,10,TimeUnit.SECONDS,queue);
try{
LocalDevice.getLocalDevice().setDiscover... |
dd6591c6-0f84-4fdf-a7c1-623973175e74 | 4 | public BigInteger attack(BsGs_Key key) throws Error{
BigInteger t = sqrt(key.p.subtract(BigInteger.ONE)).add(BigInteger.ONE); // t>sqrt(p)
// -------------------------
// -- Hier programmieren ---
// -------------------------
List<BigInteger> babyStep = new ArrayList<BigInteger>();
List<BigInteger> giantSte... |
c24ebab8-10e7-40ea-830e-02fc3839338a | 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) {
... |
4c0c7409-79d5-49d3-851d-491304cd0935 | 2 | public PublicWorkType getPublicWorkType() {
double t = nextRand();
if ( t < 0.5 )
return PublicWorkType.PRESCRIBE;
else if ( t < 0.8 )
return PublicWorkType.HOSPTILIZE;
else
return PublicWorkType.REFER;
} |
479a58e1-0bf0-49f2-82b1-38a02eba5019 | 3 | public boolean addNode(UrlNode node){
if (node.parentUrl.equals(this.selfUrl)){
childNodes.add(node) ;
return true ;
}else{
for(UrlNode urlNode : childNodes){
if( urlNode.addNode(node) )
return true ;
}
}
return false ;
} |
ec2f01d1-70fe-437e-80b1-59af49fe086f | 1 | protected void readScaleFactors()
{
for (int i = 0; i < num_subbands; ++i)
subbands[i].read_scalefactor(stream, header);
} |
2e6279dd-9636-4ae4-bb5b-b4692944211f | 3 | public void incrementPlayerTrappedCount(Player player) {
if (player == null)
throw new IllegalArgumentException("The given arguments are invalid!");
if (trappedPlayerCount.containsKey(player)) {
int numberOfTimes = trappedPlayerCount.get(player);
numberOfTimes++;
trappedPlayerCount.remove(player);
... |
0d6eaa43-8c5a-4e9d-9d74-2b68bd0feabf | 8 | public static void pause(double seconds) {
if (!(instance != null && instance.screen != null)) {
return;
}
if (seconds == 0) {
// waiting for the user input (press any key);
long time1 = System.currentTimeMillis();
KeyEvent event = null;
while(event == null) {
if ((System.currentTimeMillis() - ... |
ec2f0223-9df3-4d53-85b4-4e31a4797606 | 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();
if (c < ' ') {
throw syntaxError("Unterminated string.");
}
if... |
2b6a077c-61d3-4fe8-b698-ab239c45b005 | 8 | public void Run() {
int Grid [][] = {
{8,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,8},
{49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00},
{81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65},
{52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91},
{22,31,16,71,5... |
ff7b2c7b-a40d-4a3a-b66d-79b36b4e6966 | 8 | public boolean isValidMove(int startCol, int startRow, int endCol, int endRow)
{
if(!hasMoved)
{
//If first move was successful
if((startCol == endCol && endRow - startRow <= 2)
|| (startCol == endCol && startRow - endRow <= 2))
{
hasMoved = true;
System.out.println("this pawn has moved: has... |
21bbc08e-d4f3-4230-a643-57d3b9b2d3d4 | 0 | public ArrayList<NbrCostPair> getData() {
return data;
} |
20345008-d3e5-4ddf-bf21-9643bd7b40dc | 0 | public ServerInputThread(Socket socket)
{
this.socket = socket;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.