method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fb5aa332-8788-4e82-b64d-bde1b4c49302 | 3 | public void createPowerup(Powerup pu) {
for(int i = 0; i < powerups.length; i++) {
try {
if(powerups[i].living == false) {
powerups[i] = pu;
break;
}
}
catch(NullPointerException e) {
powerups[i] = pu;
break;
}
}
} |
8471b260-1ac1-464f-8b9a-c02d2624a7a6 | 6 | public static void main(String[] args) {
int BYTES_PER_LINE = 16;
if (args.length == 1) {
BYTES_PER_LINE = Integer.parseInt(args[0]);
}
int i;
for (i = 0; !BinaryStdIn.isEmpty(); i++) {
if (BYTES_PER_LINE == 0) { BinaryStdIn.readChar(); continue; }
... |
e44e1394-e568-423d-b87e-8b9b810cbe16 | 6 | protected static Ptg calcDDB( Ptg[] operands )
{
if( (operands.length < 4) || (operands[0].getComponents() != null) )
{ // not
// supported
// by
// function
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
double cost;
double salvage;
int life;
int period;
int factor;
cos... |
403dbd7a-1bc6-4132-970c-1c523ee0ed61 | 3 | public String checkYourself(String stringGuess) {
int guess = Integer.parseInt(stringGuess);
//DECLARE a var to hold the result well return
String result = "miss";
//DECLARE a setLocationCells() setter method that takes an int array (which has the cell locations as ints)
//METHOD String checkYourself(String user... |
ace1dc57-4a74-459c-a686-856975e8240b | 9 | @Override
public void mouseReleased(MouseEvent me) {
ArrayList<Card> sw;
synchronized (_cards) {
synchronized (_exchangers) {
if (_up != null) {
if (Card.class.isInstance(_up))
_cards.add((Card)_up);
else {
_handObjects.add(_up);
}
_up = null;
}
Iterator<... |
28c63e46-8ed9-40ab-a066-d3b2f6b5cf8e | 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 SsMessage)) {
return false;
}
SsMessage other = (SsMessage) object;
if ((this.messageid == null && other.messag... |
b042c0f6-8c71-442a-b8d9-815cbf6020c9 | 9 | public void run() {
printMessage("Started.");
while(true) {
// Low-level stream set, reception of the message.
try {
Message m = in.readMessage(false, hostingDaId);
if(m.isReliabilityFlagSet()) {
in.ack(m.getRecipient(), hostingDaId);
}
handleMessage(m);
if(isStopped()) ... |
b569ecad-b988-4cff-91e9-d3751f674079 | 0 | private int addFirstSecond(Frame frame) {
return frame.first + frame.second;
} |
e9863bc9-8ab3-4631-bca8-51cf78521dc3 | 8 | public static Set<Class<?>> scan(String... packageNames) {
Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
if (packageNames != null && packageNames.length > 0) {
try {
for (String one : packageNames) {
Set<ClassInfo> classInfos = null;
classInfos = ClassPath.from(
Thread.currentThrea... |
a3f9b744-08d9-4462-be0e-31526705039a | 9 | public Boolean canBook(String userType, Integer reservationLength, Integer bookingLength, Integer totalItems) {
// No constraints: ok
if(constraints == null){return true;}
// Check against user type
if(constraints.containsKey("userType") && !userType.equalsIgnoreCase(constraints... |
99e1ead9-ba53-4277-ab21-c4466bb9f29e | 2 | public boolean RequirePermission(Player player, String perm) {
if (!HasPermission(player, perm)) {
if (player instanceof Player) {
player.sendMessage(ChatColor.RED + "Sorry, you do not have permission for this command.");
return false;
}
}
return true;
} |
6df05b5b-40e9-4eeb-ac5a-cf935fa742ca | 0 | private static int singleIndex(int row, int column) {
return row + (column << 22);
} |
137690ac-da0f-4bd4-97ef-c9fdd766b0b7 | 8 | public Object readPropertyNode(Element node) throws Exception {
Object result;
Object value;
String parentClass;
String property;
Vector children;
Element child;
int i;
Cla... |
a614cf7b-6d0e-4ed7-8d5a-85bddcf1319f | 5 | public int localeInventoryDataCount(String dataName){
int dataCount = 0;
ArrayList<String> dataList = new ArrayList<String>();
for(int x = 0; x < Main.localeInventory.length; x++){
for(int y = 0; y < Main.localeInventory[x].length; y++){
for(int z = 0; z < Main.localeInventory[x][y].length; z++){
if(M... |
58a3bddd-3a99-4017-9500-a67d673de402 | 4 | @Override
public void tick(LinkedList<GameObject> object) {
if (direction == 0) {
x -= speed;
}
if (direction == 1) {
x += speed;
}
if (x > px + Game.WIDTH / 2 || x < px - Game.WIDTH / 2) {
handler.object.remove(this);
}
Col... |
f45066b2-6744-4c89-bc3f-88cd09b6f1b3 | 3 | Properties getProperties(Class<?> clazz) {
Properties configuration = new Properties();
try (InputStream stream = clazz.getResourceAsStream(CONFIGURATION_FILE)) {
if (stream == null) {
return null;
}
configuration.load(stream);
} catch (IOExcep... |
885a1611-1608-4a8a-b7e6-d890b1477b4f | 1 | private Dimension getLayoutSize(Container target, LayoutSize sizeType) {
Insets insets = target.getInsets();
Dimension size = mRootCell != null ? mRootCell.getSize(sizeType) : new Dimension();
size.width += insets.left + insets.right;
size.height += insets.top + insets.bottom;
return size;
} |
da64e3e7-698e-4a2c-8ac6-2c4fe931c4ae | 6 | private void drawline(GOut g, Coord d, int med, int id, Coord c0, Coord cx,
Coord sc) {
Coord m = d.abs();
Coord r = m.swap();
Coord off = m.mul(med).add(d.add(m).div(2));
int min = c0.mul(r).sum();
int max = cx.mul(r).sum() + 1;
boolean t = false;
int begin = min;
int ol = 1 << id;
g.chcolor(olc[... |
31a5151b-c07a-44c9-b1e1-cdd56e80c8f8 | 2 | public String getManufacturer (int language)
{
try {
int id = getManufacturerStringId ();
if (id > 0)
return dev.getString (id, language);
} catch (IOException e) { }
return null;
} |
2c32ec5d-d946-4708-a3be-1d70a9fc9fab | 0 | public RuleSet getRuleSet() {
return ruleSet;
} |
e3c304c2-7168-401e-95c1-e74ffbb8cceb | 6 | public void drawImage(int x, int y) {
x += offsetX;
y += offsetY;
int destinationOffset = x + y * DrawingArea.width;
int sourceOffset = 0;
int rowCount = height;
int columnCount = width;
int lineDestinationOffset = DrawingArea.width - columnCount;
int lineSourceOffset = 0;
if (y < DrawingArea.topY) {
... |
43f87b86-359b-408d-be76-d745aed1077a | 2 | private void writeListTagPayload(ListTag tag) throws IOException {
Class<? extends Tag> clazz = tag.getListType();
List<Tag> tags = tag.getValue();
int size = tags.size();
os.writeByte(NBTUtils.getTypeCode(clazz));
os.writeInt(size);
for(int i = 0; i < size; i++) {
writeTagPayload(tags.get(i));
}
} |
ace385e9-8e0d-4ee1-9d0d-465119ccda46 | 7 | public void setInstances(Instances inst) {
m_Instances = inst;
String [] attribNames = new String [m_Instances.numAttributes()];
for (int i = 0; i < attribNames.length; i++) {
String type = "";
switch (m_Instances.attribute(i).type()) {
case Attribute.NOMINAL:
type = "(Nom) ";
break... |
2f5a3272-e3d4-40ba-88a4-426452cf003b | 9 | public Collection<CollectionAndArtist> extractNames(PageInfo info) {
// HTML herunterladen zur Regex-Untersuchung
String pageHTML = info.getContent();
if (pageHTML == null) {
System.out.println("## ERROR could not download '" + info.getURL() + "'");
return new LinkedList<... |
23cc1dbd-87ce-4cb5-8a7a-cc7196a94f6b | 7 | @Override
public void redraw() {
Graphics2D g = buttonImage.createGraphics();
BufferedImage i;
if (clickedInside && mouseContained) i = ImageData.buttonDepress;
else if (state == State.dead) i = ImageData.buttonDead;
else if (state == State.win) i = ImageData.buttonWin;
else if (clickedInside && !mouseC... |
e126fa4f-4e38-4ace-b215-d6a5a24a59ec | 5 | public static void triangle4(String s) {
char c[] = s.toCharArray();
for (int i = 0; i < c.length; i++) {
System.out.println();
for (int j = 0; j < c.length; j++) {
if (j < (c.length - i)) {
System.out.print(c[j]);
} else {
System.out.print(" ");
}
}
for (int j = 0; j < c.length; j... |
85a07efe-d88f-4bf6-92bd-a0fc2ef884df | 2 | @Override
public void mousePressed(MouseEvent event) {
if (!event.isPopupTrigger() && event.getButton() == 1) {
mInMouseDown = true;
mPressed = true;
repaint();
MouseCapture.start(this, Cursor.getDefaultCursor());
}
} |
bc598a63-40a2-4039-8f6a-158bcdfe032d | 6 | public Color getCouleur() {
if(couleur.equals("Bleu"))return Color.BLUE;
if(couleur.equals("Rouge")) return Color.RED;
if(couleur.equals("Jaune")) return Color.YELLOW;
if(couleur.equals("Noir")) return Color.BLACK;
if(couleur.equals("Vert")) return Color.GREEN;
if(couleur.equals("Rose")) return Color.PINK;
... |
4c9908b8-e2fd-4734-9d32-ad63d2f5d12b | 9 | public Border createInsetsTabBorder(boolean roundEdges, boolean open, boolean highlight) {
Border insetsBorder = new Border() {
public boolean isBorderOpaque() {
return false;
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
}
public I... |
cffcf7ea-2abf-49f8-bd88-d27e1a0dae02 | 8 | public ValidationInfo validate(String mdPrefix, String xml) {
ValidationInfo validationInfo = new ValidationInfo();
StringReader toValidate = new StringReader(xml);
long retrievalDelay = 0;
Schema schema = schemaCache.get(mdPrefix);
if (schema == null) {
if (malformed... |
5dc564c0-1ebe-4fda-a9ea-d3907b72dcf7 | 3 | public static boolean reverseByteOrder( Class libraryClass )
{
if( libraryClass == null )
{
errorMessage( "Parameter 'libraryClass' null in method" +
"'reverseByteOrder'" );
return false;
}
if( !Library.class.isAssignableFrom( library... |
bc2b000e-1c1c-41b0-941a-b4324b65e579 | 6 | private boolean isGoodLogin(String login, String password, HashMap currentlyConnectedUsers) {
if (currentlyConnectedUsers.get(login) == null) {
File file = new File(userFilePath);
if (file.exists()) {
try {
BufferedReader br = new BufferedReader(
... |
084047f9-b7b0-4e3a-9d06-e4590dfaba4e | 3 | private static void disposeOtherWindows(final JFrame jf, final JFrame jf2) {
Window[] windows = Frame.getOwnerlessWindows();
for (Window window : windows) {
if (!window.getName().equals(jf) && !window.getName().equals(jf2)) {
window.dispose();
}
}
} |
1a0d4845-76e0-480a-a5ee-1ade054d5c3d | 7 | public Element handle(FreeColServer server, Player player, Connection connection) {
ServerPlayer serverPlayer = server.getPlayer(connection);
if (nationName == null || nationName.length() == 0
|| countryName == null || countryName.length() == 0) {
return DOMMessage.clientError("... |
7fb576cd-c450-4f86-99c1-a3e4a455acc6 | 3 | public static boolean existPresa(ICard card, List<ICard> tableCards){
for(ICard c : tableCards)
if(card.getNumber() == c.getNumber())
return true;
if(getPrese(card, tableCards).size() == 0)
return false;
else
return true;
} |
a376cb00-6bba-41bd-8aed-85848c55f501 | 9 | @Override
public InputStream openDownloadStream(String trackId) {
HTTPProxy httpProxy = new YaHTTPProxy();
YaMusicTrackInfo trackInfo = null;
// step 1 : search for track in our trackList
for (IMusicTrackInfo musicTrackInfo : trackList) {
if (musicTrackInfo.getTrackId().equals(trackId)) {
trackInfo = (... |
9af37e45-b0eb-4116-b5d1-6750ab66c54b | 4 | @Override
public void run() {
try {
//opens sockets
peer.connect();
out = new DataOutputStream(peer.getSocket().getOutputStream());
in = new DataInputStream(peer.getSocket().getInputStream());
managePeerConnection();
} catch(SocketTimeoutException ste){
System.err.println("Socket for peer: " + t... |
c57eeb08-5cc6-48bd-9982-5d8d2d6f4c8b | 7 | public static List<String> getChilds(DefaultMutableTreeNode node){
List <String> v = new ArrayList<String>();
//String clasa =node.getUserObject().getClass().toString();
if (getName(node.getUserObject())=="hierarchy"){
v.add("hierarchy_docs");
v.add("hierarchy_blocks");
}... |
1e93af07-6f5a-41ac-91a3-46f55dde242b | 5 | private void initPageContents() throws InterruptedException {
Object pageContent = library.getObject(entries, CONTENTS_KEY.getName());
// if a stream process it as needed
if (pageContent instanceof Stream) {
contents = new Vector<Stream>(1);
Stream tmpStream = (Stream) p... |
876f3de1-901d-4fe4-867d-f47242272394 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MemoryFootprint that = (MemoryFootprint) o;
if (committedMemoryFootprint != that.committedMemoryFootprint) return false;
if (maxMemoryFootprint... |
1d4ed015-6e75-4c9c-b596-7630f441c46b | 3 | public void updateUniforms(Matrix4f worldMatrix, Matrix4f projectedMatrix, Material material)
{
if(material.getTexture() != null)
material.getTexture().bind();
else
RenderUtil.unbindTextures();
setUniform("transformProjected", projectedMatrix);
setUniform("transform", worldMatrix);
setUniform("baseC... |
9f7c3eb5-d412-4bd0-9860-2cbec5da8efd | 8 | @Override
public void mouseDragged(int oldX, int oldY, int newX, int newY) {
if(sliding) {
float oldValue = sliderValue;
switch(orientation) {
case Horizontal:
//Restrict newX to size of slider
newX = newX>staticBar.getMinX()? newX:(int)staticBar.getMinX();
newX = newX<staticBar.getMaxX()+1?... |
5a313bce-33ca-42b8-a2e8-e956ecb46018 | 1 | private boolean jj_2_63(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_63(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(62, xla); }
} |
929def66-9c7f-40f9-9287-22a0d2cd263a | 1 | private static void showArray(int[] array) {
for (int i = 0; i < array.length; i++) {
System.out.print(Integer.toString(array[i]));
System.out.print(" ");
}
System.out.println();
} |
d5278538-2aea-48a5-97b2-7c1925574cf8 | 9 | public static boolean isValidMethod(Method m)
{
int mod = m.getModifiers();
if ((!Modifier.isStatic(mod) && !m.isSynthetic() && !m.getName().equals("getClass")
&& !m.isAnnotationPresent(Transient.class) && !m.getReturnType().equals(void.class)
&& (m.getName().startsWith("get") || m.getName().startsWith("i... |
f8e76a71-2487-4bba-b5c1-9aca5f8dadc7 | 0 | public CheckResultMessage check7(int day) {
return checkReport.check7(day);
} |
f0dcb7dd-f7be-4658-b197-13f71abf170e | 5 | public static ArrayList<Region> getPreferredStartingRegions(BotState state) {
ArrayList<Region> out = new ArrayList<>();
List<Region> pickableRegions = state.getPickableStartingRegions();
List<Region> australiaRegions = getSubListFromSuperRegion(pickableRegions, state.getFullMap().getSuperRegion(6));
List<Regio... |
96ead1a6-efd8-4296-9991-6467748b1fae | 3 | private List<Score> readScoreList(InputStream in) throws IOException {
int scoreCount = readInt(in);
List<Score> scores = new ArrayList<Score>(scoreCount);
for (int i = 0; i < scoreCount; i++) {
String shipName = readString(in);
String shipType = readString(in);
int score = readInt(in);
int s... |
c54d0b86-bf8d-4613-b81a-99fa56c5c98d | 6 | private String addOptionalsToReadable() {
String palautettava = "";
if (volume != 0) {
palautettava += "\nVolume: " + volume;
}
if (number != 0) {
palautettava += "\nNumber: " + number;
}
if (pages != null) {
palautettava += "\nPages: "... |
abe6ba24-293f-4dfa-b5c2-cfae245300f9 | 0 | @Override
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.console = context.getConsole();
this.history = context.getHistory();
this.context = context;
this.indicators = context.getIndicators();
} |
3cdd2c78-f3d7-4341-b14e-aef1af8f733a | 3 | public int getHealthyTaxis() {
int taxis = 0;
for (int i = 0; i < items.size(); i++) {
if (items.get(i) instanceof Taxi) {
if(! items.get(i).dying() ) taxis++;
}
}
return taxis;
} |
dcfd3d43-e072-4333-abf2-d0d2911fee81 | 9 | public void connect(TreeLinkNode root) {
// Start typing your Java solution below
// DO NOT write main() function
if (root == null)
return;
while (root != null) {
TreeLinkNode next = null;
TreeLinkNode pre = null;
while (root != null) {
if (root.left != null) {
if (next == null)
next ... |
ebcfad1c-48d6-433f-abe6-dd477d62864c | 2 | private long getSeedForRandom() throws InitializationError
{
String seed = System.getProperty("jcheck.seed");
if (seed != null) {
try {
return Long.parseLong(seed);
}
catch (NumberFormatException ex) {
throw new InitializationError(... |
96dd412d-f523-45a0-bd17-b2509d0dbda6 | 7 | public String getPlacement()
{
switch (Classification) {
case "Dormant":
case "Discretionary":
case "Demanding":
return "Latent";
case "Dominant":
case "Dangerous":
case "Dependent":
return "Expectant";
... |
32c5f9a4-c223-4f14-8e61-4267bf70cca9 | 8 | @Override
public void execute() throws Exception {
try {
parseOptions();
if (options.isHelp()) {
options.format(new HelpFormatter(), getIoStreams().getStdout());
exit(ExitCodeImpl.OK);
}
if (options.isShowVersion()) {
... |
f3483a5a-43d9-4b6e-9b26-9ddb0d3fcd73 | 2 | public int getRoadNumber(){
int number=0;
String requete= "select count(*) from road";
try {
Statement statement = MyConnection.getInstance().createStatement();
ResultSet resultat = statement.executeQuery(requete);
while(resultat.next()){
numbe... |
23bf14eb-9677-45ac-a8cf-f557a6d253f9 | 2 | private JButton getJButtonStart() {
if (jButtonStart == null) {
jButtonStart = new JButton();
jButtonStart.setText("Start parsing");
jButtonStart.setEnabled(true);
jButtonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
try
... |
90a459b6-67aa-4837-87ed-e9a401fd03ac | 5 | public static ArrayList<String> getDrugCount(){
Statement stmt = null;
ResultSet rs = null;
String sql= "SELECT * FROM DRUGS";
ArrayList<String> count=null;
try {
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt... |
8817433a-b50a-4c2b-96e2-36b105fcc6e4 | 8 | boolean valid(int []dis)
{
return dis[0] == 0 &&
dis[1] == 1 &&
dis[2] == 4 &&
dis[3] == 7 &&
dis[4] == 5 &&
dis[5] == 8 &&
dis[6] == 10 &&
dis[7] == 12 &&
dis[8] == 16 ;
} |
26ba9a0f-ed90-4705-bc37-fbbca4642882 | 8 | public static MapleDisease getType(int skill) {
switch (skill) {
case 120:
return MapleDisease.SEAL;
case 121:
return MapleDisease.DARKNESS;
case 122:
return MapleDisease.WEAKEN;
case 123:
return Mapl... |
52672796-f142-49eb-88c9-33c78e80d587 | 3 | private void decodageNRZ() {
float somme = 0;
for (int i = 0; i < nbBitsEnvoyes * nbEchantillon; i += nbEchantillon) {
for (int j = i; j < i + nbEchantillon; j++) {
somme += informationRecue.iemeElement(j).floatValue();
}
somme /= nbEchantillon;
if (somme >= (min + max) / 2)
informationEmise.... |
9e0d08fa-3894-474c-947d-6bf36007137c | 4 | @Override
public int compareTo(SortedFile o) {
if(this.counterName.compareTo(o.getCounterName()) < 0)
return 1;
else if(this.counterName.compareTo(o.getCounterName()) > 0)
return -1;
if(this.counter < o.counter)
return -1;
else if(this.counter > o.counter)
return 1;
return 0;
} |
eb088957-e6fb-4b40-8c3a-980e76c2d1f9 | 0 | public int[] getCharacteristicSize() {
return characteristicSize;
} |
80a5a54d-9f5f-48c6-8a12-4145c576c178 | 4 | public static void main(String[] args) throws IOException {
System.out.println("Welcome to Server side");
BufferedReader in = null;
PrintWriter out = null;
ServerSocket servers = null;
Socket fromclient = null;
// create server socket
try {
servers = new ServerSocket... |
09912251-8dd6-458a-aa11-a9fbb983a36c | 7 | public static List<List<Integer>> scc(List<Integer>[] graph) {
int n = graph.length;
System.out.println("Graph length : " + n);
boolean[] used = new boolean[n];
List<Integer> order = new ArrayList<>();
for (int i = 0; i < n; i++)
if (!used[i])
dfs(graph, used, order, i);
List<Integer>[] reverseGrap... |
bf738892-7aed-4b02-ab06-9e569abf211c | 2 | public void setAge(int newAge) {
if (newAge > minAge && newAge < maxAge)
age = newAge;
else
System.out.println("age settings ERROR!");
} |
193e352c-dab3-441a-9a18-3764722a7cf9 | 0 | public GregorianCalendar getFecha() {
return fecha;
} |
3dba037e-fb32-4687-a588-b1fbe82ed1d0 | 3 | public void CreateReplicaLan(XmlNode parent, XmlNode router, XmlNode node,
String name, float latency, float bit_rate)
{
if (parent == null || router == null || node == null)
return;
XmlNode replicalan = CreateReplica(parent, node, name);
XmlNode if1 = CreateInterface(router, INTERFACE + "_" +... |
c1645c44-d674-4d7b-a611-b8a861bad509 | 7 | @SuppressWarnings("unchecked")
private T advance()
{
boolean advance_left = true, advance_right = true;
Comparable<T> lnext = null, rnext = null;
while (true)
{
if (advance_left)
if (!left.hasNext())
return null;
else
lnext = (Comparable<T>)left.next();
if (advance_right)
if (!... |
b4d6b8c9-f12c-459a-82d1-06c59fab278b | 2 | public boolean expand() {
children = new TreeNode[nActions];
MyList moves = state.findMoves();
if(moves.size()==0){
return false;
}
Iterator it = moves.iterator();
int i=0;
while(it.hasNext()){
Move newmove = (Move) it.next();
children[i... |
59e2bd7a-2487-4316-ba73-f6bf32e0e5bd | 9 | public void onLoad(JFileChooser fileChooser) {
File file = fileChooser.getSelectedFile();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String text = null;
Integer line = 0;
Integer pElement = 0;
... |
65acf7cc-b4b1-4343-ae16-cf64807187a2 | 2 | public synchronized void freeBusyFlag () {
if (getBusyFlagOwner() == Thread.currentThread()) {
busycount--;
if (busycount == 0)
busyflag = null;
}
} |
190cc7a5-98cf-4e01-b7e1-f46c5e99a817 | 1 | public ArrayList<String> getOpiskellutAiheet(){
ArrayList<String> opiskellutAiheet = new ArrayList();
for (String avain : opiskelut.keySet()) {
opiskellutAiheet.add(avain);
}
Collections.sort(opiskellutAiheet);
return opiskellutAiheet;
} |
22eebee9-c2f3-43b0-9673-636b015a453f | 4 | @Override
public void deserialize(Buffer buf) {
position = buf.readUShort();
if (position < 0 || position > 65535)
throw new RuntimeException("Forbidden value on position = " + position + ", it doesn't respect the following condition : position < 0 || position > 65535");
total = ... |
a5162f8d-54c0-452b-afff-76034dab3ddd | 4 | public void playGame()
{
while(!player1Checkmated || !player2Checkmated)
{
takeTurn();
}
board.printBoard();
if(player1Checkmated)
{
System.out.println("Player 1 is in checkmate. Player 2 wins.");
}
else if(player2Checkmated)
{
System.out.println("Player 2 is in checkmate. Player 1 win... |
7831aa92-98dd-42e2-bcd5-7387c3bbaff7 | 5 | @Override
public void run() {
System.out.println( threadId + " Start server thread");
while ( isRunning ) {
try {
Socket socket = listener.accept();
ClientThread clientThread = new ClientThread(socket);
clientList.add(clientThread);
... |
188ffbb6-68e7-4b4c-bf7b-dc93d0e7d3df | 9 | public static Station getStationByID(long stationID){
Station h=new Station(stationID,"Unknown station: "+stationID);
File cache = FileSystem.getFile("cache/static/outposts.xml");
if( isCacheNeeded(cache) ){
try{
URL url = new URL("https://"+Defaults.SERVER+"/eve/Conquer... |
beabdf7b-8212-4972-ac36-bbf5e3368cc5 | 7 | private void jbuttonOKMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbuttonOKMouseClicked
//this.jTextFieldBackground.setText(singleExperiment.getParam("Flag Background"));
this.singleExperiment.setParam("Description", this.jTextFieldDescription.getText());
// this.singleExperiment.setPar... |
6a7c60e4-d092-4d40-adc3-41e13f8f0bf8 | 6 | private static Terrain getNewTerrain(String s, Map m) {
Vector3f pos = new Vector3f(Float.valueOf(s.split(" ")[2]),
Float.valueOf(s.split(" ")[3]),
Float.valueOf(s.split(" ")[4]));
int type = Integer.parseInt(s.split(" ")[1]);
... |
1610e0ea-ca58-469b-b90c-e12e3f6534f6 | 7 | public static void main(String[] args)
{
int numero=0,c1=0;
for (int i = 0; i < 2; i++)
{
numero=Integer.parseInt(JOptionPane.showInputDialog(null,"Ingrese numero entero positivo"));
if (numero>0)
{
i=2;
}
... |
8d79831e-a671-44a7-9cd8-c797a4dbdc6c | 5 | public void testManyLargeMessages () throws IOException {
final int messageCount = 1024;
int objectBufferSize = 10250;
int writeBufferSize = 10250 * messageCount;
Server server = new Server(writeBufferSize, objectBufferSize);
startEndPoint(server);
register(server.getKryo());
server.bind(tcpPort);
ser... |
ba742d4f-d08b-4a2f-b094-f261e52de22b | 0 | public IntBTNode getLeft( )
{
return left;
} |
a2d3e11a-c466-4b18-9962-8274a21a077e | 2 | public void back() throws JSONException {
if (this.usePrevious || this.index <= 0) {
throw new JSONException("Stepping back two steps is not supported");
}
this.index -= 1;
this.character -= 1;
this.usePrevious = true;
this.eof = false;
} |
7d83e9ba-eba6-4113-9d7f-b95f0128d353 | 0 | private static Graph testGraph1() {
DynamicArray<String> m = new DynamicArray();
m.insert("1 0");
m.insert("0 0");
Graph g = GraphParser.initialize(m);
return g;
} |
448a17ba-ac38-48ca-a93f-fa3eec9139b5 | 4 | private void validateTree(LLNode n) {
boolean left,right;
if(n.left!=null){
n.left.prev=n;
left = true;
}else{
left = false;
// System.out.println("Left LLNode at Level "+depth+" is empty");
}
if(n.right!=null){
n.right... |
c12d43d2-59ee-497d-95a3-8f4902dce625 | 5 | @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onSignChange(SignChangeEvent event) {
if (event.getLine(0).equalsIgnoreCase("[game]")) {
Player player = event.getPlayer();
if (player.hasPermission("ctt.create")) {
try {
... |
50749888-c7d5-4e2d-a37e-3a0047a58a0e | 9 | private boolean formatInput() {
if (rawString.length() == 0) {
return false;
}
if (rawString.length() == 1) {
if (rawString.equals(">")) {
myType = SegmentType.NODECLOSE;
formattedString = rawString;
return true;
}
}
else if (rawString.length() == 2) {
if (rawString.equals("/>")) {
... |
34ea9f87-92be-4f0c-b654-8f8fc71cff3e | 5 | public void Solve() {
int biggest = 0;
for (int number = 2; number < _max; number++) {
String numberString = Integer.toString(number);
for (int multiplier = 2; multiplier < 10; multiplier++) {
numberString += Integer.toString(number * multiplier);
... |
eaec0593-2b7b-46b8-822c-4eee46eb9830 | 3 | public static UWECImage convolve(UWECImage in, Mask m, UWECImage out, ImagePanel outPanel) {
ConvolutionThread[] cts = new ConvolutionThread[4];
Thread[] ts = new Thread[4];
for (int i=0; i<4; i++) {
cts[i] = new ConvolutionThread(in, m, out, outPanel, i);
ts[i] = new Thread(cts[i]);
ts[i].start();
... |
ecde70c7-9199-43a1-aacc-425110811135 | 5 | * @param price The price for an existing item
* @param name The name for an existing item
* @return
*/
public long removeFromPriceIndex(long id, long price, ArrayList<Long> name){
long retval = 0;
// Iterate through all the long ints (keyword) that are in the name of the item
Iterator<Long> itr = n... |
43bc3777-a7c7-4a1e-90ac-716ba2ae2453 | 9 | public Student getStudent(final String studentId) throws SisException {
if (isEmpty(studentId)) {
throw new SisException("ID Cannot be null");
} else if (studentId.contains(" ") && !settings.allowSpacesInID()) {
throw new SisException("Spaces in ID numbers are not allowed as conf... |
82dd43fd-33b3-42ec-b0d2-051b44e69cf3 | 3 | public static Carte getCarteById(int id_carte) {
Carte carte = null;
Statement stat;
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("use nemovelo");
ResultSet res = stat.executeQuery("select * from carte where id_carte="+ id_ca... |
f9e8c850-b39d-4cac-bafa-8dc71c89541e | 1 | @SuppressWarnings({ "unchecked", "rawtypes" })
NewPatientPage(Gui frame){
GridBagConstraints c = new GridBagConstraints();
JLabel picLabel=new JLabel();
picLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/phms_se/resources/img/bg.jpg")));
this.add(picLabel);
picLabel.setLayout(new Gr... |
72f71e82-12f1-4ca0-bb3b-31a1444a8244 | 8 | public void paint(Graphics g){
setSize(500,500);
g.drawString("ID\tEmployee Name\tTotal Sale\tCommission\tState Tax\tNet Income", 25,y);
while(counter1 <= client){
empid = JOptionPane.showInputDialog("Enter Employee ID");
empname = JOptionPane.showInputDialog("Enter Employee Name");
sales = Double.pa... |
6de576c2-3785-4692-a315-66dc5d8bf310 | 0 | public InputStream getInputStream() {
return inputStream;
} |
3ed427d1-a2ff-4ed5-b4d7-525f207c61e8 | 9 | private void jarjestetaanTunnuspareja() {
if (this.kategoria.equals(TunnusTilastoKategoriat.TUNNUS1_PARI)) {
Collections.sort(liittyma.getTunnusParit());
} else if (this.kategoria.equals(TunnusTilastoKategoriat.TUNNUS2_PARI)) {
Collections.sort(liittyma.getTunnusParit(), new Tunn... |
4b95cabe-dae2-4f47-a237-5be8fb9fc631 | 5 | public List<Country> getCountries() {
List<Country> list = new ArrayList<>();
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.g... |
107f1b4f-a584-41ff-8bf4-1ffbd54f411b | 0 | public DisconnectEvent(Object client) {
super(client);
} |
a24bc883-61ad-4334-bf48-42c430196fd6 | 1 | boolean validateRequirement(TextField field, String fieldName) {
if (field.getText().isEmpty()) {
showErrorMessage(String.format("%sを入力してください。", fieldName));
return false;
}
return true;
} |
786c5317-98d6-4750-8497-330e888298cd | 4 | @Override
public void move(GameBoard currentBoard) {
int columnSelection = 1;
if ((columnSelection > -1) && (columnSelection < 8)) {
for (int i = 5; i >= 0; --i) {
if ((currentBoard.getColor(i,columnSelection-1))==Color.EMPTY) {
currentBoard.setColor(i,(columnSelection-1),Color.BLUE);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.